From 0d0999b909b3c064455918461831b1911761a214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20O=C5=BCarowski?= <piotr@debian.org> Date: Fri, 23 Sep 2011 23:11:00 +0200 Subject: [PATCH] avoid catching KeyboardInterrupt --- debpython/namespace.py | 2 +- debpython/option.py | 2 +- debpython/tools.py | 6 +++--- debpython/version.py | 4 ++-- dh_python2 | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/debpython/namespace.py b/debpython/namespace.py index ecee720..9c61a96 100644 --- a/debpython/namespace.py +++ b/debpython/namespace.py @@ -91,7 +91,7 @@ def add_namespace_files(files, package=None, action=None): if action is True: try: open(fpath, 'a').close() - except: + except Exception: log.error('cannot create %s', fpath) else: yield fpath diff --git a/debpython/option.py b/debpython/option.py index 116f807..d243413 100644 --- a/debpython/option.py +++ b/debpython/option.py @@ -35,7 +35,7 @@ def parse_version_range(option, opt, value): def compile_regexpr(option, opt, value): try: pattern = re.compile(value) - except: + except Exception: raise optparse.OptionValueError('regular expression is not valid') return pattern diff --git a/debpython/tools.py b/debpython/tools.py index ca6ca59..78979f6 100644 --- a/debpython/tools.py +++ b/debpython/tools.py @@ -198,19 +198,19 @@ def pyinstall(package, vrange): if not exists(dstdir): try: os.makedirs(dstdir) - except: + except Exception: log.error('cannot create %s directory', dstdir) return False if exists(dstfpath): try: os.remove(dstfpath) - except: + except Exception: status = False log.error('cannot replace %s file', dstfpath) continue try: os.link(fpath, dstfpath) - except: + except Exception: status = False log.error('cannot copy %s file to %s', fpath, dstdir) return status diff --git a/debpython/version.py b/debpython/version.py index 2324cca..ba287a9 100644 --- a/debpython/version.py +++ b/debpython/version.py @@ -42,13 +42,13 @@ _config.read(['/usr/share/python/debian_defaults', try: DEFAULT = tuple(int(i) for i in _config.get('DEFAULT', 'default-version')[6:].split('.')) -except: +except Exception: log.exception('cannot read debian_defaults') try: SUPPORTED = tuple(tuple(int(j) for j in i.strip()[6:].split('.'))\ for i in _config.get('DEFAULT', 'supported-versions').split(',')) -except: +except Exception: log.exception('cannot read debian_defaults') diff --git a/dh_python2 b/dh_python2 index 79a2cdd..b266aef 100755 --- a/dh_python2 +++ b/dh_python2 @@ -458,7 +458,7 @@ def scan(package, dname=None, clean_dbg_pkg=True): if '-packages/' in root and not file_names: try: os.rmdir(root) - except: + except Exception: pass log.debug("package %s details = %s", package, r) @@ -531,7 +531,7 @@ def main(): # fail now rather than at runtime try: pattern = re.compile(pattern) - except: + except Exception: log.error('regular expression is not valid: %s', pattern) exit(1) -- GitLab