1
0
mirror of https://github.com/janeczku/calibre-web synced 2025-01-02 13:30:29 +00:00

Dependency check respects now python version restrictions

This commit is contained in:
Ozzie Isaacs 2024-11-04 21:10:18 +01:00
parent 1b73d8a7e4
commit 6315f40800
3 changed files with 10 additions and 4 deletions

View File

@ -39,11 +39,16 @@ def load_dependencies(optional=False):
with open(req_path, 'r') as f: with open(req_path, 'r') as f:
for line in f: for line in f:
if not line.startswith('#') and not line == '\n' and not line.startswith('git'): if not line.startswith('#') and not line == '\n' and not line.startswith('git'):
res = re.match(r'(.*?)([<=>\s]+)([\d\.]+),?\s?([<=>\s]+)?([\d\.]+)?', line.strip()) res = re.match(r'(.*?)([<=>\s]+)([\d\.]+),?\s?([<=>\s]+)?([\d\.]+)?'
r'(?:;python_version([<=>\s]+)\'([\d\.]+)\')?', line.strip())
try: try:
if getattr(sys, 'frozen', False): if getattr(sys, 'frozen', False):
dep_version = exe_deps[res.group(1).lower().replace('_', '-')] dep_version = exe_deps[res.group(1).lower().replace('_', '-')]
else: else:
if res.group(6) and res.group(7):
if not eval(str(sys.version_info[0]) + "." + str(sys.version_info[1]) +
res.group(6)+ res.group(7)):
continue
if importlib: if importlib:
dep_version = version(res.group(1)) dep_version = version(res.group(1))
else: else:

View File

@ -32,7 +32,8 @@ dependencies = [
"Flask-Babel>=0.11.1,<4.1.0", "Flask-Babel>=0.11.1,<4.1.0",
"Flask-Principal>=0.3.2,<0.5.1", "Flask-Principal>=0.3.2,<0.5.1",
"Flask>=1.0.2,<3.1.0", "Flask>=1.0.2,<3.1.0",
"iso-639>=0.4.5,<0.5.0", "iso-639>=0.4.5,<0.5.0;python_version<'3.12'",
"pycountry>=20.0.0,<25.0.0;python_version>='3.12'",
"PyPDF>=3.15.6,<5.1.0", "PyPDF>=3.15.6,<5.1.0",
"pytz>=2016.10", "pytz>=2016.10",
"requests>=2.32.0,<2.33.0", "requests>=2.32.0,<2.33.0",

View File

@ -3,8 +3,8 @@ Babel>=1.3,<3.0
Flask-Babel>=0.11.1,<4.1.0 Flask-Babel>=0.11.1,<4.1.0
Flask-Principal>=0.3.2,<0.5.1 Flask-Principal>=0.3.2,<0.5.1
Flask>=1.0.2,<3.1.0 Flask>=1.0.2,<3.1.0
iso-639>=0.4.5,<0.5.0;python_version<"3.12" iso-639>=0.4.5<0.5.0;python_version<'3.12'
pycountry>=20.0.0,<25.0.0;python_version>="3.12" pycountry>=20.0.0,<25.0.0;python_version>='3.12'
PyPDF>=3.15.6,<5.1.0 PyPDF>=3.15.6,<5.1.0
pytz>=2016.10 pytz>=2016.10
requests>=2.32.0,<2.33.0 requests>=2.32.0,<2.33.0