Skip to content

Commit 910593a

Browse files
authored
Merge pull request #48 from dhellmann/doc-version-git
doc build take version from git when package not installed
2 parents 0542464 + 8fc971c commit 910593a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

docs/source/conf.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,15 @@
1414

1515
import datetime
1616

17-
import virtualenvwrapper.version
17+
# Try to import the version from our package, but if that fails
18+
# because of the way the RTD build works fall back to at least using
19+
# the git tag information.
20+
try:
21+
from virtualenvwrapper.version import version
22+
except ImportError:
23+
import subprocess
24+
p = subprocess.run(['git', 'describe'], stdout=subprocess.PIPE)
25+
version = p.stdout.decode('utf-8').strip()
1826

1927
# If extensions (or modules to document with autodoc) are in another directory,
2028
# add these directories to sys.path here. If the directory is relative to the
@@ -52,7 +60,7 @@
5260
# built documents.
5361
#
5462
# The short X.Y version.
55-
version = virtualenvwrapper.version.version
63+
# version = "SEE IMPORTS ABOVE"
5664
# The full version, including alpha/beta/rc tags.
5765
release = version
5866

0 commit comments

Comments
 (0)