From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1518577-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 6B6CD15806E
	for <garchives@archives.gentoo.org>; Sun, 14 May 2023 19:29:16 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 13FDEE08E2;
	Sun, 14 May 2023 19:29:15 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id B3AFDE08E5
	for <gentoo-commits@lists.gentoo.org>; Sun, 14 May 2023 19:29:14 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id A8784340821
	for <gentoo-commits@lists.gentoo.org>; Sun, 14 May 2023 19:29:13 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id D344BA6D
	for <gentoo-commits@lists.gentoo.org>; Sun, 14 May 2023 19:29:11 +0000 (UTC)
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" <mgorny@gentoo.org>
Message-ID: <1684092546.10cfc95c9c73507af93d0f8fc8dabb63145435a6.mgorny@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pypy3/
X-VCS-Repository: repo/gentoo
X-VCS-Files: dev-python/pypy3/Manifest dev-python/pypy3/pypy3-7.3.12_rc1.ebuild
X-VCS-Directories: dev-python/pypy3/
X-VCS-Committer: mgorny
X-VCS-Committer-Name: Michał Górny
X-VCS-Revision: 10cfc95c9c73507af93d0f8fc8dabb63145435a6
X-VCS-Branch: master
Date: Sun, 14 May 2023 19:29:11 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: d926dbc9-82bd-4eb5-8acf-c187fe6bd2e4
X-Archives-Hash: 30613639dfe82784f42cb85a388eef24

commit:     10cfc95c9c73507af93d0f8fc8dabb63145435a6
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun May 14 16:13:37 2023 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun May 14 19:29:06 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=10cfc95c

dev-python/pypy3: Bump to 7.3.12_rc1

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/pypy3/Manifest                |   2 +
 dev-python/pypy3/pypy3-7.3.12_rc1.ebuild | 208 +++++++++++++++++++++++++++++++
 2 files changed, 210 insertions(+)

diff --git a/dev-python/pypy3/Manifest b/dev-python/pypy3/Manifest
index ebda7445a38c..b8622936868c 100644
--- a/dev-python/pypy3/Manifest
+++ b/dev-python/pypy3/Manifest
@@ -1,2 +1,4 @@
+DIST pypy3.10-gentoo-patches-7.3.12rc1.tar.xz 3416 BLAKE2B 1ad7e2f05fa26136f7a89fc36f9bba6247f5e7dab235798d47599d412783802e09fb98453386d546169010b944d6d564ac759eb3329da50c5401957d243a55d0 SHA512 93a7b1d1efcf88e5616f5b149e3b7c2c40c7a42d8b689f02f9ffa8e9d03356dbaba647181dc73c3cc41d0eb8b9a7a83301a9bb5d6224752a4c4d8e0afb4c2eab
+DIST pypy3.10-v7.3.12rc1-src.tar.bz2 22994145 BLAKE2B fff1a0c82f60db6abfa1db5b8fc833f62882f98965c3fb6131028e7ccc9f40475d375e7e0f7de564f91dc82840f5b263d097c6cab83458c82298c18498d55d8b SHA512 9f7eb625236d8a1740d80a02cd4e1bebd09ff4f3c5e117881b133c416c615b5a7ca5d5df2cfc42f5aa014905096005fc4ef328d05554d39ef00bae870e30b9c0
 DIST pypy3.9-gentoo-patches-7.3.11_p1.tar.xz 7480 BLAKE2B ffb478402e82244af25dd67bb9e21abb4bb186d98495899f8ca8f323bdf27a77356e40efd33217a5238ef86f6156fc7d85c681a747ea5a35bd73bab659972986 SHA512 6c3ee21b51145907c2434f740e9849ac02ad83203fdcb2802b97ba199f37d08297d8016f659069bea3f0854ace30aefb947af4f057cbc91332106d9fc1389cf4
 DIST pypy3.9-v7.3.11-src.tar.bz2 23460769 BLAKE2B fa8a827c28813243926c8689addb008c0a43acdc3f81a18749a8f2c1926b6294f2c0c95a4c315e3b77ce84b4f337af7a0bce5daf8dcb60ead965532d4af183cb SHA512 33c978ffbeeb39453028d1d1646ccfdace062ce48a5d939245bea41643038dd3687e80e34f88fa0622bcb175d7dd78f75cbe36b24229c8052f09d2d17dcdfd8c

