Sphinx docs now pull version info from git tag

Based on http://dreamiurg.net/2011/10/03/using-git-to-get-version-information/
This commit is contained in:
Simon Willison 2019-07-14 12:24:45 -07:00
commit 0fcb1e4839

View file

@ -1,6 +1,8 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
from subprocess import Popen, PIPE
# This file is execfile()d with the current directory set to its
# containing dir.
#
@ -52,9 +54,15 @@ author = "Simon Willison"
# built documents.
#
# The short X.Y version.
version = ""
# The full version, including alpha/beta/rc tags.
release = ""
pipe = Popen("git describe --tags --always", stdout=PIPE, shell=True)
git_version = pipe.stdout.read().decode("utf8")
if git_version:
version = git_version
release = git_version
else:
version = ""
release = ""
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.