Handling of missing required dependency during dependency check

This commit is contained in:
Ozzieisaacs 2021-11-06 21:17:48 +04:00
parent 27e8fbd248
commit 60aa016734
3 changed files with 11 additions and 9 deletions

View File

@ -129,7 +129,7 @@ def create_app():
web_server.stop(True) web_server.stop(True)
sys.exit(7) sys.exit(7)
for res in dependency_check() + dependency_check(True): for res in dependency_check() + dependency_check(True):
log.info('*** "{}" version does not fit the requirements. Should: {}, Found: {}, please consider updating. ***' log.info('*** "{}" version does not fit the requirements. Should: {}, Found: {}, please consider installing required version ***'
.format(res['name'], .format(res['name'],
res['target'], res['target'],
res['found'])) res['found']))

View File

@ -117,7 +117,6 @@ else:
Jinja2=jinja2.__version__, Jinja2=jinja2.__version__,
pySqlite = sqlite3.version, pySqlite = sqlite3.version,
SQLite = sqlite3.sqlite_version, SQLite = sqlite3.sqlite_version,
Unidecode=unidecode_version,
) )
_VERSIONS.update(ret) _VERSIONS.update(ret)
_VERSIONS.update(uploader.get_versions(False)) _VERSIONS.update(uploader.get_versions(False))

View File

@ -38,11 +38,7 @@ def load_dependencys(optional=False):
except ImportNotFound: except ImportNotFound:
if optional: if optional:
continue continue
'''else: dep_version = "not installed"
return [{'name':res.group(1),
'target': "available",
'found': "Not available"
}]'''
deps.append([dep_version, res.group(1), res.group(2), res.group(3), res.group(4), res.group(5)]) deps.append([dep_version, res.group(1), res.group(2), res.group(3), res.group(4), res.group(5)])
return deps return deps
@ -51,12 +47,19 @@ def dependency_check(optional=False):
d = list() d = list()
deps = load_dependencys(optional) deps = load_dependencys(optional)
for dep in deps: for dep in deps:
dep_version_int = [int(x) for x in dep[0].split('.')]
low_check = [int(x) for x in dep[3].split('.')]
try: try:
dep_version_int = [int(x) for x in dep[0].split('.')]
low_check = [int(x) for x in dep[3].split('.')]
high_check = [int(x) for x in dep[5].split('.')] high_check = [int(x) for x in dep[5].split('.')]
except AttributeError: except AttributeError:
high_check = None high_check = None
except ValueError:
d.append({'name': dep[1],
'target': "available",
'found': "Not available"
})
continue
if dep[2].strip() == "==": if dep[2].strip() == "==":
if dep_version_int != low_check: if dep_version_int != low_check:
d.append({'name': dep[1], d.append({'name': dep[1],