diff --git a/dev-python/pypy3/pypy3-7.3.12_rc1.ebuild b/dev-python/pypy3/pypy3-7.3.12_rc1.ebuild
new file mode 100644
index 000000000000..88738f20e479
--- /dev/null
+++ b/dev-python/pypy3/pypy3-7.3.12_rc1.ebuild
@@ -0,0 +1,208 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit pax-utils python-utils-r1 toolchain-funcs
+
+PYPY_PV=${PV%_p*}
+PYVER=3.10
+MY_P="pypy${PYVER}-v${PYPY_PV/_}"
+PATCHSET="pypy${PYVER}-gentoo-patches-${PV/_rc/rc}"
+
+DESCRIPTION="A fast, compliant alternative implementation of the Python (${PYVER}) language"
+HOMEPAGE="
+	https://www.pypy.org/
+	https://foss.heptapod.net/pypy/pypy/
+"
+SRC_URI="
+	https://buildbot.pypy.org/pypy/${MY_P}-src.tar.bz2
+	https://dev.gentoo.org/~mgorny/dist/python/${PATCHSET}.tar.xz
+"
+S="${WORKDIR}/${MY_P}-src"
+
+LICENSE="MIT"
+# pypy3 -c 'import sysconfig; print(sysconfig.get_config_var("SOABI"))'
+# also check pypy/interpreter/pycode.py -> pypy_incremental_magic
+SLOT="0/pypy310-pp73-384"
+KEYWORDS=""
+IUSE="+ensurepip gdbm +jit ncurses sqlite tk"
+# many tests are failing upstream
+# see https://buildbot.pypy.org/summary?branch=py${PYVER}
+RESTRICT="test"
+
+RDEPEND="
+	|| (
+		>=dev-python/pypy3-exe-${PYPY_PV}:${PYVER}-${PYPY_PV}[bzip2(+),ncurses?]
+		>=dev-python/pypy3-exe-bin-${PYPY_PV}:${PYVER}-${PYPY_PV}
+	)
+	dev-lang/python-exec[python_targets_pypy3(-)]
+	dev-libs/openssl:0=
+	dev-python/gentoo-common
+	ensurepip? ( dev-python/ensurepip-wheels )
+	gdbm? ( sys-libs/gdbm:0= )
+	sqlite? ( dev-db/sqlite:3= )
+	tk? (
+		dev-lang/tk:0=
+		dev-tcltk/tix:0=
+	)
+"
+DEPEND="
+	${RDEPEND}
+"
+
+src_prepare() {
+	local PATCHES=(
+		"${WORKDIR}/${PATCHSET}"
+	)
+	default
+
+	eapply_user
+}
+
+src_configure() {
+	tc-export CC
+}
+
+src_compile() {
+	mkdir bin || die
+	# switch to the layout expected for cffi module builds
+	mkdir include/pypy${PYVER} || die
+	# copy over to make sys.prefix happy
+	cp -p "${BROOT}"/usr/bin/pypy${PYVER}-c-${PYPY_PV} pypy${PYVER}-c || die
+	cp -p "${BROOT}"/usr/include/pypy${PYVER}/${PYPY_PV}/* include/pypy${PYVER}/ || die
+	# (not installed by pypy-exe)
+	rm pypy/module/cpyext/include/_numpypy/numpy/README || die
+	mv pypy/module/cpyext/include/* include/pypy${PYVER}/ || die
+	mv pypy/module/cpyext/parse/*.h include/pypy${PYVER}/ || die
+	pax-mark m pypy${PYVER}-c
+
+	# verify the subslot
+	local soabi=$(
+		./pypy${PYVER}-c - <<-EOF
+			import importlib.util
+			import sysconfig
+			soabi = sysconfig.get_config_var("SOABI")
+			magic = importlib.util._RAW_MAGIC_NUMBER & 0xffff
+			print(f"{soabi}-{magic}")
+		EOF
+	)
+	[[ ${soabi} == ${SLOT#*/} ]] || die "update subslot to ${soabi}"
+
+	# Add epython.py to the distribution
+	echo 'EPYTHON="pypy3"' > lib-python/3/epython.py || die
+
+	einfo "Generating caches and CFFI modules ..."
+
+	# Generate sysconfig data
+	local host_gnu_type=$(sh pypy/tool/release/config.guess)
+	local overrides=(
+		HOST_GNU_TYPE "${host_gnu_type:-unknown}"
+		INCLUDEPY "${EPREFIX}/usr/include/pypy${PYVER}"
+		LIBDIR "${EPREFIX}/usr/$(get_libdir)"
+		TZPATH "${EPREFIX}/usr/share/zoneinfo"
+		WHEEL_PKG_DIR "${EPREFIX}/usr/lib/python/ensurepip"
+	)
+	./pypy${PYVER}-c -m sysconfig --generate-posix-vars "${overrides[@]}" || die
+	local outdir
+	outdir=$(<pybuilddir.txt) || die
+	cp "${outdir}"/_sysconfigdata__*.py lib-python/3/ || die
+
+	# Generate Grammar and PatternGrammar pickles.
+	./pypy${PYVER}-c - <<-EOF || die "Generation of Grammar and PatternGrammar pickles failed"
+		import lib2to3.pygram
+		import lib2to3.patcomp
+		lib2to3.patcomp.PatternCompiler()
+	EOF
+
+	# Generate cffi modules
+	# Please keep in sync with lib_pypy/pypy_tools/build_cffi_imports.py!
+	# (NB: we build CFFI modules first to avoid error log when importing
+	# build_cffi_imports).
+	cffi_targets=(
+		pypy_util blake2/_blake2 sha3/_sha3 ssl
+		audioop syslog pwdgrp resource lzma posixshmem
+	)
+	use gdbm && cffi_targets+=( gdbm )
+	use ncurses && cffi_targets+=( curses )
+	use sqlite && cffi_targets+=( sqlite3 )
+	use tk && cffi_targets+=( tkinter/tklib )
+
+	local t
+	# all modules except tkinter output to .
+	# tkinter outputs to the correct dir ...
+	cd lib_pypy || die
+	for t in "${cffi_targets[@]}"; do
+		# tkinter doesn't work via -m
+		../pypy${PYVER}-c "_${t}_build.py" || die "Failed to build CFFI bindings for ${t}"
+	done
+
+	# Verify that CFFI module list is up-to-date
+	local expected_cksum=63d4659f
+	local local_cksum=$(
+		../pypy${PYVER}-c - <<-EOF
+			import binascii
+			import json
+			from pypy_tools.build_cffi_imports import cffi_build_scripts as x
+			print("%08x" % (binascii.crc32(json.dumps(x).encode()),))
+		EOF
+	)
+	if [[ ${local_cksum} != ${expected_cksum} ]]; then
+		die "Please verify cffi_targets and update checksum to ${local_cksum}"
+	fi
+
+	# Cleanup temporary objects
+	find -name "*_cffi.[co]" -delete || die
+	find -type d -empty -delete || die
+}
+
+src_install() {
+	einfo "Installing PyPy ..."
+	dodir /usr/bin
+	dosym pypy${PYVER}-c-${PYPY_PV} /usr/bin/pypy${PYVER}
+	dosym pypy${PYVER} /usr/bin/pypy3
+	insinto /usr/lib/pypy${PYVER}
+	# preserve mtimes to avoid obsoleting caches
+	insopts -p
+	doins -r lib-python/3/. lib_pypy/.
+	insinto /usr/include
+	doins -r include/pypy${PYVER}
+
+	# replace copied headers with symlinks
+	for x in "${BROOT}"/usr/include/pypy${PYVER}/${PYPY_PV}/*; do
+		dosym "${PYPY_PV}/${x##*/}" "/usr/include/pypy${PYVER}/${x##*/}"
+	done
+
+	dodoc README.rst
+
+	local dest=/usr/lib/pypy${PYVER}
+	rm -r "${ED}${dest}"/ensurepip/_bundled || die
+	if ! use ensurepip; then
+		rm -r "${ED}${dest}"/ensurepip || die
+	fi
+	if ! use gdbm; then
+		rm -r "${ED}${dest}"/_gdbm* || die
+	fi
+	if ! use sqlite; then
+		rm -r "${ED}${dest}"/sqlite3 \
+			"${ED}${dest}"/_sqlite3* \
+			"${ED}${dest}"/test/test_sqlite.py || die
+	fi
+	if ! use tk; then
+		rm -r "${ED}${dest}"/{idlelib,tkinter} \
+			"${ED}${dest}"/_tkinter \
+			"${ED}${dest}"/test/test_{tcl,tk,ttk*}.py || die
+	fi
+	dosym ../python/EXTERNALLY-MANAGED "${dest}/EXTERNALLY-MANAGED"
+
+	local -x EPYTHON=pypy3
+	local -x PYTHON=${ED}/usr/bin/pypy${PYVER}-c-${PYPY_PV}
+	# temporarily copy to build tree to facilitate module builds
+	cp -p "${BROOT}/usr/bin/pypy${PYVER}-c-${PYPY_PV}" "${PYTHON}" || die
+
+	einfo "Byte-compiling Python standard library..."
+	python_optimize "${ED}${dest}"
+
+	# remove to avoid collisions
+	rm "${PYTHON}" || die
+}