diff options
author | volpino <fox91@anche.no> | 2012-09-14 11:33:57 +0200 |
---|---|---|
committer | Corentin Chary <corentin.chary@gmail.com> | 2012-10-29 13:06:02 +0100 |
commit | 60deecd8532361270bc7a212e27971fa7341589a (patch) | |
tree | f97667f7d0dbfce03aeb9599fca537e94ecd18fc /pym | |
parent | djeuscan: really fix scan on demand (diff) | |
download | euscan-60deecd8532361270bc7a212e27971fa7341589a.tar.gz euscan-60deecd8532361270bc7a212e27971fa7341589a.tar.bz2 euscan-60deecd8532361270bc7a212e27971fa7341589a.zip |
euscan: Adding support for disabling handlers
Signed-off-by: volpino <fox91@anche.no>
Diffstat (limited to 'pym')
-rw-r--r-- | pym/euscan/__init__.py | 4 | ||||
-rw-r--r-- | pym/euscan/handlers/__init__.py | 10 |
2 files changed, 10 insertions, 4 deletions
diff --git a/pym/euscan/__init__.py b/pym/euscan/__init__.py index 946c63c..49241dd 100644 --- a/pym/euscan/__init__.py +++ b/pym/euscan/__init__.py @@ -7,6 +7,7 @@ __version__ = "git" import ConfigParser import os +from ast import literal_eval CONFIG = { @@ -29,6 +30,7 @@ CONFIG = { 'ignore-pre-release': False, 'ignore-pre-release-if-stable': False, 'ebuild-uri': False, + 'handlers-exclude': [], } config = ConfigParser.ConfigParser() @@ -36,7 +38,7 @@ config.read(['/etc/euscan.conf', os.path.expanduser('~/.euscan.conf')]) if config.has_section("euscan"): for key, value in config.items("euscan"): if key in CONFIG: - CONFIG[key] = value + CONFIG[key] = literal_eval(value) BLACKLIST_VERSIONS = [ # Compatibility package for running binaries linked against a diff --git a/pym/euscan/handlers/__init__.py b/pym/euscan/handlers/__init__.py index ee4dedf..e89a0fc 100644 --- a/pym/euscan/handlers/__init__.py +++ b/pym/euscan/handlers/__init__.py @@ -37,7 +37,8 @@ def find_best_handler(kind, pkg, *args): Find the best handler for the given package """ for handler in handlers[kind]: - if handler.can_handle(pkg, *args): + if (handler.HANDLER_NAME not in CONFIG["handlers-exclude"] and + handler.can_handle(pkg, *args)): return handler return None @@ -149,8 +150,11 @@ def scan_url(pkg, urls, options, on_progress=None): try: url_handler = find_best_handler('url', pkg, url) - for o in options: - versions += url_handler.scan_url(pkg, url, o) + if url_handler: + for o in options: + versions += url_handler.scan_url(pkg, url, o) + else: + output.eerror("Can't find a suitable handler!") except Exception as e: output.ewarn( "Handler failed: [%s] %s" % |