summaryrefslogtreecommitdiff
path: root/gnu/packages/python.scm
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2021-12-03 11:08:18 +0100
committerMarius Bakke <marius@gnu.org>2022-10-27 19:43:06 +0200
commit6e7ed040339d815c3a3f72706b75bd0162969c9d (patch)
tree2fbc87fd8fa77aadc97c32b8c54d832d3a705d9f /gnu/packages/python.scm
parentc485a9d8af210425a0435280fff8588563e49684 (diff)
gnu: pypy: Move to separate module.
This removes the need to import (gnu packages python-xyz) in (gnu packages python), avoiding issues with circular imports. * gnu/packages/python.scm (pypy): Move… * gnu/packages/pypy.scm (pypy): …here * gnu/local.mk: Register new file. Co-authored-by: Marius Bakke <marius@gnu.org>
Diffstat (limited to 'gnu/packages/python.scm')
-rw-r--r--gnu/packages/python.scm170
1 files changed, 0 insertions, 170 deletions
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index e31158dfc0a..00c3eb7774e 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -81,17 +81,13 @@
81 #:use-module (gnu packages) 81 #:use-module (gnu packages)
82 #:use-module (gnu packages base) 82 #:use-module (gnu packages base)
83 #:use-module (gnu packages bash) 83 #:use-module (gnu packages bash)
84 #:use-module (gnu packages certs)
85 #:use-module (gnu packages check) 84 #:use-module (gnu packages check)
86 #:use-module (gnu packages compression) 85 #:use-module (gnu packages compression)
87 #:use-module (gnu packages dbm) 86 #:use-module (gnu packages dbm)
88 #:use-module (gnu packages hurd) 87 #:use-module (gnu packages hurd)
89 #:use-module (gnu packages libffi) 88 #:use-module (gnu packages libffi)
90 #:use-module (gnu packages ncurses)
91 #:use-module (gnu packages pkg-config) 89 #:use-module (gnu packages pkg-config)
92 #:use-module (gnu packages python-xyz)
93 #:use-module (gnu packages readline) 90 #:use-module (gnu packages readline)
94 #:use-module (gnu packages shells)
95 #:use-module (gnu packages sqlite) 91 #:use-module (gnu packages sqlite)
96 #:use-module (gnu packages tcl) 92 #:use-module (gnu packages tcl)
97 #:use-module (gnu packages tls) 93 #:use-module (gnu packages tls)
@@ -736,169 +732,3 @@ run within just 256k of code space and 16k of RAM. MicroPython aims to be as
736compatible with normal Python as possible to allow you to transfer code with 732compatible with normal Python as possible to allow you to transfer code with
737ease from the desktop to a microcontroller or embedded system.") 733ease from the desktop to a microcontroller or embedded system.")
738 (license license:expat))) 734 (license license:expat)))
739
740(define-public pypy
741 (package
742 (name "pypy")
743 (version "7.3.5")
744 (source (origin
745 (method url-fetch)
746 (uri (string-append "https://downloads.python.org/pypy/"
747 "pypy3.7-v" version "-src.tar.bz2"))
748 (sha256
749 (base32
750 "18lrdmpcczlbk3cfarkgwqdmilrybz56i1dafk8dkjlyk90gw86r"))))
751 (build-system gnu-build-system)
752 (arguments
753 (list
754 #:tests? #f ;FIXME: 43 out of 364 tests are failing
755 #:modules '((ice-9 ftw) (ice-9 match)
756 (guix build utils) (guix build gnu-build-system))
757 #:disallowed-references (list nss-certs)
758 #:phases
759 #~(modify-phases %standard-phases
760 (delete 'configure)
761 (add-after 'unpack 'patch-source
762 (lambda* (#:key inputs #:allow-other-keys)
763 (substitute* '("rpython/rlib/clibffi.py")
764 ;; find_library does not work for libc
765 (("ctypes\\.util\\.find_library\\('c'\\)") "'libc.so'"))
766 (substitute* '("lib_pypy/cffi/_pycparser/ply/cpp.py")
767 ;; Make reproducible (XXX: unused?)
768 (("time\\.localtime\\(\\)") "time.gmtime(0)"))
769 (substitute* '("pypy/module/sys/version.py")
770 ;; Make reproducible
771 (("t\\.gmtime\\(\\)") "t.gmtime(0)"))
772 (substitute* '("lib_pypy/_tkinter/tklib_build.py")
773 ;; Link to versioned libtcl and libtk
774 (("linklibs = \\['tcl', 'tk'\\]")
775 "linklibs = ['tcl8.6', 'tk8.6']")
776 (("incdirs = \\[\\]")
777 (string-append
778 "incdirs = ['"
779 #$(this-package-input "tcl") "/include', '"
780 #$(this-package-input "tk") "/include']")))
781 (substitute* '("lib_pypy/_curses_build.py")
782 ;; Find curses
783 (("/usr/local")
784 #$(this-package-input "ncurses")))
785 (substitute* '("lib_pypy/_dbm.py")
786 ;; Use gdbm compat library, so we don’t need to pull
787 ;; in bdb.
788 (("ctypes.util.find_library\\('db'\\)")
789 (format #f "~s" (search-input-file
790 inputs "lib/libgdbm_compat.so"))))
791 (substitute* '("lib_pypy/_sqlite3_build.py")
792 ;; Always use search paths
793 (("sys\\.platform\\.startswith\\('freebsd'\\)") "True")
794 ;; Find sqlite3
795 (("/usr/local") (assoc-ref inputs "sqlite"))
796 (("libname = 'sqlite3'")
797 (format #f "libname = ~s"
798 (search-input-file inputs "lib/libsqlite3.so.0"))))
799 (substitute* '("lib-python/3/subprocess.py")
800 ;; Fix shell path
801 (("/bin/sh")
802 (search-input-file inputs "/bin/sh")))
803 (substitute* '("lib-python/3/distutils/unixccompiler.py")
804 ;; gcc-toolchain does not provide symlink cc -> gcc
805 (("\"cc\"") "\"gcc\""))))
806 (add-after 'unpack 'set-source-file-times-to-1980
807 ;; copied from python package, required by zip testcase
808 (lambda _
809 (let ((circa-1980 (* 10 366 24 60 60)))
810 (ftw "." (lambda (file stat flag)
811 (utime file circa-1980 circa-1980)
812 #t)))))
813 (replace 'build
814 (lambda _
815 (with-directory-excursion "pypy/goal"
816 ;; Build with jit optimization.
817 (invoke "python2"
818 "../../rpython/bin/rpython"
819 (string-append "--make-jobs="
820 (number->string (parallel-job-count)))
821 "-Ojit"
822 "targetpypystandalone"
823 "--allworkingmodules"))
824 ;; Build c modules and package everything, so tests work.
825 (with-directory-excursion "pypy/tool/release"
826 (invoke "python2" "package.py"
827 "--archive-name" "pypy-dist"
828 "--builddir" (getcwd)))))
829 (replace 'check
830 (lambda* (#:key tests? #:allow-other-keys)
831 (if tests?
832 (begin
833 (setenv "HOME" "/tmp") ; test_with_pip tries to
834 ; access ~/.cache/pip
835 ;; Run library tests only (no interpreter unit tests).
836 ;; This is what Gentoo does.
837 (invoke "python" "pypy/test_all.py"
838 "--pypy=pypy/tool/release/pypy-dist/bin/pypy3"
839 "lib-python"))
840 (format #t "test suite not run~%"))))
841 (replace 'install
842 (lambda* (#:key inputs outputs #:allow-other-keys)
843 (let* ((bin-pypy3 (string-append #$output "/bin/pypy3"))
844 (shebang-match-python "#!.+/bin/python")
845 (shebang-pypy3 (string-append "#!" bin-pypy3))
846 (dist-dir "pypy/tool/release/pypy-dist"))
847 (with-directory-excursion dist-dir
848 ;; Delete test data.
849 (for-each
850 (lambda (x)
851 (delete-file-recursively (string-append
852 "lib-python/3/" x)))
853 '("tkinter/test"
854 "test"
855 "sqlite3/test"
856 "lib2to3/tests"
857 "idlelib/idle_test"
858 "distutils/tests"
859 "ctypes/test"
860 "unittest/test"))
861 ;; Patch shebang referencing python.
862 (substitute* '("lib-python/3/cgi.py"
863 "lib-python/3/encodings/rot_13.py")
864 ((shebang-match-python) shebang-pypy3))
865 (with-fluids ((%default-port-encoding "ISO-8859-1"))
866 (substitute* '("lib_pypy/_md5.py"
867 "lib_pypy/_sha1.py")
868 ((shebang-match-python) shebang-pypy3))))
869 (copy-recursively dist-dir #$output)))))))
870 (native-inputs
871 (list gzip
872 nss-certs ; For ssl tests
873 pkg-config
874 python-2
875 python2-pycparser
876 tar)) ; Required for package.py
877 (inputs
878 (list bzip2
879 expat
880 gdbm
881 glibc
882 libffi
883 ncurses
884 openssl
885 sqlite
886 tcl
887 tk
888 xz
889 zlib))
890 (home-page "https://www.pypy.org/")
891 (synopsis "Python implementation with just-in-time compilation")
892 (description "PyPy is a faster, alternative implementation of the Python
893programming language employing a just-in-time compiler. It supports most
894Python code natively, including C extensions.")
895 (license (list license:expat ; pypy itself; _pytest/
896 license:psfl ; python standard library in lib-python/
897 license:asl2.0 ; dotviewer/font/ and some of lib-python/
898 license:gpl3+ ; ./rpython/rlib/rvmprof/src/shared/libbacktrace/dwarf2.*
899 license:bsd-3 ; lib_pypy/cffi/_pycparser/ply/
900 (license:non-copyleft
901 "http://www.unicode.org/copyright.html")))))
902
903(define-public pypy3
904 (deprecated-package "pypy3" pypy))