summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <egon@debian-devbox>2013-03-13 18:36:17 +0100
committerMichael Vogt <egon@debian-devbox>2013-03-13 18:36:17 +0100
commit6c4a6388831e4c9a158f626b94634bddad819592 (patch)
treead9b07a4db047954febfa392729b02e167a331d3
parent610c1592a0118483651e66d12eea51df0624ebc1 (diff)
downloadpython-apt-6c4a6388831e4c9a158f626b94634bddad819592.tar.gz
python2.6 compat fixes
-rw-r--r--aptsources/distro.py4
-rw-r--r--tests/test_all.py9
2 files changed, 12 insertions, 1 deletions
diff --git a/aptsources/distro.py b/aptsources/distro.py
index 1c9daa27..108a3012 100644
--- a/aptsources/distro.py
+++ b/aptsources/distro.py
@@ -163,6 +163,10 @@ class Distribution(object):
fname = "/usr/share/xml/iso-codes/iso_3166.xml"
if os.path.exists(fname):
et = ElementTree(file=fname)
+ # 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:
diff --git a/tests/test_all.py b/tests/test_all.py
index 0eccfa91..25774617 100644
--- a/tests/test_all.py
+++ b/tests/test_all.py
@@ -6,9 +6,16 @@
# notice and this notice are preserved.
"""Run all available unit tests."""
import os
-import unittest
import sys
+try:
+ import unittest.runner
+ import unittest
+except ImportError:
+ # py2.6 compat
+ import unittest2 as unittest
+
+
# workaround for py3.2 that apparently does not have this anymore
# it has "abiflags"
if not hasattr(sys, "pydebug"):