Merge lp:~alan-griffiths/miral/try-python3-pil into lp:miral

Proposed by Alan Griffiths
Status: Merged
Approved by: Gerry Boland
Approved revision: 584
Merged at revision: 579
Proposed branch: lp:~alan-griffiths/miral/try-python3-pil
Merge into: lp:miral
Diff against target: 197 lines (+31/-31)
5 files modified
cmake/FindPIL.cmake (+1/-1)
debian/control (+1/-1)
miral-shell/spinner/CMakeLists.txt (+1/-1)
miral-shell/spinner/png2header.py (+12/-12)
scripts/process_doxygen_xml.py (+16/-16)
To merge this branch: bzr merge lp:~alan-griffiths/miral/try-python3-pil
Reviewer Review Type Date Requested Status
Gerry Boland (community) Approve
Mir CI Bot continuous-integration Approve
Review via email: mp+329438@code.launchpad.net

Commit message

Migrate to python3

Description of the change

Migrate to python3

This is a good idea anyway, but especially as using pil on python2 breaks on armhf. (As I found when trying to merge MirAL into Mir!)

To post a comment you must log in.
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
579. By Alan Griffiths

Try incantation used by USC

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
580. By Alan Griffiths

Try incantations used by USC

581. By Alan Griffiths

Try incantations used by USC

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
582. By Alan Griffiths

Convert script to python3

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:582
https://mir-jenkins.ubuntu.com/job/miral-ci/69/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-miral/112
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5114
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5103
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5103
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5103
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=artful/116
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=artful/116/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=xenial/116
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=xenial/116/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=zesty/116
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=zesty/116/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=artful/116
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=artful/116/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=xenial/116
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=xenial/116/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=zesty/116
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=zesty/116/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/miral-ci/69/rebuild

review: Approve (continuous-integration)
583. By Alan Griffiths

2to3 scripts/process_doxygen_xml.py

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:583
https://mir-jenkins.ubuntu.com/job/miral-ci/70/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-miral/113
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5116
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5105
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5105
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5105
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=artful/117
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=artful/117/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=xenial/117
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=xenial/117/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=zesty/117
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=zesty/117/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=artful/117
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=artful/117/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=xenial/117
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=xenial/117/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=zesty/117
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=zesty/117/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/miral-ci/70/rebuild

review: Approve (continuous-integration)
584. By Alan Griffiths

Remove unnecessary build dep

Revision history for this message
Mir CI Bot (mir-ci-bot) wrote :

PASSED: Continuous integration, rev:584
https://mir-jenkins.ubuntu.com/job/miral-ci/71/
Executed test runs:
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-miral/114
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-0-fetch/5119
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=artful/5108
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/5108
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-1-sourcepkg/release=zesty/5108
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=artful/118
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=artful/118/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=xenial/118
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=xenial/118/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=zesty/118
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=amd64,release=zesty/118/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=artful/118
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=artful/118/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=xenial/118
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=xenial/118/artifact/output/*zip*/output.zip
    SUCCESS: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=zesty/118
        deb: https://mir-jenkins.ubuntu.com/job/build-2-binpkg-miral/arch=i386,release=zesty/118/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://mir-jenkins.ubuntu.com/job/miral-ci/71/rebuild

