All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] README: require Python 2.4 or newer
@ 2018-02-28 19:18 Doug Goldstein
  2018-02-28 19:18 ` [PATCH v2 2/2] xen/tools: support Python 2 and Python 3 Doug Goldstein
  2018-02-28 19:20 ` [PATCH v2 1/2] README: require Python 2.4 or newer Doug Goldstein
  0 siblings, 2 replies; 3+ messages in thread
From: Doug Goldstein @ 2018-02-28 19:18 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Wei Liu, George Dunlap, Andrew Cooper,
	Doug Goldstein, Tim Deegan, Jan Beulich, Ian Jackson

Increase the minimum required Python to 2.4 or newer.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
---
CC: Andrew Cooper <andrew.cooper3@citrix.com>
CC: George Dunlap <George.Dunlap@eu.citrix.com>
CC: Ian Jackson <ian.jackson@eu.citrix.com>
CC: Jan Beulich <jbeulich@suse.com>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Tim Deegan <tim@xen.org>
CC: Wei Liu <wei.liu2@citrix.com>
---
change from v1:
- changed from Python 2.6 to Python 2.4 based on

While the tools are broke with Python 2.4 currently there are
some scripts that people have an interest in still being able
to run with Python 2.4 so changed the documented information there.
I'm working on some updates to the Travis CI test loop (actually
switching to GitLab CI) to give us more flexibility in what is
being tested.

See
https://lists.xenproject.org/archives/html/xen-devel/2017-09/msg02389.html
for context on the build failures in tools with Python 2.4
---
 README | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README b/README
index e96cdd2862..4ed03b7fe2 100644
--- a/README
+++ b/README
@@ -46,7 +46,7 @@ provided by your OS distributor:
         - GCC 4.8 or later
         - GNU Binutils 2.24 or later
     * Development install of zlib (e.g., zlib-dev)
-    * Development install of Python v2.3 or later (e.g., python-dev)
+    * Development install of Python v2.4 or later (e.g., python-dev)
     * 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)
-- 
2.16.1


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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v2 2/2] xen/tools: support Python 2 and Python 3
  2018-02-28 19:18 [PATCH v2 1/2] README: require Python 2.4 or newer Doug Goldstein
@ 2018-02-28 19:18 ` Doug Goldstein
  2018-02-28 19:20 ` [PATCH v2 1/2] README: require Python 2.4 or newer Doug Goldstein
  1 sibling, 0 replies; 3+ messages in thread
From: Doug Goldstein @ 2018-02-28 19:18 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Wei Liu, George Dunlap, Andrew Cooper,
	Doug Goldstein, Tim Deegan, Jan Beulich, Ian Jackson

These changes should make it possible to support modern Pythons as well
as the oldest Python 2 still supported.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
---
CC: Andrew Cooper <andrew.cooper3@citrix.com>
CC: George Dunlap <George.Dunlap@eu.citrix.com>
CC: Ian Jackson <ian.jackson@eu.citrix.com>
CC: Jan Beulich <jbeulich@suse.com>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Tim Deegan <tim@xen.org>
CC: Wei Liu <wei.liu2@citrix.com>
---
changes since v1:
- switched to print() in cases where it works from Andrew Cooper
- dropped long() magic from Andrew Cooper. This is unnecessary with
  Python 2.4 and newer.
---
 xen/tools/compat-build-header.py |  2 +-
 xen/tools/compat-build-source.py |  2 +-
 xen/tools/gen-cpuid.py           | 34 ++++++++++++++++++++++++----------
 xen/tools/get-fields.sh          |  2 +-
 4 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/xen/tools/compat-build-header.py b/xen/tools/compat-build-header.py
