mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01: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
|
from ubuntutools import subprocess
|
||||||
|
|
||||||
|
|
||||||
class PbuilderDist:
|
class PbuilderDist(object):
|
||||||
def __init__(self, builder):
|
def __init__(self, builder):
|
||||||
# Base directory where pbuilder will put all the files it creates.
|
# Base directory where pbuilder will put all the files it creates.
|
||||||
self.base = None
|
self.base = None
|
||||||
@ -87,7 +87,6 @@ class PbuilderDist:
|
|||||||
self._debian_distros = DebianDistroInfo().all + \
|
self._debian_distros = DebianDistroInfo().all + \
|
||||||
['stable', 'testing', 'unstable']
|
['stable', 'testing', 'unstable']
|
||||||
|
|
||||||
|
|
||||||
# Ensure that the used builder is installed
|
# Ensure that the used builder is installed
|
||||||
paths = set(os.environ['PATH'].split(':'))
|
paths = set(os.environ['PATH'].split(':'))
|
||||||
paths |= set(('/sbin', '/usr/sbin', '/usr/local/sbin'))
|
paths |= set(('/sbin', '/usr/sbin', '/usr/local/sbin'))
|
||||||
@ -143,9 +142,9 @@ class PbuilderDist:
|
|||||||
# Debian experimental doesn't have a debootstrap file but
|
# Debian experimental doesn't have a debootstrap file but
|
||||||
# should work nevertheless.
|
# should work nevertheless.
|
||||||
if distro not in self._debian_distros:
|
if distro not in self._debian_distros:
|
||||||
answer = YesNoQuestion().ask(
|
question = ('Warning: Unknown distribution "%s". '
|
||||||
'Warning: Unknown distribution "%s". '
|
'Do you want to continue' % distro)
|
||||||
'Do you want to continue' % distro, 'no')
|
answer = YesNoQuestion().ask(question, 'no')
|
||||||
if answer == 'yes':
|
if answer == 'yes':
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
else:
|
else:
|
||||||
@ -180,7 +179,7 @@ class PbuilderDist:
|
|||||||
self.operation = operation
|
self.operation = operation
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def get_command(self, remaining_arguments = None):
|
def get_command(self, remaining_arguments=None):
|
||||||
""" PbuilderDist.get_command -> string
|
""" PbuilderDist.get_command -> string
|
||||||
|
|
||||||
Generate the pbuilder command which matches the given configuration
|
Generate the pbuilder command which matches the given configuration
|
||||||
@ -255,8 +254,8 @@ class PbuilderDist:
|
|||||||
mirror = os.environ.get('MIRRORSITE',
|
mirror = os.environ.get('MIRRORSITE',
|
||||||
config.get_value('UBUNTU_MIRROR'))
|
config.get_value('UBUNTU_MIRROR'))
|
||||||
if self.build_architecture not in ('amd64', 'i386'):
|
if self.build_architecture not in ('amd64', 'i386'):
|
||||||
mirror = os.environ.get('MIRRORSITE',
|
mirror = os.environ.get(
|
||||||
config.get_value('UBUNTU_PORTS_MIRROR'))
|
'MIRRORSITE', config.get_value('UBUNTU_PORTS_MIRROR'))
|
||||||
components = 'main restricted'
|
components = 'main restricted'
|
||||||
if self.extra_components:
|
if self.extra_components:
|
||||||
components += ' universe multiverse'
|
components += ' universe multiverse'
|
||||||
@ -269,8 +268,8 @@ class PbuilderDist:
|
|||||||
try:
|
try:
|
||||||
codename = debian_info.codename(self.target_distro,
|
codename = debian_info.codename(self.target_distro,
|
||||||
default=self.target_distro)
|
default=self.target_distro)
|
||||||
except DistroDataOutdated, e:
|
except DistroDataOutdated, error:
|
||||||
Logger.warn(e)
|
Logger.warn(error)
|
||||||
if codename in (debian_info.devel(), 'experimental'):
|
if codename in (debian_info.devel(), 'experimental'):
|
||||||
self.enable_security = False
|
self.enable_security = False
|
||||||
self.enable_updates = False
|
self.enable_updates = False
|
||||||
@ -291,8 +290,8 @@ class PbuilderDist:
|
|||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
dev_release = self.target_distro == UbuntuDistroInfo().devel()
|
dev_release = self.target_distro == UbuntuDistroInfo().devel()
|
||||||
except DistroDataOutdated, e:
|
except DistroDataOutdated, error:
|
||||||
Logger.warn(e)
|
Logger.warn(error)
|
||||||
dev_release = True
|
dev_release = True
|
||||||
|
|
||||||
if dev_release:
|
if dev_release:
|
||||||
@ -366,7 +365,8 @@ class PbuilderDist:
|
|||||||
self.builder,
|
self.builder,
|
||||||
] + arguments
|
] + arguments
|
||||||
|
|
||||||
def show_help(exit_code = 0):
|
|
||||||
|
def show_help(exit_code=0):
|
||||||
""" help() -> None
|
""" help() -> None
|
||||||
|
|
||||||
Print a help message for pbuilder-dist, and exit with the given code.
|
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)
|
sys.exit(exit_code)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
""" main() -> None
|
""" main() -> None
|
||||||
|
|
||||||
@ -412,9 +413,9 @@ def main():
|
|||||||
if len(parts) > 2:
|
if len(parts) > 2:
|
||||||
requested_arch = parts[2]
|
requested_arch = parts[2]
|
||||||
elif len(args) > 0 and args[0] in (
|
elif len(args) > 0 and args[0] in (
|
||||||
'alpha', 'amd64', 'arm', 'armeb', 'armel', 'armhf', 'arm64', 'i386', 'lpia',
|
'alpha', 'amd64', 'arm', 'armeb', 'armel', 'armhf', 'arm64',
|
||||||
'm68k', 'mips', 'mipsel', 'powerpc', 'ppc64', 'ppc64el', 'sh4', 'sh4eb',
|
'i386', 'lpia', 'm68k', 'mips', 'mipsel', 'powerpc', 'ppc64',
|
||||||
'sparc', 'sparc64'):
|
'ppc64el', 'sh4', 'sh4eb', 'sparc', 'sparc64'):
|
||||||
requested_arch = args.pop(0)
|
requested_arch = args.pop(0)
|
||||||
else:
|
else:
|
||||||
requested_arch = None
|
requested_arch = None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user