diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2011-10-21 09:13:58 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2011-10-21 09:13:58 +0200 |
| commit | 8ca5779cfe930f8a423969f7266949ab2826cede (patch) | |
| tree | 44918730b1f9f5a567ac89f15ab661ae7be1e1a9 /aptsources/distinfo.py | |
| parent | 50756e0efb5081d3379fa874ca41ab57bdf2798d (diff) | |
| parent | 52097d7edaa97379a4a604be4feb24e5e9c3bd73 (diff) | |
| download | python-apt-8ca5779cfe930f8a423969f7266949ab2826cede.tar.gz | |
merged from the debian-sid branch
Diffstat (limited to 'aptsources/distinfo.py')
| -rw-r--r-- | aptsources/distinfo.py | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/aptsources/distinfo.py b/aptsources/distinfo.py index b21e95b3..c8ec5c46 100644 --- a/aptsources/distinfo.py +++ b/aptsources/distinfo.py @@ -22,11 +22,11 @@ # USA import errno +import logging import os import gettext from os import getenv from subprocess import Popen, PIPE -import ConfigParser import re import apt_pkg @@ -173,9 +173,9 @@ class DistInfo(object): try: dist = Popen(["lsb_release", "-i", "-s"], stdout=PIPE).communicate()[0].strip() - except OSError, exc: + except OSError as exc: if exc.errno != errno.ENOENT: - print 'WARNING: lsb_release failed, using defaults:', exc + logging.warn('lsb_release failed, using defaults:' % exc) dist = "Debian" self.dist = dist @@ -184,9 +184,6 @@ class DistInfo(object): dist_fname = "%s/%s.info" % (base_dir, dist) with open(dist_fname) as dist_file: - - - template = None component = None for line in dist_file: @@ -299,17 +296,17 @@ class DistInfo(object): if __name__ == "__main__": d = DistInfo("Ubuntu", "/usr/share/python-apt/templates") - print d.changelogs_uri + logging.info(d.changelogs_uri) for template in d.templates: - print "\nSuite: %s" % template.name - print "Desc: %s" % template.description - print "BaseURI: %s" % template.base_uri - print "MatchURI: %s" % template.match_uri + logging.info("\nSuite: %s" % template.name) + logging.info("Desc: %s" % template.description) + logging.info("BaseURI: %s" % template.base_uri) + logging.info("MatchURI: %s" % template.match_uri) if template.mirror_set != {}: - print "Mirrors: %s" % template.mirror_set.keys() + logging.info("Mirrors: %s" % template.mirror_set.keys()) for comp in template.components: - print " %s -%s -%s" % (comp.name, - comp.description, - comp.description_long) + logging.info(" %s -%s -%s" % (comp.name, + comp.description, + comp.description_long)) for child in template.children: - print " %s" % child.description + logging.info(" %s" % child.description) |
