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