Skip to content

Commit

Permalink
packaging: Use current module version for docs
Browse files Browse the repository at this point in the history
Instead of parsing the __init__ file, just assume the package has been
installed locally.
  • Loading branch information
rbarrois committed Apr 29, 2021
1 parent 44b61da commit 5502ec9
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

import sys, os

import xworkflows

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
Expand Down Expand Up @@ -48,18 +50,8 @@
# |version| and |release|, also used in various other places throughout the
# built documents.
#
root_dir = os.path.abspath(os.path.dirname(__file__))
def get_version():
import re
version_re = re.compile(r"^__version__ = '([\w_.-]+)'$")
with open(os.path.join(root_dir, os.pardir, 'xworkflows', '__init__.py')) as f:
for line in f:
match = version_re.match(line[:-1])
if match:
return match.groups()[0]
return '0.0.0'

release = get_version()
release = xworkflows.__version__
# The short X.Y version
version = '.'.join(release.split('.')[:2])


Expand Down

0 comments on commit 5502ec9

Please sign in to comment.