Skip to content

Commit 9a2c2f9

Browse files
committed
Automatically generate the version number for docs
Reuse the code from setup.py to generate the proper version number for the Sphinx documentation.
1 parent 9d43660 commit 9a2c2f9

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

docs/conf.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# All configuration values have a default; values that are commented out
1212
# serve to show the default.
1313
import os
14+
import re
1415
import sys
1516

1617

@@ -63,10 +64,15 @@ def __getattr__(self, name):
6364
# |version| and |release|, also used in various other places throughout the
6465
# built documents.
6566
#
66-
# The short X.Y version.
67-
version = '2.0'
6867
# The full version, including alpha/beta/rc tags.
69-
release = '2.0.1'
68+
release = ''
69+
here = os.path.abspath(os.path.dirname(__file__))
70+
with open(os.path.join(here, '..', 'kazoo', 'version.py')) as f:
71+
release = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
72+
f.read(), re.MULTILINE).group(1)
73+
74+
# The short X.Y version.
75+
version = '.'.join(release.split('.')[:-1])
7076

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

0 commit comments

Comments
 (0)