Skip to content

Commit d844f03

Browse files
committed
update conf file
1 parent 9c41054 commit d844f03

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

src-doc/conf.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,25 @@
1313
# import os
1414
# import sys
1515
# sys.path.insert(0, os.path.abspath('.'))
16-
import allagash
16+
import codecs
17+
import os
18+
import re
19+
20+
here = os.path.abspath(os.path.dirname(__file__))
21+
22+
23+
def read(*parts):
24+
with codecs.open(os.path.join(here, *parts), 'r') as fp:
25+
return fp.read()
26+
27+
28+
def find_version(*file_paths):
29+
version_file = read(*file_paths)
30+
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
31+
version_file, re.M)
32+
if version_match:
33+
return version_match.group(1)
34+
raise RuntimeError("Unable to find version string.")
1735

1836
# -- Project information -----------------------------------------------------
1937

@@ -22,7 +40,7 @@
2240
author = 'Aaron Pulver'
2341

2442
# The full version, including alpha/beta/rc tags
25-
release = allagash.__version__
43+
release = find_version(r"../src/allagash", "__init__.py")
2644

2745

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

0 commit comments

Comments
 (0)