diff options
Diffstat (limited to 'dev-python/pypy3')
-rw-r--r-- | dev-python/pypy3/Manifest | 3 | ||||
-rw-r--r-- | dev-python/pypy3/pypy3-7.3.11.ebuild | 203 |
2 files changed, 206 insertions, 0 deletions
diff --git a/dev-python/pypy3/Manifest b/dev-python/pypy3/Manifest index 9de10da2a7f5..fd1e6d197dcf 100644 --- a/dev-python/pypy3/Manifest +++ b/dev-python/pypy3/Manifest @@ -1,4 +1,7 @@ DIST pypy3.9-gentoo-patches-7.3.10_p1.tar.xz 10348 BLAKE2B 4daeecd2b6631785ccb22789518599cab84c39da93bd054389f733f9396c90717d7754b5894a4ed1088416327a6e3e147cc4c454caac7e59d63bbca7aa3bd0ab SHA512 1a149ac967a5bb0facfdb801b816d2a527e6e16183c3301f38d6467c269994d165928ece2c5cf39650516c952aceaadf6e0ec70a2bf62c81c9ba1ed978da6bdf +DIST pypy3.9-gentoo-patches-7.3.11.tar.xz 6444 BLAKE2B adcc1ae4c3ae2c5317a05d6de51785945625d8bcc7cb35bd6608fa80f09b37c483c95663eacb0353013a5abec308d25b12666699c65512f5f3a6d7345f2b5b18 SHA512 f2064ecffa09ba23f5f8c281ca4c8c0740cb6b57185d66c02eec2bcb77cfb566b1a2db4f52c472bcaf0d5fb759ee8003b27761af37785d12465c2010fd73c49d DIST pypy3.9-v7.3.10-src.tar.bz2 23416039 BLAKE2B 1b13e8bbe6c38c4b9183a632063aeed593986bc7906cfe527fa7534d29f9b1ae0f1e6d3795ff73be19f5737c3fd9d1b3cc2777f30d9237d853e4266bea60a5bb SHA512 1ed3fc9cdda7f3144141fc6a37b124e7141cb3f294ce8b5ca3c3aa30a3c58715e168879decaa796c890a9a287c82c2dbabb81db5f6b8d17f4215d7d3261fe9a8 +DIST pypy3.9-v7.3.11-src.tar.bz2 23460769 BLAKE2B fa8a827c28813243926c8689addb008c0a43acdc3f81a18749a8f2c1926b6294f2c0c95a4c315e3b77ce84b4f337af7a0bce5daf8dcb60ead965532d4af183cb SHA512 33c978ffbeeb39453028d1d1646ccfdace062ce48a5d939245bea41643038dd3687e80e34f88fa0622bcb175d7dd78f75cbe36b24229c8052f09d2d17dcdfd8c EBUILD pypy3-7.3.10_p1.ebuild 5769 BLAKE2B 80f603635d1d8d9195810bc5d7d9810d233a3cb52a406c10493d9412ede33a93836e0038e4982a130d84e13b910d4a5110993aaa825326050287687adce3b2a0 SHA512 dffdd2e3c15e8493444cbb0714b9c3484d90f485aa0f3ae8b3b13733d58ef6162cfcdb0b6315b587e25bfa6fd7023d5fbd0311774ae1d80cd700d2197802ff54 +EBUILD pypy3-7.3.11.ebuild 5771 BLAKE2B 111c1e31c4d2ea4e9ee140c3b53f17a7ba8845308ec931a9657976c0a55b8ba9085b0a1e538e5ab4aa01d5f42fb7950201b210e0c7b79853c2052e371c35e4bb SHA512 2e8a602cf7bd47c6dda0585f79a81835c9e959ef5b5e628cbdc18c67c26171182c39bd1245f6ba768f02d9a25e04ea194b183e1bc979adf9f6e0ed17a30fe3cc MISC metadata.xml 531 BLAKE2B 0f727c7ced9fb24ba0dc0b41d51c177b3711de33b838bf46cfdde5d8b751de9694873c13fe8153747f2cb533c078c54f004ee84b1c3c57b6f8d62128ffb9dba2 SHA512 331b66647a58047ded4bcf1529e3ca16b21cbb37afa82d8be0a4b6ad605e17bf3f1478fad1ea3b9c970bdf5162cb41e6adcb029a261fcbf894e807998b9219f6 diff --git a/dev-python/pypy3/pypy3-7.3.11.ebuild b/dev-python/pypy3/pypy3-7.3.11.ebuild new file mode 100644 index 000000000000..e203c371b1f8 --- /dev/null +++ b/dev-python/pypy3/pypy3-7.3.11.ebuild @@ -0,0 +1,203 @@ +# Copyright 1999-2022 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*} +MY_P=pypy3.9-v${PYPY_PV/_rc/rc} +PATCHSET="pypy3.9-gentoo-patches-${PV/_rc/rc}" + +DESCRIPTION="A fast, compliant alternative implementation of the Python (3.9) 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/pypy39-pp73-336" +KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86 ~amd64-linux ~x86-linux" +IUSE="+ensurepip gdbm +jit ncurses sqlite tk" +# many tests are failing upstream +# see https://buildbot.pypy.org/summary?branch=py3.9 +RESTRICT="test" + +RDEPEND=" + || ( + >=dev-python/pypy3-exe-${PYPY_PV}:3.9-${PYPY_PV}[bzip2(+),ncurses?] + >=dev-python/pypy3-exe-bin-${PYPY_PV}:3.9-${PYPY_PV} + ) + dev-lang/python-exec[python_targets_pypy3(-)] + dev-libs/openssl:0= + 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/pypy3.9 || die + # copy over to make sys.prefix happy + cp -p "${BROOT}"/usr/bin/pypy3.9-c-${PYPY_PV} pypy3.9-c || die + cp -p "${BROOT}"/usr/include/pypy3.9/${PYPY_PV}/* include/pypy3.9/ || die + # (not installed by pypy-exe) + rm pypy/module/cpyext/include/_numpypy/numpy/README || die + mv pypy/module/cpyext/include/* include/pypy3.9/ || die + mv pypy/module/cpyext/parse/*.h include/pypy3.9/ || die + pax-mark m pypy3.9-c + + # verify the subslot + local soabi=$( + ./pypy3.9-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/pypy3.9" + LIBDIR "${EPREFIX}/usr/$(get_libdir)" + TZPATH "${EPREFIX}/usr/share/zoneinfo" + WHEEL_PKG_DIR "${EPREFIX}/usr/lib/python/ensurepip" + ) + ./pypy3.9-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. + ./pypy3.9-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 pypy/tool/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 + ../pypy3.9-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=$( + ../pypy3.9-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 pypy3.9-c-${PYPY_PV} /usr/bin/pypy3.9 + dosym pypy3.9 /usr/bin/pypy3 + insinto /usr/lib/pypy3.9 + # preserve mtimes to avoid obsoleting caches + insopts -p + doins -r lib-python/3/. lib_pypy/. + insinto /usr/include + doins -r include/pypy3.9 + + # replace copied headers with symlinks + for x in "${BROOT}"/usr/include/pypy3.9/${PYPY_PV}/*; do + dosym "${PYPY_PV}/${x##*/}" "/usr/include/pypy3.9/${x##*/}" + done + + dodoc README.rst + + local dest=/usr/lib/pypy3.9 + 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 + + local -x EPYTHON=pypy3 + local -x PYTHON=${ED}/usr/bin/pypy3.9-c-${PYPY_PV} + # temporarily copy to build tree to facilitate module builds + cp -p "${BROOT}/usr/bin/pypy3.9-c-${PYPY_PV}" "${PYTHON}" || die + + einfo "Byte-compiling Python standard library..." + python_optimize "${ED}${dest}" + + # remove to avoid collisions + rm "${PYTHON}" || die +} |