diff --git a/pull-lp-source b/pull-lp-source index dc21710..f11fb92 100755 --- a/pull-lp-source +++ b/pull-lp-source @@ -34,7 +34,7 @@ from ubuntutools.logger import Logger from ubuntutools.lp.lpapicache import Distribution, Launchpad from ubuntutools.lp.udtexceptions import (SeriesNotFoundException, PackageNotFoundException, PocketDoesNotExistError) -from ubuntutools.misc import splitReleasePocket, dsc_url +from ubuntutools.misc import split_release_pocket, dsc_url def main(): usage = "Usage: %prog <package> [release]" @@ -70,7 +70,7 @@ def main(): .getDevelopmentSeries().name) try: - (release, pocket) = splitReleasePocket(release) + (release, pocket) = split_release_pocket(release) except PocketDoesNotExistError, error: Logger.error(error) sys.exit(1) diff --git a/ubuntu-build b/ubuntu-build index daf06b6..ed4a2e9 100755 --- a/ubuntu-build +++ b/ubuntu-build @@ -30,7 +30,7 @@ from ubuntutools.lp.udtexceptions import (SeriesNotFoundException, PackageNotFoundException, PocketDoesNotExistError,) from ubuntutools.lp.lpapicache import Distribution, PersonTeam -from ubuntutools.misc import splitReleasePocket +from ubuntutools.misc import split_release_pocket def main(): # Usage. @@ -124,7 +124,7 @@ def main(): # split release and pocket try: - (release, pocket) = splitReleasePocket(release) + (release, pocket) = split_release_pocket(release) except PocketDoesNotExistError, error: print 'E: %s' % error sys.exit(1) @@ -220,7 +220,7 @@ def main(): release = (options.series or Distribution('ubuntu').getDevelopmentSeries().name) try: - (release, pocket) = splitReleasePocket(release) + (release, pocket) = split_release_pocket(release) except PocketDoesNotExistError, error: print 'E: %s' % error sys.exit(1) diff --git a/ubuntutools/config.py b/ubuntutools/config.py index 11c88f1..1445b3a 100644 --- a/ubuntutools/config.py +++ b/ubuntutools/config.py @@ -58,9 +58,9 @@ class UDTConfig(object): dictionary """ config = {} - for fn in ('/etc/devscripts.conf', '~/.devscripts'): + for filename in ('/etc/devscripts.conf', '~/.devscripts'): try: - f = open(os.path.expanduser(fn), 'r') + f = open(os.path.expanduser(filename), 'r') except IOError: continue for line in f: @@ -130,10 +130,10 @@ def ubu_email(name=None, email=None, export=True): name_email_re = re.compile(r'^\s*(.+?)\s*<(.+@.+)>\s*$') if email: - m = name_email_re.match(email) - if m and not name: - name = m.group(1) - email = m.group(2) + match = name_email_re.match(email) + if match and not name: + name = match.group(1) + email = match.group(2) if export and not name and not email and 'UBUMAIL' not in os.environ: export = False @@ -147,12 +147,12 @@ def ubu_email(name=None, email=None, export=True): if name and email: break if var in os.environ: - m = name_email_re.match(os.environ[var]) - if m: + match = name_email_re.match(os.environ[var]) + if match: if not name: - name = m.group(1) + name = match.group(1) if not email: - email = m.group(2) + email = match.group(2) elif target == 'name' and not name: name = os.environ[var].strip() elif target == 'email' and not email: diff --git a/ubuntutools/misc.py b/ubuntutools/misc.py index 3f37b2d..84ad93e 100644 --- a/ubuntutools/misc.py +++ b/ubuntutools/misc.py @@ -40,15 +40,16 @@ def system_distribution(): if _system_distribution is None: try: if os.path.isfile('/usr/bin/dpkg-vendor'): - p = Popen(('dpkg-vendor', '--query', 'vendor'), stdout=PIPE) + process = Popen(('dpkg-vendor', '--query', 'vendor'), + stdout=PIPE) else: - p = Popen(('lsb_release', '-cs'), stdout=PIPE) - output = p.communicate()[0] + process = Popen(('lsb_release', '-cs'), stdout=PIPE) + output = process.communicate()[0] except OSError: print ('Error: Could not determine what distribution you are ' 'running.') return None - if p.returncode != 0: + if process.returncode != 0: print 'Error determininng system distribution' return None _system_distribution = output.strip() @@ -95,7 +96,7 @@ def readlist(filename, uniq=True): return items -def splitReleasePocket(release): +def split_release_pocket(release): '''Splits the release and pocket name. If the argument doesn't contain a pocket name then the 'Release' pocket @@ -128,5 +129,5 @@ def dsc_name(package, version): def dsc_url(mirror, component, package, version): "Build a source package URL" group = package[:4] if package.startswith('lib') else package[0] - fn = dsc_name(package, version) - return os.path.join(mirror, 'pool', component, group, package, fn) + filename = dsc_name(package, version) + return os.path.join(mirror, 'pool', component, group, package, filename) diff --git a/ubuntutools/test/test_help.py b/ubuntutools/test/test_help.py index f13cab1..c374c50 100644 --- a/ubuntutools/test/test_help.py +++ b/ubuntutools/test/test_help.py @@ -59,13 +59,14 @@ class HelpTestCase(unittest.TestCase): raise unittest.SkipTest("Blacklisted: " + BLACKLIST[script]) null = open('/dev/null', 'r') - p = subprocess.Popen(['./' + script, '--help'], - close_fds=True, stdin=null, - stdout=subprocess.PIPE, stderr=subprocess.PIPE) + process = subprocess.Popen(['./' + script, '--help'], + close_fds=True, stdin=null, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) started = time.time() out = [] - fds = [p.stdout.fileno(), p.stderr.fileno()] + fds = [process.stdout.fileno(), process.stderr.fileno()] for fd in fds: fcntl.fcntl(fd, fcntl.F_SETFL, fcntl.fcntl(fd, fcntl.F_GETFL) | os.O_NONBLOCK) @@ -73,17 +74,17 @@ class HelpTestCase(unittest.TestCase): while time.time() - started < TIMEOUT: for fd in select.select(fds, [], fds, TIMEOUT)[0]: out.append(os.read(fd, 1024)) - if p.poll() is not None: + if process.poll() is not None: break - if p.poll() is None: - os.kill(p.pid, signal.SIGTERM) + if process.poll() is None: + os.kill(process.pid, signal.SIGTERM) time.sleep(1) - if p.poll() is None: - os.kill(p.pid, signal.SIGKILL) + if process.poll() is None: + os.kill(process.pid, signal.SIGKILL) null.close() - self.assertEqual(p.poll(), 0, + self.assertEqual(process.poll(), 0, "%s failed to return usage within %i seconds.\n" "Output:\n%s" % (script, TIMEOUT, ''.join(out))) diff --git a/ubuntutools/test/test_pylint.py b/ubuntutools/test/test_pylint.py index 9d21d7c..f6230f1 100644 --- a/ubuntutools/test/test_pylint.py +++ b/ubuntutools/test/test_pylint.py @@ -36,12 +36,12 @@ class PylintTestCase(unittest.TestCase): if 'python' in f.readline(): files.append(script) f.close() - p = subprocess.Popen(['pylint', '--rcfile=ubuntutools/test/pylint.conf', - '-E', '--include-ids=y', '--'] + files, - stdout=subprocess.PIPE, stderr=subprocess.PIPE, - close_fds=True) + cmd = ['pylint', '--rcfile=ubuntutools/test/pylint.conf', '-E', + '--include-ids=y', '--'] + files + process = subprocess.Popen(cmd, stdout=subprocess.PIPE, + stderr=subprocess.PIPE, close_fds=True) - out, err = p.communicate() + out, err = process.communicate() self.assertEqual(err, '') filtered_out = []