summaryrefslogtreecommitdiff
path: root/gnu/packages/python.scm
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2023-01-30 11:33:18 +0200
committerEfraim Flashner <efraim@flashner.co.il>2023-01-30 12:39:40 +0200
commit4cf1acc7f3033b50b0bf19e02c9f522d522d338c (patch)
tree9fd64956ee60304c15387eb394cd649e49f01467 /gnu/packages/python.scm
parentedb8c09addd186d9538d43b12af74d6c7aeea082 (diff)
parent595b53b74e3ef57a1c0c96108ba86d38a170a241 (diff)
Merge remote-tracking branch 'origin/master' into core-updates
Conflicts: doc/guix.texi gnu/local.mk gnu/packages/admin.scm gnu/packages/base.scm gnu/packages/chromium.scm gnu/packages/compression.scm gnu/packages/databases.scm gnu/packages/diffoscope.scm gnu/packages/freedesktop.scm gnu/packages/gnome.scm gnu/packages/gnupg.scm gnu/packages/guile.scm gnu/packages/inkscape.scm gnu/packages/llvm.scm gnu/packages/openldap.scm gnu/packages/pciutils.scm gnu/packages/ruby.scm gnu/packages/samba.scm gnu/packages/sqlite.scm gnu/packages/statistics.scm gnu/packages/syndication.scm gnu/packages/tex.scm gnu/packages/tls.scm gnu/packages/version-control.scm gnu/packages/xml.scm guix/build-system/copy.scm guix/scripts/home.scm
Diffstat (limited to 'gnu/packages/python.scm')
-rw-r--r--gnu/packages/python.scm210
1 files changed, 37 insertions, 173 deletions
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 2b0c6fdb8ca..8ba4c76a3de 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -26,7 +26,7 @@
26;;; Copyright © 2016, 2017 Nikita <nikita@n0.is> 26;;; Copyright © 2016, 2017 Nikita <nikita@n0.is>
27;;; Copyright © 2016 Dylan Jeffers <sapientech@sapientech@openmailbox.org> 27;;; Copyright © 2016 Dylan Jeffers <sapientech@sapientech@openmailbox.org>
28;;; Copyright © 2016 David Craven <david@craven.ch> 28;;; Copyright © 2016 David Craven <david@craven.ch>
29;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Marius Bakke <marius@gnu.org> 29;;; Copyright © 2016-2022 Marius Bakke <marius@gnu.org>
30;;; Copyright © 2016, 2017 Stefan Reichör <stefan@xsteve.at> 30;;; Copyright © 2016, 2017 Stefan Reichör <stefan@xsteve.at>
31;;; Copyright © 2016, 2017 Alex Vong <alexvong1995@gmail.com> 31;;; Copyright © 2016, 2017 Alex Vong <alexvong1995@gmail.com>
32;;; Copyright © 2016, 2017, 2018 Arun Isaac <arunisaac@systemreboot.net> 32;;; Copyright © 2016, 2017, 2018 Arun Isaac <arunisaac@systemreboot.net>
@@ -59,6 +59,8 @@
59;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> 59;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
60;;; Copyright © 2020, 2021 Greg Hogan <code@greghogan.com> 60;;; Copyright © 2020, 2021 Greg Hogan <code@greghogan.com>
61;;; Copyright © 2022 Philip McGrath <philip@philipmcgrath.com> 61;;; Copyright © 2022 Philip McGrath <philip@philipmcgrath.com>
62;;; Copyright © 2022 jgart <jgart@dismail.de>
63;;; Copyright © 2021 Lars-Dominik Braun <lars@6xq.net>
62;;; 64;;;
63;;; This file is part of GNU Guix. 65;;; This file is part of GNU Guix.
64;;; 66;;;
@@ -80,17 +82,14 @@
80 #:use-module (gnu packages) 82 #:use-module (gnu packages)
81 #:use-module (gnu packages base) 83 #:use-module (gnu packages base)
82 #:use-module (gnu packages bash) 84 #:use-module (gnu packages bash)
83 #:use-module (gnu packages certs)
84 #:use-module (gnu packages check) 85 #:use-module (gnu packages check)
85 #:use-module (gnu packages compression) 86 #:use-module (gnu packages compression)
86 #:use-module (gnu packages dbm) 87 #:use-module (gnu packages dbm)
87 #:use-module (gnu packages hurd) 88 #:use-module (gnu packages hurd)
88 #:use-module (gnu packages libffi) 89 #:use-module (gnu packages libffi)
89 #:use-module (gnu packages ncurses)
90 #:use-module (gnu packages pkg-config) 90 #:use-module (gnu packages pkg-config)
91 #:use-module (gnu packages python-xyz) 91 #:use-module (gnu packages python-build)
92 #:use-module (gnu packages readline) 92 #:use-module (gnu packages readline)
93 #:use-module (gnu packages shells)
94 #:use-module (gnu packages sqlite) 93 #:use-module (gnu packages sqlite)
95 #:use-module (gnu packages tcl) 94 #:use-module (gnu packages tcl)
96 #:use-module (gnu packages tls) 95 #:use-module (gnu packages tls)
@@ -679,10 +678,41 @@ and the unversioned commands available.")))
679(define-public python-wrapper (wrap-python3 python)) 678(define-public python-wrapper (wrap-python3 python))
680(define-public python-minimal-wrapper (wrap-python3 python-minimal)) 679(define-public python-minimal-wrapper (wrap-python3 python-minimal))
681 680
681;; The Python used in pyproject-build-system.
682(define-public python-sans-pip
683 (hidden-package
684 (package/inherit python
685 (arguments
686 (substitute-keyword-arguments (package-arguments python)
687 ((#:configure-flags flags #~())
688 #~(append '("--with-ensurepip=no")
689 (delete "--with-ensurepip=install" #$flags))))))))
690
691(define-public python-sans-pip-wrapper
692 (wrap-python3 python-sans-pip))
693
694(define-public python-toolchain
695 (let ((base (package/inherit python-sans-pip-wrapper)))
696 (package
697 (inherit base)
698 (properties '())
699 (name "python-toolchain")
700 (propagated-inputs
701 (modify-inputs (package-propagated-inputs base)
702 (append python-pip
703 python-pypa-build
704 python-setuptools
705 python-wheel)))
706 (synopsis "Python toolchain")
707 (description
708 "Python toolchain including Python itself, setuptools and pip.
709Use this package if you need a minimal Python toolchain instead of just
710the interpreter."))))
711
682(define-public micropython 712(define-public micropython
683 (package 713 (package
684 (name "micropython") 714 (name "micropython")
685 (version "1.18") 715 (version "1.19")
686 (source 716 (source
687 (origin 717 (origin
688 (method url-fetch) 718 (method url-fetch)
@@ -690,7 +720,7 @@ and the unversioned commands available.")))
690 "releases/download/v" version 720 "releases/download/v" version
691 "/micropython-" version ".tar.xz")) 721 "/micropython-" version ".tar.xz"))
692 (sha256 722 (sha256
693 (base32 "1d1yza02pwq3kh8531ryq9sjk7zjqh786nnw397cccfk5ss73z4n")) 723 (base32 "090bbls5vnicynjyjqqd5zqwx8d6zxp7wlnrxgh0b4s8cyf5i8zj"))
694 (modules '((guix build utils))) 724 (modules '((guix build utils)))
695 (snippet 725 (snippet
696 '(begin 726 '(begin
@@ -737,169 +767,3 @@ run within just 256k of code space and 16k of RAM. MicroPython aims to be as
737compatible with normal Python as possible to allow you to transfer code with 767compatible with normal Python as possible to allow you to transfer code with
738ease from the desktop to a microcontroller or embedded system.") 768ease from the desktop to a microcontroller or embedded system.")
739 (license license:expat))) 769 (license license:expat)))
740
741(define-public pypy
742 (package
743 (name "pypy")
744 (version "7.3.5")
745 (source (origin
746 (method url-fetch)
747 (uri (string-append "https://downloads.python.org/pypy/"
748 "pypy3.7-v" version "-src.tar.bz2"))
749 (sha256
750 (base32
751 "18lrdmpcczlbk3cfarkgwqdmilrybz56i1dafk8dkjlyk90gw86r"))))
752 (build-system gnu-build-system)
753 (arguments
754 (list
755 #:tests? #f ;FIXME: 43 out of 364 tests are failing
756 #:modules '((ice-9 ftw) (ice-9 match)
757 (guix build utils) (guix build gnu-build-system))
758 #:disallowed-references (list nss-certs)
759 #:phases
760 #~(modify-phases %standard-phases
761 (delete 'configure)
762 (add-after 'unpack 'patch-source
763 (lambda* (#:key inputs #:allow-other-keys)
764 (substitute* '("rpython/rlib/clibffi.py")
765 ;; find_library does not work for libc
766 (("ctypes\\.util\\.find_library\\('c'\\)") "'libc.so'"))
767 (substitute* '("lib_pypy/cffi/_pycparser/ply/cpp.py")
768 ;; Make reproducible (XXX: unused?)
769 (("time\\.localtime\\(\\)") "time.gmtime(0)"))
770 (substitute* '("pypy/module/sys/version.py")
771 ;; Make reproducible
772 (("t\\.gmtime\\(\\)") "t.gmtime(0)"))
773 (substitute* '("lib_pypy/_tkinter/tklib_build.py")
774 ;; Link to versioned libtcl and libtk
775 (("linklibs = \\['tcl', 'tk'\\]")
776 "linklibs = ['tcl8.6', 'tk8.6']")
777 (("incdirs = \\[\\]")
778 (string-append
779 "incdirs = ['"
780 #$(this-package-input "tcl") "/include', '"
781 #$(this-package-input "tk") "/include']")))
782 (substitute* '("lib_pypy/_curses_build.py")
783 ;; Find curses
784 (("/usr/local")
785 #$(this-package-input "ncurses")))
786 (substitute* '("lib_pypy/_dbm.py")
787 ;; Use gdbm compat library, so we don’t need to pull
788 ;; in bdb.
789 (("ctypes.util.find_library\\('db'\\)")
790 (format #f "~s" (search-input-file
791 inputs "lib/libgdbm_compat.so"))))
792 (substitute* '("lib_pypy/_sqlite3_build.py")
793 ;; Always use search paths
794 (("sys\\.platform\\.startswith\\('freebsd'\\)") "True")
795 ;; Find sqlite3
796 (("/usr/local") (assoc-ref inputs "sqlite"))
797 (("libname = 'sqlite3'")
798 (format #f "libname = ~s"
799 (search-input-file inputs "lib/libsqlite3.so.0"))))
800 (substitute* '("lib-python/3/subprocess.py")
801 ;; Fix shell path
802 (("/bin/sh")
803 (search-input-file inputs "/bin/sh")))
804 (substitute* '("lib-python/3/distutils/unixccompiler.py")
805 ;; gcc-toolchain does not provide symlink cc -> gcc
806 (("\"cc\"") "\"gcc\""))))
807 (add-after 'unpack 'set-source-file-times-to-1980
808 ;; copied from python package, required by zip testcase
809 (lambda _
810 (let ((circa-1980 (* 10 366 24 60 60)))
811 (ftw "." (lambda (file stat flag)
812 (utime file circa-1980 circa-1980)
813 #t)))))
814 (replace 'build
815 (lambda _
816 (with-directory-excursion "pypy/goal"
817 ;; Build with jit optimization.
818 (invoke "python2"
819 "../../rpython/bin/rpython"
820 (string-append "--make-jobs="
821 (number->string (parallel-job-count)))
822 "-Ojit"
823 "targetpypystandalone"
824 "--allworkingmodules"))
825 ;; Build c modules and package everything, so tests work.
826 (with-directory-excursion "pypy/tool/release"
827 (invoke "python2" "package.py"
828 "--archive-name" "pypy-dist"
829 "--builddir" (getcwd)))))
830 (replace 'check
831 (lambda* (#:key tests? #:allow-other-keys)
832 (if tests?
833 (begin
834 (setenv "HOME" "/tmp") ; test_with_pip tries to
835 ; access ~/.cache/pip
836 ;; Run library tests only (no interpreter unit tests).
837 ;; This is what Gentoo does.
838 (invoke "python" "pypy/test_all.py"
839 "--pypy=pypy/tool/release/pypy-dist/bin/pypy3"
840 "lib-python"))
841 (format #t "test suite not run~%"))))
842 (replace 'install
843 (lambda* (#:key inputs outputs #:allow-other-keys)
844 (let* ((bin-pypy3 (string-append #$output "/bin/pypy3"))
845 (shebang-match-python "#!.+/bin/python")
846 (shebang-pypy3 (string-append "#!" bin-pypy3))
847 (dist-dir "pypy/tool/release/pypy-dist"))
848 (with-directory-excursion dist-dir
849 ;; Delete test data.
850 (for-each
851 (lambda (x)
852 (delete-file-recursively (string-append
853 "lib-python/3/" x)))
854 '("tkinter/test"
855 "test"
856 "sqlite3/test"
857 "lib2to3/tests"
858 "idlelib/idle_test"
859 "distutils/tests"
860 "ctypes/test"
861 "unittest/test"))
862 ;; Patch shebang referencing python.
863 (substitute* '("lib-python/3/cgi.py"
864 "lib-python/3/encodings/rot_13.py")
865 ((shebang-match-python) shebang-pypy3))
866 (with-fluids ((%default-port-encoding "ISO-8859-1"))
867 (substitute* '("lib_pypy/_md5.py"
868 "lib_pypy/_sha1.py")
869 ((shebang-match-python) shebang-pypy3))))
870 (copy-recursively dist-dir #$output)))))))
871 (native-inputs
872 (list gzip
873 nss-certs ; For ssl tests
874 pkg-config
875 python-2
876 python2-pycparser
877 tar)) ; Required for package.py
878 (inputs
879 (list bzip2
880 expat
881 gdbm
882 glibc
883 libffi
884 ncurses
885 openssl
886 sqlite
887 tcl
888 tk
889 xz
890 zlib))
891 (home-page "https://www.pypy.org/")
892 (synopsis "Python implementation with just-in-time compilation")
893 (description "PyPy is a faster, alternative implementation of the Python
894programming language employing a just-in-time compiler. It supports most
895Python code natively, including C extensions.")
896 (license (list license:expat ; pypy itself; _pytest/
897 license:psfl ; python standard library in lib-python/
898 license:asl2.0 ; dotviewer/font/ and some of lib-python/
899 license:gpl3+ ; ./rpython/rlib/rvmprof/src/shared/libbacktrace/dwarf2.*
900 license:bsd-3 ; lib_pypy/cffi/_pycparser/ply/
901 (license:non-copyleft
902 "http://www.unicode.org/copyright.html")))))
903
904(define-public pypy3
905 (deprecated-package "pypy3" pypy))