dev-python/pypy3: Bump to 5.9.0
authorMichał Górny <mgorny@gentoo.org>
Thu, 5 Oct 2017 17:45:39 +0000 (19:45 +0200)
committerMichał Górny <mgorny@gentoo.org>
Mon, 9 Oct 2017 18:58:14 +0000 (20:58 +0200)
dev-python/pypy3/Manifest
dev-python/pypy3/files/5.9.0-shared-lib.patch [new file with mode: 0644]
dev-python/pypy3/pypy3-5.9.0.ebuild [new file with mode: 0644]
dev-python/pypy3/pypy3-9999.ebuild

index 84c8dbad617f6fac45981cdf2721d1b92f19f534..ba2c2b770e871778ec108fa7c83c7c2e495c826f 100644 (file)
@@ -1,4 +1,5 @@
 DIST pypy3-v5.7.1-src.tar.bz2 28811162 SHA256 40ece0145282980ac121390f13709404c0532896507d5767496381180b631bd0 SHA512 f8ead8214ad7d89fe80e24d97b13ece7f2c80b2f11446257a2eab0e3025fc7d8fec26474b0e9eb2b2e3ccd629532dd062829459361b601add12e40793bd5aa60 WHIRLPOOL 180a5cb39c9a5e3840f4940463dd9cccf44486f11a657d2ac644d1eac4561068f08905fdadc495918fb0ceaf018d4b85a3e5756ca6d99a020310b46bdb16ef87
 DIST pypy3-v5.8.0-src.tar.bz2 28986883 SHA256 9d090127335c3c0fd2b14c8835bf91752e62756e55ea06aad3353f24a6854223 SHA512 d78b4c899a5643028664365ed973a7b292a8e5b3989cc75203cd381ea3cda7dd73121c574726e23dca86e8364fcfcf42c372c9deee438c805f30d6e1c4ac115a WHIRLPOOL b7567fa21e3ded400a72ec06197184df37e0b5893adfb55622ea9afb668bfbda7ebbecd9b80660efef42f160838966d103c4181a9b07355e873981b35f4bf104
+DIST pypy3-v5.9.0-src.tar.bz2 29055111 SHA256 a014f47f50a1480f871a0b82705f904b38c93c4ca069850eb37653fedafb1b97 SHA512 3d5384d644fdd1bc8b95f5747dbd1771ae06eb2cfc7b57be359b8bf40177676afd097620d0cb9d9000c40d8cce075cfa6bfd92de987d3dd927c04d7d595dc5bd WHIRLPOOL e0936d56c64c3c077910c4713295010ec3e0fabebe654115ddf07407884d1564db7de2f85bcedf1226449c516085f3e4814a2c523f0d48e3ad8ac21150a93a72
 DIST pypy3.3-v5.5.0-alpha-src.tar.bz2 25122033 SHA256 d5591c34d77253e9ed57d182b6f49585b95f7c09c3e121f0e8630e5a7e75ab5f SHA512 b2cf9700e45c452293297edffe08e572dffc3c567026b4b5d9165c1ba1b4d858ffc8a6754f5f28781020016c36440e5c02d07562d075b12444c9c32ea5dd2168 WHIRLPOOL 6bde174969413c55d6d077cd14e737c4f034f19935536af1bffaf3a1caa456d2bf6850760a18c274ad99089bd5ab7331d7d185f914cd6c69f708abf857d35df3
 DIST python-gentoo-patches-3.3.5-0.tar.xz 12892 SHA256 a7240de9598033cb40f8f273d8104d4e2b1dcaea028d45ac28efaa3c680ff6f7 SHA512 27eef4c2b3f631b000db3f6a5c426d9b498d63a08fe82b1ab7c2c010fb72208109461a5f008d47703852526655b70a734ea95be8742897026db5750bb9cc9d16 WHIRLPOOL edab9222d7da94cab3b1de0e1a27c6c7dbd49194b813a0a1cf9e532063029c4e4f19151c9f4878eeabed3168ff1f97eae7f008280c7ed2897fc14c5516c68d7e
