commit:     61ee5e7fe94a944842077b4740c6857d2c60ba2a
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Nov  4 23:59:59 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Nov  5 12:19:19 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=61ee5e7f

dev-python/pypy: Generate caches earlier, in compile

Generate the caches in compile phase since they are needed for tests.

Closes: https://bugs.gentoo.org/636490

 dev-python/pypy/pypy-5.9.0.ebuild | 72 ++++++++++++++++++++-------------------
 dev-python/pypy/pypy-9999.ebuild  | 72 ++++++++++++++++++++-------------------
 2 files changed, 74 insertions(+), 70 deletions(-)

diff --git a/dev-python/pypy/pypy-5.9.0.ebuild 
b/dev-python/pypy/pypy-5.9.0.ebuild
index 737757a547f..cef567ec30c 100644
--- a/dev-python/pypy/pypy-5.9.0.ebuild
+++ b/dev-python/pypy/pypy-5.9.0.ebuild
@@ -178,6 +178,42 @@ src_compile() {
        pax-mark m pypy-c libpypy-c.so
 
        use doc && emake -C pypy/doc html
+
+       einfo "Generating caches and CFFI modules ..."
+
+       # Generate Grammar and PatternGrammar pickles.
+       ./pypy-c -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,
+       cffi_targets=( audioop syslog pwdgrp resource )
+       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-c "_${t}_build.py" || die "Failed to build CFFI 
bindings for ${t}"
+       done
+
+       # Cleanup temporary objects
+       find -name "_cffi_*.[co]" -delete || die
+       find -type d -empty -delete || die
 }
 
 src_test() {
@@ -216,8 +252,6 @@ src_install() {
        # Install docs
        use doc && dodoc -r pypy/doc/_build/html
 
-       einfo "Generating caches and byte-compiling ..."
-
        local -x PYTHON=${ED%/}${dest}/pypy-c
        # we can't use eclass function since PyPy is dumb and always gives
        # paths relative to the interpreter
@@ -227,39 +261,7 @@ src_install() {
        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,
-       cffi_targets=( audioop syslog pwdgrp resource )
-       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
+       einfo "Byte-compiling Python standard library..."
 
        # compile the installed modules
        python_optimize "${ED%/}${dest}"

diff --git a/dev-python/pypy/pypy-9999.ebuild b/dev-python/pypy/pypy-9999.ebuild
index 4fb5eb37b37..08bd414c590 100644
--- a/dev-python/pypy/pypy-9999.ebuild
+++ b/dev-python/pypy/pypy-9999.ebuild
@@ -184,6 +184,42 @@ src_compile() {
        pax-mark m pypy-c libpypy-c.so
 
        use doc && emake -C pypy/doc html
+
+       einfo "Generating caches and CFFI modules ..."
+
+       # Generate Grammar and PatternGrammar pickles.
+       ./pypy-c -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,
+       cffi_targets=( audioop syslog pwdgrp resource )
+       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-c "_${t}_build.py" || die "Failed to build CFFI 
bindings for ${t}"
+       done
+
+       # Cleanup temporary objects
+       find -name "_cffi_*.[co]" -delete || die
+       find -type d -empty -delete || die
 }
 
 src_test() {
@@ -222,8 +258,6 @@ src_install() {
        # Install docs
        use doc && dodoc -r pypy/doc/_build/html
 
-       einfo "Generating caches and byte-compiling ..."
-
        local -x PYTHON=${ED%/}${dest}/pypy-c
        # we can't use eclass function since PyPy is dumb and always gives
        # paths relative to the interpreter
@@ -233,39 +267,7 @@ src_install() {
        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,
-       cffi_targets=( audioop syslog pwdgrp resource )
-       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
+       einfo "Byte-compiling Python standard library..."
 
        # compile the installed modules
        python_optimize "${ED%/}${dest}"

Reply via email to