1
0
mirror of https://github.com/janeczku/calibre-web.git synced 2024-11-21 17:56:35 +02:00

Add libmagic for windows installations

This commit is contained in:
Ozzie Isaacs 2024-11-10 14:52:55 +01:00
parent f0b770224a
commit 5a87c1c4b3
2 changed files with 16 additions and 5 deletions

View File

@ -39,17 +39,27 @@ def load_dependencies(optional=False):
with open(req_path, 'r') as f:
for line in f:
if not line.startswith('#') and not line == '\n' and not line.startswith('git'):
res = re.match(r'(.*?)([<=>\s]+)([\d\.]+),?\s?([<=>\s]+)?([\d\.]+)?'
r'(?:;python_version([<=>\s]+)\'([\d\.]+)\')?', line.strip())
res = re.match(r'(.*?)([<=>\s]+)([\d\.]+),?\s?([<=>\s]+)?([\d\.]+)?(?:\s?;\s?'
r'(?:(python_version)\s?([<=>]+)\s?\'([\d\.]+)\'|'
r'(sys_platform)\s?([\!=]+)\s?\'([\w]+)\'))?', line.strip())
try:
if getattr(sys, 'frozen', False):
dep_version = exe_deps[res.group(1).lower().replace('_', '-')]
else:
if res.group(6) and res.group(7):
val = res.group(7).split(".")
if res.group(7) and res.group(8):
val = res.group(8).split(".")
if not eval(str(sys.version_info[0]) + "." + "{:02d}".format(sys.version_info[1]) +
res.group(6) + val[0] + "." + "{:02d}".format(int(val[1]))):
res.group(7) + val[0] + "." + "{:02d}".format(int(val[1]))):
continue
elif res.group(10) and res.group(11):
# only installed if platform is eqal, don't check if platform is not equal
if res.group(10) == "==":
if sys.platform != res.group(11):
continue
# installed if platform is not eqal, don't check if platform is equal
elif res.group(10) == "!=":
if sys.platform == res.group(11):
continue
if importlib:
dep_version = version(res.group(1))
else:

View File

@ -21,5 +21,6 @@ Flask-Limiter>=2.3.0,<3.9.0
regex>=2022.3.2,<2024.6.25
bleach>=6.0.0,<6.2.0
python-magic>=0.4.27,<0.5.0
python-magic-bin>=0.4.0,<0.5.0;sys_platform=='win32'
flask-httpAuth>=4.4.0,<5.0.0
cryptography>=30.0.0,<44.0.0