diff --git a/src/pylorax/executils.py b/src/pylorax/executils.py index 6da74c8e..bb3dd1cc 100644 --- a/src/pylorax/executils.py +++ b/src/pylorax/executils.py @@ -267,9 +267,6 @@ def execWithCapture(command, argv, stdin = None, stderr = None, root=None, def execWithCallback(command, argv, stdin = None, stdout = None, stderr = None, echo = True, callback = None, callback_data = None, root = '/'): - def chroot(): - os.chroot(root) - def closefds (): stdinclose() stdoutclose() diff --git a/src/pylorax/imgutils.py b/src/pylorax/imgutils.py index 4279912d..b2a15178 100644 --- a/src/pylorax/imgutils.py +++ b/src/pylorax/imgutils.py @@ -151,7 +151,7 @@ def loop_waitfor(loop_dev, outfile): Raise RuntimeError if it isn't setup after 5 tries. """ - for x in xrange(0,5): + for _ in xrange(0,5): runcmd(["udevadm", "settle", "--timeout", "300"]) ## XXX Note that losetup --list output can be truncated to 64 bytes in some ## situations. Don't use it to lookup backing file, go the other way diff --git a/src/pylorax/treebuilder.py b/src/pylorax/treebuilder.py index 495e35cf..ef916701 100644 --- a/src/pylorax/treebuilder.py +++ b/src/pylorax/treebuilder.py @@ -53,10 +53,10 @@ def generate_module_info(moddir, outfile=None): 'eth':read_module_set("modules.networking")} modinfo = list() - for root, dirs, files in os.walk(moddir): + for root, _dirs, files in os.walk(moddir): for modtype, modset in modsets.items(): for mod in modset.intersection(files): # modules in this dir - (name, ext) = os.path.splitext(mod) # foo.ko -> (foo, .ko) + (name, _ext) = os.path.splitext(mod) # foo.ko -> (foo, .ko) desc = module_desc(joinpaths(root,mod)) or "%s driver" % name modinfo.append(dict(name=name, type=modtype, desc=desc)) @@ -238,7 +238,7 @@ class TreeBuilder(object): self.implantisomd5() def implantisomd5(self): - for section, data in self.treeinfo_data.items(): + for _section, data in self.treeinfo_data.items(): if 'boot.iso' in data: iso = joinpaths(self.vars.outroot, data['boot.iso']) runcmd(["implantisomd5", iso]) @@ -296,7 +296,7 @@ def findkernels(root="/", kdir="boot"): for kernel in kernels: for f in bootfiles: if f.endswith('-'+kernel.version+'.img'): - imgtype, rest = f.split('-',1) + imgtype, _rest = f.split('-',1) # special backwards-compat case if imgtype == 'initramfs': imgtype = 'initrd' diff --git a/utils/filediff.py b/utils/filediff.py index 4233d97b..abac28ed 100644 --- a/utils/filediff.py +++ b/utils/filediff.py @@ -22,7 +22,7 @@ def main(args): # parse sourcedir and targetdir sourcetree, targettree = {}, {} for tree, dir in [[sourcetree, sourcedir], [targettree, targetdir]]: - for root, dnames, fnames in os.walk(dir): + for root, _dnames, fnames in os.walk(dir): for fname in fnames: fpath = os.path.join(root, fname) rpath = fpath.replace(dir, "", 1) @@ -116,7 +116,7 @@ def main(args): [(rpath, sizeinbytes, islink)] # sort by size - for pkg, size in sorted(sizedict.items(), key=operator.itemgetter(1), + for pkg, _size in sorted(sizedict.items(), key=operator.itemgetter(1), reverse=True): for item in sorted(pkgdict[pkg]):