gnu: pypy3: Use gdbm compat library and other small fixes.

* gnu/packages/python.scm (pypy3)[inputs]: Remove bash-minimal.
[phases]: Remove trailing #t.
{patch-source}: Use gdbm compat library.  Fix shell with the implicit Bash
input.
{build}: Use the '--allworkingmodules' argument.
{install}: Refactor for clarity.
[license]: Re-indent comments.

Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
This commit is contained in:
Lars-Dominik Braun 2020-11-15 10:54:26 +01:00 committed by Maxim Cournoyer
parent 49432f6534
commit 7e05fda6e8
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -745,7 +745,6 @@ (define-public pypy3
("tcl" ,tcl) ("tcl" ,tcl)
("tk" ,tk) ("tk" ,tk)
("glibc" ,glibc) ("glibc" ,glibc)
("bash-minimal" ,bash-minimal) ; Used as /bin/sh
("xz" ,xz))) ; liblzma ("xz" ,xz))) ; liblzma
(arguments (arguments
`(#:tests? #f ;FIXME: 43 out of 364 tests are failing `(#:tests? #f ;FIXME: 43 out of 364 tests are failing
@ -777,6 +776,12 @@ (define-public pypy3
(substitute* '("lib_pypy/_curses_build.py") (substitute* '("lib_pypy/_curses_build.py")
;; Find curses ;; Find curses
(("/usr/local") (assoc-ref inputs "ncurses"))) (("/usr/local") (assoc-ref inputs "ncurses")))
(substitute* '("lib_pypy/_dbm.py")
;; Use gdbm compat library, so we dont need to pull
;; in bdb.
(("ctypes.util.find_library\\('db'\\)")
(format #f "'~a/lib/libgdbm_compat.so'"
(assoc-ref inputs "gdbm"))))
(substitute* '("lib_pypy/_sqlite3_build.py") (substitute* '("lib_pypy/_sqlite3_build.py")
;; Always use search paths ;; Always use search paths
(("sys\\.platform\\.startswith\\('freebsd'\\)") "True") (("sys\\.platform\\.startswith\\('freebsd'\\)") "True")
@ -788,12 +793,10 @@ (define-public pypy3
"/lib/libsqlite3.so.0'"))) "/lib/libsqlite3.so.0'")))
(substitute* '("lib-python/3/subprocess.py") (substitute* '("lib-python/3/subprocess.py")
;; Fix shell path ;; Fix shell path
(("/bin/sh") (("/bin/sh") (which "sh")))
(string-append (assoc-ref inputs "bash-minimal") "/bin/sh")))
(substitute* '("lib-python/3/distutils/unixccompiler.py") (substitute* '("lib-python/3/distutils/unixccompiler.py")
;; gcc-toolchain does not provide symlink cc -> gcc ;; gcc-toolchain does not provide symlink cc -> gcc
(("\"cc\"") "\"gcc\"")) (("\"cc\"") "\"gcc\""))))
#t))
(add-after (add-after
'unpack 'set-source-file-times-to-1980 'unpack 'set-source-file-times-to-1980
;; copied from python package, required by zip testcase ;; copied from python package, required by zip testcase
@ -801,8 +804,7 @@ (define-public pypy3
(let ((circa-1980 (* 10 366 24 60 60))) (let ((circa-1980 (* 10 366 24 60 60)))
(ftw "." (lambda (file stat flag) (ftw "." (lambda (file stat flag)
(utime file circa-1980 circa-1980) (utime file circa-1980 circa-1980)
#t)) #t)))))
#t)))
(replace 'build (replace 'build
(lambda* (#:key inputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(with-directory-excursion "pypy/goal" (with-directory-excursion "pypy/goal"
@ -812,7 +814,8 @@ (define-public pypy3
(string-append "--make-jobs=" (string-append "--make-jobs="
(number->string (parallel-job-count))) (number->string (parallel-job-count)))
"-Ojit" "-Ojit"
"targetpypystandalone")) "targetpypystandalone"
"--allworkingmodules"))
;; Build c modules and package everything, so tests work. ;; Build c modules and package everything, so tests work.
(with-directory-excursion "pypy/tool/release" (with-directory-excursion "pypy/tool/release"
(unsetenv "PYTHONPATH") ; Do not use the systems python libs: (unsetenv "PYTHONPATH") ; Do not use the systems python libs:
@ -834,44 +837,45 @@ (define-public pypy3
"pypy/test_all.py" "pypy/test_all.py"
"--pypy=pypy/tool/release/pypy-dist/bin/pypy3" "--pypy=pypy/tool/release/pypy-dist/bin/pypy3"
"lib-python")) "lib-python"))
(format #t "test suite not run~%")) (format #t "test suite not run~%"))))
#t))
(replace 'install (replace 'install
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs outputs #:allow-other-keys)
(with-directory-excursion "pypy/tool/release" (let* ((out (assoc-ref outputs "out"))
;; Delete test data. (bin-pypy3 (string-append out "/bin/pypy3"))
(for-each (shebang-match-python "#!.+/bin/python")
(lambda (x) (shebang-pypy3 (string-append "#!" bin-pypy3))
(delete-file-recursively (string-append (dist-dir "pypy/tool/release/pypy-dist"))
"pypy-dist/lib-python/3/" x))) (with-directory-excursion dist-dir
'("tkinter/test" ;; Delete test data.
"test" (for-each
"sqlite3/test" (lambda (x)
"lib2to3/tests" (delete-file-recursively (string-append
"idlelib/idle_test" "lib-python/3/" x)))
"distutils/tests" '("tkinter/test"
"ctypes/test" "test"
"unittest/test")) "sqlite3/test"
;; Patch shebang referencing python2 "lib2to3/tests"
(substitute* '("pypy-dist/lib-python/3/cgi.py" "idlelib/idle_test"
"pypy-dist/lib-python/3/encodings/rot_13.py") "distutils/tests"
(("#!.+/bin/python") "ctypes/test"
(string-append "#!" (assoc-ref outputs "out") "/bin/pypy3"))) "unittest/test"))
(with-fluids ((%default-port-encoding "ISO-8859-1")) ;; Patch shebang referencing python2
(substitute* '("pypy-dist/lib_pypy/_md5.py" (substitute* '("lib-python/3/cgi.py"
"pypy-dist/lib_pypy/_sha1.py") "lib-python/3/encodings/rot_13.py")
(("#!.+/bin/python") ((shebang-match-python) shebang-pypy3))
(string-append "#!" (assoc-ref outputs "out") "/bin/pypy3")))) (with-fluids ((%default-port-encoding "ISO-8859-1"))
(copy-recursively "pypy-dist" (assoc-ref outputs "out"))) (substitute* '("lib_pypy/_md5.py"
#t))))) "lib_pypy/_sha1.py")
((shebang-match-python) shebang-pypy3))))
(copy-recursively dist-dir out)))))))
(home-page "https://www.pypy.org/") (home-page "https://www.pypy.org/")
(synopsis "Python implementation with just-in-time compilation") (synopsis "Python implementation with just-in-time compilation")
(description "PyPy is a faster, alternative implementation of the Python (description "PyPy is a faster, alternative implementation of the Python
programming language employing a just-in-time compiler. It supports most programming language employing a just-in-time compiler. It supports most
Python code natively, including C extensions.") Python code natively, including C extensions.")
(license (list license:expat ; pypy itself; _pytest/ (license (list license:expat ; pypy itself; _pytest/
license:psfl ; python standard library in lib-python/ license:psfl ; python standard library in lib-python/
license:asl2.0 ; dotviewer/font/ and some of lib-python/ license:asl2.0 ; dotviewer/font/ and some of lib-python/
license:gpl3+ ; ./rpython/rlib/rvmprof/src/shared/libbacktrace/dwarf2.* license:gpl3+ ; ./rpython/rlib/rvmprof/src/shared/libbacktrace/dwarf2.*
license:bsd-3 ; lib_pypy/cffi/_pycparser/ply/ license:bsd-3 ; lib_pypy/cffi/_pycparser/ply/
(license:non-copyleft (license:non-copyleft