diff options
author | Gilles Dartiguelongue <eva@gentoo.org> | 2012-11-30 23:39:25 +0100 |
---|---|---|
committer | Gilles Dartiguelongue <eva@gentoo.org> | 2012-11-30 23:39:25 +0100 |
commit | e249199caec7e325cb8d3e37f2fefa1bbcf47844 (patch) | |
tree | 248e07372970917617caf6f7f45c8c258df2b19e | |
parent | Add gnome handler (diff) | |
download | euscan-e249199caec7e325cb8d3e37f2fefa1bbcf47844.tar.gz euscan-e249199caec7e325cb8d3e37f2fefa1bbcf47844.tar.bz2 euscan-e249199caec7e325cb8d3e37f2fefa1bbcf47844.zip |
Fix issues raised in pull request #19
* Replace print/raise by eoutput usage.
* Fix scan_url function to properly format arguments of scan_pkg.
-rw-r--r-- | pym/euscan/handlers/gnome.py | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/pym/euscan/handlers/gnome.py b/pym/euscan/handlers/gnome.py index 512f634..9836e91 100644 --- a/pym/euscan/handlers/gnome.py +++ b/pym/euscan/handlers/gnome.py @@ -34,22 +34,18 @@ def guess_package(cp, url): def scan_url(pkg, url, options): 'http://ftp.gnome.org/pub/GNOME/sources/' - package = guess_package(pkg.cpv, url) + package = { + 'data': guess_package(pkg.cpv, url), + 'type': 'gnome', + } return scan_pkg(pkg, package) def scan_pkg(pkg, options): - # For some weird reasons package with no metadata - # will fail without this hack - options = { - 'data': options, - 'type': 'gnome', - } package = options['data'] output.einfo("Using Gnome json cache: " + package) - print 'Opening', '/'.join([GNOME_URL_SOURCE, package, 'cache.json']) fp = urllib2.urlopen('/'.join([GNOME_URL_SOURCE, package, 'cache.json'])) content = fp.read() fp.close() @@ -57,12 +53,13 @@ def scan_pkg(pkg, options): cache = json.loads(content, encoding='ascii') if cache[0] != 4: - raise Exception('Unknow cache format detected') + output.eerror('Unknow cache format detected') + return [] versions = cache[2][package] if not versions: - return versions + return [] versions.reverse() @@ -80,6 +77,7 @@ def scan_pkg(pkg, options): up_files[tarball_comp]]) break else: - raise Exception('No tarball for release ' + up_pv) + output.ewarn('No tarball for release %s' % up_pv) ret.append((url, pv, HANDLER_NAME, CONFIDENCE)) + return ret |