From 7351f378ef574225c4461e6348ec7ddacdd2eb35 Mon Sep 17 00:00:00 2001 From: "G.Allegri" Date: Mon, 29 Jun 2026 17:20:38 +0200 Subject: [PATCH] Fix dynamic version resolution in pyproject.toml setuptools resolves the dynamic version attr by reading geonode.__version__ directly. That attribute is a tuple (e.g. (5, 1, 0, 'final', 0)); setuptools normalises a non-string attr by joining it with dots, producing an invalid PEP 440 version like '5.1.0.final.0' and breaking the wheel build. Expose a plain string attribute __version_str__ = get_version() in geonode/__init__.py and point the dynamic version at it, so setuptools reads an already-normalised version string (e.g. '5.1.0'). (cherry picked from commit a2dda2e3f76d6804f2f91ab0a02c994b4edca39a) --- geonode/__init__.py | 6 ++++++ pyproject.toml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/geonode/__init__.py b/geonode/__init__.py index a5ad6613ff7..e18c1b7350c 100644 --- a/geonode/__init__.py +++ b/geonode/__init__.py @@ -28,6 +28,12 @@ def get_version(): return geonode.version.get_version(__version__) +# PEP 440 compliant version string, referenced by pyproject.toml's dynamic +# version (a plain string attribute, so setuptools doesn't have to stringify the +# __version__ tuple, which would produce an invalid version like "5.1.0.final.0"). +__version_str__ = get_version() + + def main(_, **settings): from django.core.wsgi import get_wsgi_application diff --git a/pyproject.toml b/pyproject.toml index 7661d2878de..e34b8db2ff9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -191,7 +191,7 @@ exclude = ["tests*"] include = ["geonode*"] [tool.setuptools.dynamic] -version = {attr = "geonode.__version__"} +version = {attr = "geonode.__version_str__"} [tool.black] line-length = 120