Fix other flake8 complaints
E231 missing whitespace after ',' E265 block comment should start with '# ' E266 too many leading '#' for block comment E302 expected 2 blank lines, found 1 E501 line too long (115 > 88 characters) E713 test for membership should be 'not in' E722 do not use bare 'except' F812 list comprehension redefines 'g' from line 1499 F821 undefined name 'cmp' F841 local variable 'ex' is assigned to but never used JIRA: COMPOSE-4108 Signed-off-by: Haibo Lin <hlin@redhat.com>
This commit is contained in:
parent
c0193c9fca
commit
65aa8fde2f
@ -136,7 +136,7 @@ def _try_read_cpuinfo(): # pragma: no cover
|
|||||||
try:
|
try:
|
||||||
with open("/proc/cpuinfo", "r") as f:
|
with open("/proc/cpuinfo", "r") as f:
|
||||||
return f.readlines()
|
return f.readlines()
|
||||||
except:
|
except Exception:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ def _parse_auxv(): # pragma: no cover
|
|||||||
try:
|
try:
|
||||||
with open("/proc/self/auxv", "rb") as f:
|
with open("/proc/self/auxv", "rb") as f:
|
||||||
data = f.read()
|
data = f.read()
|
||||||
except:
|
except Exception:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Define values from /usr/include/elf.h
|
# Define values from /usr/include/elf.h
|
||||||
@ -223,7 +223,7 @@ def getCanonPPCArch(arch): # pragma: no cover
|
|||||||
try:
|
try:
|
||||||
if platform.startswith("power") and int(platform[5:].rstrip("+")) >= 7:
|
if platform.startswith("power") and int(platform[5:].rstrip("+")) >= 7:
|
||||||
return "ppc64p7"
|
return "ppc64p7"
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if machine is None:
|
if machine is None:
|
||||||
@ -290,7 +290,7 @@ def getCanonArch(skipRpmPlatform=0): # pragma: no cover
|
|||||||
f.close()
|
f.close()
|
||||||
(arch, vendor, opersys) = line.split("-", 2)
|
(arch, vendor, opersys) = line.split("-", 2)
|
||||||
return arch
|
return arch
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
arch = os.uname()[4]
|
arch = os.uname()[4]
|
||||||
|
@ -310,9 +310,9 @@ class Compose(kobo.log.LoggingBase):
|
|||||||
self.all_variants[variant.uid] = variant
|
self.all_variants[variant.uid] = variant
|
||||||
|
|
||||||
# populate ci_base with variants - needed for layered-products (compose_id)
|
# populate ci_base with variants - needed for layered-products (compose_id)
|
||||||
####FIXME - compose_to_composeinfo is no longer needed and has been
|
# FIXME - compose_to_composeinfo is no longer needed and has been
|
||||||
#### removed, but I'm not entirely sure what this is needed for
|
# removed, but I'm not entirely sure what this is needed for
|
||||||
#### or if it is at all
|
# or if it is at all
|
||||||
self.ci_base = compose_to_composeinfo(self)
|
self.ci_base = compose_to_composeinfo(self)
|
||||||
|
|
||||||
def get_variants(self, types=None, arch=None):
|
def get_variants(self, types=None, arch=None):
|
||||||
|
@ -450,7 +450,7 @@ class Pungi(PungiBase):
|
|||||||
# deal with our repos
|
# deal with our repos
|
||||||
try:
|
try:
|
||||||
self.ksparser.handler.repo.methodToRepo()
|
self.ksparser.handler.repo.methodToRepo()
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
for repo in self.ksparser.handler.repo.repoList:
|
for repo in self.ksparser.handler.repo.repoList:
|
||||||
@ -777,7 +777,7 @@ class Pungi(PungiBase):
|
|||||||
self.add_package(dep, msg)
|
self.add_package(dep, msg)
|
||||||
added.add(dep)
|
added.add(dep)
|
||||||
|
|
||||||
except (yum.Errors.InstallError, yum.Errors.YumBaseError) as ex:
|
except (yum.Errors.InstallError, yum.Errors.YumBaseError):
|
||||||
self.logger.warning(
|
self.logger.warning(
|
||||||
"Unresolvable dependency %s in %s.%s (repo: %s)",
|
"Unresolvable dependency %s in %s.%s (repo: %s)",
|
||||||
r,
|
r,
|
||||||
@ -1136,7 +1136,7 @@ class Pungi(PungiBase):
|
|||||||
if self.is_resolve_deps:
|
if self.is_resolve_deps:
|
||||||
# get conditional deps (defined in comps)
|
# get conditional deps (defined in comps)
|
||||||
for txmbr in self.ayum.tsInfo:
|
for txmbr in self.ayum.tsInfo:
|
||||||
if not txmbr.po in self.po_list:
|
if txmbr.po not in self.po_list:
|
||||||
if not is_package(txmbr.po):
|
if not is_package(txmbr.po):
|
||||||
# we don't want sources which can be pulled in,
|
# we don't want sources which can be pulled in,
|
||||||
# because 'src' arch is part of self.valid_arches
|
# because 'src' arch is part of self.valid_arches
|
||||||
@ -1381,7 +1381,7 @@ class Pungi(PungiBase):
|
|||||||
# flags
|
# flags
|
||||||
try:
|
try:
|
||||||
srpm_po = self.sourcerpm_srpmpo_map[po.sourcerpm]
|
srpm_po = self.sourcerpm_srpmpo_map[po.sourcerpm]
|
||||||
except:
|
except Exception:
|
||||||
self.logger.warning("Failed to find source for %s", po.sourcerpm)
|
self.logger.warning("Failed to find source for %s", po.sourcerpm)
|
||||||
srpm_po = None
|
srpm_po = None
|
||||||
if srpm_po in self.input_packages:
|
if srpm_po in self.input_packages:
|
||||||
@ -1461,7 +1461,7 @@ class Pungi(PungiBase):
|
|||||||
try:
|
try:
|
||||||
pungi.util._link(local, target, self.logger, force=True)
|
pungi.util._link(local, target, self.logger, force=True)
|
||||||
continue
|
continue
|
||||||
except:
|
except Exception:
|
||||||
self.logger.error("Unable to link %s from the yum cache." % po.name)
|
self.logger.error("Unable to link %s from the yum cache." % po.name)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
@ -1492,9 +1492,9 @@ class Pungi(PungiBase):
|
|||||||
# Filter out things we don't include
|
# Filter out things we don't include
|
||||||
ourgroups = []
|
ourgroups = []
|
||||||
for item in self.ksparser.handler.packages.groupList:
|
for item in self.ksparser.handler.packages.groupList:
|
||||||
g = self.ayum.comps.return_group(item.name)
|
grp = self.ayum.comps.return_group(item.name)
|
||||||
if g:
|
if grp:
|
||||||
ourgroups.append(g.groupid)
|
ourgroups.append(grp.groupid)
|
||||||
allgroups = [g.groupid for g in self.ayum.comps.get_groups()]
|
allgroups = [g.groupid for g in self.ayum.comps.get_groups()]
|
||||||
for group in allgroups:
|
for group in allgroups:
|
||||||
if (
|
if (
|
||||||
@ -1595,7 +1595,7 @@ class Pungi(PungiBase):
|
|||||||
"flags": sorted(flags),
|
"flags": sorted(flags),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
result.sort(lambda x, y: cmp(x["path"], y["path"]))
|
result.sort(lambda x, y: cmp(x["path"], y["path"])) # noqa: F821 (py2 only)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def list_packages(self):
|
def list_packages(self):
|
||||||
@ -1796,7 +1796,7 @@ class Pungi(PungiBase):
|
|||||||
try:
|
try:
|
||||||
# Convert url method to a repo
|
# Convert url method to a repo
|
||||||
self.ksparser.handler.repo.methodToRepo()
|
self.ksparser.handler.repo.methodToRepo()
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
for repo in self.ksparser.handler.repo.repoList:
|
for repo in self.ksparser.handler.repo.repoList:
|
||||||
@ -2028,7 +2028,7 @@ class Pungi(PungiBase):
|
|||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
universal_newlines=True,
|
universal_newlines=True,
|
||||||
).communicate()
|
).communicate()
|
||||||
except:
|
except Exception:
|
||||||
self.logger.error("Got an error from rpm2cpio")
|
self.logger.error("Got an error from rpm2cpio")
|
||||||
self.logger.error(err)
|
self.logger.error(err)
|
||||||
raise
|
raise
|
||||||
|
@ -336,7 +336,7 @@ def main():
|
|||||||
if opts.do_all or opts.do_buildinstall:
|
if opts.do_all or opts.do_buildinstall:
|
||||||
try:
|
try:
|
||||||
enforcing = selinux.security_getenforce()
|
enforcing = selinux.security_getenforce()
|
||||||
except:
|
except Exception:
|
||||||
print("INFO: selinux disabled")
|
print("INFO: selinux disabled")
|
||||||
enforcing = False
|
enforcing = False
|
||||||
if enforcing:
|
if enforcing:
|
||||||
|
@ -543,7 +543,7 @@ def find_old_compose(
|
|||||||
with open(status_path, "r") as f:
|
with open(status_path, "r") as f:
|
||||||
if f.read().strip() in allowed_statuses:
|
if f.read().strip() in allowed_statuses:
|
||||||
composes.append((_sortable(i), os.path.abspath(path)))
|
composes.append((_sortable(i), os.path.abspath(path)))
|
||||||
except:
|
except Exception:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not composes:
|
if not composes:
|
||||||
|
@ -514,7 +514,7 @@ def get_compose_data(compose_path):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
return data
|
return data
|
||||||
except Exception as exc:
|
except Exception:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
||||||
|
6
setup.py
6
setup.py
@ -49,7 +49,7 @@ setup(
|
|||||||
"pungi-config-validate = pungi.scripts.config_validate:cli_main",
|
"pungi-config-validate = pungi.scripts.config_validate:cli_main",
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
scripts=["contrib/yum-dnf-compare/pungi-compare-depsolving",],
|
scripts=["contrib/yum-dnf-compare/pungi-compare-depsolving"],
|
||||||
data_files=[
|
data_files=[
|
||||||
("/usr/share/pungi", glob.glob("share/*.xsl")),
|
("/usr/share/pungi", glob.glob("share/*.xsl")),
|
||||||
("/usr/share/pungi", glob.glob("share/*.ks")),
|
("/usr/share/pungi", glob.glob("share/*.ks")),
|
||||||
@ -65,6 +65,6 @@ setup(
|
|||||||
"six",
|
"six",
|
||||||
"dogpile.cache",
|
"dogpile.cache",
|
||||||
],
|
],
|
||||||
extras_require={':python_version=="2.7"': ["enum34", "lockfile", "dict.sorted",]},
|
extras_require={':python_version=="2.7"': ["enum34", "lockfile", "dict.sorted"]},
|
||||||
tests_require=["mock", "nose", "nose-cov",],
|
tests_require=["mock", "nose", "nose-cov"],
|
||||||
)
|
)
|
||||||
|
@ -602,6 +602,7 @@ class TestSchemaValidator(unittest.TestCase):
|
|||||||
{'enum': ['git://localhost/pungi-fedora.git'], 'type': 'string'})
|
{'enum': ['git://localhost/pungi-fedora.git'], 'type': 'string'})
|
||||||
self.assertEqual(scm_dict_properties["file"], {"type": "string"})
|
self.assertEqual(scm_dict_properties["file"], {"type": "string"})
|
||||||
|
|
||||||
|
|
||||||
class TestUmask(unittest.TestCase):
|
class TestUmask(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.orig_umask = os.umask(0)
|
self.orig_umask = os.umask(0)
|
||||||
|
Loading…
Reference in New Issue
Block a user