some pep8 for ModuleUpdate.py

This commit is contained in:
Fabian Dill 2020-03-06 23:37:57 +01:00
parent dbf38db16f
commit d07644c274
1 changed files with 7 additions and 5 deletions

View File

@ -22,7 +22,7 @@ def update():
os.path.join(os.path.dirname(__file__), 'requirements.txt') os.path.join(os.path.dirname(__file__), 'requirements.txt')
with open(path) as requirementsfile: with open(path) as requirementsfile:
for line in requirementsfile.readlines(): for line in requirementsfile.readlines():
module, remoteversion = line.split(">=") module, remote_version = line.split(">=")
module = naming_specialties.get(module, module) module = naming_specialties.get(module, module)
try: try:
module = importlib.import_module(module) module = importlib.import_module(module)
@ -37,10 +37,12 @@ def update():
module = module.__name__ # also unloads the module to make it writable module = module.__name__ # also unloads the module to make it writable
if type(module_version) == str: if type(module_version) == str:
module_version = tuple(int(part.strip()) for part in module_version.split(".")) module_version = tuple(int(part.strip()) for part in module_version.split("."))
remoteversion = tuple(int(part.strip()) for part in remoteversion.split(".")) remote_version = tuple(int(part.strip()) for part in remote_version.split("."))
if module_version < remoteversion: if module_version < remote_version:
input(f'Required python module {module} is outdated ({module_version}<{remoteversion}), press enter to upgrade it') input(
f'Required python module {module} is outdated ({module_version}<{remote_version}), press enter to upgrade it')
update_command() update_command()
if __name__ == "__main__": if __name__ == "__main__":
update() update()