diff options
Diffstat (limited to 'aptsources')
| -rw-r--r-- | aptsources/distinfo.py | 3 | ||||
| -rw-r--r-- | aptsources/distro.py | 8 | ||||
| -rw-r--r-- | aptsources/sourceslist.py | 2 |
3 files changed, 9 insertions, 4 deletions
diff --git a/aptsources/distinfo.py b/aptsources/distinfo.py index e0ee915d..d80721e5 100644 --- a/aptsources/distinfo.py +++ b/aptsources/distinfo.py @@ -172,7 +172,8 @@ class DistInfo(object): stdout=PIPE).communicate()[0].strip() except OSError as exc: if exc.errno != errno.ENOENT: - logging.warn('lsb_release failed, using defaults:' % exc) + logging.warning( + 'lsb_release failed, using defaults:' % exc) dist = "Debian" self.dist = dist diff --git a/aptsources/distro.py b/aptsources/distro.py index 15b93823..e9facbfb 100644 --- a/aptsources/distro.py +++ b/aptsources/distro.py @@ -164,7 +164,11 @@ class Distribution(object): fname = "/usr/share/xml/iso-codes/iso_3166.xml" if os.path.exists(fname): et = ElementTree(file=fname) - it = et.getiterator('iso_3166_entry') + # python2.6 compat, the next two lines can get removed + # once we do not use py2.6 anymore + if getattr(et, "iter", None) is None: + et.iter = et.getiterator + it = et.iter('iso_3166_entry') for elm in it: try: descr = elm.attrib["common_name"] @@ -466,7 +470,7 @@ def _lsb_release(): result.update(l.split(":\t") for l in out.split("\n") if ':\t' in l) except OSError as exc: if exc.errno != errno.ENOENT: - logging.warn('lsb_release failed, using defaults:' % exc) + logging.warning('lsb_release failed, using defaults:' % exc) return result diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py index 40902d84..f5a86ecb 100644 --- a/aptsources/sourceslist.py +++ b/aptsources/sourceslist.py @@ -375,7 +375,7 @@ class SourcesList(object): source = SourceEntry(line, file) self.list.append(source) except: - logging.warn("could not open file '%s'\n" % file) + logging.warning("could not open file '%s'\n" % file) def save(self): """ save the current sources """ |
