mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-28 20:39:59 +00:00
Improved dependency check for executables
This commit is contained in:
parent
295888c654
commit
0436f0f9b2
@ -23,8 +23,12 @@ if not importlib:
|
|||||||
def load_dependencys(optional=False):
|
def load_dependencys(optional=False):
|
||||||
deps = list()
|
deps = list()
|
||||||
if getattr(sys, 'frozen', False):
|
if getattr(sys, 'frozen', False):
|
||||||
with open(os.path.join(BASE_DIR, ".pip_installed")) as f:
|
pip_installed = os.path.join(BASE_DIR, ".pip_installed")
|
||||||
exe_deps = json.loads(f.readlines())
|
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 importlib or pkgresources:
|
||||||
if optional:
|
if optional:
|
||||||
req_path = os.path.join(BASE_DIR, "optional-requirements.txt")
|
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())
|
res = re.match(r'(.*?)([<=>\s]+)([\d\.]+),?\s?([<=>\s]+)?([\d\.]+)?', line.strip())
|
||||||
try:
|
try:
|
||||||
if getattr(sys, 'frozen', False):
|
if getattr(sys, 'frozen', False):
|
||||||
dep_version = exe_deps[res.group(1).lower()]
|
dep_version = exe_deps[res.group(1).lower().replace('_','-')]
|
||||||
else:
|
else:
|
||||||
if importlib:
|
if importlib:
|
||||||
dep_version = version(res.group(1))
|
dep_version = version(res.group(1))
|
||||||
else:
|
else:
|
||||||
dep_version = pkg_resources.get_distribution(res.group(1)).version
|
dep_version = pkg_resources.get_distribution(res.group(1)).version
|
||||||
except ImportNotFound:
|
except (ImportNotFound, KeyError):
|
||||||
if optional:
|
if optional:
|
||||||
continue
|
continue
|
||||||
dep_version = "not installed"
|
dep_version = "not installed"
|
||||||
|
@ -33,7 +33,7 @@ scholarly>=1.2.0,<1.6
|
|||||||
markdown2>=2.0.0,<2.5.0
|
markdown2>=2.0.0,<2.5.0
|
||||||
html2text>=2020.1.16,<2022.1.1
|
html2text>=2020.1.16,<2022.1.1
|
||||||
python-dateutil>=2.1,<2.9.0
|
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
|
cchardet>=2.0.0,<2.2.0
|
||||||
|
|
||||||
# Comics
|
# Comics
|
||||||
|
@ -5,7 +5,7 @@ Flask-Principal>=0.3.2,<0.5.1
|
|||||||
backports_abc>=0.4
|
backports_abc>=0.4
|
||||||
Flask>=1.0.2,<2.1.0
|
Flask>=1.0.2,<2.1.0
|
||||||
iso-639>=0.4.5,<0.5.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
|
pytz>=2016.10
|
||||||
requests>=2.11.1,<2.28.0
|
requests>=2.11.1,<2.28.0
|
||||||
SQLAlchemy>=1.3.0,<1.5.0
|
SQLAlchemy>=1.3.0,<1.5.0
|
||||||
|
@ -45,7 +45,7 @@ install_requires =
|
|||||||
backports_abc>=0.4
|
backports_abc>=0.4
|
||||||
Flask>=1.0.2,<2.1.0
|
Flask>=1.0.2,<2.1.0
|
||||||
iso-639>=0.4.5,<0.5.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
|
pytz>=2016.10
|
||||||
requests>=2.11.1,<2.28.0
|
requests>=2.11.1,<2.28.0
|
||||||
SQLAlchemy>=1.3.0,<1.5.0
|
SQLAlchemy>=1.3.0,<1.5.0
|
||||||
@ -88,7 +88,7 @@ metadata =
|
|||||||
markdown2>=2.0.0,<2.5.0
|
markdown2>=2.0.0,<2.5.0
|
||||||
html2text>=2020.1.16,<2022.1.1
|
html2text>=2020.1.16,<2022.1.1
|
||||||
python-dateutil>=2.1,<2.9.0
|
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
|
cchardet>=2.0.0,<2.2.0
|
||||||
comics =
|
comics =
|
||||||
natsort>=2.2.0,<8.2.0
|
natsort>=2.2.0,<8.2.0
|
||||||
|
Loading…
Reference in New Issue
Block a user