File tree Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Expand file tree Collapse file tree 1 file changed +9
-13
lines changed Original file line number Diff line number Diff line change 49
49
# built documents.
50
50
#
51
51
# 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()`.
65
61
66
62
# The language for content autogenerated by Sphinx. Refer to documentation
67
63
# for a list of supported languages.
You can’t perform that action at this time.
0 commit comments