guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

06/08: gnu: python-versioneer: Add support for Guix build directories.


From: guix-commits
Subject: 06/08: gnu: python-versioneer: Add support for Guix build directories.
Date: Mon, 13 Dec 2021 17:33:56 -0500 (EST)

mbakke pushed a commit to branch master
in repository guix.

commit 99e0c4bc74670f9c25567781a3b243e6145f9406
Author: Marius Bakke <marius@gnu.org>
AuthorDate: Mon Dec 13 19:19:52 2021 +0100

    gnu: python-versioneer: Add support for Guix build directories.
    
    * gnu/packages/patches/python-versioneer-guix-support.patch: New file.
    * gnu/local.mk (dist_patch_DATA): Adjust accordingly.
    * gnu/packages/python-xyz.scm (python-versioneer)[source](patches): New 
field.
---
 gnu/local.mk                                       |  1 +
 .../patches/python-versioneer-guix-support.patch   | 35 ++++++++++++++++++++++
 gnu/packages/python-xyz.scm                        |  3 +-
 3 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 7e1cedf..56ae2c3 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1691,6 +1691,7 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/python2-subprocess32-disable-input-test.patch   \
   %D%/packages/patches/python-unittest2-python3-compat.patch   \
   %D%/packages/patches/python-unittest2-remove-argparse.patch  \
+  %D%/packages/patches/python-versioneer-guix-support.patch    \
   %D%/packages/patches/python-waitress-fix-tests.patch         \
   %D%/packages/patches/python-werkzeug-tests.patch             \
   %D%/packages/patches/qemu-build-info-manual.patch            \
diff --git a/gnu/packages/patches/python-versioneer-guix-support.patch 
b/gnu/packages/patches/python-versioneer-guix-support.patch
new file mode 100644
index 0000000..336020b
--- /dev/null
+++ b/gnu/packages/patches/python-versioneer-guix-support.patch
@@ -0,0 +1,35 @@
+Versioneer does not work in the Guix build container because:
+
+* VCS information is unavailable
+* the build directory does not have the supported "$name-$version" format
+* as of 0.21, versioneer has no way to override the discovered values
+
+This patch adds support for extracting version from the
+'/tmp/guix-build-foo-0.1.drv-0' style directories created by the daemon.
+
+diff --git a/src/from_parentdir.py b/src/from_parentdir.py
+index 69ada9a..e0fac8f 100644
+--- a/src/from_parentdir.py
++++ b/src/from_parentdir.py
+@@ -15,6 +15,21 @@ def versions_from_parentdir(parentdir_prefix, root, 
verbose):
+             return {"version": dirname[len(parentdir_prefix):],
+                     "full-revisionid": None,
+                     "dirty": False, "error": None, "date": None}
++        # Guix specific patch: try extracting the version from the build
++        # directory.
++        elif dirname.startswith("guix-build-"):
++            delimiter = dirname.rindex(".drv-")
++            name_and_version = dirname[11:delimiter]
++            if name_and_version.startswith(parentdir_prefix):
++                guix_version = name_and_version[len(parentdir_prefix):]
++            elif 
name_and_version.startswith("python-{}".format(parentdir_prefix)):
++                guix_version = name_and_version[(7 + len(parentdir_prefix)):]
++            else:
++                break
++            return {"version": guix_version,
++                    "full-revisionid": None,
++                    "dirty": False, "error": None, "date": None}
++
+         rootdirs.append(root)
+         root = os.path.dirname(root)  # up a level
+ 
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index c364c14..72c2809 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -26014,7 +26014,8 @@ applications with variable CPU loads).")
        (uri (pypi-uri "versioneer" version))
        (sha256
         (base32
-         "084fglxafbzvf1vbkzfajvs9qwnvjwwn8pxql9nrlpyipv5xpwk4"))))
+         "084fglxafbzvf1vbkzfajvs9qwnvjwwn8pxql9nrlpyipv5xpwk4"))
+       (patches (search-patches "python-versioneer-guix-support.patch"))))
     (build-system python-build-system)
     (home-page
      "https://github.com/python-versioneer/python-versioneer";)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]