diff mbox series

[PULL,v2,01/57] docker: docker.py wrap StringIO import for python3

Message ID 20180621062605.941-2-alex.bennee@linaro.org
State New
Headers show
Series [PULL,v2,01/57] docker: docker.py wrap StringIO import for python3 | expand

Commit Message

Alex Bennée June 21, 2018, 6:25 a.m. UTC
Although the docker.py is nominally python2 we actually invoke it with
the configured python from the configure script.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Comments

Peter Maydell June 21, 2018, 8:49 a.m. UTC | #1
On 21 June 2018 at 07:25, Alex Bennée <alex.bennee@linaro.org> wrote:
> Although the docker.py is nominally python2 we actually invoke it with
> the configured python from the configure script.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>
> diff --git a/tests/docker/docker.py b/tests/docker/docker.py
> index 306e14cf69..e4095270eb 100755
> --- a/tests/docker/docker.py
> +++ b/tests/docker/docker.py
> @@ -26,7 +26,10 @@ import tempfile
>  import re
>  import signal
>  from tarfile import TarFile, TarInfo
> -from StringIO import StringIO
> +try:
> +    from StringIO import StringIO
> +except ImportError:
> +    from io import StringIO
>  from shutil import copy, rmtree
>  from pwd import getpwuid

This is fairly trivial, but it is a new unreviewed patch:
would one of the python experts like to review it ?

thanks
-- PMM
Daniel P. Berrangé June 21, 2018, 9:13 a.m. UTC | #2
On Thu, Jun 21, 2018 at 09:49:55AM +0100, Peter Maydell wrote:
> On 21 June 2018 at 07:25, Alex Bennée <alex.bennee@linaro.org> wrote:
> > Although the docker.py is nominally python2 we actually invoke it with
> > the configured python from the configure script.
> >
> > Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> >
> > diff --git a/tests/docker/docker.py b/tests/docker/docker.py
> > index 306e14cf69..e4095270eb 100755
> > --- a/tests/docker/docker.py
> > +++ b/tests/docker/docker.py
> > @@ -26,7 +26,10 @@ import tempfile
> >  import re
> >  import signal
> >  from tarfile import TarFile, TarInfo
> > -from StringIO import StringIO
> > +try:
> > +    from StringIO import StringIO
> > +except ImportError:
> > +    from io import StringIO
> >  from shutil import copy, rmtree
> >  from pwd import getpwuid
> 
> This is fairly trivial, but it is a new unreviewed patch:
> would one of the python experts like to review it ?

Yes, this is the normal fix for this particular scenario.

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
diff mbox series

Patch

diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index 306e14cf69..e4095270eb 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -26,7 +26,10 @@  import tempfile
 import re
 import signal
 from tarfile import TarFile, TarInfo
-from StringIO import StringIO
+try:
+    from StringIO import StringIO
+except ImportError:
+    from io import StringIO
 from shutil import copy, rmtree
 from pwd import getpwuid