aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/python.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/python.scm')
-rw-r--r--gnu/packages/python.scm166
1 files changed, 145 insertions, 21 deletions
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index e2e74d773f..080552573d 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -30,7 +30,7 @@
;;; Copyright © 2016, 2017 Stefan Reichör <stefan@xsteve.at>
;;; Copyright © 2016 Dylan Jeffers <sapientech@sapientech@openmailbox.org>
;;; Copyright © 2016, 2017 Alex Vong <alexvong1995@gmail.com>
-;;; Copyright © 2016, 2017 Arun Isaac <arunisaac@systemreboot.net>
+;;; Copyright © 2016, 2017, 2018 Arun Isaac <arunisaac@systemreboot.net>
;;; Copyright © 2016, 2017 Julien Lepiller <julien@lepiller.eu>
;;; Copyright © 2016, 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2016, 2017 Thomas Danckaert <post@thomasdanckaert.be>
@@ -141,7 +141,7 @@
(define-public python-2.7
(package
- (name "python")
+ (name "python2")
(version "2.7.14")
(source
(origin
@@ -341,7 +341,8 @@ data types.")
(define-public python-3.6
(package (inherit python-2)
- (version "3.6.3")
+ (name "python")
+ (version "3.6.5")
(source (origin
(method url-fetch)
(uri (string-append "https://www.python.org/ftp/python/"
@@ -354,7 +355,7 @@ data types.")
(patch-flags '("-p0"))
(sha256
(base32
- "1nl1raaagr4car787a2hmjv2dw6gqny53xfd6wisbgx4r5kxk9yd"))
+ "19l7inxm056jjw33zz97z0m02hsi7jnnx5kyb76abj5ml4xhad7l"))
(snippet
'(begin
(for-each delete-file
@@ -362,8 +363,75 @@ data types.")
"Lib/ctypes/test/test_win32.py" ; fails on aarch64
"Lib/test/test_fcntl.py")) ; fails on aarch64
#t))))
- (arguments (substitute-keyword-arguments (package-arguments python-2)
- ((#:tests? _) #t)))
+ (arguments
+ (substitute-keyword-arguments (package-arguments python-2)
+ ((#:tests? _) #t)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'unpack 'patch-timestamp-for-pyc-files
+ (lambda _
+ ;; We set DETERMINISTIC_BUILD to only override the mtime when
+ ;; building with Guix, lest we break auto-compilation in
+ ;; environments.
+ (setenv "DETERMINISTIC_BUILD" "1")
+ (substitute* "Lib/py_compile.py"
+ (("source_stats\\['mtime'\\]")
+ "(1 if 'DETERMINISTIC_BUILD' in os.environ else source_stats['mtime'])"))
+
+ ;; Use deterministic hashes for strings, bytes, and datetime
+ ;; objects.
+ (setenv "PYTHONHASHSEED" "0")
+
+ ;; Reset mtime when validating bytecode header.
+ (substitute* "Lib/importlib/_bootstrap_external.py"
+ (("source_mtime = int\\(source_stats\\['mtime'\\]\\)")
+ "source_mtime = 1"))
+ #t))
+ ;; These tests fail because of our change to the bytecode
+ ;; validation. They fail because expected exceptions do not get
+ ;; thrown. This seems to be no problem.
+ (add-after 'unpack 'disable-broken-bytecode-tests
+ (lambda _
+ (substitute* "Lib/test/test_importlib/source/test_file_loader.py"
+ (("test_bad_marshal")
+ "disable_test_bad_marshal")
+ (("test_no_marshal")
+ "disable_test_no_marshal")
+ (("test_non_code_marshal")
+ "disable_test_non_code_marshal"))
+ #t))
+ ;; Unset DETERMINISTIC_BUILD to allow for tests that check that
+ ;; stale pyc files are rebuilt.
+ (add-before 'check 'allow-non-deterministic-compilation
+ (lambda _ (unsetenv "DETERMINISTIC_BUILD") #t))
+ ;; We need to rebuild all pyc files for three different
+ ;; optimization levels to replace all files that were not built
+ ;; deterministically.
+
+ ;; FIXME: Without this phase we have close to 2000 files that
+ ;; differ across different builds of this package. With this phase
+ ;; there are about 500 files left that differ.
+ (add-after 'install 'rebuild-bytecode
+ (lambda* (#:key outputs #:allow-other-keys)
+ (setenv "DETERMINISTIC_BUILD" "1")
+ (let ((out (assoc-ref outputs "out")))
+ (for-each
+ (lambda (opt)
+ (format #t "Compiling with optimization level: ~a\n"
+ (if (null? opt) "none" (car opt)))
+ (for-each (lambda (file)
+ (apply invoke
+ `(,(string-append out "/bin/python3")
+ ,@opt
+ "-m" "compileall"
+ "-f" ; force rebuild
+ ;; Don't build lib2to3, because it's Python 2 code.
+ ;; Also don't build obviously broken test code.
+ "-x" "(lib2to3|test/bad.*)"
+ ,file)))
+ (find-files out "\\.py$")))
+ (list '() '("-O") '("-OO")))
+ #t)))))))
(native-search-paths
(list (search-path-specification
(variable "PYTHONPATH")
@@ -382,7 +450,7 @@ data types.")
(define-public python2-minimal
(package (inherit python-2)
- (name "python-minimal")
+ (name "python2-minimal")
(outputs '("out"))
;; Keep zlib, which is used by 'pip' (via the 'zipimport' module), which
@@ -1074,7 +1142,7 @@ from the Python interpreter, or as a small part of a larger application.")
(modify-phases %standard-phases
(replace 'check
(lambda _
- (zero? (system* "py.test" "-v")))))))
+ (invoke "py.test" "-v"))))))
(native-inputs
`(("python-py" ,python-py)
("python-pytest" ,python-pytest-bootstrap)))
@@ -1091,6 +1159,16 @@ Python file, so it can be easily copied into your project.")
(define-public python2-six
(package-with-python2 python-six))
+(define-public python-six-bootstrap
+ (package
+ (inherit python-six)
+ (name "python-six-bootstrap")
+ (native-inputs `())
+ (arguments `(#:tests? #f))))
+
+(define-public python2-six-bootstrap
+ (package-with-python2 python-six-bootstrap))
+
(define-public python-schedule
(package
(name "python-schedule")
@@ -1645,6 +1723,15 @@ matching them against a list of media-ranges.")
"Backport of @code{funcsigs} which was introduced in Python 3.3.")
(license license:asl2.0)))
+(define-public python2-funcsigs-bootstrap
+ (package
+ (inherit python2-funcsigs)
+ (name "python2-funcsigs-bootstrap")
+ (native-inputs `())
+ (arguments
+ `(#:tests? #f
+ ,@(package-arguments python2-funcsigs)))))
+
(define-public python-pafy
(package
(name "python-pafy")
@@ -1672,14 +1759,14 @@ matching them against a list of media-ranges.")
(define-public python-py
(package
(name "python-py")
- (version "1.4.34")
+ (version "1.5.3")
(source
(origin
(method url-fetch)
(uri (pypi-uri "py" version))
(sha256
(base32
- "1qyd5z0hv8ymxy84v5vig3vps2fvhcf4bdlksb3r03h549fmhb8g"))))
+ "10gq2lckvgwlk9w6yzijhzkarx44hsaknd0ypa08wlnpjnsgmj99"))))
(build-system python-build-system)
(arguments
;; FIXME: "ImportError: 'test' module incorrectly imported from
@@ -1687,7 +1774,7 @@ matching them against a list of media-ranges.")
;; Expected '/tmp/guix-build-python-py-1.4.31.drv-0/py-1.4.31/py'.
;; Is this module globally installed?"
'(#:tests? #f))
- (home-page "http://pylib.readthedocs.org/")
+ (home-page "http://pylib.readthedocs.io/")
(synopsis "Python library for parsing, I/O, instrospection, and logging")
(description
"Py is a Python library for file name parsing, .ini file parsing, I/O,
@@ -3262,7 +3349,8 @@ that client code uses to construct the grammar directly in Python code.")
;; input since it would create a circular dependency: Extend the
;; test for Python 3, where it is already dropped, to Python 2.
(substitute* "numpydoc/tests/test_plot_directive.py"
- (("3") "2"))))))
+ (("3") "2"))
+ #t))))
(build-system python-build-system)
(propagated-inputs
`(("python-sphinx" ,python-sphinx)))
@@ -5349,13 +5437,14 @@ so it might be a tiny bit slower.")
(modify-phases %standard-phases
(replace 'build
(lambda _
- (zero? (system* "python" "waf-light" "configure" "build"))))
+ (invoke "python" "waf-light" "configure" "build")))
(replace 'check
(lambda _
- (zero? (system* "python" "waf" "--version"))))
+ (invoke "python" "waf" "--version")))
(replace 'install
(lambda _
- (copy-file "waf" %output))))))
+ (copy-file "waf" %output)
+ #t)))))
(home-page "https://waf.io/")
(synopsis "Python-based build system")
(description
@@ -6162,14 +6251,14 @@ designed to efficiently cope with extremely large amounts of data.")
(define-public python-pyasn1
(package
(name "python-pyasn1")
- (version "0.2.3")
+ (version "0.4.2")
(source
(origin
(method url-fetch)
(uri (pypi-uri "pyasn1" version))
(sha256
(base32
- "1b86yx23c1x74clai05a5ma8c8nfmhlx3j1mxq0ff657i2ylx33k"))))
+ "05bxnr4wmrg62m4qr1pg1p3z7bhwrv74jll3k42pgxwl36kv0n6j"))))
(build-system python-build-system)
(home-page "http://pyasn1.sourceforge.net/")
(synopsis "ASN.1 types and codecs")
@@ -7529,14 +7618,14 @@ library as well as on the command line.")
(define-public python-pluggy
(package
(name "python-pluggy")
- (version "0.3.1")
+ (version "0.6.0")
(source
(origin
(method url-fetch)
(uri (pypi-uri "pluggy" version))
(sha256
(base32
- "18qfzfm40bgx672lkg8q9x5hdh76n7vax99aank7vh2nw21wg70m"))))
+ "1zqckndfn85l1cd8pndw212zg1bq9fkg1nnj32kp2mppppsyg2kz"))))
(build-system python-build-system)
(synopsis "Plugin and hook calling mechanism for Python")
(description "Pluggy is an extraction of the plugin manager as used by
@@ -10729,13 +10818,13 @@ and bit flag values.")
(define-public python-attrs
(package
(name "python-attrs")
- (version "17.2.0")
+ (version "17.4.0")
(source (origin
(method url-fetch)
(uri (pypi-uri "attrs" version))
(sha256
(base32
- "04gx08ikpk26wnq22f7l42gapcvk8iz1512r927k6sadz6cinkax"))))
+ "1jafnn1kzd6qhxgprhx6y6ik1r5m2rilx25syzcmq03azp660y8w"))))
(build-system python-build-system)
(native-inputs
`(("python-pytest" ,python-pytest)
@@ -10752,6 +10841,16 @@ protocols.")
(define-public python2-attrs
(package-with-python2 python-attrs))
+(define-public python-attrs-bootstrap
+ (package
+ (inherit python-attrs)
+ (name "python-attrs-bootstrap")
+ (native-inputs `())
+ (arguments `(#:tests? #f))))
+
+(define-public python2-attrs-bootstrap
+ (package-with-python2 python-attrs-bootstrap))
+
(define-public python2-cliapp
(package
(name "python2-cliapp")
@@ -13126,6 +13225,31 @@ file system events on Linux.")
"0svc9nla3b9145d6b7fb9dizx412l3difzqw0ilh9lz52nsixw8j"))
(file-name (string-append name "-" version ".tar.gz"))))))
+(define-public python-more-itertools
+ (package
+ (name "python-more-itertools")
+ (version "4.1.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "more-itertools" version))
+ (sha256
+ (base32
+ "0i3ch700g5fyjp692gprlnzbysl8w0sa2vijbp3s40drvk67xkn9"))))
+ (build-system python-build-system)
+ (propagated-inputs
+ `(("python-six" ,python-six-bootstrap)))
+ (home-page "https://github.com/erikrose/more-itertools")
+ (synopsis "More routines for operating on iterables, beyond itertools")
+ (description "Python's built-in @code{itertools} module implements a
+number of iterator building blocks inspired by constructs from APL, Haskell,
+and SML. @code{more-itertools} includes additional building blocks for
+working with iterables.")
+ (license license:expat)))
+
+(define-public python2-more-itertools
+ (package-with-python2 python-more-itertools))
+
(define-public python-latexcodec
(package
(name "python-latexcodec")