Skip to content

Commit 0e33c67

Browse files
committed
Read version from Git.
0.1 as a version was useless and outdated anyways. Rather use the last commit date (or, if not built from a Git checkout, today) as a version number. This makes referencing builds much easier.
1 parent d3271b9 commit 0e33c67

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎source/conf.py‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,17 @@
4848
# built documents.
4949
#
5050
# The short X.Y version.
51-
version = '0.1'
51+
import subprocess
52+
_git_version_cmd = "git log --max-count=1 --format=format:%ad --date=short"
53+
try:
54+
version = subprocess.check_output(_git_version_cmd.split())
55+
except (AttributeError, OSError, subprocess.CalledProcessError):
56+
import datetime
57+
version = datetime.datetime.strftime("%Y.%m.%d")
58+
else:
59+
version = version.replace("-", ".")
5260
# The full version, including alpha/beta/rc tags.
53-
release = '0.1'
61+
release = version
5462

5563
# The language for content autogenerated by Sphinx. Refer to documentation
5664
# for a list of supported languages.

0 commit comments

Comments
 (0)