guide: When running in Read The Docs, get version from its environment
Git isn't available in the Read The Docs build, but we don't actually need it there anyway because we are told the version number that Read The Docs thinks it is building.
This commit is contained in:
parent
c6f6feed76
commit
33120477c7
@ -1,4 +1,5 @@
|
||||
import subprocess
|
||||
import os
|
||||
import os.path
|
||||
|
||||
# -- Project information -----------------------------------------------------
|
||||
@ -7,12 +8,15 @@ project = u'HCL'
|
||||
copyright = u'2018, HashiCorp'
|
||||
author = u'HashiCorp'
|
||||
|
||||
git_version = subprocess.check_output(['git', 'describe', '--always']).strip()
|
||||
if 'READTHEDOCS_VERSION' in os.environ:
|
||||
version_str = os.environ['READTHEDOCS_VERSION']
|
||||
else:
|
||||
version_str = subprocess.check_output(['git', 'describe', '--always']).strip()
|
||||
|
||||
# The short X.Y version
|
||||
version = unicode(git_version)
|
||||
version = unicode(version_str)
|
||||
# The full version, including alpha/beta/rc tags
|
||||
release = unicode(git_version)
|
||||
release = unicode(version_str)
|
||||
|
||||
|
||||
# -- General configuration ---------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user