diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2011-10-19 18:07:20 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2011-10-19 18:07:20 +0200 |
| commit | 46885bf24dc2cf9b3986abcf40c040e20566402a (patch) | |
| tree | 1471609c09a6c27624651d179a97e39939f0c747 /aptsources/sourceslist.py | |
| parent | 3c35eb3da332cf30781dba78ed777b26934136ac (diff) | |
| parent | b0995cca556668a4eced03e40e3edbc7362c2a10 (diff) | |
| download | python-apt-46885bf24dc2cf9b3986abcf40c040e20566402a.tar.gz | |
* merged from ubuntu:
- use logging instead of print
- update distro template Ubuntu.info.in
- add xz compression support
Diffstat (limited to 'aptsources/sourceslist.py')
| -rw-r--r-- | aptsources/sourceslist.py | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py index 353cce2d..40a0379b 100644 --- a/aptsources/sourceslist.py +++ b/aptsources/sourceslist.py @@ -25,6 +25,7 @@ import gettext import glob +import logging import os.path import re import shutil @@ -32,7 +33,7 @@ import sys import time import apt_pkg -from aptsources.distinfo import DistInfo +from distinfo import DistInfo from apt.deprecation import function_deprecated_by @@ -373,7 +374,7 @@ class SourcesList(object): source = SourceEntry(line, file) self.list.append(source) except: - print "could not open file '%s'" % file + logging.warn("could not open file '%s'\n" % file) def save(self): """ save the current sources """ @@ -449,7 +450,10 @@ class SourceEntryMatcher(object): found = False for template in self.templates: if (re.search(template.match_uri, source.uri) and - re.match(template.match_name, source.dist)): + re.match(template.match_name, source.dist) and + # deb is a valid fallback for deb-src (if that is not + # definied, see #760035 + (source.type == template.type or template.type == "deb")): found = True source.template = template break @@ -467,14 +471,14 @@ if __name__ == "__main__": sources = SourcesList() for entry in sources: - print entry.str() + logging.info("entry %s" % entry.str()) #print entry.uri mirror = is_mirror("http://archive.ubuntu.com/ubuntu/", "http://de.archive.ubuntu.com/ubuntu/") - print "is_mirror(): %s" % mirror + logging.info("is_mirror(): %s" % mirror) - print is_mirror("http://archive.ubuntu.com/ubuntu", - "http://de.archive.ubuntu.com/ubuntu/") - print is_mirror("http://archive.ubuntu.com/ubuntu/", - "http://de.archive.ubuntu.com/ubuntu") + logging.info(is_mirror("http://archive.ubuntu.com/ubuntu", + "http://de.archive.ubuntu.com/ubuntu/")) + logging.info(is_mirror("http://archive.ubuntu.com/ubuntu/", + "http://de.archive.ubuntu.com/ubuntu")) |
