diff --git a/cps/dep_check.py b/cps/dep_check.py index 5e8e36cf..84e16e85 100644 --- a/cps/dep_check.py +++ b/cps/dep_check.py @@ -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" diff --git a/optional-requirements.txt b/optional-requirements.txt index 123f4686..f7c7b572 100644 --- a/optional-requirements.txt +++ b/optional-requirements.txt @@ -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 diff --git a/requirements.txt b/requirements.txt index 0b95dfa3..d9bed7bb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/setup.cfg b/setup.cfg index e6774776..12874151 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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