From b8ffb0f04605e6c11c3d452e42ce15d303e48f68 Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Fri, 29 Jan 2021 11:58:09 +0100 Subject: [PATCH] Delete entry in __init__.py only if it exists --- pyext/ctools/__init__.py.in | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pyext/ctools/__init__.py.in b/pyext/ctools/__init__.py.in index 6973fa3..e6c4661 100755 --- a/pyext/ctools/__init__.py.in +++ b/pyext/ctools/__init__.py.in @@ -1,7 +1,7 @@ # ========================================================================== # ctools Python module # -# Copyright (C) 2015-2016 Juergen Knoedlseder +# Copyright (C) 2015-2021 Juergen Knoedlseder # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -26,14 +26,15 @@ from @PYTHON_RELATIVE_IMPORT@tools import * # Remove swig register stuff bad_entries = [entry for entry in list(locals()) if entry.endswith('_swigregister')] -for entry in bad_entries: - del locals()[entry] +if len(bad_entries) > 0: + for entry in bad_entries: + del locals()[entry] + del entry # Clean-up del tools del gammalib del bad_entries -del entry # Add version __version__ = '@PACKAGE_VERSION@' -- libgit2 0.21.4