mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
53337b5025
commit
ce370fa47f
14
setup.py
14
setup.py
@ -6,14 +6,16 @@ __license__ = 'GPL v3'
|
|||||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
import sys, os, tomllib, re
|
import sys, os, re
|
||||||
base = os.path.dirname(os.path.abspath(__file__))
|
src_base = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
|
||||||
def check_version_info():
|
def check_version_info():
|
||||||
with open(os.path.join(base, 'pyproject.toml'), 'rb') as f:
|
with open(os.path.join(src_base, 'pyproject.toml')) as f:
|
||||||
m = tomllib.load(f)
|
raw = f.read()
|
||||||
minver = m['project']['requires-python']
|
m = re.search(r'''^requires-python\s*=\s*['"](.+?)['"]''', raw, flags=re.MULTILINE)
|
||||||
|
assert m is not None
|
||||||
|
minver = m.group(1)
|
||||||
m = re.match(r'(>=?)(\d+)\.(\d+)', minver)
|
m = re.match(r'(>=?)(\d+)\.(\d+)', minver)
|
||||||
q = int(m.group(2)), int(m.group(3))
|
q = int(m.group(2)), int(m.group(3))
|
||||||
if m.group(1) == '>=':
|
if m.group(1) == '>=':
|
||||||
@ -27,7 +29,7 @@ def check_version_info():
|
|||||||
|
|
||||||
check_version_info()
|
check_version_info()
|
||||||
|
|
||||||
sys.path.insert(0, base)
|
sys.path.insert(0, src_base)
|
||||||
|
|
||||||
import setup.commands as commands
|
import setup.commands as commands
|
||||||
from setup import prints, get_warnings
|
from setup import prints, get_warnings
|
||||||
|
Loading…
x
Reference in New Issue
Block a user