From c9ab9c906eb0db3015f5a8e23eb995a34659c70f Mon Sep 17 00:00:00 2001 From: Chris Warrick Date: Sun, 4 Dec 2016 10:46:08 +0100 Subject: [PATCH] Various style fixes Signed-off-by: Chris Warrick --- localeprovider.py | 8 ++++---- pkgbuilder/build.py | 2 +- pkgbuilder/exceptions.py | 4 ++-- pkgbuilder/pbds.py | 5 +---- pkgbuilder/wrapper.py | 6 +++--- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/localeprovider.py b/localeprovider.py index 8b1eddd..3c024bb 100644 --- a/localeprovider.py +++ b/localeprovider.py @@ -1,5 +1,5 @@ # A module only for gettext locale provision. -translationcheat = _('usage') + - _('positional arguments') + - _('optional arguments') + - _('show this help message and exit') +translationcheat = (_('usage') + + _('positional arguments') + + _('optional arguments') + + _('show this help message and exit')) diff --git a/pkgbuilder/build.py b/pkgbuilder/build.py index 7e70a04..8df869e 100644 --- a/pkgbuilder/build.py +++ b/pkgbuilder/build.py @@ -386,7 +386,7 @@ def fetch_runner(pkgnames, preprocessed=False): if rc > 0: raise pkgbuilder.exceptions.NetworkError( _('Failed to retieve {0} (from ABS/rsync).').format( - pkg.name), pkg=pkg, retcode=rc) + pkg.name), source='rsync', pkg=pkg, retcode=rc) if aurpkgs: print(_(':: Retrieving packages from aur...')) diff --git a/pkgbuilder/exceptions.py b/pkgbuilder/exceptions.py index 17ba32f..3d43ae1 100644 --- a/pkgbuilder/exceptions.py +++ b/pkgbuilder/exceptions.py @@ -86,10 +86,10 @@ def __init__(self, msg, source, exit=True, *args, **kwargs): self.msg = msg try: self.source = source.args[0].reason - except: + except Exception: try: self.source = source.args[0] - except: + except Exception: self.source = source self._source = source self.exit = exit diff --git a/pkgbuilder/pbds.py b/pkgbuilder/pbds.py index 8cb230f..df2a0ea 100644 --- a/pkgbuilder/pbds.py +++ b/pkgbuilder/pbds.py @@ -67,10 +67,7 @@ class PBDS(object): else: paccommand = os.getenv('PACMAN') - if os.path.exists('/usr/bin/sudo'): - hassudo = True - else: - hassudo = False + hassudo = os.path.exists('/usr/bin/sudo') uid = os.geteuid() diff --git a/pkgbuilder/wrapper.py b/pkgbuilder/wrapper.py index c579fd8..68036f3 100644 --- a/pkgbuilder/wrapper.py +++ b/pkgbuilder/wrapper.py @@ -205,10 +205,10 @@ def wrapper(source='AUTO'): if k in allcountable: # == This is a countable argument. if k in allshortc: - for x in range(v): + for _i in range(v): execargs.append('-' + k) elif k in alllongc: - for x in range(v): + for _i in range(v): execargs.append('--' + k) elif v: # == This argument doesn't have a value. @@ -223,7 +223,7 @@ def wrapper(source='AUTO'): elif i[2:] in alllong + alllongc: s = i[2:] else: - raise SanityError('argparse broke') + raise SanityError('argparse broke', 'argparse') if s in allcommon: pacargs.append(i)