Add fallback in ImportError for io.StringIO. This is needed for python-2.6
authorZac Medico <zmedico@gentoo.org>
Sun, 20 Sep 2009 22:45:32 +0000 (22:45 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 20 Sep 2009 22:45:32 +0000 (22:45 -0000)
with USE=build since io imports threading which imports thread which is
unavailable.

svn path=/main/trunk/; revision=14304

pym/_emerge/JobStatusDisplay.py
pym/portage/util.py

index 7cf3607fb2d6b09b1f6094aa06cec721b7aca04c..f543d00bb2f0b39c88d0849621042c880d99279e 100644 (file)
@@ -5,7 +5,13 @@
 import formatter
 import sys
 import time
-from io import StringIO
+try:
+       from io import StringIO
+except ImportError:
+       # Needed for python-2.6 with USE=build since
+       # io imports threading which imports thread
+       # which is unavailable.
+       from StringIO import StringIO
 
 import portage
 from portage import os
index 1401febaeed1cf5b8821e34de443a36757c38357..a85948962f7fd5980ea472939a60a29616e6e000 100644 (file)
@@ -24,7 +24,13 @@ import shlex
 import stat
 import string
 import sys
-from io import StringIO
+try:
+       from io import StringIO
+except ImportError:
+       # Needed for python-2.6 with USE=build since
+       # io imports threading which imports thread
+       # which is unavailable.
+       from StringIO import StringIO
 
 import portage
 from portage import os