Skip to content

Commit

Permalink
src/__init__.py: pymupdf_version_tuple: cope with 'rc' in version str…
Browse files Browse the repository at this point in the history
…ing.
  • Loading branch information
julian-smith-artifex-com committed Jan 2, 2024
1 parent ef473b8 commit fd24bb6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21766,13 +21766,21 @@ def _atexit():
class FitzDeprecation(DeprecationWarning):
pass

def int_rc(text):
'''
Converts string to int, ignoring trailing 'rc...'.
'''
rc = text.find('rc')
if rc >= 0:
text = text[:rc]
return int(text)

VersionFitz = "1.23.7" # MuPDF version.
VersionBind = "1.23.9rc1" # PyMuPDF version.
VersionDate = "2024-01-02 00:00:01"
VersionDate2 = VersionDate.replace('-', '').replace(' ', '').replace(':', '')
version = (VersionBind, VersionFitz, VersionDate2)
pymupdf_version_tuple = tuple( [int(i) for i in VersionBind.split('.')])
pymupdf_version_tuple = tuple( [int_rc(i) for i in VersionBind.split('.')])

def restore_aliases():
warnings.filterwarnings( "once", category=FitzDeprecation)
Expand Down

0 comments on commit fd24bb6

Please sign in to comment.