Commit df671c98 authored by echel0n's avatar echel0n
Browse files

added python version constraints for importlib-metadata in requirements.txt

parent 6d724274
......@@ -36,7 +36,8 @@ hachoir==3.1.1
html5lib==1.1
httplib2==0.18.1
idna==2.10
importlib-metadata==4.11.3
importlib-metadata==4.11.3; python_version >= '3.7'
importlib-metadata==4.8.3; python_version == '3.6'
ipaddress==1.0.23
knowit==0.2.4
lockfile==0.12.2
......
......@@ -27,6 +27,7 @@ import atexit
import gettext
import os
import pathlib
import re
import site
import subprocess
import sys
......@@ -187,7 +188,16 @@ def check_requirements():
with open(REQS_FILE) as f:
for line in f.readlines():
try:
req_name, req_version = line.strip().split('==')
req_name, req_version = line.strip().split('==', 1)
if 'python_version' in req_version:
m = re.search('(\d+.\d+.\d+).*(\d+.\d+)', req_version)
req_version = m.group(1)
python_version = m.group(2)
python_version_major = int(python_version.split('.')[0])
python_version_minor = int(python_version.split('.')[1])
if sys.version_info.major == python_version_major and sys.version_info.minor != python_version_minor:
continue
if not pkg_resources.get_distribution(req_name).version == req_version:
print('Updating requirement {} to {}'.format(req_name, req_version))
subprocess.check_call([sys.executable, "-m", "pip", "install", "--no-deps", "--no-cache-dir", line.strip()])
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment