Avoid depending on a newer setuptool version
authorCesar Strauss <cestrauss@gmail.com>
Wed, 17 May 2023 00:41:31 +0000 (00:41 +0000)
committerCesar Strauss <cestrauss@gmail.com>
Wed, 17 May 2023 00:45:51 +0000 (00:45 +0000)
"fallback_version" is not recognized on earlier setuptools.
Instead of requiring a newer version, adopt the approach from
lambdasoc's setup.py, which doesn't use this feature.

setup.py

index 89c5dab60e51d3f9a488e9e80177265b8cf0d566..2243981d2c1c298e0ba8750a425bf5ed9bf32aff 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -4,6 +4,18 @@ from setuptools import setup
 from setuptools import find_packages
 
 
+def scm_version():
+    def local_scheme(version):
+        if version.tag and not version.distance:
+            return version.format_with("")
+        else:
+            return version.format_choice("+{node}", "+{node}.dirty")
+    return {
+        "relative_to": __file__,
+        "version_scheme": "guess-next-dev",
+        "local_scheme": local_scheme
+    }
+
 setup(
     # Vitals
     name="gram",
@@ -13,14 +25,7 @@ setup(
     author="LambdaConcept",
     author_email="contact@lambdaconcept.com",
     description="DRAM core for LambdaSoC",
-    use_scm_version= {
-        "root": '..',
-        "relative_to": __file__,
-        "version_scheme": "guess-next-dev",
-        "local_scheme": lambda version : version.format_choice("+{node}", "+{node}.dirty"),
-        "fallback_version": "r0.0"
-    },
-
+    use_scm_version=scm_version(),
     # Imports / exports / requirements
     platforms='any',
     packages=find_packages(exclude=("test*", "doc*", "examples*", "contrib*", "libgram*")),