mirror of
https://github.com/janeczku/calibre-web
synced 2024-12-26 10:00:37 +00:00
Find imports in executables
This commit is contained in:
parent
7317084a4e
commit
295888c654
@ -81,6 +81,7 @@ else:
|
|||||||
calibre_web_version = (constants.STABLE_VERSION['version'] + ' - '
|
calibre_web_version = (constants.STABLE_VERSION['version'] + ' - '
|
||||||
+ constants.NIGHTLY_VERSION[0].replace('%', '%%') + ' - '
|
+ constants.NIGHTLY_VERSION[0].replace('%', '%%') + ' - '
|
||||||
+ constants.NIGHTLY_VERSION[1].replace('%', '%%'))
|
+ constants.NIGHTLY_VERSION[1].replace('%', '%%'))
|
||||||
|
|
||||||
if getattr(sys, 'frozen', False):
|
if getattr(sys, 'frozen', False):
|
||||||
calibre_web_version += " - Exe-Version"
|
calibre_web_version += " - Exe-Version"
|
||||||
elif constants.HOME_CONFIG:
|
elif constants.HOME_CONFIG:
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
|
||||||
from .constants import BASE_DIR
|
from .constants import BASE_DIR
|
||||||
try:
|
try:
|
||||||
@ -8,7 +10,7 @@ try:
|
|||||||
ImportNotFound = BaseException
|
ImportNotFound = BaseException
|
||||||
except ImportError:
|
except ImportError:
|
||||||
importlib = False
|
importlib = False
|
||||||
|
version = None
|
||||||
|
|
||||||
if not importlib:
|
if not importlib:
|
||||||
try:
|
try:
|
||||||
@ -20,6 +22,9 @@ if not importlib:
|
|||||||
|
|
||||||
def load_dependencys(optional=False):
|
def load_dependencys(optional=False):
|
||||||
deps = list()
|
deps = list()
|
||||||
|
if getattr(sys, 'frozen', False):
|
||||||
|
with open(os.path.join(BASE_DIR, ".pip_installed")) as f:
|
||||||
|
exe_deps = json.loads(f.readlines())
|
||||||
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")
|
||||||
@ -31,6 +36,9 @@ def load_dependencys(optional=False):
|
|||||||
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\.]+)?', line.strip())
|
||||||
try:
|
try:
|
||||||
|
if getattr(sys, 'frozen', False):
|
||||||
|
dep_version = exe_deps[res.group(1).lower()]
|
||||||
|
else:
|
||||||
if importlib:
|
if importlib:
|
||||||
dep_version = version(res.group(1))
|
dep_version = version(res.group(1))
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user