diff --git a/cps/dep_check.py b/cps/dep_check.py index 2f156913..1fee2adb 100644 --- a/cps/dep_check.py +++ b/cps/dep_check.py @@ -39,11 +39,16 @@ def load_dependencies(optional=False): with open(req_path, 'r') as f: for line in f: 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\.]+)?' + r'(?:;python_version([<=>\s]+)\'([\d\.]+)\')?', line.strip()) try: if getattr(sys, 'frozen', False): dep_version = exe_deps[res.group(1).lower().replace('_', '-')] else: + if res.group(6) and res.group(7): + if not eval(str(sys.version_info[0]) + "." + str(sys.version_info[1]) + + res.group(6)+ res.group(7)): + continue if importlib: dep_version = version(res.group(1)) else: diff --git a/pyproject.toml b/pyproject.toml index 9ff8bb1f..43221289 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,7 +32,8 @@ dependencies = [ "Flask-Babel>=0.11.1,<4.1.0", "Flask-Principal>=0.3.2,<0.5.1", "Flask>=1.0.2,<3.1.0", - "iso-639>=0.4.5,<0.5.0", + "iso-639>=0.4.5,<0.5.0;python_version<'3.12'", + "pycountry>=20.0.0,<25.0.0;python_version>='3.12'", "PyPDF>=3.15.6,<5.1.0", "pytz>=2016.10", "requests>=2.32.0,<2.33.0", diff --git a/requirements.txt b/requirements.txt index 2e1a355a..bbe3b35b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,8 +3,8 @@ Babel>=1.3,<3.0 Flask-Babel>=0.11.1,<4.1.0 Flask-Principal>=0.3.2,<0.5.1 Flask>=1.0.2,<3.1.0 -iso-639>=0.4.5,<0.5.0;python_version<"3.12" -pycountry>=20.0.0,<25.0.0;python_version>="3.12" +iso-639>=0.4.5<0.5.0;python_version<'3.12' +pycountry>=20.0.0,<25.0.0;python_version>='3.12' PyPDF>=3.15.6,<5.1.0 pytz>=2016.10 requests>=2.32.0,<2.33.0