Skip to content

Commit

Permalink
Merge pull request #44 from prmiles/fix-docs
Browse files Browse the repository at this point in the history
updated how documentation reads the version number
  • Loading branch information
Paul Miles committed May 3, 2019
2 parents a38017b + 034836e commit d233760
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#
import os
import sys
import re
sys.path.insert(0, os.path.abspath('../..'))
#sys.path.insert(0, os.path.abspath('../../pymcmcstat'))

Expand All @@ -24,13 +25,23 @@
author = 'Paul Miles'

# The short X.Y version
with open('../../pymcmcstat/__version__.py','r') as f:
version = f.read()
release = version
def get_version():
VERSIONFILE = os.path.join('..','..', 'pymcmcstat', '__init__.py')
with open(VERSIONFILE, 'rt') as f:
lines = f.readlines()
vgx = '^__version__ = \"\d+\.\d+\.\d.*\"'
for line in lines:
mo = re.search(vgx, line, re.M)
if mo:
return mo.group().split('"')[1]
raise RuntimeError('Unable to find version in %s.' % (VERSIONFILE,))
#with open('../../pymcmcstat/__init__.py','r') as f:
# version = f.read()
release = get_version()
#version = ''
# The full version, including alpha/beta/rc tags
#release = 'v1.4.0'
print(version)
print(release)

# -- General configuration ---------------------------------------------------

Expand Down

0 comments on commit d233760

Please sign in to comment.