On 05/03/2019 16:42, Wei Liu wrote:
> Signed-off-by: Wei Liu <wei.l...@citrix.com>
> ---
> Not sure this works with python 2.4, but it should work with 2.7 since
> the changes look more or less in the same vein as the changes in
> libxl.
>
> The conversion of the import is interesting. This definitely needs
> some testing.
> ---
>  tools/pygrub/src/ExtLinuxConf.py | 16 ++++++++--------
>  tools/pygrub/src/GrubConf.py     | 36 ++++++++++++++++++------------------
>  tools/pygrub/src/LiloConf.py     | 16 ++++++++--------
>  3 files changed, 34 insertions(+), 34 deletions(-)
>
> diff --git a/tools/pygrub/src/ExtLinuxConf.py 
> b/tools/pygrub/src/ExtLinuxConf.py
> index d1789bf020..60da960c4b 100644
> --- a/tools/pygrub/src/ExtLinuxConf.py
> +++ b/tools/pygrub/src/ExtLinuxConf.py
> @@ -12,7 +12,7 @@
>  
>  import sys, re, os
>  import logging
> -import GrubConf
> +from . import GrubConf

Relative imports definitely don't exist in Py 2.4

>  
>  class ExtLinuxImage(object):
>      def __init__(self, lines, path):
> @@ -32,7 +32,7 @@ class ExtLinuxImage(object):
>          self.lines = []
>          self.path = path
>          self.root = ""
> -        map(self.set_from_line, lines)
> +        list(map(self.set_from_line, lines))

This an abuse of map() in the first place, but the automatic
transformation makes the result even more confusing.

Instead, I'd rewrite the code as

for line in lines:
    self.set_from_line(line)

which makes it clear what is actually going on.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to