Skip to content

Commit 36371f0

Browse files
docs/conf.py: fix build failure caused by recent changes to representation of version.
1 parent 69c4ef8 commit 36371f0

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

docs/conf.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,15 @@
4949
# built documents.
5050
#
5151
# The full version, including alpha/beta/rc tags.
52-
_path = os.path.abspath(f'{__file__}/../../src/__init__.py')
53-
with open(_path) as f:
54-
for line in f:
55-
match = re.search('pymupdf_version = "([0-9][.][0-9]+[.][0-9]+(rc[0-9]+)?)"', line)
56-
if match:
57-
release = match.group(1)
58-
print(f'{__file__}: setting version from {_path}: {release}')
59-
break
60-
else:
61-
raise Exception(f'Failed to find `VersionBind = ...` in {_path}')
62-
63-
# The short X.Y version
64-
version = release
52+
53+
# PyMuPDF version is set in setup.py, so we import it here.
54+
sys.path.insert(0, os.path.abspath(f'{__file__}/../..'))
55+
try:
56+
import setup
57+
finally:
58+
del sys.path[0]
59+
version = setup.version_p
60+
del setup # Necessary otherwise sphinx seems to do `setup()`.
6561

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

0 commit comments

Comments
 (0)