scripts/pythondistdeps: Deal with some flake8 warnings

flake8 is mostly unhappy with pythondistdeps.py, so clean up most of
them, which is whitespace changes.
This commit is contained in:
Steve Kowalik 2020-04-17 14:15:12 +10:00 committed by Panu Matilainen
parent 3f7b03af43
commit 25a8dfae1a
1 changed files with 11 additions and 6 deletions

View File

@ -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