Skip to content

Commit ed36af4

Browse files
committed
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 a2dda2e)
1 parent 166345e commit ed36af4

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

geonode/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ def get_version():
2828
return geonode.version.get_version(__version__)
2929

3030

31+
# PEP 440 compliant version string, referenced by pyproject.toml's dynamic
32+
# version (a plain string attribute, so setuptools doesn't have to stringify the
33+
# __version__ tuple, which would produce an invalid version like "5.1.0.final.0").
34+
__version_str__ = get_version()
35+
36+
3137
def main(_, **settings):
3238
from django.core.wsgi import get_wsgi_application
3339

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ exclude = ["tests*"]
191191
include = ["geonode*"]
192192

193193
[tool.setuptools.dynamic]
194-
version = {attr = "geonode.__version__"}
194+
version = {attr = "geonode.__version_str__"}
195195

196196
[tool.black]
197197
line-length = 120

0 commit comments

Comments
 (0)