setup: link to the right documentation version from pip metadata.
authorwhitequark <whitequark@whitequark.org>
Wed, 1 Jul 2020 20:49:41 +0000 (20:49 +0000)
committerwhitequark <whitequark@whitequark.org>
Wed, 1 Jul 2020 20:49:41 +0000 (20:49 +0000)
setup.py

index 3dafc3eef232536b9be1f32ece8d32bf8aa89d1f..19f25184b5a882bfe9a5dfa5767889d455ee1828 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -1,4 +1,5 @@
 from setuptools import setup, find_packages
+from setuptools_scm.git import parse as parse_git
 
 
 def scm_version():
@@ -14,6 +15,14 @@ def scm_version():
     }
 
 
+def doc_version():
+    git = parse_git(".")
+    if git.exact:
+        return git.format_with("{tag}")
+    else:
+        return "latest"
+
+
 setup(
     name="nmigen",
     use_scm_version=scm_version(),
@@ -41,7 +50,7 @@ setup(
         ]
     },
     project_urls={
-        "Documentation": "https://nmigen.info/nmigen/",
+        "Documentation": "https://nmigen.info/nmigen/{}".format(doc_version()),
         "Source Code": "https://github.com/nmigen/nmigen",
         "Bug Tracker": "https://github.com/nmigen/nmigen/issues",
     },