mirror of
https://github.com/janeczku/calibre-web
synced 2024-12-21 07:30:30 +00:00
Improved dep check for windows exe version and further fixes for windows exe
This commit is contained in:
parent
f9cfb38ad3
commit
92fbc9c792
2
cps.py
2
cps.py
@ -43,7 +43,7 @@ def hide_console_windows():
|
||||
|
||||
if __name__ == '__main__':
|
||||
if os.name == "nt":
|
||||
hide_console_windows()
|
||||
pass # hide_console_windows()
|
||||
main()
|
||||
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
import sys
|
||||
import platform
|
||||
import sqlite3
|
||||
import importlib
|
||||
from importlib.metadata import metadata
|
||||
from collections import OrderedDict
|
||||
|
||||
import flask
|
||||
@ -41,7 +41,7 @@ req = dep_check.load_dependencies(False)
|
||||
opt = dep_check.load_dependencies(True)
|
||||
for i in (req + opt):
|
||||
modules[i[1]] = i[0]
|
||||
modules['Jinja2'] = importlib.metadata.version("jinja2")
|
||||
modules['Jinja2'] = metadata("jinja2")["Version"]
|
||||
if sys.version_info < (3, 12):
|
||||
modules['pySqlite'] = sqlite3.version
|
||||
modules['SQLite'] = sqlite3.sqlite_version
|
||||
|
@ -23,11 +23,10 @@ import zipfile
|
||||
import json
|
||||
from io import BytesIO
|
||||
from flask_babel.speaklater import LazyString
|
||||
|
||||
from importlib.metadata import metadata
|
||||
import os
|
||||
|
||||
from flask import send_file
|
||||
import importlib
|
||||
|
||||
from . import logger, config
|
||||
from .about import collect_stats
|
||||
@ -50,7 +49,7 @@ def assemble_logfiles(file_name):
|
||||
with open(f, 'rb') as fd:
|
||||
shutil.copyfileobj(fd, wfd)
|
||||
wfd.seek(0)
|
||||
version = importlib.metadata.version("flask")
|
||||
version = metadata("flask")["Version"]
|
||||
if int(version.split('.')[0]) < 2:
|
||||
return send_file(wfd,
|
||||
as_attachment=True,
|
||||
@ -74,7 +73,7 @@ def send_debug():
|
||||
for fp in file_list:
|
||||
zf.write(fp, os.path.basename(fp))
|
||||
memory_zip.seek(0)
|
||||
version = importlib.metadata.version("flask")
|
||||
version = metadata("flask")["Version"]
|
||||
if int(version.split('.')[0]) < 2:
|
||||
return send_file(memory_zip,
|
||||
as_attachment=True,
|
||||
|
@ -43,23 +43,23 @@ def load_dependencies(optional=False):
|
||||
r'(?:(python_version)\s?([<=>]+)\s?\'([\d\.]+)\'|'
|
||||
r'(sys_platform)\s?([\!=]+)\s?\'([\w]+)\'))?', line.strip())
|
||||
try:
|
||||
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(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 getattr(sys, 'frozen', False):
|
||||
dep_version = exe_deps[res.group(1).lower().replace('_', '-')]
|
||||
else:
|
||||
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(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:
|
||||
|
@ -23,7 +23,7 @@ import json
|
||||
import mimetypes
|
||||
import chardet # dependency of requests
|
||||
import copy
|
||||
import importlib
|
||||
from importlib.metadata import metadata
|
||||
|
||||
from flask import Blueprint, jsonify
|
||||
from flask import request, redirect, send_from_directory, make_response, flash, abort, url_for, Response
|
||||
@ -86,7 +86,7 @@ except ImportError:
|
||||
sort = sorted # Just use regular sort then, may cause issues with badly named pages in cbz/cbr files
|
||||
|
||||
|
||||
sql_version = importlib.metadata.version("sqlalchemy")
|
||||
sql_version = metadata("sqlalchemy")["Version"]
|
||||
sqlalchemy_version2 = ([int(x) for x in sql_version.split('.')] >= [2, 0, 0])
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user