check_root: fix lint warnings

Per `flake8-3`'s recommendations
This commit is contained in:
Euan Kemp 2017-02-17 16:00:33 -08:00
parent 2596099207
commit 3eea9d2701

View File

@ -110,11 +110,13 @@ def provided_sonames():
for atom in VARDB.settings.soname_provided:
yield atom
def ignore_sonames(cpv):
for key in dep.match_to_list(cpv, IGNORE_MISSING.iterkeys()):
for atom in IGNORE_MISSING[key]:
yield atom
def missing_sonames():
provided = frozenset(provided_sonames())
for cpv in VARDB.cpv_all():
@ -125,6 +127,7 @@ def missing_sonames():
if missing:
yield (cpv, missing)
def usr_conflicts():
for cpv in VARDB.cpv_all():
raw = VARDB.aux_get(cpv, ["CONTENTS"])[0]
@ -157,6 +160,7 @@ def usr_conflicts():
if conflicts:
yield (cpv, conflicts)
def check_libs():
ok = True
for cpv, sonames in missing_sonames():
@ -166,6 +170,7 @@ def check_libs():
ok = False
return ok
def check_usr():
ok = True
for cpv, conflicts in usr_conflicts():
@ -175,11 +180,13 @@ def check_usr():
ok = False
return ok
def is_exe(path):
# just check other, assuming root or group only commands are not scripts.
perms = stat.S_IROTH | stat.S_IXOTH
mode = os.lstat(path).st_mode
return stat.S_ISREG(mode) and mode&perms == perms
return stat.S_ISREG(mode) and (mode & perms) == perms
def check_shebang():
ok = True
@ -217,6 +224,7 @@ def check_shebang():
ok = False
return ok
class chrooted():
"""
chrooted provides a context so that it can be used via with.
@ -264,12 +272,11 @@ def check_symlink():
return ok
def error(fmt, *args):
sys.stderr.write(output.red(fmt % args))
sys.stderr.write("\n")
def main():
ok = True
check_funcs = {