mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
Whitespace -> PEP-8
This commit is contained in:
parent
04eb3ada8b
commit
b78b21f43e
@ -35,8 +35,8 @@ from sys import exit, argv, stderr
|
||||
|
||||
import ubuntutools.misc
|
||||
|
||||
debian_distros = ['etch', 'lenny', 'squeeze', 'sid', 'stable', \
|
||||
'testing', 'unstable', 'experimental']
|
||||
debian_distros = ['etch', 'lenny', 'squeeze', 'sid', 'stable', 'testing',
|
||||
'unstable', 'experimental']
|
||||
|
||||
class pbuilder_dist:
|
||||
|
||||
@ -87,7 +87,8 @@ class pbuilder_dist:
|
||||
|
||||
##############################################################
|
||||
|
||||
self.base = os.path.expanduser(os.environ.get('PBUILDFOLDER', '~/pbuilder/'))
|
||||
self.base = os.path.expanduser(os.environ.get('PBUILDFOLDER',
|
||||
'~/pbuilder/'))
|
||||
|
||||
if not os.path.isdir(self.base):
|
||||
try:
|
||||
@ -124,13 +125,14 @@ class pbuilder_dist:
|
||||
% distro)
|
||||
exit(1)
|
||||
|
||||
if not os.path.isfile(os.path.join('/usr/share/debootstrap/scripts/', distro)):
|
||||
if not os.path.isfile(os.path.join('/usr/share/debootstrap/scripts/',
|
||||
distro)):
|
||||
if os.path.isdir('/usr/share/debootstrap/scripts/'):
|
||||
# Debian experimental doesn't have a debootstrap file but
|
||||
# should work nevertheless.
|
||||
if distro not in debian_distros:
|
||||
answer = ask('Warning: Unknown distribution "%s". Do you ' \
|
||||
'want to continue [y/N]? ' % distro)
|
||||
answer = ask(('Warning: Unknown distribution "%s". Do you '
|
||||
'want to continue [y/N]? ') % distro)
|
||||
if answer not in ('y', 'Y'):
|
||||
exit(0)
|
||||
else:
|
||||
@ -156,11 +158,14 @@ class pbuilder_dist:
|
||||
self.operation = 'build'
|
||||
return [operation]
|
||||
else:
|
||||
print >> stderr, 'Error: Could not find file "%s".' % operation
|
||||
print >> stderr, ('Error: Could not find file "%s".'
|
||||
% operation)
|
||||
exit(1)
|
||||
else:
|
||||
print >> stderr, 'Error: "%s" is not a recognized argument.' % operation
|
||||
print >> stderr, 'Please use one of these: %s.' % ', '.join(arguments)
|
||||
print >> stderr, (
|
||||
'Error: "%s" is not a recognized argument.\n'
|
||||
'Please use one of these: %s.'
|
||||
) % (operation, ', '.join(arguments))
|
||||
exit(1)
|
||||
else:
|
||||
self.operation = operation
|
||||
@ -178,7 +183,8 @@ class pbuilder_dist:
|
||||
self.chroot_string = self.target_distro
|
||||
self.build_architecture = self.system_architecture
|
||||
else:
|
||||
self.chroot_string = self.target_distro + '-' + self.build_architecture
|
||||
self.chroot_string = (self.target_distro + '-'
|
||||
+ self.build_architecture)
|
||||
|
||||
prefix = os.path.join(self.base, self.chroot_string)
|
||||
result = '%s_result/' % prefix
|
||||
@ -237,7 +243,8 @@ class pbuilder_dist:
|
||||
else:
|
||||
if self.build_architecture in ('amd64', 'i386'):
|
||||
arguments += ['--mirror', 'http://archive.ubuntu.com/ubuntu/']
|
||||
elif self.build_architecture == 'powerpc' and self.target_distro == 'dapper':
|
||||
elif (self.build_architecture == 'powerpc'
|
||||
and self.target_distro == 'dapper'):
|
||||
arguments += ['--mirror', 'http://archive.ubuntu.com/ubuntu/']
|
||||
else:
|
||||
arguments += ['--mirror',
|
||||
@ -252,7 +259,8 @@ class pbuilder_dist:
|
||||
arguments += ['--debootstrapopts',
|
||||
'--arch=' + self.build_architecture]
|
||||
|
||||
apt_conf_dir = os.path.join(self.base, 'etc/%s/apt.conf' % self.target_distro)
|
||||
apt_conf_dir = os.path.join(self.base,
|
||||
'etc/%s/apt.conf' % self.target_distro)
|
||||
if os.path.exists(apt_conf_dir):
|
||||
arguments += ['--aptconfdir', apt_conf_dir]
|
||||
|
||||
@ -313,9 +321,10 @@ def main():
|
||||
# Copy arguments into another list for save manipulation
|
||||
args = argv[1:]
|
||||
|
||||
if '-' in script_name and (parts[0] != 'pbuilder' and \
|
||||
parts[0] != 'cowbuilder') or len(parts) > 3:
|
||||
print >> stderr, 'Error: "%s" is not a valid name for a "pbuilder-dist" executable.' % script_name
|
||||
if ('-' in script_name and parts[0] not in ('pbuilder', 'cowbuilder')
|
||||
or len(parts) > 3):
|
||||
print >> stderr, ('Error: "%s" is not a valid name for a '
|
||||
'"pbuilder-dist" executable.') % script_name
|
||||
exit(1)
|
||||
|
||||
if len(args) < 1:
|
||||
@ -334,9 +343,10 @@ def main():
|
||||
|
||||
if len(parts) > 2:
|
||||
requested_arch = parts[2]
|
||||
elif len(args) > 0 and args[0] in ("alpha", "amd64", "arm", "armeb",
|
||||
"armel", "i386", "lpia", "m68k", "mips", "mipsel", "powerpc", "ppc64",
|
||||
"sh4", "sh4eb", "sparc", "sparc64"):
|
||||
elif len(args) > 0 and args[0] in (
|
||||
'alpha', 'amd64', 'arm', 'armeb', 'armel', 'i386', 'lpia', 'm68k',
|
||||
'mips', 'mipsel', 'powerpc', 'ppc64', 'sh4', 'sh4eb', 'sparc',
|
||||
'sparc64'):
|
||||
requested_arch = args.pop(0)
|
||||
else:
|
||||
requested_arch = None
|
||||
@ -344,11 +354,12 @@ def main():
|
||||
if requested_arch:
|
||||
app.build_architecture = requested_arch
|
||||
# For some foreign architectures we need to use qemu
|
||||
if requested_arch != app.system_architecture and (app.system_architecture,
|
||||
requested_arch) not in [("amd64", "i386"), ("amd64", "lpia"),
|
||||
("arm", "armel"), ("armel", "arm"), ("i386", "lpia"), ("lpia", "i386"),
|
||||
("powerpc", "ppc64"), ("ppc64", "powerpc"), ("sparc", "sparc64"),
|
||||
("sparc64", "sparc")]:
|
||||
if (requested_arch != app.system_architecture
|
||||
and (app.system_architecture, requested_arch) not in [
|
||||
('amd64', 'i386'), ('amd64', 'lpia'), ('arm', 'armel'),
|
||||
('armel', 'arm'), ('i386', 'lpia'), ('lpia', 'i386'),
|
||||
('powerpc', 'ppc64'), ('ppc64', 'powerpc'),
|
||||
('sparc', 'sparc64'), ('sparc64', 'sparc')]):
|
||||
args.append('--debootstrap qemu-debootstrap')
|
||||
|
||||
if 'mainonly' in argv or '--main-only' in argv:
|
||||
@ -366,12 +377,13 @@ def main():
|
||||
args = app.set_operation(args.pop(0)) + args
|
||||
|
||||
if app.operation == 'build' and not '.dsc' in ' '.join(args):
|
||||
print >> stderr, 'Error: You have to specify a .dsc file if you want to build.'
|
||||
print >> stderr, ('Error: You have to specify a .dsc file if you want '
|
||||
'to build.')
|
||||
exit(1)
|
||||
|
||||
# Execute the pbuilder command
|
||||
if not '--debug-echo' in args:
|
||||
p = subprocess.Popen(app.get_command(args))
|
||||
p = subprocess.Popen(app.get_command(args)))
|
||||
exit(p.wait())
|
||||
else:
|
||||
print app.get_command([arg for arg in args if arg != '--debug-echo'])
|
||||
|
Loading…
x
Reference in New Issue
Block a user