[elbe-devel] [PATCH v2 09/24] rpcaptcache: ValueError is not derived from BaseException

Manuel Traut manut at linutronix.de
Thu Feb 8 14:16:55 CET 2018


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>
---
 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




More information about the elbe-devel mailing list