[elbe-devel] [PATCH v2 09/24] rpcaptcache: ValueError is not derived from BaseException
Torben Hohn
torben.hohn at linutronix.de
Thu Feb 8 15:15:05 CET 2018
On Thu, Feb 08, 2018 at 02:16:55PM +0100, Manuel Traut wrote:
> autopep8 cleanup in commit 068507337aaa0fb32ee3ca7d1e410884d0b253ff
> changed 'except:' into 'except BaseException'. However the ValueError that might
> occur here is not derived from BaseException.
>
> Change the code to use a set instead of a list. That enables handling
> the element removal without exceptions at all.
>
> Signed-off-by: Manuel Traut <manut at linutronix.de>
Reviewed-by: Torben Hohn <torben.hohn at linutronix.de>
> ---
> elbepack/elbeproject.py | 4 ++--
> elbepack/rpcaptcache.py | 13 +++----------
> 2 files changed, 5 insertions(+), 12 deletions(-)
>
> diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
> index 986d08c5..c7b7b2df 100644
> --- a/elbepack/elbeproject.py
> +++ b/elbepack/elbeproject.py
> @@ -194,8 +194,8 @@ class ElbeProject (object):
> raise AptCacheUpdateError(e)
>
> try:
> - self.get_rpcaptcache().mark_install_devpkgs(ignore_pkgs,
> - ignore_dev_pkgs)
> + self.get_rpcaptcache().mark_install_devpkgs(set(ignore_pkgs),
> + set(ignore_dev_pkgs))
> except SystemError as e:
> self.log.printo("mark install devpkgs failed: %s" % str(e))
> try:
> diff --git a/elbepack/rpcaptcache.py b/elbepack/rpcaptcache.py
> index eb485cee..8577abed 100644
> --- a/elbepack/rpcaptcache.py
> +++ b/elbepack/rpcaptcache.py
> @@ -112,16 +112,9 @@ class RPCAPTCache(InChRootObject):
> from_user=from_user)
>
> def mark_install_devpkgs(self, ignore_pkgs, ignore_dev_pkgs):
> - ignore_pkgs.remove('libc6') # we don't want to ignore libc
> - # we don't want to ignore libstdc++
> - try:
> - ignore_pkgs.remove('libstdc++5')
> - except BaseException:
> - pass
> - try:
> - ignore_pkgs.remove('libstdc++6')
> - except BaseException:
> - pass
> + ignore_pkgs.discard('libc6') # we don't want to ignore libc
> + ignore_pkgs.discard('libstdc++5')
> + ignore_pkgs.discard('libstdc++6')
> # list all debian src packages of all installed packages that don't
> # come from debootstrap
> src_list = [
> --
> 2.15.1
>
--
Mit freundlichen Grüßen
Torben Hohn
Linutronix GmbH
Standort: Bremen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99
Firmensitz / Registered Office: D-88690 Uhldingen, Bahnhofstr. 3
Registergericht / Local District Court: Amtsgericht Freiburg i. Br.; HRB
Nr. / Trade register no.: 700 806
Geschäftsführer / Managing Directors: Heinz Egger, Thomas Gleixner
Eine Bitte von uns: Sollten Sie diese E-Mail irrtümlich erhalten haben,
benachrichtigen Sie uns in diesem Falle bitte sobald wie es Ihnen
möglich ist, durch Antwort-Mail. Vielen Dank!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.linutronix.de/pipermail/elbe-devel/attachments/20180208/2220eba0/attachment.sig>
More information about the elbe-devel
mailing list