index 32421b645b..b85c43f13f 100755
--- a/xen/tools/compat-build-header.py
+++ b/xen/tools/compat-build-header.py
@@ -23,4 +23,4 @@ pats = [
 for line in sys.stdin.readlines():
     for pat in pats:
         line = re.subn(pat[0], pat[1], line)[0]
-    print line.rstrip()
+    print(line.rstrip())
diff --git a/xen/tools/compat-build-source.py b/xen/tools/compat-build-source.py
index 595bc3ff58..c664eb85e6 100755
--- a/xen/tools/compat-build-source.py
+++ b/xen/tools/compat-build-source.py
@@ -26,4 +26,4 @@ for pat in pats:
 for line in sys.stdin.readlines():
     for pat in pats:
         line = re.sub(pat[0], pat[1], line)
-    print line.rstrip()
+    print(line.rstrip())
diff --git a/xen/tools/gen-cpuid.py b/xen/tools/gen-cpuid.py
index 613b909c3d..6359afb704 100755
--- a/xen/tools/gen-cpuid.py
+++ b/xen/tools/gen-cpuid.py
@@ -3,6 +3,10 @@
 
 import sys, os, re
 
+if (sys.version_info > (3, 0)):
+    def xrange(x):
+        return range(x)
+
 class Fail(Exception):
     pass
 
@@ -98,13 +102,13 @@ def parse_definitions(state):
 def featureset_to_uint32s(fs, nr):
     """ Represent a featureset as a list of C-compatible uint32_t's """
 
-    bitmap = 0L
+    bitmap = 0
     for f in fs:
-        bitmap |= 1L << f
+        bitmap |= 1 << f
 
     words = []
     while bitmap:
-        words.append(bitmap & ((1L << 32) - 1))
+        words.append(bitmap & ((1 << 32) - 1))
         bitmap >>= 32
 
     assert len(words) <= nr
@@ -276,8 +280,8 @@ def crunch_numbers(state):
             # To debug, uncomment the following lines:
             # def repl(l):
             #     return "[" + ", ".join((state.names[x] for x in l)) + "]"
-            # print >>sys.stderr, "Feature %s, seen %s, to_process %s " % \
-            #     (state.names[feat], repl(seen), repl(to_process))
+            # sys.stderr.write("Feature %s, seen %s, to_process %s \n" % \
+            #     (state.names[feat], repl(seen), repl(to_process)))
 
             f = to_process.pop(0)
 
@@ -293,7 +297,12 @@ def crunch_numbers(state):
     state.deep_features = featureset_to_uint32s(deps.keys(), nr_entries)
     state.nr_deep_deps = len(state.deep_deps.keys())
 
-    for k, v in state.deep_deps.iteritems():
+    try:
+        _tmp = state.deep_deps.iteritems()
+    except AttributeError:
+        _tmp = state.deep_deps.items()
+
+    for k, v in _tmp:
         state.deep_deps[k] = featureset_to_uint32s(v, nr_entries)
 
     # Calculate the bitfield name declarations
@@ -410,7 +419,8 @@ def open_file_or_fd(val, mode, buffering):
         else:
             return open(val, mode, buffering)
 
-    except StandardError, e:
+    except StandardError:
+        e = sys.exc_info()[1]
         if fd != -1:
             raise Fail("Unable to open fd %d: %s: %s" %
                        (fd, e.__class__.__name__, e))
@@ -453,10 +463,14 @@ def main():
 if __name__ == "__main__":
     try:
         sys.exit(main())
-    except Fail, e:
-        print >>sys.stderr, "%s:" % (sys.argv[0],), e
+    except Fail:
+        e = sys.exc_info()[1]
+        sys.stderr.write("%s:" % (sys.argv[0],))
+        sys.stderr.write(e)
+        sys.stderr.write("\n")
         sys.exit(1)
-    except SystemExit, e:
+    except SystemExit:
+        e = sys.exc_info()[1]
         sys.exit(e.code)
     except KeyboardInterrupt:
         sys.exit(2)
diff --git a/xen/tools/get-fields.sh b/xen/tools/get-fields.sh
index 887feec370..45a0e2ed50 100644
--- a/xen/tools/get-fields.sh
+++ b/xen/tools/get-fields.sh
@@ -139,7 +139,7 @@ handle_field ()
 		local tag=$(echo "$5" | ${PYTHON} -c '
 import re,sys
 for line in sys.stdin.readlines():
-    print re.subn(r"\s*(struct|union)\s+(compat_)?(\w+)\s.*", r"\3", line)[0].rstrip()
+    sys.stdout.write(re.subn(r"\s*(struct|union)\s+(compat_)?(\w+)\s.*", r"\3", line)[0].rstrip() + "\n")
 ')
 		echo " \\"
 		printf %s "${1}XLAT_$tag(&(_d_)->$3, &(_s_)->$3);"
-- 
2.16.1


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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 1/2] README: require Python 2.4 or newer
  2018-02-28 19:18 [PATCH v2 1/2] README: require Python 2.4 or newer Doug Goldstein
  2018-02-28 19:18 ` [PATCH v2 2/2] xen/tools: support Python 2 and Python 3 Doug Goldstein
@ 2018-02-28 19:20 ` Doug Goldstein
  1 sibling, 0 replies; 3+ messages in thread
From: Doug Goldstein @ 2018-02-28 19:20 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Wei Liu, George Dunlap, Andrew Cooper,
	Ian Jackson, Tim Deegan, Jan Beulich


[-- Attachment #1.1.1: Type: text/plain, Size: 284 bytes --]

On 2/28/18 1:18 PM, Doug Goldstein wrote:

> change from v1:
> - changed from Python 2.6 to Python 2.4 based on

Not sure what happened to my mind here....

based on feedback on the list of folks still having environments where
Python 2.4 is in use.

-- 
Doug Goldstein


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-28 19:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-28 19:18 [PATCH v2 1/2] README: require Python 2.4 or newer Doug Goldstein
2018-02-28 19:18 ` [PATCH v2 2/2] xen/tools: support Python 2 and Python 3 Doug Goldstein
2018-02-28 19:20 ` [PATCH v2 1/2] README: require Python 2.4 or newer Doug Goldstein

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.