Subject: [PATCH v2 1/2] gnu: python-filelock: Update to 3.8.0.

From: Tanguy Le Carrour <[email-masked]>
Date: Wed, 26 Oct 2022 15:44:34 +0200

Hi Guix,

This was less trivial than what I expected, indeed.
I'm adding python-virtualenv to the patch set as it now builds.

Unfortunately, I couldn't make it up to Poetry, because, for
unknown reasons (to me), building poetry with updated python-filelock
and python-virtualenv triggers a **LOT** of rebuilds! I `Ctrl+c` the
process when it started building things related to wayland and to
modem-manager!? If someone was kind enough to tell me why, it would be
very much appreciated!

Thanks

* gnu/packages/python-xyz.scm (python-filelock): Update to 3.8.0.
[arguments]<#:phases>: Build the package PyPA's style.
[native-inputs]: Add python-pypa-build, python-setuptools,
python-setuptools-scm.
---
 gnu/packages/python-xyz.scm | 36 ++++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 08a33061a9..655d4501b0 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -1978,15 +1978,47 @@ (define-public python-fb-re2
 (define-public python-filelock
   (package
     (name "python-filelock")
-    (version "3.0.12")
+    (version "3.8.0")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "filelock" version))
        (sha256
         (base32
-         "0ngzlvb5j8gqs2nxlp2b0jhzii792h66wsn694qm8kqixr225n0q"))))
+         "1p2f1il288abcrjx002w25dzl9jd1392cfminv2rh8bgcsm7qi2m"))))
     (build-system python-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+                  (add-after 'unpack 'compatibility-fixes
+                    (lambda _
+                      ;; We have an outdated version of setuptools-scm
+                      (substitute* "pyproject.toml" (("7.0.5") "6.3.2"))))
+                  (replace 'build
+                    (lambda _
+                      (setenv "SETUPTOOLS_SCM_PRETEND_VERSION" #$version)
+                      ;; ZIP does not support timestamps before 1980.
+                      (setenv "SOURCE_DATE_EPOCH" "315532800")
+                      (invoke "python"
+                              "-m"
+                              "build"
+                              "--wheel"
+                              "--no-isolation"
+                              ".")))
+                  (replace 'install
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let* ((whl (car (find-files "dist" "\\.whl$"))))
+                        (invoke "pip"
+                                "--no-cache-dir"
+                                "--no-input"
+                                "install"
+                                "--no-deps"
+                                "--prefix"
+                               #$output
+                                whl))))
+                  (delete 'check))))  ; pytest causes a circular dependency (?)
+    (native-inputs (list python-pypa-build python-setuptools python-setuptools-scm))
     (home-page
      "https://github.com/benediktschmitt/py-filelock")
     (synopsis "Platform independent file lock")
-- 
2.38.0