Skip to content

Commit a2dda2e

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').
1 parent 51d19cc commit a2dda2e

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
@@ -189,7 +189,7 @@ exclude = ["tests*"]
189189
include = ["geonode*"]
190190

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

194194
[tool.black]
195195
line-length = 120

0 commit comments

Comments
 (0)