diff --git a/dev-python/pypy3/files/5.9.0-shared-lib.patch b/dev-python/pypy3/files/5.9.0-shared-lib.patch
new file mode 100644 (file)
index 0000000..5d89d3b
--- /dev/null
@@ -0,0 +1,12 @@
+diff -dupr a/rpython/translator/platform/posix.py b/rpython/translator/platform/posix.py
+--- a/rpython/translator/platform/posix.py     2017-10-05 20:17:25.009954656 +0200
++++ b/rpython/translator/platform/posix.py     2017-10-05 20:17:31.115666386 +0200
+@@ -227,7 +227,7 @@ class BasePosix(Platform):
+                    'int main(int argc, char* argv[]) '
+                    '{ return $(PYPY_MAIN_FUNCTION)(argc, argv); }" > $@')
+             m.rule('$(DEFAULT_TARGET)', ['$(TARGET)', 'main.o'],
+-                   ['$(CC_LINK) $(LDFLAGS_LINK) main.o -L. -l$(SHARED_IMPORT_LIB) -o $@ $(RPATH_FLAGS)', '$(MAKE) postcompile BIN=$(DEFAULT_TARGET)'])
++                   ['$(CC_LINK) $(LDFLAGS_LINK) main.o -L. -l$(SHARED_IMPORT_LIB) \'-Wl,-rpath,$$ORIGIN\' -o $@', '$(MAKE) postcompile BIN=$(DEFAULT_TARGET)'])
+         return m
diff --git a/dev-python/pypy3/pypy3-5.9.0.ebuild b/dev-python/pypy3/pypy3-5.9.0.ebuild
new file mode 100644 (file)
index 0000000..1c93d21
--- /dev/null
@@ -0,0 +1,236 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+# pypy3 needs to be built using python 2
+PYTHON_COMPAT=( python2_7 pypy )
+inherit check-reqs pax-utils python-any-r1 toolchain-funcs versionator
+
+MY_P=pypy3-v${PV}
+
+DESCRIPTION="A fast, compliant alternative implementation of the Python (3.3) language"
+HOMEPAGE="http://pypy.org/"
+SRC_URI="https://bitbucket.org/pypy/pypy/downloads/${MY_P}-src.tar.bz2"
+
+LICENSE="MIT"
+# pypy3 -c 'import sysconfig; print(sysconfig.get_config_var("SOABI"))'
+SLOT="0/59"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="bzip2 gdbm +jit libressl low-memory ncurses sandbox sqlite tk"
+
+RDEPEND=">=sys-libs/zlib-1.1.3:0=
+       virtual/libffi:0=
+       virtual/libintl:0=
+       dev-libs/expat:0=
+       !libressl? ( dev-libs/openssl:0=[-bindist] )
+       libressl? ( dev-libs/libressl:0= )
+       bzip2? ( app-arch/bzip2:0= )
+       gdbm? ( sys-libs/gdbm:0= )
+       ncurses? ( sys-libs/ncurses:0= )
+       sqlite? ( dev-db/sqlite:3= )
+       tk? (
+               dev-lang/tk:0=
+               dev-tcltk/tix:0=
+       )
+       !dev-python/pypy3-bin:0"
+DEPEND="${RDEPEND}
+       low-memory? ( virtual/pypy:0 )
+       !low-memory? ( ${PYTHON_DEPS} )"
+#      doc? ( dev-python/sphinx )
+
+S="${WORKDIR}/${MY_P}-src"
+
+pkg_pretend() {
+       if [[ ${MERGE_TYPE} != binary ]]; then
+               if use low-memory; then
+                       CHECKREQS_MEMORY="1750M"
+                       use amd64 && CHECKREQS_MEMORY="3500M"
+               else
+                       CHECKREQS_MEMORY="3G"
+                       use amd64 && CHECKREQS_MEMORY="6G"
+               fi
+
+               check-reqs_pkg_pretend
+       fi
+}
+
+pkg_setup() {
+       if [[ ${MERGE_TYPE} != binary ]]; then
+               pkg_pretend
+
+               # unset to allow forcing pypy below :)
+               use low-memory && local EPYTHON=
+               if python_is_installed pypy && [[ ! ${EPYTHON} || ${EPYTHON} == pypy ]]; then
+                       einfo "Using PyPy to perform the translation."
+                       local EPYTHON=pypy
+               else
+                       einfo "Using ${EPYTHON:-python2} to perform the translation. Please note that upstream"
+                       einfo "recommends using PyPy for that. If you wish to do so, please install"
+                       einfo "virtual/pypy and ensure that EPYTHON variable is unset."
+               fi
+
+               python-any-r1_pkg_setup
+       fi
+}
+
+src_prepare() {
+       eapply "${FILESDIR}/4.0.0-gentoo-path.patch"
+       eapply "${FILESDIR}/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch"
+       eapply "${FILESDIR}"/5.9.0-shared-lib.patch     # 517002
+
+       sed -e "s^@EPREFIX@^${EPREFIX}^" \
+               -e "s^@libdir@^$(get_libdir)^" \
+               -i lib-python/3/distutils/command/install.py || die
+
+       # apply CPython stdlib patches
+       pushd lib-python/3 > /dev/null || die
+       eapply "${FILESDIR}"/5.8.0_all_distutils_cxx.patch
+       eapply "${FILESDIR}"/python-3.5-distutils-OO-build.patch
+       popd > /dev/null || die
+
+       eapply_user
+}
+
+src_configure() {
+       tc-export CC
+
+       local args=(
+               --shared
+               $(usex jit -Ojit -O2)
+               $(usex sandbox --sandbox '')
+
+               --jit-backend=auto
+
+               pypy/goal/targetpypystandalone
+       )
+
+       # Avoid linking against libraries disabled by use flags
+       local opts=(
+               bzip2:bz2
+               ncurses:_minimal_curses
+       )
+
+       local opt
+       for opt in "${opts[@]}"; do
+               local flag=${opt%:*}
+               local mod=${opt#*:}
+
+               args+=(
+                       $(usex ${flag} --withmod --withoutmod)-${mod}
+               )
+       done
+
+       local interp=( "${PYTHON}" )
+       if use low-memory; then
+               interp=( env PYPY_GC_MAX_DELTA=200MB
+                       "${PYTHON}" --jit loop_longevity=300 )
+       fi
+
+       # translate into the C sources
+       # we're going to make them ourselves since otherwise pypy does not
+       # free up the unneeded memory before spawning the compiler
+       set -- "${interp[@]}" rpython/bin/rpython --batch --source "${args[@]}"
+       echo -e "\033[1m${@}\033[0m"
+       "${@}" || die "translation failed"
+}
+
+src_compile() {
+       emake -C "${T}"/usession*-0/testing_1
+
+       # copy back to make sys.prefix happy
+       cp -p "${T}"/usession*-0/testing_1/{pypy3-c,libpypy3-c.so} . || die
+       pax-mark m pypy3-c libpypy3-c.so
+
+       #use doc && emake -C pypy/doc html
+}
+
+src_test() {
+       # (unset)
+       local -x PYTHONDONTWRITEBYTECODE
+
+       # Test runner requires Python 2 too. However, it spawns PyPy3
+       # internally so that we end up testing the correct interpreter.
+       "${PYTHON}" ./pypy/test_all.py --pypy=./pypy3-c lib-python || die
+}
+
+src_install() {
+       local dest=/usr/$(get_libdir)/pypy3
+       einfo "Installing PyPy ..."
+       exeinto "${dest}"
+       doexe pypy3-c libpypy3-c.so
+       pax-mark m "${ED%/}${dest}/pypy3-c" "${ED%/}${dest}/libpypy3-c.so"
+       insinto "${dest}"
+       doins -r include lib_pypy lib-python
+       dosym ../$(get_libdir)/pypy3/pypy3-c /usr/bin/pypy3
+       dodoc README.rst
+
+       if ! use gdbm; then
+               rm -r "${ED%/}${dest}"/lib_pypy/_gdbm* || die
+       fi
+       if ! use sqlite; then
+               rm -r "${ED%/}${dest}"/lib-python/*3/sqlite3 \
+                       "${ED%/}${dest}"/lib_pypy/_sqlite3* \
+                       "${ED%/}${dest}"/lib-python/*3/test/test_sqlite.py || die
+       fi
+       if ! use tk; then
+               rm -r "${ED%/}${dest}"/lib-python/*3/{idlelib,tkinter} \
+                       "${ED%/}${dest}"/lib_pypy/_tkinter \
+                       "${ED%/}${dest}"/lib-python/*3/test/test_{tcl,tk,ttk*}.py || die
+       fi
+
+       # Install docs
+       #use doc && dohtml -r pypy/doc/_build/html/
+
+       einfo "Generating caches and byte-compiling ..."
+
+       local -x PYTHON=${ED%/}${dest}/pypy3-c
+       local -x LD_LIBRARY_PATH="${ED%/}${dest}"
+       # we can't use eclass function since PyPy is dumb and always gives
+       # paths relative to the interpreter
+       local PYTHON_SITEDIR=${EPREFIX}/usr/$(get_libdir)/pypy3/site-packages
+       python_export pypy3 EPYTHON
+
+       echo "EPYTHON='${EPYTHON}'" > epython.py || die
+       python_domodule epython.py
+
+       # Generate Grammar and PatternGrammar pickles.
+       "${PYTHON}" -c "import lib2to3.pygram, lib2to3.patcomp; lib2to3.patcomp.PatternCompiler()" \
+               || die "Generation of Grammar and PatternGrammar pickles failed"
+
+       # Generate cffi modules
+       # Please keep in sync with pypy/tool/build_cffi_imports.py!
+#cffi_build_scripts = {
+#    "sqlite3": "_sqlite3_build.py",
+#    "audioop": "_audioop_build.py",
+#    "tk": "_tkinter/tklib_build.py",
+#    "curses": "_curses_build.py" if sys.platform != "win32" else None,
+#    "syslog": "_syslog_build.py" if sys.platform != "win32" else None,
+#    "_gdbm": "_gdbm_build.py"  if sys.platform != "win32" else None,
+#    "pwdgrp": "_pwdgrp_build.py" if sys.platform != "win32" else None,
+#    "resource": "_resource_build.py" if sys.platform != "win32" else None,
+#    "lzma": "_lzma_build.py",
+#    "_decimal": "_decimal_build.py",
+#    "ssl": "_ssl_build.py",
+       cffi_targets=( audioop syslog pwdgrp resource lzma decimal ssl )
+       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 "${ED%/}${dest}"/lib_pypy || die
+       for t in "${cffi_targets[@]}"; do
+               # tkinter doesn't work via -m
+               "${PYTHON}" "_${t}_build.py" || die "Failed to build CFFI bindings for ${t}"
+       done
+
+       # Cleanup temporary objects
+       find "${ED%/}${dest}" -name "_cffi_*.[co]" -delete || die
+       find "${ED%/}${dest}" -type d -empty -delete || die
+
+       # compile the installed modules
+       python_optimize "${ED%/}${dest}"
+}
index 7291b119ea06a7474b6d3ee5afeff2f39f8423ee..1175a210c9897d3a49ac2e178dae89950d8ee3e3 100644 (file)
@@ -15,8 +15,8 @@ HOMEPAGE="http://pypy.org/"
 SRC_URI=""
 
 LICENSE="MIT"
-# XX from pypy3-XX.so module suffix
-SLOT="0/57"
+# pypy3 -c 'import sysconfig; print(sysconfig.get_config_var("SOABI"))'
+SLOT="0/59"
 KEYWORDS=""
 IUSE="bzip2 gdbm +jit libressl low-memory ncurses sandbox sqlite cpu_flags_x86_sse2 tk"
 
@@ -84,7 +84,7 @@ src_unpack() {
 src_prepare() {
        eapply "${FILESDIR}/4.0.0-gentoo-path.patch"
        eapply "${FILESDIR}/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch"
-       eapply "${FILESDIR}"/2.5.0-shared-lib.patch     # 517002
+       eapply "${FILESDIR}"/5.9.0-shared-lib.patch     # 517002
 
        sed -e "s^@EPREFIX@^${EPREFIX}^" \
                -e "s^@libdir@^$(get_libdir)^" \