From 25a8dfae1a2d835ba226877f1d7378553f8ab5a4 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Fri, 17 Apr 2020 14:15:12 +1000 Subject: [PATCH] scripts/pythondistdeps: Deal with some flake8 warnings flake8 is mostly unhappy with pythondistdeps.py, so clean up most of them, which is whitespace changes. --- scripts/pythondistdeps.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/scripts/pythondistdeps.py b/scripts/pythondistdeps.py index 060bc4058..ecaf17b04 100755 --- a/scripts/pythondistdeps.py +++ b/scripts/pythondistdeps.py @@ -58,20 +58,22 @@ class RpmVersion(): rpm_suffix = '' return '{}{}{}'.format(rpm_epoch, rpm_version, rpm_suffix) + def convert_compatible(name, operator, version_id): if version_id.endswith('.*'): print('Invalid requirement: {} {} {}'.format(name, operator, version_id)) - exit(65) # os.EX_DATAERR + exit(65) # os.EX_DATAERR version = RpmVersion(version_id) if len(version.version) == 1: print('Invalid requirement: {} {} {}'.format(name, operator, version_id)) - exit(65) # os.EX_DATAERR + exit(65) # os.EX_DATAERR upper_version = RpmVersion(version_id) upper_version.version.pop() upper_version.increment() return '({} >= {} with {} < {})'.format( name, version, name, upper_version) + def convert_equal(name, operator, version_id): if version_id.endswith('.*'): version_id = version_id[:-2] + '.0' @@ -79,13 +81,15 @@ def convert_equal(name, operator, version_id): version = RpmVersion(version_id) return '{} = {}'.format(name, version) + def convert_arbitrary_equal(name, operator, version_id): if version_id.endswith('.*'): print('Invalid requirement: {} {} {}'.format(name, operator, version_id)) - exit(65) # os.EX_DATAERR + exit(65) # os.EX_DATAERR version = RpmVersion(version_id) return '{} = {}'.format(name, version) + def convert_not_equal(name, operator, version_id): if version_id.endswith('.*'): version_id = version_id[:-2] @@ -97,6 +101,7 @@ def convert_not_equal(name, operator, version_id): return '({} < {} or {} > {})'.format( name, version, name, lower_version) + def convert_ordered(name, operator, version_id): if version_id.endswith('.*'): # PEP 440 does not define semantics for prefix matching @@ -249,9 +254,9 @@ for f in (args.files or stdin.readlines()): deps = depsextras # console_scripts/gui_scripts entry points need pkg_resources from setuptools if ((dist.get_entry_map('console_scripts') or - dist.get_entry_map('gui_scripts')) and - (lower.endswith('.egg') or - lower.endswith('.egg-info'))): + dist.get_entry_map('gui_scripts')) and + (lower.endswith('.egg') or + lower.endswith('.egg-info'))): # stick them first so any more specific requirement overrides it deps.insert(0, Requirement.parse('setuptools')) # add requires/recommends based on egg/dist metadata