summary refs log tree commit diff
path: root/gnu/packages
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2021-12-20 14:51:53 -0500
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-01-10 11:44:41 -0500
commit5b218cc14ad85c83ef0279f435f296125a033bdd (patch)
treef27b7ec55cf8b967107924ecea3b031db40b4a5f /gnu/packages
parent3307224bf918ec59939045c68a7dc80483ca682e (diff)
downloadguix-5b218cc14ad85c83ef0279f435f296125a033bdd.tar.gz
gnu: python-flit: Update to 3.5.1, enable tests and apply guix style.
* gnu/packages/python-xyz.scm (python-flit)[origin]: Fetch from pypi-uri, to
ease updating the package.
[phases]{bootstrap}: Delete phase.
{build, install}: Do a PEP 517 build using pypa-build.
{check}: New phase.
[tests?]: Enable.
[propagated-inputs]{python-pytoml, python-toml}: Remove.
{python-pypa-build, python-tomli-w, python-flit-core, python-requests}: New
inputs.
{python-docutils}: New input, moved from...
[native-inputs]: ... here.  Apply guix style.
{python-testpath}: Use the regular python-testpath package.
[synopsis, description]: Re-indent.
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/python-xyz.scm122
1 files changed, 41 insertions, 81 deletions
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 0a85ba2a14..4bb9046394 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -23937,92 +23937,52 @@ the syntactic logic to configure and launch jobs in an execution environment.")
 (define-public python-flit
   (package
     (name "python-flit")
-    (version "3.3.0")
-    ;; We fetch the sources via git because on pypi the package is split into
-    ;; two parts: flit and flit_core; flit_core cannot be built without flit.
-    (source (origin
-              (method git-fetch)
-              (uri (git-reference
-                    (url "https://github.com/takluyver/flit")
-                    (commit version)))
-              (file-name (git-file-name name version))
-              (sha256
-               (base32
-                "0mvyymw3zqsnip4x4ca6anr5rbx30hcmpqwrnhjwcm7s8mycd01x"))))
+    (version "3.5.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "flit" version))
+       (sha256
+        (base32 "04152qj46sqbnlrj7ch9p7svjrrlpzbk0qr39g2yr0s4f5vp6frf"))))
     (build-system python-build-system)
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-before 'build 'bootstrap
-           (lambda* (#:key inputs #:allow-other-keys)
-             (let ((home (string-append (getcwd) "/home")))
-               (mkdir-p home)
-               (setenv "HOME" home))
-             (for-each make-file-writable (find-files "."))
-             (copy-recursively (assoc-ref inputs "python-testpath")
-                               (string-append (getcwd) "/testpath"))
-             (substitute* "pyproject.toml"
-               (("\"testpath\",") ""))
-             (invoke "python" "bootstrap_dev.py")))
-         (replace 'build
-           (lambda _
-             ;; A ZIP archive should be generated, but it fails with "ZIP does
-             ;; not support timestamps before 1980".  Luckily,
-             ;; SOURCE_DATE_EPOCH is respected, which we set to some time in
-             ;; 1980.
-             (setenv "SOURCE_DATE_EPOCH" "315532800")
-             (for-each (lambda (toml)
-                         (invoke "python3" "-m" "flit"
-                                 "--debug" "--ini-file" toml
-                                 "build"))
-                       '("testpath/pyproject.toml"
-                         "pyproject.toml"))
-             (with-directory-excursion "flit_core"
-               (invoke "python" "build_dists.py"))))
-         (replace 'install
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             (add-installed-pythonpath inputs outputs)
-             (let ((out (assoc-ref outputs "out")))
-               (delete-file-recursively "./home")
-               (for-each (lambda (wheel)
-                           (format #true wheel)
-                           (invoke "python" "-m" "pip" "install"
-                                   wheel (string-append "--prefix=" out)))
-                         (append
-                          (find-files "flit_core/dist" "\\.whl$")
-                          (find-files "dist" "\\.whl$")))))))
-       #:tests? #f)) ; XXX: Check requires network access.
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          ;; XXX: PEP 517 manual build copied from python-isort.
+          (replace 'build
+            (lambda _
+              (invoke "python" "-m" "build" "--wheel" "--no-isolation" ".")))
+          (replace 'check
+            (lambda* (#:key tests? inputs outputs #:allow-other-keys)
+              (when tests?
+                (setenv "HOME" "/tmp")
+                (setenv "FLIT_NO_NETWORK" "1"))))
+          (replace 'install
+            (lambda _
+              (let ((whl (car (find-files "dist" "\\.whl$"))))
+                (invoke "pip" "--no-cache-dir" "--no-input"
+                        "install" "--no-deps" "--prefix" #$output whl)))))))
     (propagated-inputs
-     (list python-pytoml python-toml))
+     (list python-pypa-build
+           python-tomli-w
+           python-flit-core
+           python-docutils
+           python-requests))
     (native-inputs
-     `(("python-docutils" ,python-docutils)
-       ("python-responses" ,python-responses)
-       ("python-pygments-github-lexers" ,python-pygments-github-lexers)
-       ("python-pytest" ,python-pytest)
-       ("python-pytest-cov" ,python-pytest-cov)
-       ("python-sphinx" ,python-sphinx)
-       ("python-sphinxcontrib-github-alt" ,python-sphinxcontrib-github-alt)
-       ;; This package needs testpath, but testpath also needs flit...
-       ("python-testpath"
-        ,(let ((name "python-testpath")
-               (version "0.4.4"))
-           (origin
-             (method git-fetch)
-             (uri (git-reference
-                   (url "https://github.com/jupyter/testpath")
-                   (commit version)))
-             (file-name (git-file-name name version))
-             (sha256
-              (base32
-               "1fwv4d3p54xx1x942s104irr35lszvv6jnr4nn1scsfvc0m1qmbk")))))))
+     (list python-responses
+           python-pygments-github-lexers
+           python-pytest
+           python-pytest-cov
+           python-sphinx
+           python-sphinxcontrib-github-alt
+           python-testpath))
     (home-page "https://flit.readthedocs.io/")
-    (synopsis
-     "Simple packaging tool for simple packages")
-    (description
-     "Flit is a simple way to put Python packages and modules on PyPI.  Flit
-packages a single importable module or package at a time, using the import
-name as the name on PyPI.  All subpackages and data files within a package
-are included automatically.")
+    (synopsis "Simple packaging tool for simple packages")
+    (description "Flit is a simple way to put Python packages and modules on
+PyPI.  Flit packages a single importable module or package at a time, using
+the import name as the name on PyPI.  All subpackages and data files within a
+package are included automatically.")
     (license license:bsd-3)))
 
 (define-public python-pathtools