guix_mirror_bot pushed a commit to branch python-team
in repository guix.

commit 6196f6c97fcca8b29bf27e86e848e7f3fc67060e
Author: Nguyễn Gia Phong <[email protected]>
AuthorDate: Mon Feb 23 00:32:26 2026 +0900

    gnu: python-versioneer: Adjust patch.
    
    * gnu/packages/patches/python-versioneer-guix-support.patch:
      Extract version from the environment variable
      instead of the parent directory name.
    
    Change-Id: Ide050eeb8fbb82c29805fce74d891d62b7e707cb
    Reviewed-by: Nicolas Graves <[email protected]>
    Signed-off-by: Sharlatan Hellseher <[email protected]>
---
 .../patches/python-versioneer-guix-support.patch   | 38 ++++++++--------------
 1 file changed, 13 insertions(+), 25 deletions(-)

diff --git a/gnu/packages/patches/python-versioneer-guix-support.patch 
b/gnu/packages/patches/python-versioneer-guix-support.patch
index 336020bc5e..ade5442d15 100644
--- a/gnu/packages/patches/python-versioneer-guix-support.patch
+++ b/gnu/packages/patches/python-versioneer-guix-support.patch
@@ -5,31 +5,19 @@ Versioneer does not work in the Guix build container because:
 * 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.
+GUIX_VERSIONEER_VERSION environment variable set by the set-version
+phase of the pyproject build system.
 
-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}
+--- a/src/get_versions.py
++++ b/src/get_versions.py
+@@ -19,6 +19,10 @@
+         # see the discussion in cmdclass.py:get_cmdclass()
+         del sys.modules["versioneer"]
+ 
++    ver = {"version": os.getenv("GUIX_VERSIONEER_VERSION")}
++    if ver["version"] is not None:
++        return ver
 +
-         rootdirs.append(root)
-         root = os.path.dirname(root)  # up a level
+     root = get_root()
+     cfg = get_config_from_root(root)
  

Reply via email to