mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-12 15:41:09 +00:00
pbuilder-dist: PEP 8 fixes.
This commit is contained in:
parent
50e589a239
commit
b0209ce796
@ -41,7 +41,7 @@ from ubuntutools.question import YesNoQuestion
|
||||
from ubuntutools import subprocess
|
||||
|
||||
|
||||
class PbuilderDist:
|
||||
class PbuilderDist(object):
|
||||
def __init__(self, builder):
|
||||
# Base directory where pbuilder will put all the files it creates.
|
||||
self.base = None
|
||||
@ -85,8 +85,7 @@ class PbuilderDist:
|
||||
self.builder = builder
|
||||
|
||||
self._debian_distros = DebianDistroInfo().all + \
|
||||
['stable', 'testing', 'unstable']
|
||||
|
||||
['stable', 'testing', 'unstable']
|
||||
|
||||
# Ensure that the used builder is installed
|
||||
paths = set(os.environ['PATH'].split(':'))
|
||||
@ -143,9 +142,9 @@ class PbuilderDist:
|
||||
# Debian experimental doesn't have a debootstrap file but
|
||||
# should work nevertheless.
|
||||
if distro not in self._debian_distros:
|
||||
answer = YesNoQuestion().ask(
|
||||
'Warning: Unknown distribution "%s". '
|
||||
'Do you want to continue' % distro, 'no')
|
||||
question = ('Warning: Unknown distribution "%s". '
|
||||
'Do you want to continue' % distro)
|
||||
answer = YesNoQuestion().ask(question, 'no')
|
||||
if answer == 'yes':
|
||||
sys.exit(0)
|
||||
else:
|
||||
@ -180,7 +179,7 @@ class PbuilderDist:
|
||||
self.operation = operation
|
||||
return []
|
||||
|
||||
def get_command(self, remaining_arguments = None):
|
||||
def get_command(self, remaining_arguments=None):
|
||||
""" PbuilderDist.get_command -> string
|
||||
|
||||
Generate the pbuilder command which matches the given configuration
|
||||
@ -240,23 +239,23 @@ class PbuilderDist:
|
||||
localrepo = '/var/cache/archive/' + self.target_distro
|
||||
if os.path.exists(localrepo):
|
||||
arguments += [
|
||||
'--othermirror',
|
||||
'deb file:///var/cache/archive/ %s/' % self.target_distro,
|
||||
'--othermirror',
|
||||
'deb file:///var/cache/archive/ %s/' % self.target_distro,
|
||||
]
|
||||
|
||||
config = UDTConfig()
|
||||
if self.target_distro in self._debian_distros:
|
||||
mirror = os.environ.get('MIRRORSITE',
|
||||
config.get_value('DEBIAN_MIRROR'))
|
||||
config.get_value('DEBIAN_MIRROR'))
|
||||
components = 'main'
|
||||
if self.extra_components:
|
||||
components += ' contrib non-free'
|
||||
else:
|
||||
mirror = os.environ.get('MIRRORSITE',
|
||||
config.get_value('UBUNTU_MIRROR'))
|
||||
config.get_value('UBUNTU_MIRROR'))
|
||||
if self.build_architecture not in ('amd64', 'i386'):
|
||||
mirror = os.environ.get('MIRRORSITE',
|
||||
config.get_value('UBUNTU_PORTS_MIRROR'))
|
||||
mirror = os.environ.get(
|
||||
'MIRRORSITE', config.get_value('UBUNTU_PORTS_MIRROR'))
|
||||
components = 'main restricted'
|
||||
if self.extra_components:
|
||||
components += ' universe multiverse'
|
||||
@ -269,8 +268,8 @@ class PbuilderDist:
|
||||
try:
|
||||
codename = debian_info.codename(self.target_distro,
|
||||
default=self.target_distro)
|
||||
except DistroDataOutdated, e:
|
||||
Logger.warn(e)
|
||||
except DistroDataOutdated, error:
|
||||
Logger.warn(error)
|
||||
if codename in (debian_info.devel(), 'experimental'):
|
||||
self.enable_security = False
|
||||
self.enable_updates = False
|
||||
@ -291,8 +290,8 @@ class PbuilderDist:
|
||||
else:
|
||||
try:
|
||||
dev_release = self.target_distro == UbuntuDistroInfo().devel()
|
||||
except DistroDataOutdated, e:
|
||||
Logger.warn(e)
|
||||
except DistroDataOutdated, error:
|
||||
Logger.warn(error)
|
||||
dev_release = True
|
||||
|
||||
if dev_release:
|
||||
@ -323,8 +322,8 @@ class PbuilderDist:
|
||||
Logger.error('ubuntu-keyring not installed')
|
||||
sys.exit(1)
|
||||
arguments += [
|
||||
'--debootstrapopts',
|
||||
'--keyring=/usr/share/keyrings/ubuntu-archive-keyring.gpg',
|
||||
'--debootstrapopts',
|
||||
'--keyring=/usr/share/keyrings/ubuntu-archive-keyring.gpg',
|
||||
]
|
||||
elif (ubuntutools.misc.system_distribution() == 'Ubuntu'
|
||||
and self.target_distro in self._debian_distros):
|
||||
@ -333,8 +332,8 @@ class PbuilderDist:
|
||||
Logger.error('debian-archive-keyring not installed')
|
||||
sys.exit(1)
|
||||
arguments += [
|
||||
'--debootstrapopts',
|
||||
'--keyring=/usr/share/keyrings/debian-archive-keyring.gpg',
|
||||
'--debootstrapopts',
|
||||
'--keyring=/usr/share/keyrings/debian-archive-keyring.gpg',
|
||||
]
|
||||
|
||||
arguments += ['--components', components]
|
||||
@ -366,7 +365,8 @@ class PbuilderDist:
|
||||
self.builder,
|
||||
] + arguments
|
||||
|
||||
def show_help(exit_code = 0):
|
||||
|
||||
def show_help(exit_code=0):
|
||||
""" help() -> None
|
||||
|
||||
Print a help message for pbuilder-dist, and exit with the given code.
|
||||
@ -375,6 +375,7 @@ def show_help(exit_code = 0):
|
||||
|
||||
sys.exit(exit_code)
|
||||
|
||||
|
||||
def main():
|
||||
""" main() -> None
|
||||
|
||||
@ -412,9 +413,9 @@ def main():
|
||||
if len(parts) > 2:
|
||||
requested_arch = parts[2]
|
||||
elif len(args) > 0 and args[0] in (
|
||||
'alpha', 'amd64', 'arm', 'armeb', 'armel', 'armhf', 'arm64', 'i386', 'lpia',
|
||||
'm68k', 'mips', 'mipsel', 'powerpc', 'ppc64', 'ppc64el', 'sh4', 'sh4eb',
|
||||
'sparc', 'sparc64'):
|
||||
'alpha', 'amd64', 'arm', 'armeb', 'armel', 'armhf', 'arm64',
|
||||
'i386', 'lpia', 'm68k', 'mips', 'mipsel', 'powerpc', 'ppc64',
|
||||
'ppc64el', 'sh4', 'sh4eb', 'sparc', 'sparc64'):
|
||||
requested_arch = args.pop(0)
|
||||
else:
|
||||
requested_arch = None
|
||||
|
Loading…
x
Reference in New Issue
Block a user