[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH v1] tools/python: Add python3 compatibility



On Tue, Oct 10, 2023 at 03:18:45PM +0100, Javi Merino wrote:
> Most of the work for python3 compatibility was done in
> 1430c5a8cad4 (tools/python: Python 3 compatibility, 2019-12-18).  This
> just adds a few builtins needed for python3.
> 
> Resolves: xen-project/xen#156
> 
> Signed-off-by: Javi Merino <javi.merino@xxxxxxxxx>
> ---
> 
> I haven't tested it.
> 
>  README                                     | 1 +
>  tools/python/scripts/convert-legacy-stream | 3 +++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/README b/README
> index 855db01d36..44ed88c392 100644
> --- a/README
> +++ b/README
> @@ -51,6 +51,7 @@ provided by your OS distributor:
>      * POSIX compatible awk
>      * Development install of zlib (e.g., zlib-dev)
>      * Development install of Python 2.7 or later (e.g., python-dev)
> +      - If using Python 2.7, you also need the future module.  This is not 
> needed for Python 3.
>      * Development install of curses (e.g., libncurses-dev)
>      * Development install of openssl (e.g., openssl-dev)
>      * Development install of x11 (e.g. xorg-x11-dev)
> diff --git a/tools/python/scripts/convert-legacy-stream 
> b/tools/python/scripts/convert-legacy-stream
> index 7fe375a668..26a66c50fc 100755
> --- a/tools/python/scripts/convert-legacy-stream
> +++ b/tools/python/scripts/convert-legacy-stream
> @@ -8,6 +8,9 @@ Convert a legacy migration stream to a v2 stream.
>  from __future__ import print_function
>  from __future__ import division
>  
> +from builtins import zip
> +from builtins import range
> +from builtins import object

In which python version it's needed? The thing about builtins is they
are available without explicit import.

>  import sys
>  import os, os.path
>  import syslog
> -- 
> 2.42.0
> 

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab

Attachment: signature.asc
Description: PGP signature


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.