1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-12-25 09:30:31 +00:00

Improved dependency check for executables

This commit is contained in:
Ozzie Isaacs 2022-02-12 11:58:56 +01:00
parent 295888c654
commit 0436f0f9b2
4 changed files with 12 additions and 8 deletions

View File

@ -23,8 +23,12 @@ if not importlib:
def load_dependencys(optional=False):
deps = list()
if getattr(sys, 'frozen', False):
with open(os.path.join(BASE_DIR, ".pip_installed")) as f:
exe_deps = json.loads(f.readlines())
pip_installed = os.path.join(BASE_DIR, ".pip_installed")
if os.path.exists(pip_installed):
with open(pip_installed) as f:
exe_deps = json.loads("".join(f.readlines()))
else:
return deps
if importlib or pkgresources:
if optional:
req_path = os.path.join(BASE_DIR, "optional-requirements.txt")
@ -37,13 +41,13 @@ def load_dependencys(optional=False):
res = re.match(r'(.*?)([<=>\s]+)([\d\.]+),?\s?([<=>\s]+)?([\d\.]+)?', line.strip())
try:
if getattr(sys, 'frozen', False):
dep_version = exe_deps[res.group(1).lower()]
dep_version = exe_deps[res.group(1).lower().replace('_','-')]
else:
if importlib:
dep_version = version(res.group(1))
else:
dep_version = pkg_resources.get_distribution(res.group(1)).version
except ImportNotFound:
except (ImportNotFound, KeyError):
if optional:
continue
dep_version = "not installed"

View File

@ -33,7 +33,7 @@ scholarly>=1.2.0,<1.6
markdown2>=2.0.0,<2.5.0
html2text>=2020.1.16,<2022.1.1
python-dateutil>=2.1,<2.9.0
beautifulsoup4>=4.0.1,<4.2.0
beautifulsoup4>=4.0.1,<4.11.0
cchardet>=2.0.0,<2.2.0
# Comics

View File

@ -5,7 +5,7 @@ Flask-Principal>=0.3.2,<0.5.1
backports_abc>=0.4
Flask>=1.0.2,<2.1.0
iso-639>=0.4.5,<0.5.0
PyPDF3>=1.0.0,<1.0.6
PyPDF3>=1.0.0,<1.0.7
pytz>=2016.10
requests>=2.11.1,<2.28.0
SQLAlchemy>=1.3.0,<1.5.0

View File

@ -45,7 +45,7 @@ install_requires =
backports_abc>=0.4
Flask>=1.0.2,<2.1.0
iso-639>=0.4.5,<0.5.0
PyPDF3>=1.0.0,<1.0.6
PyPDF3>=1.0.0,<1.0.7
pytz>=2016.10
requests>=2.11.1,<2.28.0
SQLAlchemy>=1.3.0,<1.5.0
@ -88,7 +88,7 @@ metadata =
markdown2>=2.0.0,<2.5.0
html2text>=2020.1.16,<2022.1.1
python-dateutil>=2.1,<2.9.0
beautifulsoup4>=4.0.1,<4.2.0
beautifulsoup4>=4.0.1,<4.11.0
cchardet>=2.0.0,<2.2.0
comics =
natsort>=2.2.0,<8.2.0