[arch.version] refactoring: PEP

This commit is contained in:
Vinicius Moreira
2022-04-04 16:15:40 -03:00
parent 8a935a924a
commit de387c699d

View File

@@ -21,7 +21,8 @@ def normalize_version(version: str) -> LegacyVersion:
def match_required_version(current_version: str, operator: str, required_version: str) -> bool: def match_required_version(current_version: str, operator: str, required_version: str) -> bool:
final_required, final_current = required_version.strip(), current_version.strip() final_required, final_current = required_version.strip(), current_version.strip()
required_has_epoch, current_no_epoch = bool(RE_VERSION_WITH_EPOCH.match(final_required)), RE_VERSION_WITH_EPOCH.split(final_current) required_has_epoch = bool(RE_VERSION_WITH_EPOCH.match(final_required))
current_no_epoch = RE_VERSION_WITH_EPOCH.split(final_current)
current_has_epoch = len(current_no_epoch) > 1 current_has_epoch = len(current_no_epoch) > 1
if required_has_epoch and not current_has_epoch: if required_has_epoch and not current_has_epoch:
@@ -29,7 +30,8 @@ def match_required_version(current_version: str, operator: str, required_version
elif current_has_epoch and not required_has_epoch: elif current_has_epoch and not required_has_epoch:
final_current = current_no_epoch[1] final_current = current_no_epoch[1]
required_has_release, current_no_release = bool(RE_VERSION_WITH_RELEASE.match(final_required)), RE_VERSION_WITH_RELEASE.split(final_current) required_has_release = bool(RE_VERSION_WITH_RELEASE.match(final_required))
current_no_release = RE_VERSION_WITH_RELEASE.split(final_current)
current_has_release = len(current_no_release) > 1 current_has_release = len(current_no_release) > 1
if required_has_release and not current_has_release: if required_has_release and not current_has_release: