Fix flake8 compliants in tools python programs.
Change-Id: I59feb2824fce16d23d56833fd51e4814a0e641cf
This commit is contained in:
parent
18bd6b8a0d
commit
02f8d000ff
@ -14,9 +14,9 @@ import argparse
|
|||||||
import collections
|
import collections
|
||||||
import iso8601
|
import iso8601
|
||||||
import logging
|
import logging
|
||||||
import re
|
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
|
@ -3,14 +3,12 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import distutils.spawn
|
import distutils.spawn
|
||||||
import logging
|
import logging
|
||||||
import os
|
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import pip.index
|
import pip.index
|
||||||
import pip.req
|
import pip.req
|
||||||
from pip.vcs import git, mercurial, subversion, bazaar
|
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
|
|
||||||
|
|
||||||
@ -201,13 +199,10 @@ def join_one_requirement(req_list):
|
|||||||
"""
|
"""
|
||||||
if len(req_list) == 1:
|
if len(req_list) == 1:
|
||||||
return req_list[0]
|
return req_list[0]
|
||||||
req_strict = None
|
|
||||||
lower_bound_str = None
|
lower_bound_str = None
|
||||||
lower_bound_version = None
|
lower_bound_version = None
|
||||||
lower_bound_req = None
|
|
||||||
upper_bound_str = None
|
upper_bound_str = None
|
||||||
upper_bound_version = None
|
upper_bound_version = None
|
||||||
upper_bound_req = None
|
|
||||||
conflicts = []
|
conflicts = []
|
||||||
for req in req_list:
|
for req in req_list:
|
||||||
for spec in req.req.specs:
|
for spec in req.req.specs:
|
||||||
@ -225,15 +220,13 @@ def join_one_requirement(req_list):
|
|||||||
(strict_check and version == lower_bound_version)):
|
(strict_check and version == lower_bound_version)):
|
||||||
lower_bound_version = version
|
lower_bound_version = version
|
||||||
lower_bound_str = spec_str
|
lower_bound_str = spec_str
|
||||||
lower_bound_req = req
|
|
||||||
else:
|
else:
|
||||||
if (not upper_bound_version or (version < upper_bound_version) or
|
if (not upper_bound_version or (version < upper_bound_version) or
|
||||||
(strict_check and version == upper_bound_version)):
|
(strict_check and version == upper_bound_version)):
|
||||||
upper_bound_version = version
|
upper_bound_version = version
|
||||||
upper_bound_str = spec_str
|
upper_bound_str = spec_str
|
||||||
upper_bound_req = req
|
req_key = req_list[0].req.key
|
||||||
if lower_bound_version and upper_bound_version:
|
if lower_bound_version and upper_bound_version:
|
||||||
bad_bounds = False
|
|
||||||
if lower_bound_version > upper_bound_version:
|
if lower_bound_version > upper_bound_version:
|
||||||
upper_bound_str = None
|
upper_bound_str = None
|
||||||
if lower_bound_version == upper_bound_version:
|
if lower_bound_version == upper_bound_version:
|
||||||
@ -244,7 +237,6 @@ def join_one_requirement(req_list):
|
|||||||
else:
|
else:
|
||||||
upper_bound_str = None
|
upper_bound_str = None
|
||||||
req_specs = []
|
req_specs = []
|
||||||
req_key = req_list[0].req.key
|
|
||||||
if lower_bound_str:
|
if lower_bound_str:
|
||||||
req_specs.append(lower_bound_str)
|
req_specs.append(lower_bound_str)
|
||||||
if upper_bound_str:
|
if upper_bound_str:
|
||||||
@ -304,7 +296,7 @@ def join_requirements(options):
|
|||||||
conflicts.append(parsed)
|
conflicts.append(parsed)
|
||||||
if exact_version:
|
if exact_version:
|
||||||
for req in req_list:
|
for req in req_list:
|
||||||
if not exact_version in req.req:
|
if exact_version not in req.req:
|
||||||
incompatible_requirement(joined_req, req)
|
incompatible_requirement(joined_req, req)
|
||||||
else:
|
else:
|
||||||
for req in req_list:
|
for req in req_list:
|
||||||
|
@ -16,7 +16,8 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from distutils.version import (StrictVersion, LooseVersion)
|
from distutils.version import LooseVersion
|
||||||
|
from distutils.version import StrictVersion
|
||||||
|
|
||||||
import collections
|
import collections
|
||||||
import distutils
|
import distutils
|
||||||
|
@ -4,9 +4,9 @@ import argparse
|
|||||||
import distutils.spawn
|
import distutils.spawn
|
||||||
import email.parser
|
import email.parser
|
||||||
import logging
|
import logging
|
||||||
import re
|
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
@ -58,6 +58,7 @@ mv -f INSTALLED_FILES{.tmp,}""",
|
|||||||
"""rm -rf $RPM_BUILD_ROOT""",
|
"""rm -rf $RPM_BUILD_ROOT""",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class InstallationError(Exception):
|
class InstallationError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -70,7 +71,7 @@ def python_key_to_rpm(python_name):
|
|||||||
python_name = python_name.lower()
|
python_name = python_name.lower()
|
||||||
try:
|
try:
|
||||||
return package_map[python_name]
|
return package_map[python_name]
|
||||||
except:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
python_name = python_name.replace("_", "-").replace(".", "-")
|
python_name = python_name.replace("_", "-").replace(".", "-")
|
||||||
if python_name.startswith("python-"):
|
if python_name.startswith("python-"):
|
||||||
@ -329,7 +330,7 @@ def requires_and_conflicts(req_list):
|
|||||||
for line in req_list:
|
for line in req_list:
|
||||||
try:
|
try:
|
||||||
req = pkg_resources.Requirement.parse(line)
|
req = pkg_resources.Requirement.parse(line)
|
||||||
except:
|
except Exception:
|
||||||
continue
|
continue
|
||||||
rpm_name = python_key_to_rpm(req.key)
|
rpm_name = python_key_to_rpm(req.key)
|
||||||
if not req.specs:
|
if not req.specs:
|
||||||
@ -407,7 +408,7 @@ def build_rpm(options, filename):
|
|||||||
# flake8 v2 that we don't go ahead and build a v2.0 version.
|
# flake8 v2 that we don't go ahead and build a v2.0 version.
|
||||||
#
|
#
|
||||||
# Note(harlowja): Not sure why rpm seems to not understand these are the same...
|
# Note(harlowja): Not sure why rpm seems to not understand these are the same...
|
||||||
cleaned_version = trim_zeroes(version.replace('-','_'))
|
cleaned_version = trim_zeroes(version.replace('-', '_'))
|
||||||
with open(spec_name, "w") as spec_file:
|
with open(spec_name, "w") as spec_file:
|
||||||
print >> spec_file, "%define pkg_name", pkg_name
|
print >> spec_file, "%define pkg_name", pkg_name
|
||||||
print >> spec_file, "%define rpm_name", rpm_name
|
print >> spec_file, "%define rpm_name", rpm_name
|
||||||
|
@ -23,9 +23,7 @@ from optparse import OptionParser
|
|||||||
|
|
||||||
import collections
|
import collections
|
||||||
import json
|
import json
|
||||||
import os
|
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
import sys
|
|
||||||
|
|
||||||
from yum import YumBase
|
from yum import YumBase
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user