review: Approve (continuous-integration)
Revision history for this message
Gerry Boland (gerboland) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmake/FindPIL.cmake'
2--- cmake/FindPIL.cmake 2016-04-08 16:32:03 +0000
3+++ cmake/FindPIL.cmake 2017-08-23 15:36:18 +0000
4@@ -1,5 +1,5 @@
5 execute_process(
6- COMMAND python -c "from PIL import Image"
7+ COMMAND python3 -c "from PIL import Image"
8 RESULT_VARIABLE HAVE_PIL
9 )
10
11
12=== modified file 'debian/control'
13--- debian/control 2017-06-16 11:20:59 +0000
14+++ debian/control 2017-08-23 15:36:18 +0000
15@@ -11,9 +11,9 @@
16 xsltproc,
17 graphviz,
18 pkg-config,
19- python-pil,
20 google-mock (>= 1.6.0+svn437),
21 python3:any,
22+ python3-pil,
23 libmirserver-dev (>= 0.26),
24 libmirclient-dev (>= 0.26),
25 mirtest-dev (>= 0.26),
26
27=== modified file 'miral-shell/spinner/CMakeLists.txt'
28--- miral-shell/spinner/CMakeLists.txt 2017-04-28 09:07:43 +0000
29+++ miral-shell/spinner/CMakeLists.txt 2017-08-23 15:36:18 +0000
30@@ -24,7 +24,7 @@
31 function(png2header png header varname)
32 add_custom_command(
33 OUTPUT ${header}
34- COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/png2header.py ${png} ${varname} > ${header}
35+ COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/png2header.py ${png} ${varname} > ${header}
36 DEPENDS ${png} ${CMAKE_CURRENT_SOURCE_DIR}/png2header.py
37 )
38 endfunction()
39
40=== modified file 'miral-shell/spinner/png2header.py'
41--- miral-shell/spinner/png2header.py 2017-08-10 16:59:22 +0000
42+++ miral-shell/spinner/png2header.py 2017-08-23 15:36:18 +0000
43@@ -37,7 +37,7 @@
44 if line_chars == 0:
45 result += ' "'
46
47- s = '\\%o' % ord(c)
48+ s = '\\%o' % c
49 result += s
50 line_chars += len(s)
51
52@@ -60,19 +60,19 @@
53
54 def export(image, variable_name):
55 image_info = (image.size[0], image.size[1], bytes_per_pixel(image))
56- print "static const struct {"
57- print " unsigned int width;"
58- print " unsigned int height;"
59- print " unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */"
60- print " unsigned char pixel_data[%d * %d * %d + 1];" % image_info
61- print "} %s = {" % variable_name
62- print " %d, %d, %d," % image_info
63- print tocstring(image.tobytes())
64- print "};"
65+ print("static const struct {")
66+ print(" unsigned int width;")
67+ print(" unsigned int height;")
68+ print(" unsigned int bytes_per_pixel; /* 3:RGB, 4:RGBA */")
69+ print(" unsigned char pixel_data[%d * %d * %d + 1];" % image_info)
70+ print("} %s = {" % variable_name)
71+ print(" %d, %d, %d," % image_info)
72+ print(tocstring(image.tobytes()))
73+ print("};")
74
75 def show_usage():
76- print >>sys.stderr, "Usage: ./png2header.py PNGFILE VARNAME > HEADER_FILE"
77- print >>sys.stderr, "Convert a PNG image to an embeddable C/C++ header file"
78+ print("Usage: ./png2header.py PNGFILE VARNAME > HEADER_FILE", file=sys.stderr)
79+ print("Convert a PNG image to an embeddable C/C++ header file", file=sys.stderr)
80
81 if len(sys.argv) < 3:
82 show_usage()
83
84=== modified file 'scripts/process_doxygen_xml.py'
85--- scripts/process_doxygen_xml.py 2017-07-12 13:24:16 +0000
86+++ scripts/process_doxygen_xml.py 2017-08-23 15:36:18 +0000
87@@ -32,7 +32,7 @@
88 if node.nodeType == node.ELEMENT_NODE and node.tagName == 'location':
89 return node.attributes['file'].value
90 if DEBUG:
91- print 'no location in:', node
92+ print('no location in:', node)
93 return None
94
95 def _has_element(node, tagname):
96@@ -43,7 +43,7 @@
97
98 def _print_attribs(node, attribs):
99 for attrib in attribs:
100- print ' ', attrib, '=', node.attributes[attrib].value
101+ print(' ', attrib, '=', node.attributes[attrib].value)
102
103 def _concat_text_from_tags(parent, tagnames):
104 substrings = []
105@@ -54,7 +54,7 @@
106 return ''.join(substrings)
107
108 def _print_location(node):
109- print ' ', 'location', '=', _get_file_location(node)
110+ print(' ', 'location', '=', _get_file_location(node))
111
112 def _get_attribs(node):
113 kind = node.attributes['kind'].value
114@@ -77,9 +77,9 @@
115 return
116
117 if publish:
118- print ' PUBLISH: {}'.format(symbol)
119+ print(' PUBLISH: {}'.format(symbol))
120 else:
121- print 'NOPUBLISH: {}'.format(symbol)
122+ print('NOPUBLISH: {}'.format(symbol))
123
124 OLD_STANZAS = '''MIRAL_1.0 {
125 global:
126@@ -514,17 +514,17 @@
127 } MIRAL_1.4.0;'''
128
129 def _print_report():
130- print OLD_STANZAS
131+ print(OLD_STANZAS)
132 for symbol in sorted(SYMBOLS['public']):
133 formatted_symbol = ' {};'.format(symbol)
134 if formatted_symbol not in OLD_STANZAS and 'mir::client::' not in formatted_symbol:
135- print formatted_symbol
136- print END_NEW_STANZA
137+ print(formatted_symbol)
138+ print(END_NEW_STANZA)
139
140 def _print_debug_info(node, attributes):
141 if not DEBUG:
142 return
143- print
144+ print()
145 _print_attribs(node, attributes)
146 _print_location(node)
147
148@@ -540,7 +540,7 @@
149
150 if name in ['__attribute__']:
151 if DEBUG:
152- print ' ignoring doxygen mis-parsing:', _concat_text_from_tags(node, ['argsstring'])
153+ print(' ignoring doxygen mis-parsing:', _concat_text_from_tags(node, ['argsstring']))
154 return
155
156 if name.startswith('operator'):
157@@ -559,7 +559,7 @@
158 _print_debug_info(node, ['kind', 'prot', 'static'])
159
160 if DEBUG:
161- print ' is_class:', is_class
162+ print(' is_class:', is_class)
163
164 publish = _should_publish(is_class, is_function, node)
165
166@@ -614,7 +614,7 @@
167 filename = _get_file_location(node)
168
169 if DEBUG:
170- print ' from file:', filename
171+ print(' from file:', filename)
172
173 if ('/examples/' in filename or '/test/' in filename or '[generated]' in filename
174 or '[STL]' in filename or _has_element(node, ['templateparamlist'])):
175@@ -638,18 +638,18 @@
176
177 if __name__ == "__main__":
178 if len(argv) == 1 or '-h' in argv or '--help' in argv:
179- print HELPTEXT
180+ print(HELPTEXT)
181 exit()
182
183 for arg in argv[1:]:
184 try:
185 if DEBUG:
186- print 'Processing:', arg
187+ print('Processing:', arg)
188 _parse_compound_defs(minidom.parse(arg))
189 except Exception as error:
190- print 'Error:', arg, error
191+ print('Error:', arg, error)
192
193 if DEBUG:
194- print 'Processing complete'
195+ print('Processing complete')
196
197 _print_report()

Subscribers

People subscribed via source and target branches