Commit cc75f73d authored by Stefan Behnel's avatar Stefan Behnel

print error if parsing project version fails during doc build

parent 0f1df0f7
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
# serve to show the default. # serve to show the default.
import sys, os, os.path, re import sys, os, os.path, re
import itertools
import datetime import datetime
YEAR = datetime.date.today().strftime('%Y') YEAR = datetime.date.today().strftime('%Y')
...@@ -77,11 +78,13 @@ release = '0.15' ...@@ -77,11 +78,13 @@ release = '0.15'
try: try:
_match_version = re.compile(r'^\s*_*version\s*_*\s*=\s*["\']([^"\']+)["\'].*').match _match_version = re.compile(r'^\s*_*version\s*_*\s*=\s*["\']([^"\']+)["\'].*').match
with open(os.path.join(os.path.dirname(__file__), '..', 'Cython', 'Shadow.py')) as _f: with open(os.path.join(os.path.dirname(__file__), '..', 'Cython', 'Shadow.py')) as _f:
for line in _f: for line in itertools.islice(_f, 5): # assume version comes early enough
_m = _match_version(line) _m = _match_version(line)
if _m: if _m:
release = _m.group(1) release = _m.group(1)
break break
else:
print("FAILED TO PARSE PROJECT VERSION !")
except: except:
pass pass
# The short X.Y version. # The short X.Y version.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment