diff mbox series

[bug#51963,1/4] gnu: python-pendulum: Add setup.py to fix build.

Message ID PU1PR01MB2155F73AEE9B507D30E40C9E8D9C9@PU1PR01MB2155.apcprd01.prod.exchangelabs.com
State Accepted
Headers show
Series gnu: Add pgcli. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Foo Chuan Wei Nov. 19, 2021, 5:58 a.m. UTC
* gnu/packages/time.scm (python-pendulum)[arguments]: Add setup.py
  to fix build.
---
 gnu/packages/time.scm | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/gnu/packages/time.scm b/gnu/packages/time.scm
index b60fab5db5..7585a665d3 100644
--- a/gnu/packages/time.scm
+++ b/gnu/packages/time.scm
@@ -155,9 +155,29 @@  saving time.  Almost all of the Olson timezones are supported.")
        (sha256
         (base32 "01zjc245w08j0xryrgrq9vng59q1cl5ry0hcpw5rj774pyhhqsmh"))))
     (build-system python-build-system)
-    ;; XXX: The PyPI distribution lacks tests, and the upstream repository
-    ;; lacks a setup.py!
-    (arguments '(#:tests? #f))
+    (arguments `(#:phases
+                 (modify-phases %standard-phases
+                   ;; Add setup.py to fix the build. Otherwise, the build will
+                   ;; fail with "no setup.py found".
+                   ;;
+                   ;; Upstream uses Poetry to build python-pendulum, including
+                   ;; parts written in C. Here, we simply add a setup.py file
+                   ;; and do not build the parts written in C. This is possible
+                   ;; because python-pendulum falls back on pure Python code
+                   ;; when the C parts are not available (reference: build.py).
+                   (add-after 'unpack 'add-setup.py
+                     (lambda _
+                       (call-with-output-file "setup.py"
+                         (lambda (port)
+                           (format port
+                                   "from setuptools import find_packages, setup
+setup(name='pendulum',
+      version='~a',
+      packages=find_packages())
+"
+                                   ,version))))))
+                 ;; XXX: The PyPI distribution lacks tests.
+                 #:tests? #f))
     (propagated-inputs
      `(("python-dateutil" ,python-dateutil)
        ("python-pytzdata" ,python-pytzdata)))