diff options
author | Changqing Li <changqing.li@windriver.com> | 2020-03-11 16:42:05 +0800 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2020-03-11 08:58:57 -0700 |
commit | d178745cbf5c97b7cdcf274108a58c8e1f88d3ca (patch) | |
tree | ab1cf2f60e724eeecbfbf4a6c1973c4b5fee2c65 /meta-oe/dynamic-layers | |
parent | f5d2bf55a8169a9446c2f96f327b3e5d91a6e6cc (diff) | |
download | meta-openembedded-d178745cbf5c97b7cdcf274108a58c8e1f88d3ca.tar.gz |
conf/layer.conf: add BBFILES_DYNAMIC and dynamic layers
some recipes under meta-oe have dependency on meta-python,
and test_world of yocto-check-layer will failed with error
like:
ERROR: test_world (common.CommonCheckLayer)
ERROR: Nothing PROVIDES 'python3-pytoml-native' (but
/meta-openembedded/meta-oe/recipes-extended/mozjs/mozjs_60.9.0.bb
DEPENDS on or otherwise requires it). Close matches:
python3-numpy-native
python3-pycairo-native
python3-rpm-native
ERROR: Required build target 'meta-world-pkgdata' has no buildable
providers.
Missing or unbuildable dependency chain was: ['meta-world-pkgdata',
'mozjs', 'python3-pytoml-native']
fix by make these recipes only active when identified layers are
present
Signed-off-by: Changqing Li <changqing.li@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/dynamic-layers')
49 files changed, 9606 insertions, 0 deletions
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-benchmark/speedtest-cli/speedtest-cli_2.1.2.bb b/meta-oe/dynamic-layers/meta-python/recipes-benchmark/speedtest-cli/speedtest-cli_2.1.2.bb new file mode 100644 index 0000000000..de4fa16426 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-benchmark/speedtest-cli/speedtest-cli_2.1.2.bb | |||
@@ -0,0 +1,14 @@ | |||
1 | SUMMARY = "Command line interface for testing internet bandwidth using speedtest.net" | ||
2 | AUTHOR = "Matt Martz" | ||
3 | |||
4 | LICENSE="Apache-2.0" | ||
5 | LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" | ||
6 | |||
7 | inherit setuptools3 | ||
8 | |||
9 | SRC_URI = "git://github.com/sivel/speedtest-cli.git" | ||
10 | SRCREV = "c58ad3367bf27f4b4a4d5b1bca29ebd574731c5d" | ||
11 | |||
12 | S = "${WORKDIR}/git" | ||
13 | |||
14 | RDEPENDS_${PN} = "python3 python3-setuptools-scm" | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-bsp/rwmem/rwmem_1.2.bb b/meta-oe/dynamic-layers/meta-python/recipes-bsp/rwmem/rwmem_1.2.bb new file mode 100644 index 0000000000..065243ccfe --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-bsp/rwmem/rwmem_1.2.bb | |||
@@ -0,0 +1,35 @@ | |||
1 | SUMMARY = "A small tool to read/write memory" | ||
2 | DESCRIPTION = "rwmem is a small tool for reading and writing device registers. \ | ||
3 | rwmem supports two modes: mmap mode and i2c mode. \ | ||
4 | \ | ||
5 | In mmap mode rwmem accesses a file by memory mapping it. \ | ||
6 | Using /dev/mem as the memory mapped file makes rwmem access memory and \ | ||
7 | can thus be used to access devices which have memory mapped registers. \ | ||
8 | \ | ||
9 | In i2c mode rwmem accesses an i2c peripheral by sending i2c messages to it." | ||
10 | |||
11 | LICENSE = "GPLv2+" | ||
12 | LIC_FILES_CHKSUM = "file://LICENSE;md5=b234ee4d69f5fce4486a80fdaf4a4263" | ||
13 | |||
14 | DEPENDS += "python3 python3-pybind11" | ||
15 | |||
16 | PV .= "+git${SRCPV}" | ||
17 | |||
18 | SRCREV_rwmem = "3ec3e421211b58e766651c2e3a3a21acf14a1906" | ||
19 | SRCREV_inih = "4b10c654051a86556dfdb634c891b6c3224c4109" | ||
20 | |||
21 | SRCREV_FORMAT = "rwmem_inih" | ||
22 | |||
23 | SRC_URI = " \ | ||
24 | git://github.com/tomba/rwmem.git;protocol=https;name=rwmem \ | ||
25 | git://github.com/benhoyt/inih.git;protocol=https;name=inih;nobranch=1;destsuffix=git/ext/inih \ | ||
26 | " | ||
27 | |||
28 | S = "${WORKDIR}/git" | ||
29 | |||
30 | inherit cmake pkgconfig | ||
31 | |||
32 | do_install() { | ||
33 | install -D -m 0755 ${B}/bin/rwmem ${D}${bindir}/rwmem | ||
34 | install -D -m 0644 ${B}/lib/librwmem.a ${D}${libdir}/librwmem.a | ||
35 | } | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/0001-Fix-build-on-32bit-arches-with-64bit-time_t.patch b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/0001-Fix-build-on-32bit-arches-with-64bit-time_t.patch new file mode 100644 index 0000000000..0e38f7d8ec --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/0001-Fix-build-on-32bit-arches-with-64bit-time_t.patch | |||
@@ -0,0 +1,40 @@ | |||
1 | From 50a48a7bd8d65a165ce2aac4ba0c1e02bded04aa Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sat, 30 Nov 2019 12:21:31 -0800 | ||
4 | Subject: [PATCH] Fix build on 32bit arches with 64bit time_t | ||
5 | |||
6 | time element is deprecated on new input_event structure in kernel's | ||
7 | input.h [1] | ||
8 | |||
9 | [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=152194fe9c3f | ||
10 | |||
11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
12 | --- | ||
13 | plugins/devinput.c | 7 ++++++- | ||
14 | 1 file changed, 6 insertions(+), 1 deletion(-) | ||
15 | |||
16 | diff --git a/plugins/devinput.c b/plugins/devinput.c | ||
17 | index d4d733a..feb4a61 100644 | ||
18 | --- a/plugins/devinput.c | ||
19 | +++ b/plugins/devinput.c | ||
20 | @@ -34,6 +34,11 @@ | ||
21 | #include <linux/uinput.h> | ||
22 | #include <sys/stat.h> | ||
23 | |||
24 | +#ifndef input_event_sec | ||
25 | +#define input_event_sec time.tv_sec | ||
26 | +#define input_event_usec time.tv_usec | ||
27 | +#endif | ||
28 | + | ||
29 | #ifndef EV_SYN | ||
30 | /* previous name */ | ||
31 | #define EV_SYN EV_RST | ||
32 | @@ -459,7 +464,7 @@ char* devinput_rec(struct ir_remote* remotes) | ||
33 | return 0; | ||
34 | } | ||
35 | |||
36 | - log_trace("time %ld.%06ld type %d code %d value %d", event.time.tv_sec, event.time.tv_usec, event.type, | ||
37 | + log_trace("time %ld.%06ld type %d code %d value %d", event.input_event_sec, event.input_event_usec, event.type, | ||
38 | event.code, event.value); | ||
39 | |||
40 | value = (unsigned)event.value; | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/lirc.tmpfiles b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/lirc.tmpfiles new file mode 100644 index 0000000000..0b80e2e479 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/lirc.tmpfiles | |||
@@ -0,0 +1 @@ | |||
d /run/lirc 0755 root root - | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/lirc_options.conf b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/lirc_options.conf new file mode 100644 index 0000000000..d8ddedd8fa --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/lirc_options.conf | |||
@@ -0,0 +1,24 @@ | |||
1 | # These are the default options to lircd, if installed as | ||
2 | # /etc/lirc/lirc_options.conf. See the lircd(8) and lircmd(8) | ||
3 | # manpages for info on the different options. | ||
4 | |||
5 | [lircd] | ||
6 | nodaemon = False | ||
7 | permission = 666 | ||
8 | driver = default | ||
9 | device = /dev/lirc0 | ||
10 | output = /var/run/lirc/lircd | ||
11 | pidfile = /var/run/lirc/lircd.pid | ||
12 | plugindir = /usr/lib/lirc/plugins | ||
13 | allow-simulate = No | ||
14 | repeat-max = 600 | ||
15 | #listen = [address:]port | ||
16 | #connect = host[:port] | ||
17 | #debug = 5 | ||
18 | #uinput = ... | ||
19 | #release = ... | ||
20 | #logfile = ... | ||
21 | |||
22 | [lircmd] | ||
23 | uinput = False | ||
24 | nodeamon = False | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/lircd.conf b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/lircd.conf new file mode 100644 index 0000000000..29b03c72a0 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/lircd.conf | |||
@@ -0,0 +1,315 @@ | |||
1 | # contributed by angelo castello | ||
2 | # | ||
3 | # note: this config file has been deduced starting from the | ||
4 | # raw codes provided to run mode2 utility. | ||
5 | # | ||
6 | # brand: futarque | ||
7 | |||
8 | begin remote | ||
9 | name futarque | ||
10 | bits 8 | ||
11 | flags SPACE_ENC|CONST_LENGTH | ||
12 | eps 30 | ||
13 | aeps 100 | ||
14 | |||
15 | header 8048 3898 | ||
16 | one 555 1436 | ||
17 | zero 555 439 | ||
18 | gap 113123 | ||
19 | ptrail 555 | ||
20 | pre_data_bits 8 | ||
21 | pre_data 0x54 | ||
22 | pre 570 3890 | ||
23 | |||
24 | begin codes | ||
25 | MUTE 0x70 | ||
26 | EXIT 0xA8 | ||
27 | POWER 0xF0 | ||
28 | CHANNEL_UP 0x50 | ||
29 | CHANNEL_DOWN 0xD0 | ||
30 | VOLUME_UP 0x30 | ||
31 | VOLUME_DOWN 0xB0 | ||
32 | OK 0x98 | ||
33 | FAVORITES 0x04 | ||
34 | TEXT 0x68 | ||
35 | EPG 0xC8 | ||
36 | BACK 0x48 | ||
37 | MENU 0x88 | ||
38 | 1 0x00 | ||
39 | 2 0x80 | ||
40 | 3 0x40 | ||
41 | 4 0xC0 | ||
42 | 5 0x20 | ||
43 | 6 0xA0 | ||
44 | 7 0x60 | ||
45 | 8 0xE0 | ||
46 | 9 0x10 | ||
47 | 0 0x90 | ||
48 | PAUSE 0x84 | ||
49 | INFO 0x38 | ||
50 | RED 0xE8 | ||
51 | GREEN 0x08 | ||
52 | YELLOW 0x28 | ||
53 | BLUE 0x78 | ||
54 | UP 0xD8 | ||
55 | DOWN 0xB8 | ||
56 | REWIND 0x44 | ||
57 | FASTFORWARD 0x24 | ||
58 | PLAYPAUSE 0xC4 | ||
59 | STOP 0x64 | ||
60 | RECORD 0xA4 | ||
61 | AUDIO 0xE4 | ||
62 | TAPE 0x14 | ||
63 | DVD 0x94 | ||
64 | CAPITAL_A 0xF8 | ||
65 | CAPITAL_B 0x54 | ||
66 | end codes | ||
67 | |||
68 | end remote | ||
69 | |||
70 | # brand: STM PVR-1 | ||
71 | |||
72 | begin remote | ||
73 | name stm_pvr_1 | ||
74 | bits 16 | ||
75 | flags SPACE_ENC|CONST_LENGTH | ||
76 | eps 30 | ||
77 | aeps 150 | ||
78 | |||
79 | header 9000 4500 | ||
80 | one 572 1700 | ||
81 | zero 572 572 | ||
82 | ptrail 572 | ||
83 | repeat 9000 2200 | ||
84 | pre_data_bits 16 | ||
85 | pre_data 0xFE | ||
86 | gap 100000 | ||
87 | |||
88 | begin codes | ||
89 | POWER 0x00ff | ||
90 | FAVORITES 0x7887 | ||
91 | MUTE 0x28d7 | ||
92 | 0 0x708F | ||
93 | 1 0xc03f | ||
94 | 2 0x40bf | ||
95 | 3 0x807f | ||
96 | 4 0xe01f | ||
97 | 5 0x609f | ||
98 | 6 0xa05f | ||
99 | 7 0xd02f | ||
100 | 8 0x50af | ||
101 | 9 0x906f | ||
102 | INFO 0x38c7 | ||
103 | SUBTITLE 0xe817 | ||
104 | MENU 0x9867 | ||
105 | EXIT 0x20df | ||
106 | EPG 0xa857 | ||
107 | BACK 0x48b7 | ||
108 | CURSOR_UP 0x58a7 | ||
109 | CURSOR_DOWN 0xd827 | ||
110 | CURSOR_LEFT 0x8877 | ||
111 | CURSOR_RIGHT 0xb04f | ||
112 | OK 0x10ef | ||
113 | VOLUME_UP 0x22dd | ||
114 | VOLUME_DOWN 0x8a75 | ||
115 | CHANNEL_UP 0x12ed | ||
116 | CHANNEL_DOWN 0x4ab5 | ||
117 | TEXT 0xf00f | ||
118 | RADIO 0x926d | ||
119 | ZOOM 0x6897 | ||
120 | AUDIO 0x08f7 | ||
121 | RED 0x42bd | ||
122 | GREEN 0xa25d | ||
123 | YELLOW 0x827d | ||
124 | BLUE 0x02fd | ||
125 | CUSTOM0 0x52ad | ||
126 | CUSTOM1 0x30cf | ||
127 | PLAY 0x629d | ||
128 | PAUSE 0xb24d | ||
129 | PREVIOUS 0xc837 | ||
130 | NEXT 0xf807 | ||
131 | REWIND 0x32cd | ||
132 | FASTFORWARD 0x0af5 | ||
133 | AUX 0x7a85 | ||
134 | CUSTOM3 0xb847 | ||
135 | PIP 0x3ac5 | ||
136 | SWAP 0xba45 | ||
137 | end codes | ||
138 | |||
139 | end remote | ||
140 | |||
141 | # brand: STM DTV-2 | ||
142 | |||
143 | begin remote | ||
144 | |||
145 | name stm_dtv_2 | ||
146 | flags SHIFT_ENC|CONST_LENGTH | ||
147 | bits 13 | ||
148 | aeps 150 | ||
149 | |||
150 | one 850 850 | ||
151 | zero 850 850 | ||
152 | plead 850 | ||
153 | gap 67800 | ||
154 | toggle_bit 2 | ||
155 | |||
156 | begin codes | ||
157 | POWER 0x100C | ||
158 | FAVORITES 0x1015 | ||
159 | AUX 0x1038 | ||
160 | 1 0x1001 | ||
161 | 2 0x1002 | ||
162 | 3 0x1003 | ||
163 | 4 0x1004 | ||
164 | 5 0x1005 | ||
165 | 6 0x1006 | ||
166 | 7 0x1007 | ||
167 | 8 0x1008 | ||
168 | 9 0x1009 | ||
169 | PERIOD 0x1024 | ||
170 | 0 0x103E | ||
171 | BACK 0x1023 | ||
172 | MENU 0x1016 | ||
173 | INFO 0x100F | ||
174 | EPG 0x101E | ||
175 | EXIT 0x1018 | ||
176 | CURSOR_UP 0x1017 | ||
177 | CURSOR_DOWN 0x101D | ||
178 | CURSOR_LEFT 0x1019 | ||
179 | CURSOR_RIGHT 0x101B | ||
180 | OK 0x101A | ||
181 | VOLUME_UP 0x1010 | ||
182 | VOLUME_DOWN 0x1011 | ||
183 | CHANNEL_UP 0x1020 | ||
184 | CHANNEL_DOWN 0x1021 | ||
185 | TEXT 0x102E | ||
186 | SUBTITLE 0x103C | ||
187 | FREEZE 0x1014 | ||
188 | ZOOM 0x102B | ||
189 | RED 0x1028 | ||
190 | GREEN 0x102A | ||
191 | YELLOW 0x102F | ||
192 | BLUE 0x1030 | ||
193 | CUSTOM10 0x1022 | ||
194 | INTERNET 0x1027 | ||
195 | CUSTOM11 0x102C | ||
196 | AUDIO 0x1025 | ||
197 | RECORD 0x102D | ||
198 | PLAYPAUSE 0x1029 | ||
199 | STOP 0x1026 | ||
200 | CUSTOM1 0x101C | ||
201 | MUTE 0x100d | ||
202 | CUSTOM12 0x101F | ||
203 | PIP 0x100B | ||
204 | SWAP 0x100E | ||
205 | end codes | ||
206 | |||
207 | end remote | ||
208 | |||
209 | # brand: Comcast | ||
210 | # model no. of remote control: XR2 | ||
211 | # 32 bits for the pre-date (should be value 0x170F443E) | ||
212 | # width between pre_bits and data: 12900 microseconds | ||
213 | # | ||
214 | # 24 bits for the data (key code) | ||
215 | # To get key REPEAT, XOR 0x088 with KEY value | ||
216 | # There are 8 post bits (both should be zero) | ||
217 | # | ||
218 | # Gap between keys: 8100 microseconds | ||
219 | begin remote | ||
220 | |||
221 | name Xfinity-XR2 | ||
222 | bits 24 | ||
223 | flags XMP | ||
224 | eps 20 | ||
225 | aeps 300 | ||
226 | |||
227 | one 0 137 | ||
228 | zero 250 710 | ||
229 | ptrail 250 | ||
230 | pre_data_bits 32 | ||
231 | pre_data 0x170F443E | ||
232 | post_data_bits 8 | ||
233 | post_data 0x0 | ||
234 | pre 250 12921 | ||
235 | gap 81698 | ||
236 | toggle_bit_mask 0x0 | ||
237 | |||
238 | begin codes | ||
239 | 1 0x1E0001 | ||
240 | 1_repeat 0x168001 | ||
241 | 2 0x1D0002 | ||
242 | 2_repeat 0x158002 | ||
243 | 3 0x1C0003 | ||
244 | 3_repeat 0x148003 | ||
245 | 4 0x1B0004 | ||
246 | 4_repeat 0x138004 | ||
247 | 5 0x1A0005 | ||
248 | 5_repeat 0x128005 | ||
249 | 6 0x190006 | ||
250 | 6_repeat 0x118006 | ||
251 | 7 0x180007 | ||
252 | 7_repeat 0x108007 | ||
253 | 8 0x170008 | ||
254 | 8_repeat 0x1F8008 | ||
255 | 9 0x160009 | ||
256 | 9_repeat 0x1E8009 | ||
257 | 0 0x1F0000 | ||
258 | 0_repeat 0x178000 | ||
259 | OK 0x180025 | ||
260 | OK_repeat 0x108025 | ||
261 | POWER 0x10000F | ||
262 | POWER_repeat 0x18800F | ||
263 | UP 0x1C0021 | ||
264 | UP_repeat 0x148021 | ||
265 | DOWN 0x1B0022 | ||
266 | DOWN_repeat 0x138022 | ||
267 | LEFT 0x1A0023 | ||
268 | LEFT_repeat 0x128023 | ||
269 | RIGHT 0x190024 | ||
270 | RIGHT_repeat 0x118024 | ||
271 | REWIND 0x190033 | ||
272 | REWIND_repeat 0x118033 | ||
273 | PLAY 0x1C0030 | ||
274 | PLAY_repeat 0x148030 | ||
275 | FASTFORWARD 0x180034 | ||
276 | FASTFORWARD_repeat 0x108034 | ||
277 | RECORD 0x170035 | ||
278 | RECORD_repeat 0x1F8035 | ||
279 | REPLAY 0x170053 | ||
280 | REPLAY_repeat 0x1F8053 | ||
281 | A 0x190060 | ||
282 | A_repeat 0x118060 | ||
283 | B 0x180061 | ||
284 | B_repeat 0x108061 | ||
285 | C 0x170062 | ||
286 | C_repeat 0x1F8062 | ||
287 | D 0x160063 | ||
288 | D_repeat 0x1E8063 | ||
289 | PAGE_UP 0x150028 | ||
290 | PAGE_UP_repeat 0x1D8028 | ||
291 | PAGE_DOWN 0x140029 | ||
292 | PAGE_DOWN_repeat 0x1C8029 | ||
293 | GUIDE 0x160027 | ||
294 | GUIDE_repeat 0x1E8027 | ||
295 | MENU 0x1D0020 | ||
296 | MENU_repeat 0x158020 | ||
297 | EXIT 0x13002A | ||
298 | EXIT_repeat 0x1B802A | ||
299 | INFO 0x170026 | ||
300 | INFO_repeat 0x1F8026 | ||
301 | LAST 0x190051 | ||
302 | LAST_repeat 0x118051 | ||
303 | VOLUME_UP 0x15000A | ||
304 | VOLUME_UP_repeat 0x1D800A | ||
305 | CHANNEL_UP 0x12000D | ||
306 | CHANNEL_UP_repeat 0x1A800D | ||
307 | VOLUME_DOWN 0x14000B | ||
308 | VOLUME_DOWN_repeat 0x1C800B | ||
309 | CHANNEL_DOWN 0x11000E | ||
310 | CHANNEL_DOWN_repeat 0x19800E | ||
311 | MUTE 0x13000C | ||
312 | MUTE_repeat 0x1B800D | ||
313 | end codes | ||
314 | |||
315 | end remote | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/lircd.init b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/lircd.init new file mode 100644 index 0000000000..8b124af6f2 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/lircd.init | |||
@@ -0,0 +1,40 @@ | |||
1 | #! /bin/sh | ||
2 | # | ||
3 | # This is an init script for Familiar | ||
4 | # Copy it to /etc/init.d/lircd and type | ||
5 | # > update-rc.d lircd defaults 20 | ||
6 | # | ||
7 | |||
8 | |||
9 | test -f /usr/sbin/lircd || exit 0 | ||
10 | test -f /etc/lircd.conf || exit 0 | ||
11 | |||
12 | case "$1" in | ||
13 | start) | ||
14 | echo -n "Starting lirc daemon: lircd" | ||
15 | start-stop-daemon --start --quiet --exec /usr/sbin/lircd -- --device=/dev/lirc0 | ||
16 | echo "." | ||
17 | ;; | ||
18 | stop) | ||
19 | echo -n "Stopping lirc daemon: lircd" | ||
20 | start-stop-daemon --stop --quiet --exec /usr/sbin/lircd | ||
21 | echo "." | ||
22 | ;; | ||
23 | reload|force-reload) | ||
24 | start-stop-daemon --stop --quiet --signal 1 --exec /usr/sbin/lircd | ||
25 | ;; | ||
26 | restart) | ||
27 | echo -n "Stopping lirc daemon: lircd" | ||
28 | start-stop-daemon --stop --quiet --exec /usr/sbin/lircd | ||
29 | sleep 1 | ||
30 | echo -n "Starting lirc daemon: lircd" | ||
31 | start-stop-daemon --start --quiet --exec /usr/sbin/lircd -- --device=/dev/lirc0 | ||
32 | echo "." | ||
33 | ;; | ||
34 | *) | ||
35 | echo "Usage: /etc/init.d/lircd {start|stop|reload|restart|force-reload}" | ||
36 | exit 1 | ||
37 | esac | ||
38 | |||
39 | exit 0 | ||
40 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/lircd.service b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/lircd.service new file mode 100644 index 0000000000..c8661368bb --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/lircd.service | |||
@@ -0,0 +1,20 @@ | |||
1 | [Unit] | ||
2 | Description=LIRC Infrared Signal Decoder | ||
3 | After=network.target | ||
4 | |||
5 | [Service] | ||
6 | Type=forking | ||
7 | EnvironmentFile=/etc/lirc/lircd.conf | ||
8 | PIDFile=/run/lirc/lircd.pid | ||
9 | ExecStartPre=/bin/mkdir -p /run/lirc | ||
10 | ExecStartPre=/bin/rm -f /dev/lircd | ||
11 | ExecStartPre=/bin/rm -f /run/lirc/lircd | ||
12 | ExecStartPre=/bin/ln -s /run/lirc/lircd /dev/lircd | ||
13 | |||
14 | ExecStart=/usr/sbin/lircd --pidfile=/run/lirc/lircd.pid --device=/dev/lirc0 | ||
15 | |||
16 | ExecStopPost=/bin/rm -f /dev/lircd | ||
17 | ExecStopPost=/bin/rm -fR /run/lirc | ||
18 | |||
19 | [Install] | ||
20 | WantedBy=multi-user.target | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/lircexec.init b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/lircexec.init new file mode 100644 index 0000000000..3a8c1a306e --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/lircexec.init | |||
@@ -0,0 +1,37 @@ | |||
1 | #! /bin/sh | ||
2 | # | ||
3 | # This is an init script for Familiar | ||
4 | # Copy it to /etc/init.d/lircexecd and type | ||
5 | # > update-rc.d lircexecd defaults 20 | ||
6 | # It must be started after lircd (and it does alphabetically :-) | ||
7 | # irexec reads /etc/lircrc by default | ||
8 | |||
9 | |||
10 | test -f /usr/bin/irexec || exit 0 | ||
11 | test -f /etc/lircrc || exit 0 | ||
12 | |||
13 | case "$1" in | ||
14 | start) | ||
15 | echo -n "Starting lircexec daemon: irexec" | ||
16 | start-stop-daemon --start --quiet --exec /usr/bin/irexec -- --daemon | ||
17 | echo "." | ||
18 | ;; | ||
19 | stop) | ||
20 | echo -n "Stopping lircexec daemon: irexec" | ||
21 | start-stop-daemon --stop --quiet --exec /usr/bin/irexec | ||
22 | echo "." | ||
23 | ;; | ||
24 | restart|force-restart) | ||
25 | echo -n "Stopping lircexec daemon: irexec" | ||
26 | start-stop-daemon --stop --quiet --exec /usr/bin/irexec | ||
27 | sleep 1 | ||
28 | echo -n "Starting lircexec daemon: irexec" | ||
29 | start-stop-daemon --start --quiet --exec /usr/bin/irexec -- --daemon | ||
30 | echo "." | ||
31 | ;; | ||
32 | *) | ||
33 | echo "Usage: /etc/init.d/lircexec {start|stop|reload|restart|force-restart}" | ||
34 | exit 1 | ||
35 | esac | ||
36 | |||
37 | exit 0 | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/pollfd.patch b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/pollfd.patch new file mode 100644 index 0000000000..4feea80346 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc/pollfd.patch | |||
@@ -0,0 +1,101 @@ | |||
1 | Index: lirc-0.9.4d/daemons/lircrcd.cpp | ||
2 | =================================================================== | ||
3 | --- lirc-0.9.4d.orig/daemons/lircrcd.cpp | ||
4 | +++ lirc-0.9.4d/daemons/lircrcd.cpp | ||
5 | @@ -29,10 +29,12 @@ | ||
6 | #include <sys/un.h> | ||
7 | #include <sys/stat.h> | ||
8 | #include <sys/types.h> | ||
9 | +#include <poll.h> | ||
10 | #include <syslog.h> | ||
11 | |||
12 | #include "lirc_client.h" | ||
13 | #include "lirc/lirc_log.h" | ||
14 | +#include "lirc/curl_poll.h" | ||
15 | |||
16 | #define MAX_CLIENTS 100 | ||
17 | #define WHITE_SPACE " \t" | ||
18 | Index: lirc-0.9.4d/lib/curl_poll.c | ||
19 | =================================================================== | ||
20 | --- lirc-0.9.4d.orig/lib/curl_poll.c | ||
21 | +++ lirc-0.9.4d/lib/curl_poll.c | ||
22 | @@ -36,6 +36,7 @@ | ||
23 | #include <stdlib.h> | ||
24 | #include <sys/time.h> | ||
25 | #include <sys/types.h> | ||
26 | +#include <sys/poll.h> | ||
27 | |||
28 | #include "lirc_log.h" | ||
29 | #include "curl_poll.h" | ||
30 | @@ -67,7 +68,7 @@ static const logchannel_t logchannel = L | ||
31 | |||
32 | #ifdef HAVE_POLL_FINE | ||
33 | |||
34 | -int curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms) | ||
35 | +int curl_poll(struct pollfd *ufds, unsigned int nfds, int timeout_ms) | ||
36 | { | ||
37 | return poll(ufds, nfds, timeout_ms); | ||
38 | } | ||
39 | @@ -112,7 +113,7 @@ static int verify_sock(int s) | ||
40 | } | ||
41 | |||
42 | |||
43 | -int curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms) | ||
44 | +int curl_poll(struct pollfd *ufds, unsigned int nfds, int timeout_ms) | ||
45 | { | ||
46 | struct timeval pending_tv; | ||
47 | struct timeval* ptimeout; | ||
48 | Index: lirc-0.9.4d/lib/curl_poll.h | ||
49 | =================================================================== | ||
50 | --- lirc-0.9.4d.orig/lib/curl_poll.h | ||
51 | +++ lirc-0.9.4d/lib/curl_poll.h | ||
52 | @@ -1,5 +1,5 @@ | ||
53 | -#ifndef _POLL_H | ||
54 | -#define _POLL_H | ||
55 | +#ifndef _LIB_CURL_POLL_H | ||
56 | +#define _LIB_CURL_POLL_H | ||
57 | /*************************************************************************** | ||
58 | * _ _ ____ _ | ||
59 | * Project ___| | | | _ \| | | ||
60 | @@ -29,13 +29,9 @@ | ||
61 | extern "C" { | ||
62 | #endif | ||
63 | |||
64 | -#ifdef HAVE_SYS_POLL_H | ||
65 | -#include <sys/poll.h> | ||
66 | -#else | ||
67 | #include <poll.h> | ||
68 | -#endif | ||
69 | |||
70 | -int curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms); | ||
71 | +int curl_poll(struct pollfd *ufds, unsigned int nfds, int timeout_ms); | ||
72 | |||
73 | #ifdef __cplusplus | ||
74 | } | ||
75 | Index: lirc-0.9.4d/lib/lirc/curl_poll.h | ||
76 | =================================================================== | ||
77 | --- lirc-0.9.4d.orig/lib/lirc/curl_poll.h | ||
78 | +++ lirc-0.9.4d/lib/lirc/curl_poll.h | ||
79 | @@ -1,5 +1,5 @@ | ||
80 | -#ifndef _POLL_H | ||
81 | -#define _POLL_H | ||
82 | +#ifndef _LIRC_CURL_POLL_H | ||
83 | +#define _LIRC_CURL_POLL_H | ||
84 | /*************************************************************************** | ||
85 | * _ _ ____ _ | ||
86 | * Project ___| | | | _ \| | | ||
87 | @@ -29,13 +29,9 @@ | ||
88 | extern "C" { | ||
89 | #endif | ||
90 | |||
91 | -#ifdef HAVE_SYS_POLL_H | ||
92 | -#include <sys/poll.h> | ||
93 | -#else | ||
94 | #include <poll.h> | ||
95 | -#endif | ||
96 | |||
97 | -int curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms); | ||
98 | +int curl_poll(struct pollfd *ufds, unsigned int nfds, int timeout_ms); | ||
99 | |||
100 | #ifdef __cplusplus | ||
101 | } | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc_0.9.4d.bb b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc_0.9.4d.bb new file mode 100644 index 0000000000..f599696737 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/lirc/lirc_0.9.4d.bb | |||
@@ -0,0 +1,86 @@ | |||
1 | DESCRIPTION = "LIRC is a package that allows you to decode and send infra-red signals of many commonly used remote controls." | ||
2 | DESCRIPTION_append_lirc = " This package contains the lirc daemon, libraries and tools." | ||
3 | DESCRIPTION_append_lirc-exec = " This package contains a daemon that runs programs on IR signals." | ||
4 | DESCRIPTION_append_lirc-remotes = " This package contains some config files for remotes." | ||
5 | DESCRIPTION_append_lirc-nslu2example = " This package contains a working config for RC5 remotes and a modified NSLU2." | ||
6 | HOMEPAGE = "http://www.lirc.org" | ||
7 | SECTION = "console/network" | ||
8 | LICENSE = "GPLv2" | ||
9 | DEPENDS = "libxslt-native alsa-lib libftdi libusb1 libusb-compat jack portaudio-v19 python3-pyyaml" | ||
10 | |||
11 | LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" | ||
12 | |||
13 | SRC_URI = "http://prdownloads.sourceforge.net/lirc/lirc-${PV}.tar.bz2 \ | ||
14 | file://pollfd.patch \ | ||
15 | file://0001-Fix-build-on-32bit-arches-with-64bit-time_t.patch \ | ||
16 | file://lircd.service \ | ||
17 | file://lircd.init \ | ||
18 | file://lircexec.init \ | ||
19 | file://lircd.conf \ | ||
20 | file://lirc_options.conf \ | ||
21 | file://lirc.tmpfiles \ | ||
22 | " | ||
23 | SRC_URI[md5sum] = "0d11679cbdd94a5a6da00a8e7231b4bf" | ||
24 | SRC_URI[sha256sum] = "c68f18c35b489b865c0a741d119b136e8702191538cd3551b977a7af6c4e41ab" | ||
25 | |||
26 | SYSTEMD_PACKAGES = "lirc lirc-exec" | ||
27 | SYSTEMD_SERVICE_${PN} = "lircd.service lircmd.service lircd-setup.service lircd-uinput.service" | ||
28 | SYSTEMD_SERVICE_${PN}-exec = "irexec.service" | ||
29 | SYSTEMD_AUTO_ENABLE_lirc = "enable" | ||
30 | SYSTEMD_AUTO_ENABLE_lirc-exec = "enable" | ||
31 | |||
32 | inherit autotools pkgconfig systemd python3native | ||
33 | |||
34 | PACKAGECONFIG[systemd] = "--with-systemdsystemunitdir=${systemd_unitdir}/system/,--without-systemdsystemunitdir,systemd" | ||
35 | PACKAGECONFIG[x11] = "--with-x,--with-x=no,libx11," | ||
36 | |||
37 | PACKAGECONFIG ?= " \ | ||
38 | ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', ' systemd', '', d)} \ | ||
39 | ${@bb.utils.contains('DISTRO_FEATURES', 'x11', ' x11', '', d)} \ | ||
40 | " | ||
41 | CACHED_CONFIGUREVARS = "HAVE_WORKING_POLL=yes" | ||
42 | |||
43 | #EXTRA_OEMAKE = 'SUBDIRS="lib daemons tools"' | ||
44 | do_install_append() { | ||
45 | install -m 0755 -d ${D}${sysconfdir} | ||
46 | install -m 0755 -d ${D}${sysconfdir}/lirc | ||
47 | install -m 0755 -d ${D}${systemd_unitdir}/system | ||
48 | install -m 0755 -d ${D}${libdir}/tmpfiles.d | ||
49 | install -m 0644 ${WORKDIR}/lircd.conf ${D}${sysconfdir}/lirc/ | ||
50 | install -m 0644 ${WORKDIR}/lirc_options.conf ${D}${sysconfdir}/lirc/ | ||
51 | install -m 0644 ${WORKDIR}/lircd.service ${D}${systemd_unitdir}/system/ | ||
52 | install -m 0755 ${WORKDIR}/lircexec.init ${D}${systemd_unitdir}/system/ | ||
53 | install -m 0644 ${WORKDIR}/lirc.tmpfiles ${D}${libdir}/tmpfiles.d/lirc.conf | ||
54 | rm -rf ${D}${libdir}/lirc/plugins/*.la | ||
55 | rmdir ${D}/var/run/lirc ${D}/var/run | ||
56 | chown -R root:root ${D}${datadir}/lirc/contrib | ||
57 | } | ||
58 | |||
59 | PACKAGES =+ "${PN}-contrib ${PN}-exec ${PN}-plugins ${PN}-python" | ||
60 | |||
61 | RDEPENDS_${PN} = "bash" | ||
62 | RDEPENDS_${PN}-exec = "${PN}" | ||
63 | RDEPENDS_${PN}-python = "python3-shell python3-pyyaml python3-datetime python3-netclient python3-stringold" | ||
64 | |||
65 | RRECOMMENDS_${PN} = "${PN}-exec ${PN}-plugins" | ||
66 | |||
67 | FILES_${PN}-plugins = "${libdir}/lirc/plugins/*.so ${datadir}/lirc/configs" | ||
68 | FILES_${PN}-contrib = "${datadir}/lirc/contrib" | ||
69 | FILES_${PN}-exec = "${bindir}/irexec ${sysconfdir}/lircexec ${systemd_unitdir}/system/irexec.service" | ||
70 | FILES_${PN} += "${systemd_unitdir}/system/lircexec.init" | ||
71 | FILES_${PN} += "${systemd_unitdir}/system/lircd.service" | ||
72 | FILES_${PN} += "${systemd_unitdir}/system/lircd.socket" | ||
73 | FILES_${PN} += "${libdir}/tmpfiles.d/lirc.conf" | ||
74 | FILES_${PN}-dbg += "${libdir}/lirc/plugins/.debug" | ||
75 | FILES_${PN}-python += "${bindir}/irdb-get ${bindir}/irtext2udp ${bindir}/lircd-setup ${bindir}/pronto2lirc ${libdir}/python*/site-packages" | ||
76 | |||
77 | INITSCRIPT_PACKAGES = "lirc lirc-exec" | ||
78 | INITSCRIPT_NAME_lirc-exec = "lircexec" | ||
79 | INITSCRIPT_PARAMS_lirc-exec = "defaults 21" | ||
80 | |||
81 | # this is for distributions that don't use udev | ||
82 | pkg_postinst_${PN}_append() { | ||
83 | if [ ! -c $D/dev/lirc -a ! -f /sbin/udevd ]; then mknod $D/dev/lirc c 61 0; fi | ||
84 | } | ||
85 | |||
86 | SECURITY_CFLAGS = "${SECURITY_NO_PIE_CFLAGS}" | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-core/packagegroups/packagegroup-meta-oe.bb b/meta-oe/dynamic-layers/meta-python/recipes-core/packagegroups/packagegroup-meta-oe.bb new file mode 100644 index 0000000000..e04b48f85a --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-core/packagegroups/packagegroup-meta-oe.bb | |||
@@ -0,0 +1,314 @@ | |||
1 | SUMMARY = "Meta-oe ptest packagegroups" | ||
2 | |||
3 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
4 | inherit packagegroup | ||
5 | |||
6 | PROVIDES = "${PACKAGES}" | ||
7 | PACKAGES = ' \ | ||
8 | packagegroup-meta-oe \ | ||
9 | packagegroup-meta-oe-benchmarks \ | ||
10 | packagegroup-meta-oe-connectivity \ | ||
11 | packagegroup-meta-oe-core \ | ||
12 | packagegroup-meta-oe-crypto \ | ||
13 | packagegroup-meta-oe-bsp \ | ||
14 | packagegroup-meta-oe-dbs \ | ||
15 | packagegroup-meta-oe-devtools \ | ||
16 | packagegroup-meta-oe-extended \ | ||
17 | packagegroup-meta-oe-kernel \ | ||
18 | packagegroup-meta-oe-multimedia \ | ||
19 | packagegroup-meta-oe-navigation \ | ||
20 | packagegroup-meta-oe-security \ | ||
21 | packagegroup-meta-oe-support \ | ||
22 | packagegroup-meta-oe-test \ | ||
23 | ${@bb.utils.contains("DISTRO_FEATURES", "x11", "packagegroup-meta-oe-gnome", "", d)} \ | ||
24 | ${@bb.utils.contains("DISTRO_FEATURES", "x11", "packagegroup-meta-oe-graphics", "", d)} \ | ||
25 | ${@bb.utils.contains("DISTRO_FEATURES", "ptest", "packagegroup-meta-oe-ptest-packages", "", d)} \ | ||
26 | ' | ||
27 | |||
28 | RDEPENDS_packagegroup-meta-oe = "\ | ||
29 | packagegroup-meta-oe-benchmarks \ | ||
30 | packagegroup-meta-oe-connectivity \ | ||
31 | packagegroup-meta-oe-core \ | ||
32 | packagegroup-meta-oe-crypto \ | ||
33 | packagegroup-meta-oe-bsp \ | ||
34 | packagegroup-meta-oe-dbs \ | ||
35 | packagegroup-meta-oe-devtools \ | ||
36 | packagegroup-meta-oe-extended \ | ||
37 | packagegroup-meta-oe-kernel \ | ||
38 | packagegroup-meta-oe-multimedia \ | ||
39 | packagegroup-meta-oe-navigation \ | ||
40 | packagegroup-meta-oe-security \ | ||
41 | packagegroup-meta-oe-support \ | ||
42 | packagegroup-meta-oe-test \ | ||
43 | ${@bb.utils.contains("DISTRO_FEATURES", "x11", "packagegroup-meta-oe-gnome", "", d)} \ | ||
44 | ${@bb.utils.contains("DISTRO_FEATURES", "x11", "packagegroup-meta-oe-graphics", "", d)} \ | ||
45 | ${@bb.utils.contains("DISTRO_FEATURES", "ptest", "packagegroup-meta-oe-ptest-packages", "", d)} \ | ||
46 | " | ||
47 | |||
48 | RDEPENDS_packagegroup-meta-oe-benchmarks = "\ | ||
49 | dhrystone iperf2 linpack phoronix-test-suite \ | ||
50 | tiobench bonnie++ fio iperf2 iperf3 lmbench s-suite whetstone \ | ||
51 | libc-bench memtester sysbench dbench iozone3 libhugetlbfs \ | ||
52 | nbench-byte tinymembench \ | ||
53 | ${@bb.utils.contains("DISTRO_FEATURES", "x11 wayland opengl", "glmark2", "", d)} \ | ||
54 | " | ||
55 | |||
56 | RDEPENDS_packagegroup-meta-oe-benchmarks_remove_mipsarch = "libhugetlbfs" | ||
57 | RDEPENDS_packagegroup-meta-oe-benchmarks_remove_mips64 = "tinymembench" | ||
58 | RDEPENDS_packagegroup-meta-oe-benchmarks_remove_mips64el = "tinymembench" | ||
59 | RDEPENDS_packagegroup-meta-oe-benchmarks_remove_riscv64 = "libhugetlbfs" | ||
60 | RDEPENDS_packagegroup-meta-oe-benchmarks_remove_riscv32 = "libhugetlbfs" | ||
61 | |||
62 | RDEPENDS_packagegroup-meta-oe-connectivity ="\ | ||
63 | gammu hostapd irssi krb5 libev libimobiledevice \ | ||
64 | libmbim libmtp libndp libqmi libtorrent \ | ||
65 | libuv libwebsockets linuxptp lirc loudmouth \ | ||
66 | modemmanager mosh \ | ||
67 | paho-mqtt-c phonet-utils rabbitmq-c rfkill rtorrent \ | ||
68 | ser2net smstools3 telepathy-glib thrift \ | ||
69 | usbmuxd zabbix zeromq \ | ||
70 | ${@bb.utils.contains("DISTRO_FEATURES", "x11", "obex-data-server", "", d)} \ | ||
71 | libmikmod \ | ||
72 | obexftp openobex libnet \ | ||
73 | ${@bb.utils.contains("BBFILE_COLLECTIONS", "meta-python2", "telepathy-idle", "", d)} \ | ||
74 | " | ||
75 | RDEPENDS_packagegroup-meta-oe-connectivity_append_libc-glibc = " wvstreams wvdial" | ||
76 | |||
77 | # dracut needs dracut | ||
78 | RDEPENDS_packagegroup-meta-oe-core ="\ | ||
79 | dbus-daemon-proxy libdbus-c++ \ | ||
80 | ell glibmm libsigc++-2.0 libxml++ distro-feed-configs \ | ||
81 | mm-common opencl-headers opencl-icd-loader \ | ||
82 | proxy-libintl usleep \ | ||
83 | ${@bb.utils.contains("DISTRO_FEATURES", "systemd", "dbus-broker ndctl", "", d)} \ | ||
84 | " | ||
85 | |||
86 | RDEPENDS_packagegroup-meta-oe-crypto ="\ | ||
87 | botan cryptsetup libkcapi libmcrypt \ | ||
88 | libsodium pkcs11-helper \ | ||
89 | " | ||
90 | RDEPENDS_packagegroup-meta-oe-bsp ="\ | ||
91 | acpitool cpufrequtils edac-utils efibootmgr \ | ||
92 | efivar flashrom lmsensors lmsensors-config \ | ||
93 | lsscsi nvme-cli pcmciautils pointercal \ | ||
94 | " | ||
95 | RDEPENDS_packagegroup-meta-oe-bsp_remove_mipsarch = "efivar efibootmgr" | ||
96 | RDEPENDS_packagegroup-meta-oe-bsp_remove_powerpc = "efivar efibootmgr" | ||
97 | RDEPENDS_packagegroup-meta-oe-bsp_remove_powerpc64 = "efivar efibootmgr" | ||
98 | RDEPENDS_packagegroup-meta-oe-bsp_remove_powerpc64le = "efivar efibootmgr" | ||
99 | RDEPENDS_packagegroup-meta-oe-bsp_remove_riscv64 = "efivar efibootmgr" | ||
100 | RDEPENDS_packagegroup-meta-oe-bsp_remove_riscv32 = "efivar efibootmgr" | ||
101 | |||
102 | RDEPENDS_packagegroup-meta-oe-dbs ="\ | ||
103 | leveldb libdbi mariadb mariadb-native \ | ||
104 | postgresql psqlodbc rocksdb soci \ | ||
105 | sqlite \ | ||
106 | ${@bb.utils.contains("BBFILE_COLLECTIONS", "meta-python2", "mysql-python", "", d)} \ | ||
107 | " | ||
108 | |||
109 | RDEPENDS_packagegroup-meta-oe-devtools ="\ | ||
110 | android-tools android-tools-conf bootchart breakpad \ | ||
111 | capnproto cgdb cscope ctags \ | ||
112 | debootstrap dmalloc flatbuffers \ | ||
113 | giflib grpc icon-slicer iptraf-ng jq jsoncpp jsonrpc json-spirit \ | ||
114 | kconfig-frontends lemon libedit libgee libsombok3 \ | ||
115 | libubox log4cplus lshw ltrace lua mcpp memstat mercurial \ | ||
116 | mpich msgpack-c nlohmann-json openocd pax-utils \ | ||
117 | ipc-run libdbd-mysql-perl libdbi-perl libio-pty-perl php \ | ||
118 | protobuf protobuf-c python3-distutils-extra \ | ||
119 | rapidjson serialcheck sip3 tclap uftrace uw-imap valijson \ | ||
120 | xmlrpc-c yajl yasm \ | ||
121 | ${@bb.utils.contains("DISTRO_FEATURES", "x11", "geany geany-plugins glade tk", "", d)} \ | ||
122 | ${@bb.utils.contains("BBFILE_COLLECTIONS", "meta-python2", "nodejs", "", d)} \ | ||
123 | " | ||
124 | |||
125 | RDEPENDS_packagegroup-meta-oe-devtools_remove_armv5 = "uftrace nodejs" | ||
126 | RDEPENDS_packagegroup-meta-oe-devtools_remove_mipsarch = "uftrace lshw" | ||
127 | RDEPENDS_packagegroup-meta-oe-devtools_remove_mips64 = "nodejs" | ||
128 | RDEPENDS_packagegroup-meta-oe-devtools_remove_mips64el = "nodejs" | ||
129 | RDEPENDS_packagegroup-meta-oe-devtools_remove_powerpc = "android-tools breakpad uftrace lshw" | ||
130 | RDEPENDS_packagegroup-meta-oe-devtools_remove_powerpc64 = "android-tools uftrace lshw" | ||
131 | RDEPENDS_packagegroup-meta-oe-devtools_remove_powerpc64le = "android-tools uftrace lshw" | ||
132 | RDEPENDS_packagegroup-meta-oe-devtools_remove_riscv64 = "nodejs uftrace lshw" | ||
133 | RDEPENDS_packagegroup-meta-oe-devtools_remove_riscv32 = "nodejs uftrace lshw" | ||
134 | |||
135 | RDEPENDS_packagegroup-meta-oe-extended ="\ | ||
136 | byacc cfengine cfengine-masterfiles cmpi-bindings \ | ||
137 | ddrescue dialog dumb-init enscript fluentbit \ | ||
138 | haveged hexedit hiredis hplip hwloc indent iotop isomd5sum \ | ||
139 | jansson konkretcmpi lcdproc libblockdev libcec libconfig \ | ||
140 | libdivecomputer libplist libusbmuxd \ | ||
141 | liblockfile liblogging liblognorm libmodbus libmodbus \ | ||
142 | libpwquality libqb libuio \ | ||
143 | lockfile-progs logwatch lprng mailx md5deep \ | ||
144 | mozjs mraa nana nicstat \ | ||
145 | p7zip p8platform libfile-fnmatch-perl \ | ||
146 | rarpd redis rrdtool libfastjson librelp rsyslog sanlock \ | ||
147 | sblim-cmpi-devel sblim-sfc-common sblim-sfcc \ | ||
148 | scsirastools sgpio smartmontools snappy \ | ||
149 | can-utils libsocketcan tipcutils tiptop \ | ||
150 | tmux uml-utilities upm vlock volume-key wipe zlog zram \ | ||
151 | ${@bb.utils.contains("DISTRO_FEATURES", "x11 wayland opengl", "boinc-client", "", d)} \ | ||
152 | ${@bb.utils.contains("DISTRO_FEATURES", "x11", " libgxim gnuplot libwmf", "", d)} \ | ||
153 | ${@bb.utils.contains("DISTRO_FEATURES", "bluez", "collectd", "", d)} \ | ||
154 | ${@bb.utils.contains("DISTRO_FEATURES", "pam", "pam-plugin-ccreds pam-plugin-ldapdb", "", d)} \ | ||
155 | ${@bb.utils.contains("DISTRO_FEATURES", "pam", "pam-ssh-agent-auth openwsman sblim-sfcb ", "", d)} \ | ||
156 | ${@bb.utils.contains("DISTRO_FEATURES", "polkit", "polkit polkit-group-rule-datetime ", "", d)} \ | ||
157 | ${@bb.utils.contains("DISTRO_FEATURES", "polkit", "polkit-group-rule-network ", "", d)} \ | ||
158 | ${@bb.utils.contains("BBFILE_COLLECTIONS", "meta-python2", "openlmi-tools", "", d)} \ | ||
159 | " | ||
160 | RDEPENDS_packagegroup-meta-oe-extended_remove_mipsarch = "upm mraa tiptop" | ||
161 | RDEPENDS_packagegroup-meta-oe-extended_remove_powerpc = "upm mraa" | ||
162 | RDEPENDS_packagegroup-meta-oe-extended_remove_powerpc64 = "upm mraa" | ||
163 | RDEPENDS_packagegroup-meta-oe-extended_remove_powerpc64le = "upm mraa" | ||
164 | RDEPENDS_packagegroup-meta-oe-extended_remove_riscv64 = "upm mraa tiptop" | ||
165 | RDEPENDS_packagegroup-meta-oe-extended_remove_riscv32 = "upm mraa tiptop" | ||
166 | RDEPENDS_packagegroup-meta-oe-extended_remove_libc-musl = "lcdproc" | ||
167 | |||
168 | RDEPENDS_packagegroup-meta-oe-gnome ="\ | ||
169 | atkmm gnome-common gnome-doc-utils-stub gtkmm \ | ||
170 | gtkmm3 pyxdg vte9 \ | ||
171 | " | ||
172 | |||
173 | RDEPENDS_packagegroup-meta-oe-graphics ="\ | ||
174 | cairomm dietsplash directfb directfb-examples \ | ||
175 | ${@bb.utils.contains("PACKAGE_CLASSES", "package_rpm", "dnfdragora dnf-plugin-tui", "", d)} \ | ||
176 | fbgrab fbida fontforge fvwm glm gphoto2 libgphoto2 \ | ||
177 | gtkperf jasper leptonica libmng libsdl2-image libsdl2-mixer libsdl2-net \ | ||
178 | libsdl-gfx libsdl-image libsdl-mixer libsdl-net libsdl-ttf \ | ||
179 | libvncserver libyui libyui-ncurses lxdm numlockx openbox openjpeg \ | ||
180 | packagegroup-fonts-truetype pangomm qrencode takao-fonts terminus-font \ | ||
181 | tesseract tesseract-lang tigervnc tslib source-han-sans-cn-fonts \ | ||
182 | source-han-sans-jp-fonts source-han-sans-kr-fonts source-han-sans-tw-fonts ttf-abyssinica \ | ||
183 | libvdpau x11vnc xcursorgen xdotool \ | ||
184 | bdftopcf iceauth sessreg setxkbmap twm xclock xfontsel xgamma xkbevd xkbprint xkbutils \ | ||
185 | xlsatoms xlsclients xlsfonts xmag xmessage xrdb xrefresh xsetmode xsetroot xstdcmap \ | ||
186 | xterm xwd xwud xbitmaps xorg-sgml-doctools \ | ||
187 | font-adobe-100dpi font-adobe-utopia-100dpi \ | ||
188 | font-bh-100dpi font-bh-lucidatypewriter-100dpi font-bitstream-100dpi font-cursor-misc \ | ||
189 | font-misc-misc xorg-fonts-100dpi liblbxutil libxaw libxkbui libxpresent xserver-common \ | ||
190 | ${@bb.utils.contains("DISTRO_FEATURES", "opengl", "freeglut libsdl2-ttf", "", d)} \ | ||
191 | " | ||
192 | |||
193 | |||
194 | |||
195 | RDEPENDS_packagegroup-meta-oe-kernel ="\ | ||
196 | agent-proxy broadcom-bt-firmware cpupower \ | ||
197 | crash ipmitool minicoredumper oprofile \ | ||
198 | " | ||
199 | RDEPENDS_packagegroup-meta-oe-kernel_append_x86 = " pm-graph " | ||
200 | RDEPENDS_packagegroup-meta-oe-kernel_append_x86-64 = " pm-graph " | ||
201 | |||
202 | RDEPENDS_packagegroup-meta-oe-kernel_remove_libc-musl = "crash minicoredumper" | ||
203 | |||
204 | RDEPENDS_packagegroup-meta-oe-kernel_remove_mips64 = "crash" | ||
205 | RDEPENDS_packagegroup-meta-oe-kernel_remove_mips64el = "crash" | ||
206 | |||
207 | RDEPENDS_packagegroup-meta-oe-multimedia ="\ | ||
208 | alsa-oss audiofile cdrkit id3lib \ | ||
209 | a2jmidid jack libass libburn libcdio libcdio-paranoia \ | ||
210 | libdvdread libmms libmodplug libopus live555 \ | ||
211 | mplayer-common opus-tools \ | ||
212 | sound-theme-freedesktop v4l-utils yavta wavpack libvpx \ | ||
213 | ${@bb.utils.contains("DISTRO_FEATURES", "x11", "xpext pavucontrol xsp", "", d)} \ | ||
214 | libmikmod \ | ||
215 | ${@bb.utils.contains("LICENSE_FLAGS_WHITELIST", "commercial", "libmad faad2 mpv", "", d)} \ | ||
216 | " | ||
217 | RDEPENDS_packagegroup-meta-oe-multimedia_remove_libc-musl = "alsa-oss" | ||
218 | |||
219 | RDEPENDS_packagegroup-meta-oe-navigation ="\ | ||
220 | geoclue geos libspatialite proj \ | ||
221 | ${@bb.utils.contains("DISTRO_FEATURES", "x11", "orrery", "", d)} \ | ||
222 | ${@bb.utils.contains("DISTRO_FEATURES", "bluz4", "gpsd gpsd-machine-conf", "", d)} \ | ||
223 | " | ||
224 | |||
225 | RDEPENDS_packagegroup-meta-oe-security ="\ | ||
226 | tomoyo-tools \ | ||
227 | ${@bb.utils.contains("DISTRO_FEATURES", "pam", "passwdqc", "", d)} \ | ||
228 | ${@bb.utils.contains("DISTRO_FEATURES", "bluz5", "nmap", "", d)} \ | ||
229 | " | ||
230 | |||
231 | RDEPENDS_packagegroup-meta-oe-shells ="\ | ||
232 | dash tcsh zsh \ | ||
233 | " | ||
234 | |||
235 | NE10 = "" | ||
236 | NE10_aarch64 = "ne10" | ||
237 | NE10_armv7a = "ne10" | ||
238 | NE10_armv7ve = "ne10" | ||
239 | |||
240 | RDEPENDS_packagegroup-meta-oe-support ="\ | ||
241 | anthy asio atop augeas avro-c bdwgc frame grail c-ares \ | ||
242 | ccid ceres-solver ckermit cpprest ctapi-common daemonize \ | ||
243 | daemontools debsums devmem2 dfu-util dfu-util-native digitemp \ | ||
244 | dstat eject enca epeg espeak fbset fbset-modes \ | ||
245 | fftw fltk-native gd gflags glog gnulib gperftools \ | ||
246 | gpm gradm gsl gsoap hddtemp hidapi htop hunspell hwdata iksemel \ | ||
247 | libinih inotify-tools joe lcms lcov libatasmart libbytesize \ | ||
248 | libcereal libcyusbserial libee libeigen libestr libftdi libgit2 \ | ||
249 | libgpiod libiio libjs-jquery libjs-sizzle liblinebreak libmicrohttpd \ | ||
250 | libmxml liboauth libol liboop libp11 libraw1394 libsmi libsoc libssh2 \ | ||
251 | libssh libtar libteam libtinyxml2 libtinyxml libusbg libusb-compat libutempter \ | ||
252 | links lockdev log4c log4cpp logwarn libdevmapper lvm2 \ | ||
253 | mailcap mbuffer mg minini \ | ||
254 | multipath-tools nano neon nmon numactl onig openct openldap \ | ||
255 | opensc wbxml2 p910nd pcsc-lite picocom libotr pidgin \ | ||
256 | pngcheck poco poppler poppler-data portaudio-v19 pps-tools \ | ||
257 | pv pxaregs raptor2 rdfind read-edid rsnapshot \ | ||
258 | satyr sdparm pty-forward-native serial-forward \ | ||
259 | sg3-utils sharutils smem spitools srecord ssiapi stm32flash \ | ||
260 | syslog-ng system-config-keyboard tbb thin-provisioning-tools tokyocabinet \ | ||
261 | tree uhubctl unixodbc uriparser usb-modeswitch \ | ||
262 | usb-modeswitch-data uthash utouch-evemu utouch-frame \ | ||
263 | vim vim-tiny websocketpp xdelta3 xdg-user-dirs xmlstarlet \ | ||
264 | zbar zile \ | ||
265 | ${@bb.utils.contains("DISTRO_FEATURES", "x11", "geis toscoterm uim synergy utouch-mtview links-x11 fltk pidgin-otr", "", d)} \ | ||
266 | libcanberra \ | ||
267 | ${@bb.utils.contains("DISTRO_FEATURES", "x11 pam", "xorgxrdp xrdp", "", d)} \ | ||
268 | procmail \ | ||
269 | ${@bb.utils.contains("DISTRO_FEATURES", "polkit", "udisks2 upower", "", d)} \ | ||
270 | ${NE10} \ | ||
271 | ${@bb.utils.contains("BBFILE_COLLECTIONS", "meta-python2", "lio-utils", "", d)} \ | ||
272 | " | ||
273 | |||
274 | RDEPENDS_packagegroup-meta-oe-support_remove_arm ="numactl" | ||
275 | RDEPENDS_packagegroup-meta-oe-support_remove_mipsarch = "gperftools" | ||
276 | RDEPENDS_packagegroup-meta-oe-support_remove_riscv64 = "uim" | ||
277 | RDEPENDS_packagegroup-meta-oe-support_remove_riscv32 = "uim" | ||
278 | RDEPENDS_packagegroup-meta-oe-support_remove_powerpc = "ssiapi" | ||
279 | |||
280 | RDEPENDS_packagegroup-meta-oe-support-egl ="\ | ||
281 | freerdp libnice opencv \ | ||
282 | " | ||
283 | |||
284 | RDEPENDS_packagegroup-meta-oe-test ="\ | ||
285 | catch2 cppunit cunit cxxtest evtest fb-test \ | ||
286 | fwts googletest pm-qa stress-ng testfloat \ | ||
287 | " | ||
288 | RDEPENDS_packagegroup-meta-oe-test_remove_libc-musl = "pm-qa" | ||
289 | RDEPENDS_packagegroup-meta-oe-test_remove_arm = "fwts" | ||
290 | RDEPENDS_packagegroup-meta-oe-test_remove_mipsarch = "fwts" | ||
291 | RDEPENDS_packagegroup-meta-oe-test_remove_powerpc = "fwts" | ||
292 | RDEPENDS_packagegroup-meta-oe-test_remove_riscv64 = "fwts" | ||
293 | RDEPENDS_packagegroup-meta-oe-test_remove_riscv32 = "fwts" | ||
294 | |||
295 | RDEPENDS_packagegroup-meta-oe-ptest-packages = "\ | ||
296 | zeromq-ptest \ | ||
297 | leveldb-ptest \ | ||
298 | psqlodbc-ptest \ | ||
299 | lua-ptest \ | ||
300 | protobuf-ptest \ | ||
301 | rsyslog-ptest \ | ||
302 | oprofile-ptest \ | ||
303 | libteam-ptest \ | ||
304 | uthash-ptest \ | ||
305 | libee-ptest \ | ||
306 | poco-ptest \ | ||
307 | " | ||
308 | RDEPENDS_packagegroup-meta-oe-ptest-packages_append_x86 = "\ | ||
309 | mcelog-ptest \ | ||
310 | " | ||
311 | RDEPENDS_packagegroup-meta-oe-ptest-packages_append_x86-64 = "\ | ||
312 | mcelog-ptest \ | ||
313 | " | ||
314 | RDEPENDS_packagegroup-meta-oe-ptest-packages_remove_arm = "numactl-ptest" | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-IntelRDFPMathLib20U1-Check-for-__DEFINED_wchar_t.patch b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-IntelRDFPMathLib20U1-Check-for-__DEFINED_wchar_t.patch new file mode 100644 index 0000000000..e636adc556 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-IntelRDFPMathLib20U1-Check-for-__DEFINED_wchar_t.patch | |||
@@ -0,0 +1,35 @@ | |||
1 | From 97914aeab52b4d0ea0ab9e5ff985a1c5cddb0fa1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Vincent Prince <vincent.prince.fr@gmail.com> | ||
3 | Date: Mon, 16 Sep 2019 13:41:39 +0200 | ||
4 | Subject: [PATCH 06/10] IntelRDFPMathLib20U1: Check for __DEFINED_wchar_t | ||
5 | |||
6 | This is defined by musl if wchar_t is already defined | ||
7 | |||
8 | avoids errors like | ||
9 | |||
10 | src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid_functions.h:46:15: error: typedef redefinition with different types | ||
11 | ('int' vs 'unsigned int') | ||
12 | typedef int wchar_t; | ||
13 | |||
14 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
15 | Signed-off-by: Vincent Prince <vincent.prince.fr@gmail.com> | ||
16 | --- | ||
17 | src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid_functions.h | 2 +- | ||
18 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
19 | |||
20 | diff --git a/src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid_functions.h b/src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid_functions.h | ||
21 | index 56775bc..be96a85 100755 | ||
22 | --- a/src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid_functions.h | ||
23 | +++ b/src/third_party/IntelRDFPMathLib20U1/LIBRARY/src/bid_functions.h | ||
24 | @@ -43,7 +43,7 @@ | ||
25 | |||
26 | #if 0 // MongoDB Modification -- just `#include <stddef.h>` | ||
27 | // Fix system header issue on Sun solaris and define required type by ourselves | ||
28 | -#if !defined(_WCHAR_T) && !defined(_WCHAR_T_DEFINED) && !defined(__QNX__) | ||
29 | +#if !defined(_WCHAR_T) && !defined(_WCHAR_T_DEFINED) && !defined(__QNX__) && !defined(__DEFINED_wchar_t) | ||
30 | typedef int wchar_t; | ||
31 | #endif | ||
32 | #else | ||
33 | -- | ||
34 | 2.7.4 | ||
35 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Mark-one-of-strerror_r-implementation-glibc-specific.patch b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Mark-one-of-strerror_r-implementation-glibc-specific.patch new file mode 100644 index 0000000000..5337fcdbfd --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Mark-one-of-strerror_r-implementation-glibc-specific.patch | |||
@@ -0,0 +1,31 @@ | |||
1 | From ca004968b8d2149f72d4edcfe029489a8c5e10ca Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Mon, 23 Sep 2019 12:31:31 -0700 | ||
4 | Subject: [PATCH] Mark one of strerror_r implementation glibc specific | ||
5 | |||
6 | glibc has two incompatible strerror_r definitions, one of them is | ||
7 | specific to glibc, mark this one so | ||
8 | |||
9 | Upstream-Status: Pending | ||
10 | |||
11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
12 | --- | ||
13 | src/mongo/util/errno_util.cpp | 2 +- | ||
14 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
15 | |||
16 | diff --git a/src/mongo/util/errno_util.cpp b/src/mongo/util/errno_util.cpp | ||
17 | index 564c0071ea..4f7e1d3a38 100644 | ||
18 | --- a/src/mongo/util/errno_util.cpp | ||
19 | +++ b/src/mongo/util/errno_util.cpp | ||
20 | @@ -61,7 +61,7 @@ std::string errnoWithDescription(int errNumber) { | ||
21 | char buf[kBuflen]; | ||
22 | char* msg{nullptr}; | ||
23 | |||
24 | -#if defined(__GNUC__) && defined(_GNU_SOURCE) && \ | ||
25 | +#if defined(__GNUC__) && defined(_GNU_SOURCE) && defined(__GLIBC__) && \ | ||
26 | (!defined(__ANDROID_API__) || !(__ANDROID_API__ <= 22)) && !defined(EMSCRIPTEN) | ||
27 | msg = strerror_r(errNumber, buf, kBuflen); | ||
28 | #elif defined(_WIN32) | ||
29 | -- | ||
30 | 2.23.0 | ||
31 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Support-deprecated-resolver-functions.patch b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Support-deprecated-resolver-functions.patch new file mode 100644 index 0000000000..3d949c8730 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Support-deprecated-resolver-functions.patch | |||
@@ -0,0 +1,33 @@ | |||
1 | From 8d035e84c2edb44461ef4df9cdef0a6dfce0a1d7 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Fri, 24 Aug 2018 12:56:22 -0700 | ||
4 | Subject: [PATCH 07/10] Support deprecated resolver functions | ||
5 | |||
6 | Needed for musl libc | ||
7 | |||
8 | Upstream-Status: Pending | ||
9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
10 | --- | ||
11 | src/mongo/util/dns_query_posix-impl.h | 6 ++++++ | ||
12 | 1 file changed, 6 insertions(+) | ||
13 | |||
14 | diff --git a/src/mongo/util/dns_query_posix-impl.h b/src/mongo/util/dns_query_posix-impl.h | ||
15 | index a5e3629..fb29d2d 100644 | ||
16 | --- a/src/mongo/util/dns_query_posix-impl.h | ||
17 | +++ b/src/mongo/util/dns_query_posix-impl.h | ||
18 | @@ -54,6 +54,12 @@ | ||
19 | |||
20 | #include <boost/noncopyable.hpp> | ||
21 | |||
22 | +#ifndef res_ninit | ||
23 | +#define res_nclose(arg) | ||
24 | +#define res_ninit(arg) res_init() | ||
25 | +#define res_nsearch(sta, nam, clas, typ, ans, alen) res_search(nam, clas, typ, ans, alen) | ||
26 | +#endif | ||
27 | + | ||
28 | namespace mongo { | ||
29 | namespace dns { | ||
30 | // The anonymous namespace is safe, in this header, as it is not really a header. It is only used | ||
31 | -- | ||
32 | 2.7.4 | ||
33 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Tell-scons-to-use-build-settings-from-environment-va.patch b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Tell-scons-to-use-build-settings-from-environment-va.patch new file mode 100644 index 0000000000..1908846245 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Tell-scons-to-use-build-settings-from-environment-va.patch | |||
@@ -0,0 +1,56 @@ | |||
1 | From 1b2e24e14ee72e54e466be2512c78272f62d60b4 Mon Sep 17 00:00:00 2001 | ||
2 | From: Vincent Prince <vincent.prince.fr@gmail.com> | ||
3 | Date: Mon, 16 Sep 2019 13:21:44 +0200 | ||
4 | Subject: [PATCH 01/10] Tell scons to use build settings from environment | ||
5 | variables | ||
6 | |||
7 | Signed-off-by: Sven Ebenfeld <sven.ebenfeld@gmail.com> | ||
8 | Signed-off-by: Vincent Prince <vincent.prince.fr@gmail.com> | ||
9 | --- | ||
10 | SConstruct | 8 ++++++-- | ||
11 | 1 files changed, 8 insertions(+), 2 deletions(-) | ||
12 | |||
13 | diff --git a/SConstruct b/SConstruct | ||
14 | index 7ebbcbc..e63cf15 100644 | ||
15 | --- a/SConstruct | ||
16 | +++ b/SConstruct | ||
17 | @@ -608,6 +608,7 @@ def variable_arch_converter(val): | ||
18 | 'amd64': 'x86_64', | ||
19 | 'emt64': 'x86_64', | ||
20 | 'x86': 'i386', | ||
21 | + 'aarch64': 'arm64', | ||
22 | } | ||
23 | val = val.lower() | ||
24 | |||
25 | @@ -695,7 +696,8 @@ env_vars.Add( | ||
26 | ) | ||
27 | |||
28 | env_vars.Add('CC', | ||
29 | - help='Select the C compiler to use') | ||
30 | + help='Select the C compiler to use', | ||
31 | + default=os.getenv('CC')) | ||
32 | |||
33 | env_vars.Add('CCFLAGS', | ||
34 | help='Sets flags for the C and C++ compiler', | ||
35 | @@ -715,7 +717,8 @@ env_vars.Add('CPPPATH', | ||
36 | converter=variable_shlex_converter) | ||
37 | |||
38 | env_vars.Add('CXX', | ||
39 | - help='Select the C++ compiler to use') | ||
40 | + help='Select the C++ compiler to use', | ||
41 | + default=os.getenv('CXX')) | ||
42 | |||
43 | env_vars.Add('CXXFLAGS', | ||
44 | help='Sets flags for the C++ compiler', | ||
45 | @@ -1018,6 +1021,7 @@ envDict = dict(BUILD_ROOT=buildDir, | ||
46 | ) | ||
47 | |||
48 | env = Environment(variables=env_vars, **envDict) | ||
49 | +env.PrependENVPath('PATH', os.getenv('PATH')) | ||
50 | del envDict | ||
51 | |||
52 | for var in ['CC', 'CXX']: | ||
53 | |||
54 | -- | ||
55 | 2.7.4 | ||
56 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Use-__GLIBC__-to-control-use-of-gnu_get_libc_version.patch b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Use-__GLIBC__-to-control-use-of-gnu_get_libc_version.patch new file mode 100644 index 0000000000..d98fa56cbb --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Use-__GLIBC__-to-control-use-of-gnu_get_libc_version.patch | |||
@@ -0,0 +1,41 @@ | |||
1 | From d701ceeb15662038435b80ba556a80c17f76d2dc Mon Sep 17 00:00:00 2001 | ||
2 | From: Vincent Prince <vincent.prince.fr@gmail.com> | ||
3 | Date: Mon, 16 Sep 2019 13:30:13 +0200 | ||
4 | Subject: [PATCH 03/10] Use __GLIBC__ to control use of gnu_get_libc_version | ||
5 | |||
6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
7 | Signed-off-by: Vincent Prince <vincent.prince.fr@gmail.com> | ||
8 | --- | ||
9 | src/mongo/util/processinfo_linux.cpp | 8 ++++---- | ||
10 | 1 file changed, 4 insertions(+), 4 deletions(-) | ||
11 | |||
12 | diff --git a/src/mongo/util/processinfo_linux.cpp b/src/mongo/util/processinfo_linux.cpp | ||
13 | index cccb91c..45c4b7d 100644 | ||
14 | --- a/src/mongo/util/processinfo_linux.cpp | ||
15 | +++ b/src/mongo/util/processinfo_linux.cpp | ||
16 | @@ -44,10 +44,10 @@ | ||
17 | #include <unistd.h> | ||
18 | #ifdef __BIONIC__ | ||
19 | #include <android/api-level.h> | ||
20 | -#elif __UCLIBC__ | ||
21 | -#include <features.h> | ||
22 | -#else | ||
23 | +#elif defined(__GLIBC__) && !defined(__UCLIBC__) | ||
24 | #include <gnu/libc-version.h> | ||
25 | +#else | ||
26 | +#include <features.h> | ||
27 | #endif | ||
28 | |||
29 | #include <boost/filesystem.hpp> | ||
30 | @@ -546,7 +546,7 @@ void ProcessInfo::SystemInfo::collectSystemInfo() { | ||
31 | std::stringstream ss; | ||
32 | ss << "uClibc-" << __UCLIBC_MAJOR__ << "." << __UCLIBC_MINOR__ << "." << __UCLIBC_SUBLEVEL__; | ||
33 | bExtra.append("libcVersion", ss.str()); | ||
34 | -#else | ||
35 | +#elif defined(__GLIBC__) | ||
36 | bExtra.append("libcVersion", gnu_get_libc_version()); | ||
37 | #endif | ||
38 | if (!verSig.empty()) | ||
39 | -- | ||
40 | 2.7.4 | ||
41 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Use-long-long-instead-of-int64_t.patch b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Use-long-long-instead-of-int64_t.patch new file mode 100644 index 0000000000..b9c6704075 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-Use-long-long-instead-of-int64_t.patch | |||
@@ -0,0 +1,66 @@ | |||
1 | From 20fcbf2a05ee6542aba942f6006d149db70fb9ce Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sat, 2 Sep 2017 10:03:37 -0700 | ||
4 | Subject: [PATCH 02/10] Use long long instead of int64_t | ||
5 | |||
6 | Fixes | ||
7 | error: call to member function 'appendNumber' is ambiguous | ||
8 | since this function expects long long as parameter and not int64_t | ||
9 | |||
10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
11 | --- | ||
12 | src/mongo/util/procparser.cpp | 10 +++++----- | ||
13 | 1 file changed, 5 insertions(+), 5 deletions(-) | ||
14 | |||
15 | diff --git a/src/mongo/util/procparser.cpp b/src/mongo/util/procparser.cpp | ||
16 | index c574a3f..5ea66b7 100644 | ||
17 | --- a/src/mongo/util/procparser.cpp | ||
18 | +++ b/src/mongo/util/procparser.cpp | ||
19 | @@ -261,7 +261,7 @@ Status parseProcStat(const std::vector<StringData>& keys, | ||
20 | |||
21 | StringData stringValue((*partIt).begin(), (*partIt).end() - (*partIt).begin()); | ||
22 | |||
23 | - uint64_t value; | ||
24 | + long long value; | ||
25 | |||
26 | if (!parseNumberFromString(stringValue, &value).isOK()) { | ||
27 | value = 0; | ||
28 | @@ -273,7 +273,7 @@ Status parseProcStat(const std::vector<StringData>& keys, | ||
29 | } else { | ||
30 | StringData stringValue((*partIt).begin(), (*partIt).end() - (*partIt).begin()); | ||
31 | |||
32 | - uint64_t value; | ||
33 | + long long value; | ||
34 | |||
35 | if (!parseNumberFromString(stringValue, &value).isOK()) { | ||
36 | value = 0; | ||
37 | @@ -366,7 +366,7 @@ Status parseProcMemInfo(const std::vector<StringData>& keys, | ||
38 | |||
39 | StringData stringValue((*partIt).begin(), (*partIt).end()); | ||
40 | |||
41 | - uint64_t value; | ||
42 | + long long value; | ||
43 | |||
44 | if (!parseNumberFromString(stringValue, &value).isOK()) { | ||
45 | value = 0; | ||
46 | @@ -522,7 +522,7 @@ Status parseProcDiskStats(const std::vector<StringData>& disks, | ||
47 | StringData data, | ||
48 | BSONObjBuilder* builder) { | ||
49 | bool foundKeys = false; | ||
50 | - std::vector<uint64_t> stats; | ||
51 | + std::vector<long long> stats; | ||
52 | stats.reserve(kDiskFieldCount); | ||
53 | |||
54 | using string_split_iterator = boost::split_iterator<StringData::const_iterator>; | ||
55 | @@ -597,7 +597,7 @@ Status parseProcDiskStats(const std::vector<StringData>& disks, | ||
56 | |||
57 | StringData stringValue((*partIt).begin(), (*partIt).end()); | ||
58 | |||
59 | - uint64_t value; | ||
60 | + long long value; | ||
61 | |||
62 | if (!parseNumberFromString(stringValue, &value).isOK()) { | ||
63 | value = 0; | ||
64 | -- | ||
65 | 2.7.4 | ||
66 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-asio-Dont-use-experimental-with-clang.patch b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-asio-Dont-use-experimental-with-clang.patch new file mode 100644 index 0000000000..e726933f56 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0001-asio-Dont-use-experimental-with-clang.patch | |||
@@ -0,0 +1,29 @@ | |||
1 | From 097e8a66930cfa28ac8bfa35f62d0a9ee3b74488 Mon Sep 17 00:00:00 2001 | ||
2 | From: Vincent Prince <vincent.prince.fr@gmail.com> | ||
3 | Date: Mon, 16 Sep 2019 13:46:52 +0200 | ||
4 | Subject: [PATCH 10/10] asio: Dont use experimental with clang | ||
5 | |||
6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
7 | Signed-off-by: Vincent Prince <vincent.prince.fr@gmail.com> | ||
8 | --- | ||
9 | src/third_party/asio-master/asio/include/asio/detail/string_view.hpp | 4 ++-- | ||
10 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
11 | |||
12 | diff --git a/src/third_party/asio-master/asio/include/asio/detail/string_view.hpp b/src/third_party/asio-master/asio/include/asio/detail/string_view.hpp | ||
13 | index f09cebc..fa307b5 100644 | ||
14 | --- a/src/third_party/asio-master/asio/include/asio/detail/string_view.hpp | ||
15 | +++ b/src/third_party/asio-master/asio/include/asio/detail/string_view.hpp | ||
16 | @@ -33,8 +33,8 @@ namespace asio { | ||
17 | using std::basic_string_view; | ||
18 | using std::string_view; | ||
19 | #elif defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW) | ||
20 | -using std::experimental::basic_string_view; | ||
21 | -using std::experimental::string_view; | ||
22 | +using std::basic_string_view; | ||
23 | +using std::string_view; | ||
24 | #endif // defined(ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW) | ||
25 | |||
26 | } // namespace asio | ||
27 | -- | ||
28 | 2.7.4 | ||
29 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0002-Add-a-definition-for-the-macro-__ELF_NATIVE_CLASS.patch b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0002-Add-a-definition-for-the-macro-__ELF_NATIVE_CLASS.patch new file mode 100644 index 0000000000..869d2849df --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0002-Add-a-definition-for-the-macro-__ELF_NATIVE_CLASS.patch | |||
@@ -0,0 +1,35 @@ | |||
1 | From 73c6374ceb0c062e91210cc9ef3e0e9fa30ee514 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sat, 2 Sep 2017 12:42:30 -0700 | ||
4 | Subject: [PATCH 04/10] Add a definition for the macro __ELF_NATIVE_CLASS | ||
5 | |||
6 | It depends on the native arch's word size. | ||
7 | |||
8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
9 | --- | ||
10 | src/mongo/util/stacktrace_posix.cpp | 9 +++++++++ | ||
11 | 1 file changed, 9 insertions(+) | ||
12 | |||
13 | diff --git a/src/mongo/util/stacktrace_posix.cpp b/src/mongo/util/stacktrace_posix.cpp | ||
14 | index 1d7b3d7..f81e329 100644 | ||
15 | --- a/src/mongo/util/stacktrace_posix.cpp | ||
16 | +++ b/src/mongo/util/stacktrace_posix.cpp | ||
17 | @@ -39,6 +39,15 @@ | ||
18 | #include <string> | ||
19 | #include <sys/utsname.h> | ||
20 | |||
21 | +#if !defined(__GLIBC__) | ||
22 | +#if defined __x86_64__ && !defined __ILP32__ | ||
23 | +# define __WORDSIZE 64 | ||
24 | +#else | ||
25 | +# define __WORDSIZE 32 | ||
26 | +#endif | ||
27 | +#define __ELF_NATIVE_CLASS __WORDSIZE | ||
28 | +#endif | ||
29 | + | ||
30 | #include "mongo/base/init.h" | ||
31 | #include "mongo/config.h" | ||
32 | #include "mongo/db/jsobj.h" | ||
33 | -- | ||
34 | 2.7.4 | ||
35 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0002-Fix-default-stack-size-to-256K.patch b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0002-Fix-default-stack-size-to-256K.patch new file mode 100644 index 0000000000..59066b2600 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0002-Fix-default-stack-size-to-256K.patch | |||
@@ -0,0 +1,39 @@ | |||
1 | From ffe6045b190b735601cd209d3e7ac121604c5a4e Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Fri, 24 Aug 2018 13:07:01 -0700 | ||
4 | Subject: [PATCH 08/10] Fix default stack size to 256K | ||
5 | |||
6 | On musl default stack size is ~80K which is too low | ||
7 | for mongodb | ||
8 | |||
9 | Upstream-Status: Pending | ||
10 | |||
11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
12 | --- | ||
13 | src/mongo/platform/stack_locator_pthread_getattr_np.cpp | 10 ++++++++++ | ||
14 | 1 file changed, 10 insertions(+) | ||
15 | |||
16 | diff --git a/src/mongo/platform/stack_locator_pthread_getattr_np.cpp b/src/mongo/platform/stack_locator_pthread_getattr_np.cpp | ||
17 | index 4f3044c..68e47e3 100644 | ||
18 | --- a/src/mongo/platform/stack_locator_pthread_getattr_np.cpp | ||
19 | +++ b/src/mongo/platform/stack_locator_pthread_getattr_np.cpp | ||
20 | @@ -36,6 +36,16 @@ | ||
21 | #include "mongo/util/assert_util.h" | ||
22 | #include "mongo/util/scopeguard.h" | ||
23 | |||
24 | +__attribute__((constructor)) | ||
25 | +static void set_default_stack_size(void) | ||
26 | +{ | ||
27 | + pthread_attr_t attr; | ||
28 | + invariant(pthread_attr_init(&attr) == 0); | ||
29 | + invariant(pthread_attr_setstacksize(&attr, 256*1024) == 0); | ||
30 | + pthread_setattr_default_np(&attr); | ||
31 | + invariant(pthread_attr_destroy(&attr) == 0); | ||
32 | +} | ||
33 | + | ||
34 | namespace mongo { | ||
35 | |||
36 | StackLocator::StackLocator() { | ||
37 | -- | ||
38 | 2.7.4 | ||
39 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0003-Fix-unknown-prefix-env.patch b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0003-Fix-unknown-prefix-env.patch new file mode 100644 index 0000000000..3a27aacfe4 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0003-Fix-unknown-prefix-env.patch | |||
@@ -0,0 +1,19 @@ | |||
1 | Index: git/SConstruct | ||
2 | =================================================================== | ||
3 | --- git.orig/SConstruct | ||
4 | +++ git/SConstruct | ||
5 | @@ -884,6 +884,14 @@ env_vars.Add('WINDOWS_OPENSSL_BIN', | ||
6 | help='Sets the path to the openssl binaries for packaging', | ||
7 | default='c:/openssl/bin') | ||
8 | |||
9 | +env_vars.Add('PREFIX', | ||
10 | + help='installation prefix') | ||
11 | + | ||
12 | +env_vars.Add('prefix', | ||
13 | + help='installation prefix') | ||
14 | + | ||
15 | + | ||
16 | + | ||
17 | # -- Validate user provided options -- | ||
18 | |||
19 | # A dummy environment that should *only* have the variables we have set. In practice it has | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0004-wiredtiger-Disable-strtouq-on-musl.patch b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0004-wiredtiger-Disable-strtouq-on-musl.patch new file mode 100644 index 0000000000..2cea9bc31f --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/0004-wiredtiger-Disable-strtouq-on-musl.patch | |||
@@ -0,0 +1,26 @@ | |||
1 | From cc95a8878fa581b164dee8fb1f07b05b9d919ef0 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sat, 2 Sep 2017 13:13:15 -0700 | ||
4 | Subject: [PATCH 09/10] wiredtiger: Disable strtouq on musl | ||
5 | |||
6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
7 | --- | ||
8 | src/third_party/wiredtiger/build_linux/wiredtiger_config.h | 2 +- | ||
9 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
10 | |||
11 | diff --git a/src/third_party/wiredtiger/build_linux/wiredtiger_config.h b/src/third_party/wiredtiger/build_linux/wiredtiger_config.h | ||
12 | index 82e9994..0399a67 100644 | ||
13 | --- a/src/third_party/wiredtiger/build_linux/wiredtiger_config.h | ||
14 | +++ b/src/third_party/wiredtiger/build_linux/wiredtiger_config.h | ||
15 | @@ -104,7 +104,7 @@ | ||
16 | #define HAVE_STRING_H 1 | ||
17 | |||
18 | /* Define to 1 if you have the `strtouq' function. */ | ||
19 | -#define HAVE_STRTOUQ 1 | ||
20 | +/* #undef HAVE_STRTOUQ 1 */ | ||
21 | |||
22 | /* Define to 1 if you have the `sync_file_range' function. */ | ||
23 | /* #undef HAVE_SYNC_FILE_RANGE */ | ||
24 | -- | ||
25 | 2.7.4 | ||
26 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/arm64-support.patch b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/arm64-support.patch new file mode 100644 index 0000000000..15bd7da702 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb/arm64-support.patch | |||
@@ -0,0 +1,54 @@ | |||
1 | From c9fc9e9a44b0fb764ce86a5e57f17d3c5bbfd8cd Mon Sep 17 00:00:00 2001 | ||
2 | From: Vincent Prince <vincent.prince.fr@gmail.com> | ||
3 | Date: Mon, 16 Sep 2019 13:37:10 +0200 | ||
4 | Subject: [PATCH 05/10] Add alises for arm64 which is same as aarch64 | ||
5 | |||
6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
7 | Signed-off-by: Vincent Prince <vincent.prince.fr@gmail.com> | ||
8 | --- | ||
9 | SConstruct | 1 + | ||
10 | src/third_party/IntelRDFPMathLib20U1/SConscript | 2 +- | ||
11 | src/third_party/wiredtiger/SConscript | 2 +- | ||
12 | 3 files changed, 3 insertions(+), 2 deletions(-) | ||
13 | |||
14 | diff --git a/SConstruct b/SConstruct | ||
15 | index e63cf15..5593c78 100644 | ||
16 | --- a/SConstruct | ||
17 | +++ b/SConstruct | ||
18 | @@ -1129,6 +1129,7 @@ elif endian == "big": | ||
19 | processor_macros = { | ||
20 | 'arm' : { 'endian': 'little', 'defines': ('__arm__',) }, | ||
21 | 'aarch64' : { 'endian': 'little', 'defines': ('__arm64__', '__aarch64__')}, | ||
22 | + 'arm64' : { 'endian': 'little', 'defines': ('__arm64__', '__aarch64__')}, | ||
23 | 'i386' : { 'endian': 'little', 'defines': ('__i386', '_M_IX86')}, | ||
24 | 'ppc64le' : { 'endian': 'little', 'defines': ('__powerpc64__',)}, | ||
25 | 's390x' : { 'endian': 'big', 'defines': ('__s390x__',)}, | ||
26 | diff --git a/src/third_party/IntelRDFPMathLib20U1/SConscript b/src/third_party/IntelRDFPMathLib20U1/SConscript | ||
27 | index f23c071..fb82cd6 100644 | ||
28 | --- a/src/third_party/IntelRDFPMathLib20U1/SConscript | ||
29 | +++ b/src/third_party/IntelRDFPMathLib20U1/SConscript | ||
30 | @@ -308,7 +308,7 @@ if processor == 'i386' or processor == 'emscripten': | ||
31 | elif processor == 'arm': | ||
32 | cpp_defines['IA32'] = '1' | ||
33 | cpp_defines['ia32'] = '1' | ||
34 | -elif processor == "aarch64": | ||
35 | +elif processor == "aarch64" or processor == 'arm64': | ||
36 | cpp_defines['efi2'] = '1' | ||
37 | cpp_defines['EFI2'] = '1' | ||
38 | # Using 64 bit little endian | ||
39 | diff --git a/src/third_party/wiredtiger/SConscript b/src/third_party/wiredtiger/SConscript | ||
40 | index cdd090b..97a1b3b 100644 | ||
41 | --- a/src/third_party/wiredtiger/SConscript | ||
42 | +++ b/src/third_party/wiredtiger/SConscript | ||
43 | @@ -152,7 +152,7 @@ condition_map = { | ||
44 | 'POSIX_HOST' : not env.TargetOSIs('windows'), | ||
45 | 'WINDOWS_HOST' : env.TargetOSIs('windows'), | ||
46 | |||
47 | - 'ARM64_HOST' : env['TARGET_ARCH'] == 'aarch64', | ||
48 | + 'ARM64_HOST' : env['TARGET_ARCH'] in ('aarch64', 'arm64'), | ||
49 | 'POWERPC_HOST' : env['TARGET_ARCH'] == 'ppc64le', | ||
50 | 'X86_HOST' : env['TARGET_ARCH'] == 'x86_64', | ||
51 | 'ZSERIES_HOST' : env['TARGET_ARCH'] == 's390x', | ||
52 | -- | ||
53 | 2.7.4 | ||
54 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb new file mode 100644 index 0000000000..6f460bf762 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-dbs/mongodb/mongodb_git.bb | |||
@@ -0,0 +1,73 @@ | |||
1 | SUMMARY = "mongodb" | ||
2 | LICENSE = "SSPL-1 & Apache-2.0 & Zlib" | ||
3 | LIC_FILES_CHKSUM = "file://LICENSE-Community.txt;md5=3a865f27f11f43ecbe542d9ea387dcf1 \ | ||
4 | file://APACHE-2.0.txt;md5=3b83ef96387f14655fc854ddc3c6bd57" | ||
5 | |||
6 | DEPENDS = "openssl libpcap zlib boost curl python3 \ | ||
7 | python3-setuptools-native \ | ||
8 | python3-pyyaml-native python3-cheetah-native \ | ||
9 | python3-psutil-native python3-regex-native \ | ||
10 | " | ||
11 | |||
12 | inherit scons dos2unix siteinfo python3native | ||
13 | |||
14 | PV = "4.2.2" | ||
15 | #v4.2.2 | ||
16 | SRCREV = "a0bbbff6ada159e19298d37946ac8dc4b497eadf" | ||
17 | SRC_URI = "git://github.com/mongodb/mongo.git;branch=v4.2 \ | ||
18 | file://0001-Tell-scons-to-use-build-settings-from-environment-va.patch \ | ||
19 | file://0001-Use-long-long-instead-of-int64_t.patch \ | ||
20 | file://0001-Use-__GLIBC__-to-control-use-of-gnu_get_libc_version.patch \ | ||
21 | file://0002-Add-a-definition-for-the-macro-__ELF_NATIVE_CLASS.patch \ | ||
22 | file://arm64-support.patch \ | ||
23 | file://0001-IntelRDFPMathLib20U1-Check-for-__DEFINED_wchar_t.patch \ | ||
24 | file://0001-Support-deprecated-resolver-functions.patch \ | ||
25 | file://0003-Fix-unknown-prefix-env.patch \ | ||
26 | " | ||
27 | SRC_URI_append_libc-musl ="\ | ||
28 | file://0001-Mark-one-of-strerror_r-implementation-glibc-specific.patch \ | ||
29 | file://0002-Fix-default-stack-size-to-256K.patch \ | ||
30 | file://0004-wiredtiger-Disable-strtouq-on-musl.patch \ | ||
31 | " | ||
32 | |||
33 | SRC_URI_append_toolchain-clang = "\ | ||
34 | file://0001-asio-Dont-use-experimental-with-clang.patch \ | ||
35 | " | ||
36 | |||
37 | S = "${WORKDIR}/git" | ||
38 | |||
39 | COMPATIBLE_HOST ?= '(x86_64|powerpc64|aarch64).*-linux' | ||
40 | |||
41 | PACKAGECONFIG ??= "tcmalloc system-pcre" | ||
42 | # gperftools compilation fails for arm below v7 because of missing support of | ||
43 | # dmb operation. So we use system-allocator instead of tcmalloc | ||
44 | PACKAGECONFIG_remove_armv6 = "tcmalloc" | ||
45 | PACKAGECONFIG_remove_libc-musl = "tcmalloc" | ||
46 | |||
47 | PACKAGECONFIG[tcmalloc] = "--use-system-tcmalloc,--allocator=system,gperftools," | ||
48 | PACKAGECONFIG[shell] = ",--js-engine=none,," | ||
49 | PACKAGECONFIG[system-pcre] = "--use-system-pcre,,libpcre," | ||
50 | |||
51 | EXTRA_OESCONS = "--prefix=${D}${prefix} \ | ||
52 | LIBPATH=${STAGING_LIBDIR} \ | ||
53 | LINKFLAGS='${LDFLAGS}' \ | ||
54 | CXXFLAGS='${CXXFLAGS}' \ | ||
55 | TARGET_ARCH=${TARGET_ARCH} \ | ||
56 | --ssl \ | ||
57 | --disable-warnings-as-errors \ | ||
58 | --use-system-zlib \ | ||
59 | --nostrip \ | ||
60 | --endian=${@oe.utils.conditional('SITEINFO_ENDIANNESS', 'le', 'little', 'big', d)} \ | ||
61 | --wiredtiger=${@['off','on'][d.getVar('SITEINFO_BITS') != '32']} \ | ||
62 | ${PACKAGECONFIG_CONFARGS} \ | ||
63 | core" | ||
64 | |||
65 | scons_do_compile() { | ||
66 | ${STAGING_BINDIR_NATIVE}/scons ${PARALLEL_MAKE} ${EXTRA_OESCONS} || \ | ||
67 | die "scons build execution failed." | ||
68 | } | ||
69 | |||
70 | scons_do_install() { | ||
71 | ${STAGING_BINDIR_NATIVE}/scons install ${EXTRA_OESCONS}|| \ | ||
72 | die "scons install execution failed." | ||
73 | } | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-extended/lcdproc/lcdproc/0001-Fix-parallel-build-fix-port-internal-make-dependenci.patch b/meta-oe/dynamic-layers/meta-python/recipes-extended/lcdproc/lcdproc/0001-Fix-parallel-build-fix-port-internal-make-dependenci.patch new file mode 100644 index 0000000000..f6a7956db2 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-extended/lcdproc/lcdproc/0001-Fix-parallel-build-fix-port-internal-make-dependenci.patch | |||
@@ -0,0 +1,33 @@ | |||
1 | From a20feee4963bc38975fbaf44bbe85a31825f59db Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sat, 6 Apr 2019 17:28:28 -0700 | ||
4 | Subject: [PATCH 1/3] Fix parallel build (fix port-internal make dependencies) | ||
5 | on many cores | ||
6 | |||
7 | Upstream-Status: Submitted [https://github.com/lcdproc/lcdproc/pull/142] | ||
8 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
9 | --- | ||
10 | server/drivers/Makefile.am | 4 ++-- | ||
11 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
12 | |||
13 | diff --git a/server/drivers/Makefile.am b/server/drivers/Makefile.am | ||
14 | index e08f2b2d..4fd2e3f1 100644 | ||
15 | --- a/server/drivers/Makefile.am | ||
16 | +++ b/server/drivers/Makefile.am | ||
17 | @@ -47,11 +47,11 @@ CwLnx_LDADD = libLCD.a libbignum.a | ||
18 | futaba_LDADD = @LIBUSB_LIBS@ @LIBUSB_1_0_LIBS@ libLCD.a | ||
19 | g15_LDADD = @LIBG15@ | ||
20 | glcd_LDADD = libLCD.a @GLCD_DRIVERS@ @FT2_LIBS@ @LIBPNG_LIBS@ @LIBSERDISP@ @LIBUSB_LIBS@ @LIBX11_LIBS@ | ||
21 | -glcd_DEPENDENCIES = @GLCD_DRIVERS@ glcd-glcd-render.o | ||
22 | +glcd_DEPENDENCIES = @GLCD_DRIVERS@ glcd-glcd-render.o libLCD.a | ||
23 | glcdlib_LDADD = @LIBGLCD@ | ||
24 | glk_LDADD = libbignum.a | ||
25 | hd44780_LDADD = libLCD.a @HD44780_DRIVERS@ @HD44780_I2C@ @LIBUSB_LIBS@ @LIBFTDI_LIBS@ @LIBUGPIO@ libbignum.a | ||
26 | -hd44780_DEPENDENCIES = @HD44780_DRIVERS@ @HD44780_I2C@ | ||
27 | +hd44780_DEPENDENCIES = @HD44780_DRIVERS@ @HD44780_I2C@ libLCD.a libbignum.a | ||
28 | i2500vfd_LDADD = @LIBFTDI_LIBS@ | ||
29 | imon_LDADD = libLCD.a libbignum.a | ||
30 | imonlcd_LDADD = libLCD.a | ||
31 | -- | ||
32 | 2.24.1 | ||
33 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-extended/lcdproc/lcdproc/0002-Include-limits.h-for-PATH_MAX-definition.patch b/meta-oe/dynamic-layers/meta-python/recipes-extended/lcdproc/lcdproc/0002-Include-limits.h-for-PATH_MAX-definition.patch new file mode 100644 index 0000000000..eb866bf10a --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-extended/lcdproc/lcdproc/0002-Include-limits.h-for-PATH_MAX-definition.patch | |||
@@ -0,0 +1,41 @@ | |||
1 | From d447a05ee560ba5894d2ed4cd93d0475c2f3c08e Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Tue, 17 Dec 2019 17:39:32 -0800 | ||
4 | Subject: [PATCH 2/3] Include <limits.h> for PATH_MAX definition | ||
5 | |||
6 | musl libc exposes the missing include | ||
7 | |||
8 | Upstream-Status: Submitted [https://github.com/lcdproc/lcdproc/pull/142] | ||
9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
10 | --- | ||
11 | server/drivers/hidraw_lib.c | 1 + | ||
12 | server/drivers/linux_input.c | 1 + | ||
13 | 2 files changed, 2 insertions(+) | ||
14 | |||
15 | diff --git a/server/drivers/hidraw_lib.c b/server/drivers/hidraw_lib.c | ||
16 | index 49b03f20..3b51f279 100644 | ||
17 | --- a/server/drivers/hidraw_lib.c | ||
18 | +++ b/server/drivers/hidraw_lib.c | ||
19 | @@ -8,6 +8,7 @@ | ||
20 | #include <dirent.h> | ||
21 | #include <errno.h> | ||
22 | #include <fcntl.h> | ||
23 | +#include <limits.h> | ||
24 | #include <stdlib.h> | ||
25 | #include <string.h> | ||
26 | #include <sys/ioctl.h> | ||
27 | diff --git a/server/drivers/linux_input.c b/server/drivers/linux_input.c | ||
28 | index 5b914d4c..6fcfc591 100644 | ||
29 | --- a/server/drivers/linux_input.c | ||
30 | +++ b/server/drivers/linux_input.c | ||
31 | @@ -5,6 +5,7 @@ | ||
32 | |||
33 | #include <dirent.h> | ||
34 | #include <errno.h> | ||
35 | +#include <limits.h> | ||
36 | #include <stdint.h> | ||
37 | #include <stdio.h> | ||
38 | #include <stdlib.h> | ||
39 | -- | ||
40 | 2.24.1 | ||
41 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-extended/lcdproc/lcdproc/0003-Fix-non-x86-platforms-on-musl.patch b/meta-oe/dynamic-layers/meta-python/recipes-extended/lcdproc/lcdproc/0003-Fix-non-x86-platforms-on-musl.patch new file mode 100644 index 0000000000..e39e9bda14 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-extended/lcdproc/lcdproc/0003-Fix-non-x86-platforms-on-musl.patch | |||
@@ -0,0 +1,35 @@ | |||
1 | From 7fd144f101fa5c9316d3468ed26f55629afe1305 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Tue, 17 Dec 2019 17:55:54 -0800 | ||
4 | Subject: [PATCH 3/3] Fix non x86 platforms on musl | ||
5 | |||
6 | Musl only specifies in/outb for x86/x86. Use the fallback path in case | ||
7 | musl is used. | ||
8 | |||
9 | This should fail compilation during the linking stage but for some reason | ||
10 | does not. Will do if -Werror=implicit-function-declaration is specified. | ||
11 | |||
12 | Original here: https://github.com/openwrt/packages/blob/master/utils/lcdproc/patches/110-in-outb.patch | ||
13 | Upstream-Status: Pending | ||
14 | |||
15 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
16 | --- | ||
17 | server/drivers/port.h | 2 +- | ||
18 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
19 | |||
20 | diff --git a/server/drivers/port.h b/server/drivers/port.h | ||
21 | index c584cd4e..bde235b3 100644 | ||
22 | --- a/server/drivers/port.h | ||
23 | +++ b/server/drivers/port.h | ||
24 | @@ -94,7 +94,7 @@ static inline int port_deny_multiple(unsigned short port, unsigned short count); | ||
25 | /* ---------------------------- Linux ------------------------------------ */ | ||
26 | /* Use ioperm, inb and outb in <sys/io.h> (Linux) */ | ||
27 | /* And iopl for higher addresses of PCI LPT cards */ | ||
28 | -#if defined HAVE_IOPERM | ||
29 | +#if defined(__GLIBC__) || (defined(__x86__) || defined(__x86_64__)) | ||
30 | |||
31 | /* Glibc2 and Glibc1 */ | ||
32 | # ifdef HAVE_SYS_IO_H | ||
33 | -- | ||
34 | 2.24.1 | ||
35 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-extended/lcdproc/lcdproc_git.bb b/meta-oe/dynamic-layers/meta-python/recipes-extended/lcdproc/lcdproc_git.bb new file mode 100644 index 0000000000..275b984e47 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-extended/lcdproc/lcdproc_git.bb | |||
@@ -0,0 +1,105 @@ | |||
1 | DESCRIPTION = "LCDproc is a client/server suite to drive all kinds of LCD (-like) devices. The client \ | ||
2 | shipped with this package can be used to acquire various kinds of system stats." | ||
3 | SUMMARY = "Drivers for character-based LCD displays" | ||
4 | HOMEPAGE = "http://lcdproc.org" | ||
5 | SECTION = "utils" | ||
6 | LICENSE = "GPLv2+" | ||
7 | DEPENDS = "ncurses lirc" | ||
8 | |||
9 | LIC_FILES_CHKSUM = "file://COPYING;md5=18810669f13b87348459e611d31ab760 \ | ||
10 | file://README.md;beginline=107;md5=5db392f043253a2d64b1737068ce6b58" | ||
11 | |||
12 | PV = "0.5.9+git${SRCPV}" | ||
13 | SRCREV = "3a3d622d9bb74c44fa67bc20573751a207514134" | ||
14 | SRC_URI = "git://github.com/lcdproc/lcdproc \ | ||
15 | file://0001-Fix-parallel-build-fix-port-internal-make-dependenci.patch \ | ||
16 | file://0002-Include-limits.h-for-PATH_MAX-definition.patch \ | ||
17 | file://0003-Fix-non-x86-platforms-on-musl.patch \ | ||
18 | " | ||
19 | |||
20 | S = "${WORKDIR}/git" | ||
21 | |||
22 | inherit autotools pkgconfig update-rc.d | ||
23 | |||
24 | LCD_DRIVERS ?= "all,!irman,!svga${SERIALVFD}" | ||
25 | SERIALVFD ?= "" | ||
26 | SERIALVFD_libc-musl = ",!serialVFD" | ||
27 | SERIALVFD_libc-musl_x86 = "" | ||
28 | SERIALVFD_libc-musl_x86-64 = "" | ||
29 | |||
30 | LCD_DEFAULT_DRIVER ?= "curses" | ||
31 | |||
32 | PACKAGECONFIG ??= "usb" | ||
33 | PACKAGECONFIG[usb] = "--enable-libusb,--disable-libusb,virtual/libusb0" | ||
34 | PACKAGECONFIG[ftdi] = "--enable-libftdi,--disable-libftdi,libftdi" | ||
35 | PACKAGECONFIG[g15] = ",,libg15 g15daemon libg15render," | ||
36 | PACKAGECONFIG[hid] = "--enable-libhid,--disable-libhid,libhid" | ||
37 | PACKAGECONFIG[png] = "--enable-libpng,--disable-libpng,libpng" | ||
38 | |||
39 | LCD_DRIVERS_append = "${@bb.utils.contains('PACKAGECONFIG', 'g15', '', ',!g15', d)}" | ||
40 | |||
41 | EXTRA_OECONF = "--enable-drivers='${LCD_DRIVERS}'" | ||
42 | |||
43 | do_install () { | ||
44 | # binaries | ||
45 | install -D -m 0755 server/LCDd ${D}${sbindir}/LCDd | ||
46 | install -D -m 0755 clients/lcdproc/lcdproc ${D}${bindir}/lcdproc | ||
47 | |||
48 | # init scripts | ||
49 | install -d ${D}${sysconfdir}/init.d | ||
50 | # so far, not fixed :-( and now even uglier :-(( | ||
51 | cat scripts/init-LCDd.debian | sed -e s'/--oknodo//' -e 's/ -s -f / -s 1 -f 1 /' -e 's/force-reload/force-restart/' -e 's/sleep 1/sleep 4/' > ${D}${sysconfdir}/init.d/lcdd | ||
52 | chmod 0755 ${D}${sysconfdir}/init.d/lcdd | ||
53 | install -m 0755 scripts/init-lcdproc.debian ${D}${sysconfdir}/init.d/lcdproc | ||
54 | sed -i s'/--oknodo//' ${D}${sysconfdir}/init.d/lcdproc | ||
55 | |||
56 | # configuration files | ||
57 | install -m 0644 ${S}/LCDd.conf ${D}${sysconfdir}/LCDd.conf | ||
58 | sed -i 's!^DriverPath=.*!DriverPath=${libdir}/lcdproc/!' ${D}${sysconfdir}/LCDd.conf | ||
59 | sed -i 's!^Driver=.*!Driver=${LCD_DEFAULT_DRIVER}!' ${D}${sysconfdir}/LCDd.conf | ||
60 | install -m 0644 ${S}/clients/lcdproc/lcdproc.conf ${D}${sysconfdir}/lcdproc.conf | ||
61 | |||
62 | # driver library files | ||
63 | install -d ${D}${libdir}/lcdproc | ||
64 | for i in server/drivers/*.so; do | ||
65 | install -m 0644 $i ${D}${libdir}/lcdproc/ | ||
66 | done | ||
67 | # binaries | ||
68 | install -D -m 0755 clients/lcdvc/lcdvc ${D}${sbindir}/lcdvc | ||
69 | |||
70 | # configuration files | ||
71 | install -D -m 0644 ${S}/clients/lcdvc/lcdvc.conf ${D}${sysconfdir}/lcdvc.conf | ||
72 | } | ||
73 | |||
74 | PACKAGES =+ "lcdd lcdvc" | ||
75 | |||
76 | RRECOMMENDS_${PN} = "lcdd" | ||
77 | |||
78 | FILES_lcdd = "${sysconfdir}/LCDd.conf \ | ||
79 | ${sbindir}/LCDd \ | ||
80 | ${sysconfdir}/init.d/lcdd" | ||
81 | |||
82 | CONFFILES_lcdd = "${sysconfdir}/LCDd.conf" | ||
83 | CONFFILES_${PN} = "${sysconfdir}/lcdproc.conf" | ||
84 | CONFFILES_lcdvc = "${sysconfdir}/lcdvc.conf" | ||
85 | FILES_lcdvc = "${sysconfdir}/lcdvc.conf ${sbindir}/lcdvc" | ||
86 | |||
87 | # Driver packages | ||
88 | |||
89 | # USB / no USB trickery | ||
90 | |||
91 | RCONFLICTS_lcdd-driver-hd47780nousb = "lcdd-driver-hd44780" | ||
92 | RCONFLICTS_lcdd-driver-hd47780 = "lcdd-driver-hd44780nousb" | ||
93 | |||
94 | INITSCRIPT_PACKAGES = "lcdd lcdproc" | ||
95 | INITSCRIPT_NAME_lcdd = "lcdd" | ||
96 | INITSCRIPT_NAME_lcdproc = "lcdproc" | ||
97 | INITSCRIPT_PARAMS_lcdd = "defaults 70 21" | ||
98 | INITSCRIPT_PARAMS_lcdproc = "defaults 71 20" | ||
99 | |||
100 | python populate_packages_prepend() { | ||
101 | plugindir = d.expand('${libdir}/lcdproc') | ||
102 | do_split_packages(d, plugindir, '(.*)\.so$', 'lcdd-driver-%s', 'LCDd driver for %s', prepend=True) | ||
103 | } | ||
104 | |||
105 | PACKAGES_DYNAMIC += "^lcdd-driver-.*" | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0001-Port-build-to-python3.patch b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0001-Port-build-to-python3.patch new file mode 100644 index 0000000000..e525047df4 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0001-Port-build-to-python3.patch | |||
@@ -0,0 +1,6897 @@ | |||
1 | From 33a373ba41d978af60c2f0230bcba6ad27357ec8 Mon Sep 17 00:00:00 2001 | ||
2 | From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com> | ||
3 | Date: Wed, 29 Jan 2020 16:25:11 +0100 | ||
4 | Subject: [PATCH] Port build to python3 | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | * first tool of choice was 2to3 | ||
10 | * some parts were taken from [1] but during work it was found that this patch | ||
11 | introduces interesting effects - see hash functions. Working more on this | ||
12 | makes me guess that one has never worked... | ||
13 | * Few parts were taken from upstream mirror [2]. Since they use six for porting | ||
14 | to python3 it adds us a new dependency. | ||
15 | * To get a better overview what is going on or failing some additional messages | ||
16 | were added. The most verbose one is left disabled - see | ||
17 | python/mozbuild/mozbuild/configure/__init__.py / Line 310 onwards | ||
18 | * major changes upstream on build are not to expect so upgrading should cause | ||
19 | little trouble and changes can be tracked by [3] | ||
20 | * some solutions are workarounds/hacks so this patch will not be accepeted | ||
21 | upstream. This should not be a probelme for us: once mozjs >= 68 will arrive | ||
22 | we have to go to rust/cargo based build anyway. | ||
23 | |||
24 | [1] https://code.foxkit.us/adelie/packages/blob/f2b5773da19ab397fbe64fd32dacc383cfe4cd77/user/mozjs/python3.patch | ||
25 | [2] https://github.com/mozilla/gecko-dev | ||
26 | [3] https://github.com/mozilla/gecko-dev/tree/esr60 | ||
27 | |||
28 | Upstream-Status: Inaproppriate [Some Hacks] | ||
29 | |||
30 | Signed-off-by: Andreas MĂ¼ller <schnitzeltony@gmail.com> | ||
31 | --- | ||
32 | build/autoconf/config.status.m4 | 2 +- | ||
33 | build/moz.configure/android-ndk.configure | 4 +- | ||
34 | build/moz.configure/checks.configure | 4 +- | ||
35 | build/moz.configure/init.configure | 31 +- | ||
36 | build/moz.configure/keyfiles.configure | 4 +- | ||
37 | build/moz.configure/old.configure | 32 +- | ||
38 | build/moz.configure/toolchain.configure | 18 +- | ||
39 | build/moz.configure/util.configure | 9 +- | ||
40 | build/moz.configure/windows.configure | 10 +- | ||
41 | build/templates.mozbuild | 2 +- | ||
42 | config/MozZipFile.py | 12 +- | ||
43 | config/expandlibs.py | 6 +- | ||
44 | config/expandlibs_exec.py | 14 +- | ||
45 | config/expandlibs_gen.py | 4 +- | ||
46 | configure.py | 42 +- | ||
47 | js/src/build/moz.build | 8 +- | ||
48 | js/src/builtin/embedjs.py | 10 +- | ||
49 | js/src/configure | 2 +- | ||
50 | js/src/frontend/GenerateReservedWords.py | 6 +- | ||
51 | js/src/gc/GenerateStatsPhases.py | 4 +- | ||
52 | js/src/old-configure.in | 2 + | ||
53 | memory/build/moz.build | 8 +- | ||
54 | mozglue/build/moz.build | 22 +- | ||
55 | .../mozbuild/mozbuild/action/check_binary.py | 2 + | ||
56 | .../mozbuild/action/process_define_files.py | 4 +- | ||
57 | python/mozbuild/mozbuild/backend/base.py | 8 +- | ||
58 | python/mozbuild/mozbuild/backend/common.py | 8 +- | ||
59 | .../mozbuild/backend/configenvironment.py | 14 +- | ||
60 | .../mozbuild/mozbuild/backend/fastermake.py | 10 +- | ||
61 | .../mozbuild/backend/recursivemake.py | 181 +++---- | ||
62 | python/mozbuild/mozbuild/config_status.py | 7 +- | ||
63 | .../mozbuild/mozbuild/configure/__init__.py | 83 +++- | ||
64 | .../mozbuild/configure/check_debug_ranges.py | 6 +- | ||
65 | python/mozbuild/mozbuild/configure/options.py | 24 +- | ||
66 | python/mozbuild/mozbuild/configure/util.py | 12 +- | ||
67 | .../mozbuild/mozbuild/controller/building.py | 16 +- | ||
68 | python/mozbuild/mozbuild/frontend/context.py | 89 ++-- | ||
69 | python/mozbuild/mozbuild/frontend/data.py | 8 +- | ||
70 | python/mozbuild/mozbuild/frontend/emitter.py | 50 +- | ||
71 | python/mozbuild/mozbuild/frontend/reader.py | 49 +- | ||
72 | python/mozbuild/mozbuild/frontend/sandbox.py | 3 +- | ||
73 | python/mozbuild/mozbuild/jar.py | 12 +- | ||
74 | python/mozbuild/mozbuild/makeutil.py | 24 +- | ||
75 | python/mozbuild/mozbuild/mozinfo.py | 8 +- | ||
76 | python/mozbuild/mozbuild/preprocessor.py | 27 +- | ||
77 | python/mozbuild/mozbuild/shellutil.py | 6 +- | ||
78 | .../test/backend/test_recursivemake.py | 18 +- | ||
79 | .../mozbuild/test/configure/common.py | 8 +- | ||
80 | .../mozbuild/mozbuild/test/configure/lint.py | 8 +- | ||
81 | .../test/configure/test_checks_configure.py | 8 +- | ||
82 | .../test/configure/test_compile_checks.py | 4 +- | ||
83 | .../mozbuild/test/configure/test_configure.py | 244 +++++----- | ||
84 | .../mozbuild/test/configure/test_lint.py | 24 +- | ||
85 | .../test/configure/test_moz_configure.py | 32 +- | ||
86 | .../mozbuild/test/configure/test_options.py | 450 +++++++++--------- | ||
87 | .../configure/test_toolchain_configure.py | 22 +- | ||
88 | .../test/configure/test_toolchain_helpers.py | 62 +-- | ||
89 | .../configure/test_toolkit_moz_configure.py | 2 +- | ||
90 | .../mozbuild/test/configure/test_util.py | 8 +- | ||
91 | python/mozbuild/mozbuild/testing.py | 10 +- | ||
92 | python/mozbuild/mozbuild/util.py | 79 ++- | ||
93 | python/mozbuild/mozbuild/virtualenv.py | 6 +- | ||
94 | python/mozbuild/mozpack/chrome/manifest.py | 6 +- | ||
95 | python/mozbuild/mozpack/copier.py | 12 +- | ||
96 | python/mozbuild/mozpack/files.py | 22 +- | ||
97 | python/mozbuild/mozpack/manifests.py | 16 +- | ||
98 | python/mozbuild/mozpack/mozjar.py | 37 +- | ||
99 | .../manifestparser/manifestparser/ini.py | 13 +- | ||
100 | .../manifestparser/manifestparser.py | 24 +- | ||
101 | testing/mozbase/mozinfo/mozinfo/mozinfo.py | 26 +- | ||
102 | .../mozprocess/mozprocess/processhandler.py | 10 +- | ||
103 | third_party/python/which/which.py | 18 +- | ||
104 | 72 files changed, 1081 insertions(+), 993 deletions(-) | ||
105 | |||
106 | diff --git a/build/autoconf/config.status.m4 b/build/autoconf/config.status.m4 | ||
107 | index c75575386..543c2d682 100644 | ||
108 | --- a/build/autoconf/config.status.m4 | ||
109 | +++ b/build/autoconf/config.status.m4 | ||
110 | @@ -122,7 +122,7 @@ trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 | ||
111 | |||
112 | dnl We're going to need [ ] for python syntax. | ||
113 | changequote(<<<, >>>)dnl | ||
114 | -echo creating $CONFIG_STATUS | ||
115 | +echo creating $CONFIG_STATUS in `pwd` | ||
116 | |||
117 | cat > $CONFIG_STATUS <<EOF | ||
118 | |||
119 | diff --git a/build/moz.configure/android-ndk.configure b/build/moz.configure/android-ndk.configure | ||
120 | index 1067b8619..3b592a237 100644 | ||
121 | --- a/build/moz.configure/android-ndk.configure | ||
122 | +++ b/build/moz.configure/android-ndk.configure | ||
123 | @@ -30,7 +30,7 @@ js_option('--with-android-version', | ||
124 | |||
125 | |||
126 | @depends('--with-android-version', min_android_version, '--help') | ||
127 | -@imports(_from='__builtin__', _import='ValueError') | ||
128 | +@imports(_from='builtins', _import='ValueError') | ||
129 | def android_version(value, min_version, _): | ||
130 | if not value: | ||
131 | # Someone has passed --without-android-version. | ||
132 | @@ -68,7 +68,7 @@ add_old_configure_assignment('android_ndk', ndk) | ||
133 | |||
134 | @depends(ndk) | ||
135 | @checking('for android ndk version') | ||
136 | -@imports(_from='__builtin__', _import='open') | ||
137 | +@imports(_from='builtins', _import='open') | ||
138 | def ndk_version(ndk): | ||
139 | if not ndk: | ||
140 | # Building 'js/src' for non-Android. | ||
141 | diff --git a/build/moz.configure/checks.configure b/build/moz.configure/checks.configure | ||
142 | index 516652da9..11e1091c6 100644 | ||
143 | --- a/build/moz.configure/checks.configure | ||
144 | +++ b/build/moz.configure/checks.configure | ||
145 | @@ -14,7 +14,7 @@ | ||
146 | |||
147 | |||
148 | @template | ||
149 | -@imports(_from='__builtin__', _import='Exception') | ||
150 | +@imports(_from='builtins', _import='Exception') | ||
151 | def _declare_exceptions(): | ||
152 | class FatalCheckError(Exception): | ||
153 | '''An exception to throw from a function decorated with @checking. | ||
154 | @@ -57,7 +57,7 @@ def checking(what, callback=None): | ||
155 | try: | ||
156 | ret = func(*args, **kwargs) | ||
157 | except FatalCheckError as e: | ||
158 | - error = e.message | ||
159 | + error = str(e) | ||
160 | display_ret = callback(ret) if callback else ret | ||
161 | if display_ret is True: | ||
162 | log.info('yes') | ||
163 | diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure | ||
164 | index 648ac2ded..4d74547d8 100644 | ||
165 | --- a/build/moz.configure/init.configure | ||
166 | +++ b/build/moz.configure/init.configure | ||
167 | @@ -14,7 +14,7 @@ option(env='DIST', nargs=1, help='DIST directory') | ||
168 | |||
169 | |||
170 | @depends('--help', 'DIST') | ||
171 | -@imports(_from='__builtin__', _import='open') | ||
172 | +@imports(_from='builtins', _import='open') | ||
173 | @imports(_from='os.path', _import='exists') | ||
174 | def check_build_environment(help, dist): | ||
175 | topobjdir = os.path.realpath(os.path.abspath('.')) | ||
176 | @@ -65,7 +65,7 @@ def check_build_environment(help, dist): | ||
177 | # Check for CRLF line endings. | ||
178 | with open(os.path.join(topsrcdir, 'configure.py'), 'rb') as fh: | ||
179 | data = fh.read() | ||
180 | - if '\r' in data: | ||
181 | + if b'\r' in data: | ||
182 | die('\n ***\n' | ||
183 | ' * The source tree appears to have Windows-style line endings.\n' | ||
184 | ' *\n' | ||
185 | @@ -269,7 +269,7 @@ def early_options(): | ||
186 | def early_options(): | ||
187 | return set( | ||
188 | option.env | ||
189 | - for option in __sandbox__._options.itervalues() | ||
190 | + for option in __sandbox__._options.values() | ||
191 | if option.env | ||
192 | ) | ||
193 | return early_options | ||
194 | @@ -307,15 +307,15 @@ def mozconfig_options(mozconfig, automation, help): | ||
195 | log.info(' %s' % arg) | ||
196 | helper.add(arg, origin='mozconfig', args=helper._args) | ||
197 | |||
198 | - for key, value in mozconfig['env']['added'].iteritems(): | ||
199 | + for key, value in mozconfig['env']['added'].items(): | ||
200 | add(key, value) | ||
201 | os.environ[key] = value | ||
202 | - for key, (_, value) in mozconfig['env']['modified'].iteritems(): | ||
203 | + for key, (_, value) in mozconfig['env']['modified'].items(): | ||
204 | add(key, value) | ||
205 | os.environ[key] = value | ||
206 | - for key, value in mozconfig['vars']['added'].iteritems(): | ||
207 | + for key, value in mozconfig['vars']['added'].items(): | ||
208 | add(key, value) | ||
209 | - for key, (_, value) in mozconfig['vars']['modified'].iteritems(): | ||
210 | + for key, (_, value) in mozconfig['vars']['modified'].items(): | ||
211 | add(key, value) | ||
212 | |||
213 | |||
214 | @@ -353,7 +353,7 @@ option(env='PYTHON3', nargs=1, help='Python 3 interpreter (3.5 or later)') | ||
215 | @depends('PYTHON3') | ||
216 | @checking('for Python 3', | ||
217 | callback=lambda x: '%s (%s)' % (x.path, x.str_version) if x else 'no') | ||
218 | -@imports(_from='__builtin__', _import='Exception') | ||
219 | +@imports(_from='builtins', _import='Exception') | ||
220 | @imports(_from='mozbuild.pythonutil', _import='find_python3_executable') | ||
221 | @imports(_from='mozbuild.pythonutil', _import='python_executable_version') | ||
222 | def python3(env_python): | ||
223 | @@ -377,9 +377,6 @@ def python3(env_python): | ||
224 | if not python: | ||
225 | return None | ||
226 | |||
227 | - # The API returns a bytes whereas everything in configure is unicode. | ||
228 | - python = python.decode('utf-8') | ||
229 | - | ||
230 | return namespace( | ||
231 | path=python, | ||
232 | version=version, | ||
233 | @@ -481,6 +478,8 @@ def hg_config(build_env, hg, version): | ||
234 | @imports('re') | ||
235 | def git_version(git): | ||
236 | out = check_cmd_output(git, '--version').rstrip() | ||
237 | + if isinstance(out, bytes): | ||
238 | + out = out.decode('utf-8') | ||
239 | |||
240 | match = re.search('git version (.*)$', out) | ||
241 | |||
242 | @@ -551,8 +550,8 @@ option('--target', nargs=1, | ||
243 | @imports(_from='mozbuild.configure.constants', _import='Endianness') | ||
244 | @imports(_from='mozbuild.configure.constants', _import='Kernel') | ||
245 | @imports(_from='mozbuild.configure.constants', _import='OS') | ||
246 | -@imports(_from='__builtin__', _import='KeyError') | ||
247 | -@imports(_from='__builtin__', _import='ValueError') | ||
248 | +@imports(_from='builtins', _import='KeyError') | ||
249 | +@imports(_from='builtins', _import='ValueError') | ||
250 | def split_triplet(triplet, allow_unknown=False): | ||
251 | # The standard triplet is defined as | ||
252 | # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM | ||
253 | @@ -562,6 +561,8 @@ def split_triplet(triplet, allow_unknown=False): | ||
254 | # Additionally, some may omit "unknown" when the manufacturer | ||
255 | # is not specified and emit | ||
256 | # CPU_TYPE-OPERATING_SYSTEM | ||
257 | + if isinstance(triplet, bytes): | ||
258 | + triplet = triplet.decode('utf-8') | ||
259 | parts = triplet.split('-', 2) | ||
260 | if len(parts) == 3: | ||
261 | cpu, _, os = parts | ||
262 | @@ -987,7 +988,7 @@ add_old_configure_assignment('MOZ_BUILD_APP', build_project) | ||
263 | # - otherwise, if we have "a" in GRE_MILESTONE, we're building Nightly or Aurora | ||
264 | # - otherwise, we're building Release/Beta (define RELEASE_OR_BETA) | ||
265 | @depends(check_build_environment, '--help') | ||
266 | -@imports(_from='__builtin__', _import='open') | ||
267 | +@imports(_from='builtins', _import='open') | ||
268 | @imports('re') | ||
269 | def milestone(build_env, _): | ||
270 | milestone_path = os.path.join(build_env.topsrcdir, | ||
271 | @@ -1105,7 +1106,7 @@ def enabled_in_nightly(milestone, _): | ||
272 | def all_configure_options(): | ||
273 | result = [] | ||
274 | previous = None | ||
275 | - for option in __sandbox__._options.itervalues(): | ||
276 | + for option in __sandbox__._options.values(): | ||
277 | # __sandbox__._options contains items for both option.name and | ||
278 | # option.env. But it's also an OrderedDict, meaning both are | ||
279 | # consecutive. | ||
280 | diff --git a/build/moz.configure/keyfiles.configure b/build/moz.configure/keyfiles.configure | ||
281 | index 5d51cccea..14a35a3c6 100644 | ||
282 | --- a/build/moz.configure/keyfiles.configure | ||
283 | +++ b/build/moz.configure/keyfiles.configure | ||
284 | @@ -16,8 +16,8 @@ def keyfile(desc, default=None, help=None, callback=lambda x: x): | ||
285 | |||
286 | @depends('--with-%s-keyfile' % name) | ||
287 | @checking('for the %s key' % desc, lambda x: x and x is not no_key) | ||
288 | - @imports(_from='__builtin__', _import='open') | ||
289 | - @imports(_from='__builtin__', _import='IOError') | ||
290 | + @imports(_from='builtins', _import='open') | ||
291 | + @imports(_from='builtins', _import='IOError') | ||
292 | def keyfile(value): | ||
293 | if value: | ||
294 | try: | ||
295 | diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure | ||
296 | index 81c10b91f..29b496bae 100644 | ||
297 | --- a/build/moz.configure/old.configure | ||
298 | +++ b/build/moz.configure/old.configure | ||
299 | @@ -64,9 +64,9 @@ set_config('AUTOCONF', autoconf) | ||
300 | |||
301 | @depends('OLD_CONFIGURE', mozconfig, autoconf, check_build_environment, shell, | ||
302 | old_configure_assignments, build_project) | ||
303 | -@imports(_from='__builtin__', _import='open') | ||
304 | -@imports(_from='__builtin__', _import='print') | ||
305 | -@imports(_from='__builtin__', _import='sorted') | ||
306 | +@imports(_from='builtins', _import='open') | ||
307 | +@imports(_from='builtins', _import='print') | ||
308 | +@imports(_from='builtins', _import='sorted') | ||
309 | @imports('glob') | ||
310 | @imports('itertools') | ||
311 | @imports('subprocess') | ||
312 | @@ -113,7 +113,7 @@ def prepare_configure(old_configure, mozconfig, autoconf, build_env, shell, | ||
313 | |||
314 | # Make old-configure append to config.log, where we put our own log. | ||
315 | # This could be done with a m4 macro, but it's way easier this way | ||
316 | - script = script.replace('>./config.log', '>>./config.log') | ||
317 | + script = script.replace(b'>./config.log', b'>>./config.log') | ||
318 | |||
319 | with open(old_configure, 'wb') as fh: | ||
320 | fh.write(script) | ||
321 | @@ -282,8 +282,8 @@ def old_configure_options(*options): | ||
322 | '--x-includes', | ||
323 | '--x-libraries', | ||
324 | ) | ||
325 | -@imports(_from='__builtin__', _import='compile') | ||
326 | -@imports(_from='__builtin__', _import='open') | ||
327 | +@imports(_from='builtins', _import='compile') | ||
328 | +@imports(_from='builtins', _import='open') | ||
329 | @imports('logging') | ||
330 | @imports('os') | ||
331 | @imports('subprocess') | ||
332 | @@ -326,7 +326,7 @@ def old_configure(prepare_configure, extra_old_configure_args, all_options, | ||
333 | log.debug('Running %s', quote(*cmd)) | ||
334 | if extra_env: | ||
335 | log.debug('with extra environment: %s', | ||
336 | - ' '.join('%s=%s' % pair for pair in extra_env.iteritems())) | ||
337 | + ' '.join('%s=%s' % pair for pair in extra_env.items())) | ||
338 | |||
339 | # Our logging goes to config.log, the same file old.configure uses. | ||
340 | # We can't share the handle on the file, so close it. We assume nothing | ||
341 | @@ -359,7 +359,7 @@ def old_configure(prepare_configure, extra_old_configure_args, all_options, | ||
342 | # Every variation of the exec() function I tried led to: | ||
343 | # SyntaxError: unqualified exec is not allowed in function 'main' it | ||
344 | # contains a nested function with free variables | ||
345 | - exec code in raw_config # noqa | ||
346 | + exec(code, raw_config) # noqa | ||
347 | |||
348 | # Ensure all the flags known to old-configure appear in the | ||
349 | # @old_configure_options above. | ||
350 | @@ -393,16 +393,24 @@ def set_old_configure_define(name, value): | ||
351 | @depends(old_configure) | ||
352 | @imports('types') | ||
353 | def post_old_configure(raw_config): | ||
354 | + log.info('post_old_configure started') | ||
355 | + | ||
356 | for k, v in raw_config['substs']: | ||
357 | set_old_configure_config( | ||
358 | - k[1:-1], v[1:-1] if isinstance(v, types.StringTypes) else v) | ||
359 | + k[1:-1], v[1:-1] if isinstance(v, str) else v) | ||
360 | + | ||
361 | + log.info('post_old_configure 1 finished') | ||
362 | |||
363 | - for k, v in dict(raw_config['defines']).iteritems(): | ||
364 | + for k, v in dict(raw_config['defines']).items(): | ||
365 | set_old_configure_define(k[1:-1], v[1:-1]) | ||
366 | |||
367 | + log.info('post_old_configure 2 finished') | ||
368 | + | ||
369 | set_old_configure_config('non_global_defines', | ||
370 | raw_config['non_global_defines']) | ||
371 | |||
372 | + log.info('post_old_configure 3 finished') | ||
373 | + | ||
374 | |||
375 | # Assuming no other option is declared after this function, handle the | ||
376 | # env options that were injected by mozconfig_options by creating dummy | ||
377 | @@ -414,6 +422,7 @@ def post_old_configure(raw_config): | ||
378 | @imports('__sandbox__') | ||
379 | @imports(_from='mozbuild.configure.options', _import='Option') | ||
380 | def remaining_mozconfig_options(_): | ||
381 | + log.info('remaining_mozconfig_options started') | ||
382 | helper = __sandbox__._helper | ||
383 | for arg in helper: | ||
384 | if helper._origins[arg] != 'mozconfig': | ||
385 | @@ -422,5 +431,6 @@ def remaining_mozconfig_options(_): | ||
386 | if name.isupper() and name not in __sandbox__._options: | ||
387 | option = Option(env=name, nargs='*', help=name) | ||
388 | helper.handle(option) | ||
389 | + log.info('remaining_mozconfig_options finished') | ||
390 | |||
391 | # Please do not add anything after remaining_mozconfig_options() | ||
392 | diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure | ||
393 | index fc640c75e..c5508dfb7 100755 | ||
394 | --- a/build/moz.configure/toolchain.configure | ||
395 | +++ b/build/moz.configure/toolchain.configure | ||
396 | @@ -391,7 +391,7 @@ def get_compiler_info(compiler, language): | ||
397 | ('CPU', CPU_preprocessor_checks), | ||
398 | ('KERNEL', kernel_preprocessor_checks), | ||
399 | ): | ||
400 | - for n, (value, condition) in enumerate(preprocessor_checks.iteritems()): | ||
401 | + for n, (value, condition) in enumerate(preprocessor_checks.items()): | ||
402 | check += dedent('''\ | ||
403 | #%(if)s %(condition)s | ||
404 | %%%(name)s "%(value)s" | ||
405 | @@ -425,9 +425,9 @@ def get_compiler_info(compiler, language): | ||
406 | data = {} | ||
407 | for line in result.splitlines(): | ||
408 | if line.startswith(b'%'): | ||
409 | - k, _, v = line.partition(' ') | ||
410 | - k = k.lstrip('%') | ||
411 | - data[k] = v.replace(' ', '').lstrip('"').rstrip('"') | ||
412 | + k, _, v = line.partition(b' ') | ||
413 | + k = k.lstrip(b'%').decode('utf-8') | ||
414 | + data[k] = v.replace(b' ', b'').lstrip(b'"').rstrip(b'"').decode('utf-8') | ||
415 | log.debug('%s = %s', k, data[k]) | ||
416 | |||
417 | try: | ||
418 | @@ -551,7 +551,7 @@ def check_compiler(compiler, language, target): | ||
419 | ) | ||
420 | |||
421 | |||
422 | -@imports(_from='__builtin__', _import='open') | ||
423 | +@imports(_from='builtins', _import='open') | ||
424 | @imports('json') | ||
425 | @imports('subprocess') | ||
426 | @imports('sys') | ||
427 | @@ -606,7 +606,7 @@ def vs_major_version(value): | ||
428 | |||
429 | |||
430 | @depends(host, target, vs_major_version, check_build_environment, '--with-visual-studio-version') | ||
431 | -@imports(_from='__builtin__', _import='sorted') | ||
432 | +@imports(_from='builtins', _import='sorted') | ||
433 | @imports(_from='operator', _import='itemgetter') | ||
434 | @imports('platform') | ||
435 | def vc_compiler_path(host, target, vs_major_version, env, vs_release_name): | ||
436 | @@ -807,7 +807,7 @@ def compiler(language, host_or_target, c_compiler=None, other_compiler=None, | ||
437 | target.os != 'Android': | ||
438 | return namespace(**{ | ||
439 | k: [] if k == 'flags' else v | ||
440 | - for k, v in other_compiler.__dict__.iteritems() | ||
441 | + for k, v in other_compiler.__dict__.items() | ||
442 | }) | ||
443 | |||
444 | # Normally, we'd use `var` instead of `_var`, but the interaction with | ||
445 | @@ -1238,7 +1238,7 @@ set_config('VISIBILITY_FLAGS', visibility_flags) | ||
446 | |||
447 | @depends(c_compiler) | ||
448 | @imports('multiprocessing') | ||
449 | -@imports(_from='__builtin__', _import='min') | ||
450 | +@imports(_from='builtins', _import='min') | ||
451 | def pgo_flags(compiler): | ||
452 | if compiler.type in ('gcc', 'clang'): | ||
453 | return namespace( | ||
454 | @@ -1517,6 +1517,8 @@ def enable_gnu_linker(enable_gold_option, c_compiler, developer_options, build_e | ||
455 | gold = check_cmd_output(*detection_cmd).strip() | ||
456 | if not gold: | ||
457 | return | ||
458 | + if isinstance(gold, bytes): | ||
459 | + gold = gold.decode('utf-8') | ||
460 | |||
461 | goldFullPath = find_program(gold) | ||
462 | if goldFullPath is None: | ||
463 | diff --git a/build/moz.configure/util.configure b/build/moz.configure/util.configure | ||
464 | index 3284fd8b5..218813e2d 100644 | ||
465 | --- a/build/moz.configure/util.configure | ||
466 | +++ b/build/moz.configure/util.configure | ||
467 | @@ -25,7 +25,6 @@ def configure_error(message): | ||
468 | # does not. | ||
469 | |||
470 | |||
471 | -@imports(_from='__builtin__', _import='unicode') | ||
472 | @imports('subprocess') | ||
473 | @imports('sys') | ||
474 | @imports(_from='mozbuild.configure.util', _import='LineIO') | ||
475 | @@ -39,10 +38,10 @@ def check_cmd_output(*args, **kwargs): | ||
476 | if 'env' in kwargs: | ||
477 | normalized_env = {} | ||
478 | for k, v in kwargs['env'].items(): | ||
479 | - if isinstance(k, unicode): | ||
480 | + if isinstance(k, str): | ||
481 | k = k.encode('utf-8', 'strict') | ||
482 | |||
483 | - if isinstance(v, unicode): | ||
484 | + if isinstance(v, str): | ||
485 | v = v.encode('utf-8', 'strict') | ||
486 | |||
487 | normalized_env[k] = v | ||
488 | @@ -285,7 +284,7 @@ def unique_list(l): | ||
489 | # ('19.0', 'x64', r'C:\...\amd64\cl.exe') | ||
490 | # ('19.0', 'x86', r'C:\...\amd64_x86\cl.exe') | ||
491 | @imports(_import='_winreg', _as='winreg') | ||
492 | -@imports(_from='__builtin__', _import='WindowsError') | ||
493 | +@imports(_from='builtins', _import='WindowsError') | ||
494 | @imports(_from='fnmatch', _import='fnmatch') | ||
495 | def get_registry_values(pattern, get_32_and_64_bit=False): | ||
496 | def enum_helper(func, key): | ||
497 | @@ -360,6 +359,8 @@ def get_registry_values(pattern, get_32_and_64_bit=False): | ||
498 | @imports(_from='mozbuild.configure.util', _import='Version', _as='_Version') | ||
499 | def Version(v): | ||
500 | 'A version number that can be compared usefully.' | ||
501 | + if isinstance(v, bytes): | ||
502 | + v = v.decode('utf-8') | ||
503 | return _Version(v) | ||
504 | |||
505 | # Denotes a deprecated option. Combines option() and @depends: | ||
506 | diff --git a/build/moz.configure/windows.configure b/build/moz.configure/windows.configure | ||
507 | index a5b790e3b..2b88fc447 100644 | ||
508 | --- a/build/moz.configure/windows.configure | ||
509 | +++ b/build/moz.configure/windows.configure | ||
510 | @@ -10,7 +10,7 @@ option('--with-windows-version', nargs=1, default='603', | ||
511 | |||
512 | |||
513 | @depends('--with-windows-version') | ||
514 | -@imports(_from='__builtin__', _import='ValueError') | ||
515 | +@imports(_from='builtins', _import='ValueError') | ||
516 | def valid_windows_version(value): | ||
517 | if not value: | ||
518 | die('Cannot build with --without-windows-version') | ||
519 | @@ -50,8 +50,8 @@ def windows_sdk_dir(value, host): | ||
520 | |||
521 | @imports('os') | ||
522 | @imports('re') | ||
523 | -@imports(_from='__builtin__', _import='sorted') | ||
524 | -@imports(_from='__builtin__', _import='WindowsError') | ||
525 | +@imports(_from='builtins', _import='sorted') | ||
526 | +@imports(_from='builtins', _import='WindowsError') | ||
527 | def get_sdk_dirs(sdk, subdir): | ||
528 | def get_dirs_containing(sdk, stem, subdir): | ||
529 | base = os.path.join(sdk, stem) | ||
530 | @@ -96,7 +96,7 @@ def valid_windows_sdk_dir_result(value): | ||
531 | |||
532 | @depends(c_compiler, windows_sdk_dir, valid_windows_version, 'WINDOWSSDKDIR') | ||
533 | @checking('for Windows SDK', valid_windows_sdk_dir_result) | ||
534 | -@imports(_from='__builtin__', _import='sorted') | ||
535 | +@imports(_from='builtins', _import='sorted') | ||
536 | @imports(_from='textwrap', _import='dedent') | ||
537 | def valid_windows_sdk_dir(compiler, windows_sdk_dir, target_version, | ||
538 | windows_sdk_dir_env): | ||
539 | @@ -174,7 +174,7 @@ def valid_ucrt_sdk_dir_result(value): | ||
540 | @depends(windows_sdk_dir, 'WINDOWSSDKDIR', c_compiler) | ||
541 | @checking('for Universal CRT SDK', valid_ucrt_sdk_dir_result) | ||
542 | @imports('os') | ||
543 | -@imports(_from='__builtin__', _import='sorted') | ||
544 | +@imports(_from='builtins', _import='sorted') | ||
545 | @imports(_import='mozpack.path', _as='mozpath') | ||
546 | def valid_ucrt_sdk_dir(windows_sdk_dir, windows_sdk_dir_env, c_compiler): | ||
547 | if windows_sdk_dir_env: | ||
548 | diff --git a/build/templates.mozbuild b/build/templates.mozbuild | ||
549 | index 3da850ce5..ae5e410fe 100644 | ||
550 | --- a/build/templates.mozbuild | ||
551 | +++ b/build/templates.mozbuild | ||
552 | @@ -10,7 +10,7 @@ def Binary(): | ||
553 | templates.''' | ||
554 | |||
555 | # Add -llog by default, since we use it all over the place. | ||
556 | - if CONFIG['OS_TARGET'] == 'Android': | ||
557 | + if str(CONFIG['OS_TARGET']) == 'Android': | ||
558 | OS_LIBS += ['log'] | ||
559 | |||
560 | |||
561 | diff --git a/config/MozZipFile.py b/config/MozZipFile.py | ||
562 | index 337fe0521..dc7add4c3 100644 | ||
563 | --- a/config/MozZipFile.py | ||
564 | +++ b/config/MozZipFile.py | ||
565 | @@ -18,7 +18,7 @@ class ZipFile(zipfile.ZipFile): | ||
566 | def __init__(self, file, mode="r", compression=zipfile.ZIP_STORED, | ||
567 | lock = False): | ||
568 | if lock: | ||
569 | - assert isinstance(file, basestring) | ||
570 | + assert isinstance(file, str) | ||
571 | self.lockfile = lock_file(file + '.lck') | ||
572 | else: | ||
573 | self.lockfile = None | ||
574 | @@ -46,7 +46,7 @@ class ZipFile(zipfile.ZipFile): | ||
575 | date_time=time.localtime(time.time())) | ||
576 | zinfo.compress_type = self.compression | ||
577 | # Add some standard UNIX file access permissions (-rw-r--r--). | ||
578 | - zinfo.external_attr = (0x81a4 & 0xFFFF) << 16L | ||
579 | + zinfo.external_attr = (0x81a4 & 0xFFFF) << 16 | ||
580 | else: | ||
581 | zinfo = zinfo_or_arcname | ||
582 | |||
583 | @@ -58,7 +58,7 @@ class ZipFile(zipfile.ZipFile): | ||
584 | # as the old, reuse the existing entry. | ||
585 | |||
586 | doSeek = False # store if we need to seek to the eof after overwriting | ||
587 | - if self.NameToInfo.has_key(zinfo.filename): | ||
588 | + if zinfo.filename in self.NameToInfo: | ||
589 | # Find the last ZipInfo with our name. | ||
590 | # Last, because that's catching multiple overwrites | ||
591 | i = len(self.filelist) | ||
592 | @@ -109,14 +109,14 @@ class ZipFile(zipfile.ZipFile): | ||
593 | # adjust file mode if we originally just wrote, now we rewrite | ||
594 | self.fp.close() | ||
595 | self.fp = open(self.filename, 'r+b') | ||
596 | - all = map(lambda zi: (zi, True), self.filelist) + \ | ||
597 | - map(lambda zi: (zi, False), self._remove) | ||
598 | + all = [(zi, True) for zi in self.filelist] + \ | ||
599 | + [(zi, False) for zi in self._remove] | ||
600 | all.sort(lambda l, r: cmp(l[0].header_offset, r[0].header_offset)) | ||
601 | # empty _remove for multiple closes | ||
602 | self._remove = [] | ||
603 | |||
604 | lengths = [all[i+1][0].header_offset - all[i][0].header_offset | ||
605 | - for i in xrange(len(all)-1)] | ||
606 | + for i in range(len(all)-1)] | ||
607 | lengths.append(self.end - all[-1][0].header_offset) | ||
608 | to_pos = 0 | ||
609 | for (zi, keep), length in zip(all, lengths): | ||
610 | diff --git a/config/expandlibs.py b/config/expandlibs.py | ||
611 | index ac06c432f..df1fed15d 100644 | ||
612 | --- a/config/expandlibs.py | ||
613 | +++ b/config/expandlibs.py | ||
614 | @@ -26,7 +26,7 @@ ${LIB_PREFIX}${ROOT}.${LIB_SUFFIX} following these rules: | ||
615 | descriptor contains. And for each of these LIBS, also apply the same | ||
616 | rules. | ||
617 | ''' | ||
618 | -from __future__ import with_statement | ||
619 | + | ||
620 | import sys, os, errno | ||
621 | import expandlibs_config as conf | ||
622 | |||
623 | @@ -36,7 +36,7 @@ def ensureParentDir(file): | ||
624 | if dir and not os.path.exists(dir): | ||
625 | try: | ||
626 | os.makedirs(dir) | ||
627 | - except OSError, error: | ||
628 | + except OSError as error: | ||
629 | if error.errno != errno.EEXIST: | ||
630 | raise | ||
631 | |||
632 | @@ -140,4 +140,4 @@ class ExpandArgs(list): | ||
633 | return [relativize(arg)] | ||
634 | |||
635 | if __name__ == '__main__': | ||
636 | - print " ".join(ExpandArgs(sys.argv[1:])) | ||
637 | + print(" ".join(ExpandArgs(sys.argv[1:]))) | ||
638 | diff --git a/config/expandlibs_exec.py b/config/expandlibs_exec.py | ||
639 | index df656016c..fb786a6a8 100644 | ||
640 | --- a/config/expandlibs_exec.py | ||
641 | +++ b/config/expandlibs_exec.py | ||
642 | @@ -20,7 +20,7 @@ With the --symbol-order argument, followed by a file name, it will add the | ||
643 | relevant linker options to change the order in which the linker puts the | ||
644 | symbols appear in the resulting binary. Only works for ELF targets. | ||
645 | ''' | ||
646 | -from __future__ import with_statement | ||
647 | + | ||
648 | import sys | ||
649 | import os | ||
650 | from expandlibs import ( | ||
651 | @@ -304,11 +304,11 @@ class SectionFinder(object): | ||
652 | return syms | ||
653 | |||
654 | def print_command(out, args): | ||
655 | - print >>out, "Executing: " + " ".join(args) | ||
656 | + print("Executing: " + " ".join(args), file=out) | ||
657 | for tmp in [f for f in args.tmp if os.path.isfile(f)]: | ||
658 | - print >>out, tmp + ":" | ||
659 | + print(tmp + ":", file=out) | ||
660 | with open(tmp) as file: | ||
661 | - print >>out, "".join([" " + l for l in file.readlines()]) | ||
662 | + print("".join([" " + l for l in file.readlines()]), file=out) | ||
663 | out.flush() | ||
664 | |||
665 | def main(args, proc_callback=None): | ||
666 | @@ -338,13 +338,13 @@ def main(args, proc_callback=None): | ||
667 | proc = subprocess.Popen(args, stdout = subprocess.PIPE, stderr = subprocess.STDOUT) | ||
668 | if proc_callback: | ||
669 | proc_callback(proc) | ||
670 | - except Exception, e: | ||
671 | - print >>sys.stderr, 'error: Launching', args, ':', e | ||
672 | + except Exception as e: | ||
673 | + print('error: Launching', args, ':', e, file=sys.stderr) | ||
674 | raise e | ||
675 | (stdout, stderr) = proc.communicate() | ||
676 | if proc.returncode and not options.verbose: | ||
677 | print_command(sys.stderr, args) | ||
678 | - sys.stderr.write(stdout) | ||
679 | + sys.stderr.write(stdout.decode("utf-8")) | ||
680 | sys.stderr.flush() | ||
681 | if proc.returncode: | ||
682 | return proc.returncode | ||
683 | diff --git a/config/expandlibs_gen.py b/config/expandlibs_gen.py | ||
684 | index b1de63cd0..dc62bd184 100644 | ||
685 | --- a/config/expandlibs_gen.py | ||
686 | +++ b/config/expandlibs_gen.py | ||
687 | @@ -5,7 +5,7 @@ | ||
688 | '''Given a list of object files and library names, prints a library | ||
689 | descriptor to standard output''' | ||
690 | |||
691 | -from __future__ import with_statement | ||
692 | + | ||
693 | import sys | ||
694 | import os | ||
695 | import expandlibs_config as conf | ||
696 | @@ -38,4 +38,4 @@ if __name__ == '__main__': | ||
697 | |||
698 | ensureParentDir(options.output) | ||
699 | with open(options.output, 'w') as outfile: | ||
700 | - print >>outfile, generate(args) | ||
701 | + print(generate(args), file=outfile) | ||
702 | diff --git a/configure.py b/configure.py | ||
703 | index 771e34e38..bee329d7c 100644 | ||
704 | --- a/configure.py | ||
705 | +++ b/configure.py | ||
706 | @@ -2,10 +2,11 @@ | ||
707 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
708 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
709 | |||
710 | -from __future__ import print_function, unicode_literals | ||
711 | + | ||
712 | |||
713 | import codecs | ||
714 | import itertools | ||
715 | +import logging | ||
716 | import os | ||
717 | import sys | ||
718 | import textwrap | ||
719 | @@ -34,7 +35,9 @@ from mozbuild.util import ( | ||
720 | def main(argv): | ||
721 | config = {} | ||
722 | sandbox = ConfigureSandbox(config, os.environ, argv) | ||
723 | + print('sandbox.run started') | ||
724 | sandbox.run(os.path.join(os.path.dirname(__file__), 'moz.configure')) | ||
725 | + print('sandbox.run finished') | ||
726 | |||
727 | if sandbox._help: | ||
728 | return 0 | ||
729 | @@ -56,12 +59,21 @@ def config_status(config): | ||
730 | |||
731 | sanitized_config = {} | ||
732 | sanitized_config['substs'] = { | ||
733 | - k: sanitized_bools(v) for k, v in config.iteritems() | ||
734 | + k: sanitized_bools(v) for k, v in config.items() | ||
735 | if k not in ('DEFINES', 'non_global_defines', 'TOPSRCDIR', 'TOPOBJDIR', | ||
736 | 'ALL_CONFIGURE_PATHS') | ||
737 | } | ||
738 | + | ||
739 | + # Hack around OptionValue entries unknown during compile | ||
740 | + for opt in ('BUILD_BACKENDS', 'MOZ_UI_LOCALE', 'RUSTFLAGS' ): | ||
741 | + old = sanitized_config['substs'][opt] | ||
742 | + new = [] | ||
743 | + for setting in old: | ||
744 | + new.append(setting) | ||
745 | + sanitized_config['substs'][opt] = new | ||
746 | + | ||
747 | sanitized_config['defines'] = { | ||
748 | - k: sanitized_bools(v) for k, v in config['DEFINES'].iteritems() | ||
749 | + k: sanitized_bools(v) for k, v in config['DEFINES'].items() | ||
750 | } | ||
751 | sanitized_config['non_global_defines'] = config['non_global_defines'] | ||
752 | sanitized_config['topsrcdir'] = config['TOPSRCDIR'] | ||
753 | @@ -71,20 +83,17 @@ def config_status(config): | ||
754 | # Create config.status. Eventually, we'll want to just do the work it does | ||
755 | # here, when we're able to skip configure tests/use cached results/not rely | ||
756 | # on autoconf. | ||
757 | - print("Creating config.status", file=sys.stderr) | ||
758 | - encoding = 'mbcs' if sys.platform == 'win32' else 'utf-8' | ||
759 | - with codecs.open('config.status', 'w', encoding) as fh: | ||
760 | + logging.getLogger('moz.configure').info('Creating config.status') | ||
761 | + with codecs.open('config.status', 'w', 'utf-8') as fh: | ||
762 | fh.write(textwrap.dedent('''\ | ||
763 | #!%(python)s | ||
764 | - # coding=%(encoding)s | ||
765 | - from __future__ import unicode_literals | ||
766 | - from mozbuild.util import encode | ||
767 | - encoding = '%(encoding)s' | ||
768 | - ''') % {'python': config['PYTHON'], 'encoding': encoding}) | ||
769 | + # coding=utf-8 | ||
770 | + print("config.status started") | ||
771 | + ''') % {'python': config['PYTHON']}) | ||
772 | # A lot of the build backend code is currently expecting byte | ||
773 | # strings and breaks in subtle ways with unicode strings. (bug 1296508) | ||
774 | - for k, v in sanitized_config.iteritems(): | ||
775 | - fh.write('%s = encode(%s, encoding)\n' % (k, indented_repr(v))) | ||
776 | + for k, v in sanitized_config.items(): | ||
777 | + fh.write('%s = %s\n' % (k, indented_repr(v))) | ||
778 | fh.write("__all__ = ['topobjdir', 'topsrcdir', 'defines', " | ||
779 | "'non_global_defines', 'substs', 'mozconfig']") | ||
780 | |||
781 | @@ -97,6 +106,9 @@ def config_status(config): | ||
782 | args = dict([(name, globals()[name]) for name in __all__]) | ||
783 | config_status(**args) | ||
784 | ''')) | ||
785 | + fh.write(textwrap.dedent(''' | ||
786 | + print("config.status finished") | ||
787 | + ''')) | ||
788 | |||
789 | partial_config = PartialConfigEnvironment(config['TOPOBJDIR']) | ||
790 | partial_config.write_vars(sanitized_config) | ||
791 | @@ -116,7 +128,7 @@ def config_status(config): | ||
792 | # executable permissions. | ||
793 | os.chmod('config.status', 0o755) | ||
794 | if config.get('MOZ_BUILD_APP') != 'js' or config.get('JS_STANDALONE'): | ||
795 | - os.environ[b'WRITE_MOZINFO'] = b'1' | ||
796 | + os.environ['WRITE_MOZINFO'] = '1' | ||
797 | from mozbuild.config_status import config_status | ||
798 | |||
799 | # Some values in sanitized_config also have more complex types, such as | ||
800 | @@ -127,7 +139,7 @@ def config_status(config): | ||
801 | |||
802 | # A lot of the build backend code is currently expecting byte strings | ||
803 | # and breaks in subtle ways with unicode strings. | ||
804 | - return config_status(args=[], **encode(sanitized_config, encoding)) | ||
805 | + return config_status(args=[], **sanitized_config) | ||
806 | return 0 | ||
807 | |||
808 | |||
809 | diff --git a/js/src/build/moz.build b/js/src/build/moz.build | ||
810 | index a7f5fa4ce..856cae32d 100644 | ||
811 | --- a/js/src/build/moz.build | ||
812 | +++ b/js/src/build/moz.build | ||
813 | @@ -47,22 +47,22 @@ USE_LIBS += [ | ||
814 | 'zlib', | ||
815 | ] | ||
816 | |||
817 | -if CONFIG['OS_ARCH'] not in ('WINNT', 'HP-UX'): | ||
818 | +if str(CONFIG['OS_ARCH']) not in ('WINNT', 'HP-UX'): | ||
819 | OS_LIBS += [ | ||
820 | 'm', | ||
821 | ] | ||
822 | |||
823 | -if CONFIG['OS_ARCH'] == 'FreeBSD': | ||
824 | +if str(CONFIG['OS_ARCH']) == 'FreeBSD': | ||
825 | OS_LIBS += [ | ||
826 | '-pthread', | ||
827 | ] | ||
828 | |||
829 | -if CONFIG['OS_ARCH'] == 'Linux': | ||
830 | +if str(CONFIG['OS_ARCH']) == 'Linux': | ||
831 | OS_LIBS += [ | ||
832 | 'dl', | ||
833 | ] | ||
834 | |||
835 | -if CONFIG['OS_ARCH'] == 'SunOS': | ||
836 | +if str(CONFIG['OS_ARCH']) == 'SunOS': | ||
837 | OS_LIBS += [ | ||
838 | 'posix4', | ||
839 | 'dl', | ||
840 | diff --git a/js/src/builtin/embedjs.py b/js/src/builtin/embedjs.py | ||
841 | index ba25e71c1..d4f2de122 100644 | ||
842 | --- a/js/src/builtin/embedjs.py | ||
843 | +++ b/js/src/builtin/embedjs.py | ||
844 | @@ -36,7 +36,7 @@ | ||
845 | # | ||
846 | # It uses the C preprocessor to process its inputs. | ||
847 | |||
848 | -from __future__ import with_statement | ||
849 | + | ||
850 | import re, sys, os, subprocess | ||
851 | import shlex | ||
852 | import which | ||
853 | @@ -52,8 +52,8 @@ def ToCAsciiArray(lines): | ||
854 | |||
855 | def ToCArray(lines): | ||
856 | result = [] | ||
857 | - for chr in lines: | ||
858 | - result.append(str(ord(chr))) | ||
859 | + for char in lines: | ||
860 | + result.append("0x%0.2X" % char) | ||
861 | return ", ".join(result) | ||
862 | |||
863 | HEADER_TEMPLATE = """\ | ||
864 | @@ -87,7 +87,7 @@ def embed(cxx, preprocessorOption, cppflags, msgs, sources, c_out, js_out, names | ||
865 | |||
866 | js_out.write(processed) | ||
867 | import zlib | ||
868 | - compressed = zlib.compress(processed) | ||
869 | + compressed = zlib.compress(processed.encode('utf-8')) | ||
870 | data = ToCArray(compressed) | ||
871 | c_out.write(HEADER_TEMPLATE % { | ||
872 | 'sources_type': 'unsigned char', | ||
873 | @@ -107,7 +107,7 @@ def preprocess(cxx, preprocessorOption, source, args = []): | ||
874 | tmpOut = 'self-hosting-preprocessed.pp'; | ||
875 | outputArg = shlex.split(preprocessorOption + tmpOut) | ||
876 | |||
877 | - with open(tmpIn, 'wb') as input: | ||
878 | + with open(tmpIn, 'w') as input: | ||
879 | input.write(source) | ||
880 | print(' '.join(cxx + outputArg + args + [tmpIn])) | ||
881 | result = subprocess.Popen(cxx + outputArg + args + [tmpIn]).wait() | ||
882 | diff --git a/js/src/configure b/js/src/configure | ||
883 | index 3b3a39af3..8f5ea41d0 100755 | ||
884 | --- a/js/src/configure | ||
885 | +++ b/js/src/configure | ||
886 | @@ -24,4 +24,4 @@ export OLD_CONFIGURE="$SRCDIR"/old-configure | ||
887 | |||
888 | set -- "$@" --enable-project=js | ||
889 | |||
890 | -which python2.7 > /dev/null && exec python2.7 "$TOPSRCDIR/configure.py" "$@" || exec python "$TOPSRCDIR/configure.py" "$@" | ||
891 | +which python3 > /dev/null && exec python3 "$TOPSRCDIR/configure.py" "$@" || exec python "$TOPSRCDIR/configure.py" "$@" | ||
892 | diff --git a/js/src/frontend/GenerateReservedWords.py b/js/src/frontend/GenerateReservedWords.py | ||
893 | index 3aa2307b9..381c8e2b4 100644 | ||
894 | --- a/js/src/frontend/GenerateReservedWords.py | ||
895 | +++ b/js/src/frontend/GenerateReservedWords.py | ||
896 | @@ -80,14 +80,14 @@ def split_list_per_column(reserved_word_list, column): | ||
897 | per_column = column_dict.setdefault(word[column], []) | ||
898 | per_column.append(item) | ||
899 | |||
900 | - return sorted(column_dict.items(), key=lambda (char, word): ord(char)) | ||
901 | + return sorted(list(column_dict.items()), key=lambda char_word: ord(char_word[0])) | ||
902 | |||
903 | def generate_letter_switch(opt, unprocessed_columns, reserved_word_list, | ||
904 | columns=None): | ||
905 | assert(len(reserved_word_list) != 0); | ||
906 | |||
907 | if not columns: | ||
908 | - columns = range(0, unprocessed_columns) | ||
909 | + columns = list(range(0, unprocessed_columns)) | ||
910 | |||
911 | if len(reserved_word_list) == 1: | ||
912 | index, word = reserved_word_list[0] | ||
913 | @@ -161,7 +161,7 @@ def split_list_per_length(reserved_word_list): | ||
914 | per_length = length_dict.setdefault(len(word), []) | ||
915 | per_length.append(item) | ||
916 | |||
917 | - return sorted(length_dict.items(), key=lambda (length, word): length) | ||
918 | + return sorted(list(length_dict.items()), key=lambda length_word: length_word[0]) | ||
919 | |||
920 | def generate_switch(opt, reserved_word_list): | ||
921 | assert(len(reserved_word_list) != 0); | ||
922 | diff --git a/js/src/gc/GenerateStatsPhases.py b/js/src/gc/GenerateStatsPhases.py | ||
923 | index 2daf83555..e39a26a4b 100644 | ||
924 | --- a/js/src/gc/GenerateStatsPhases.py | ||
925 | +++ b/js/src/gc/GenerateStatsPhases.py | ||
926 | @@ -267,7 +267,7 @@ def generateHeader(out): | ||
927 | # | ||
928 | # Generate PhaseKind enum. | ||
929 | # | ||
930 | - phaseKindNames = map(lambda phaseKind: phaseKind.name, AllPhaseKinds) | ||
931 | + phaseKindNames = [phaseKind.name for phaseKind in AllPhaseKinds] | ||
932 | extraPhaseKinds = [ | ||
933 | "NONE = LIMIT", | ||
934 | "EXPLICIT_SUSPENSION = LIMIT", | ||
935 | @@ -279,7 +279,7 @@ def generateHeader(out): | ||
936 | # | ||
937 | # Generate Phase enum. | ||
938 | # | ||
939 | - phaseNames = map(lambda phase: phase.name, AllPhases) | ||
940 | + phaseNames = [phase.name for phase in AllPhases] | ||
941 | extraPhases = [ | ||
942 | "NONE = LIMIT", | ||
943 | "EXPLICIT_SUSPENSION = LIMIT", | ||
944 | diff --git a/js/src/old-configure.in b/js/src/old-configure.in | ||
945 | index 11c3d5a2e..389265404 100644 | ||
946 | --- a/js/src/old-configure.in | ||
947 | +++ b/js/src/old-configure.in | ||
948 | @@ -1884,3 +1884,5 @@ if test "$JS_STANDALONE"; then | ||
949 | fi | ||
950 | |||
951 | rm -fr confdefs* $ac_clean_files | ||
952 | +echo confdefs* $ac_clean_files removed | ||
953 | +echo "old-configure done" | ||
954 | diff --git a/memory/build/moz.build b/memory/build/moz.build | ||
955 | index e2c715271..f09ce7935 100644 | ||
956 | --- a/memory/build/moz.build | ||
957 | +++ b/memory/build/moz.build | ||
958 | @@ -30,7 +30,7 @@ else: | ||
959 | 'fallback.cpp', | ||
960 | ] | ||
961 | |||
962 | -if CONFIG['OS_TARGET'] == 'Darwin' and (CONFIG['MOZ_REPLACE_MALLOC'] or | ||
963 | +if str(CONFIG['OS_TARGET']) == 'Darwin' and (CONFIG['MOZ_REPLACE_MALLOC'] or | ||
964 | CONFIG['MOZ_MEMORY']): | ||
965 | SOURCES += [ | ||
966 | 'zone.c', | ||
967 | @@ -38,15 +38,15 @@ if CONFIG['OS_TARGET'] == 'Darwin' and (CONFIG['MOZ_REPLACE_MALLOC'] or | ||
968 | |||
969 | Library('memory') | ||
970 | |||
971 | -if CONFIG['OS_TARGET'] == 'Android' and CONFIG['CC_TYPE'] == 'clang': | ||
972 | +if str(CONFIG['OS_TARGET']) == 'Android' and str(CONFIG['CC_TYPE']) == 'clang': | ||
973 | CXXFLAGS += [ | ||
974 | '-Wno-tautological-pointer-compare', | ||
975 | ] | ||
976 | |||
977 | -if CONFIG['MOZ_BUILD_APP'] != 'memory': | ||
978 | +if str(CONFIG['MOZ_BUILD_APP']) != 'memory': | ||
979 | FINAL_LIBRARY = 'mozglue' | ||
980 | |||
981 | -if CONFIG['CC_TYPE'] in ('msvc', 'clang-cl'): | ||
982 | +if str(CONFIG['CC_TYPE']) in ('msvc', 'clang-cl'): | ||
983 | CXXFLAGS += ['-wd4273'] # inconsistent dll linkage (bug 558163) | ||
984 | |||
985 | if CONFIG['MOZ_REPLACE_MALLOC_STATIC']: | ||
986 | diff --git a/mozglue/build/moz.build b/mozglue/build/moz.build | ||
987 | index 53758485a..5e9308802 100644 | ||
988 | --- a/mozglue/build/moz.build | ||
989 | +++ b/mozglue/build/moz.build | ||
990 | @@ -9,12 +9,12 @@ | ||
991 | # If this is ever changed, update MOZ_SHARED_MOZGLUE in browser/installer/Makefile.in | ||
992 | if CONFIG['JS_STANDALONE'] and not CONFIG['MOZ_MEMORY']: | ||
993 | Library('mozglue') | ||
994 | -elif CONFIG['OS_TARGET'] in ('WINNT', 'Darwin', 'Android'): | ||
995 | +elif str(CONFIG['OS_TARGET']) in ('WINNT', 'Darwin', 'Android'): | ||
996 | SharedLibrary('mozglue') | ||
997 | else: | ||
998 | Library('mozglue') | ||
999 | |||
1000 | -if CONFIG['OS_TARGET'] == 'Android': | ||
1001 | +if str(CONFIG['OS_TARGET']) == 'Android': | ||
1002 | SOURCES += [ | ||
1003 | 'BionicGlue.cpp', | ||
1004 | ] | ||
1005 | @@ -24,14 +24,14 @@ if CONFIG['MOZ_ASAN']: | ||
1006 | 'AsanOptions.cpp', | ||
1007 | ] | ||
1008 | |||
1009 | -if CONFIG['OS_TARGET'] == 'WINNT': | ||
1010 | +if str(CONFIG['OS_TARGET']) == 'WINNT': | ||
1011 | DEFFILE = 'mozglue.def' | ||
1012 | # We'll break the DLL blocklist if we immediately load user32.dll | ||
1013 | DELAYLOAD_DLLS += [ | ||
1014 | 'user32.dll', | ||
1015 | ] | ||
1016 | |||
1017 | - if CONFIG['CC_TYPE'] == "msvc": | ||
1018 | + if str(CONFIG['CC_TYPE']) == "msvc": | ||
1019 | CFLAGS += ['-guard:cf'] | ||
1020 | CXXFLAGS += ['-guard:cf'] | ||
1021 | LDFLAGS += ['-guard:cf'] | ||
1022 | @@ -48,12 +48,12 @@ if CONFIG['MOZ_WIDGET_TOOLKIT']: | ||
1023 | 'dummy.cpp', | ||
1024 | ] | ||
1025 | |||
1026 | - if CONFIG['OS_TARGET'] == 'WINNT': | ||
1027 | + if str(CONFIG['OS_TARGET']) == 'WINNT': | ||
1028 | LOCAL_INCLUDES += [ | ||
1029 | '/memory/build', | ||
1030 | ] | ||
1031 | |||
1032 | - if CONFIG['CC_TYPE'] == "msvc": | ||
1033 | + if str(CONFIG['CC_TYPE']) == "msvc": | ||
1034 | SOURCES += ['WindowsCFGStatus.cpp'] | ||
1035 | SOURCES += [ | ||
1036 | 'Authenticode.cpp', | ||
1037 | @@ -85,17 +85,17 @@ if CONFIG['MOZ_WIDGET_TOOLKIT']: | ||
1038 | 'WindowsDllBlocklist.h', | ||
1039 | ] | ||
1040 | |||
1041 | - if CONFIG['CPU_ARCH'].startswith('x86'): | ||
1042 | + if str(CONFIG['CPU_ARCH']).startswith('x86'): | ||
1043 | SOURCES += [ | ||
1044 | 'SSE.cpp', | ||
1045 | ] | ||
1046 | |||
1047 | - if CONFIG['CPU_ARCH'] == 'arm': | ||
1048 | + if str(CONFIG['CPU_ARCH']) == 'arm': | ||
1049 | SOURCES += [ | ||
1050 | 'arm.cpp', | ||
1051 | ] | ||
1052 | |||
1053 | - if CONFIG['CPU_ARCH'].startswith('mips'): | ||
1054 | + if str(CONFIG['CPU_ARCH']).startswith('mips'): | ||
1055 | SOURCES += [ | ||
1056 | 'mips.cpp', | ||
1057 | ] | ||
1058 | @@ -114,7 +114,7 @@ LIBRARY_DEFINES['MOZ_HAS_MOZGLUE'] = True | ||
1059 | |||
1060 | LDFLAGS += CONFIG['MOZ_GLUE_WRAP_LDFLAGS'] | ||
1061 | |||
1062 | -if CONFIG['OS_TARGET'] == 'Darwin': | ||
1063 | +if str(CONFIG['OS_TARGET']) == 'Darwin': | ||
1064 | # On OSX 10.10.3, a dead lock happens in some cases involving dynamic | ||
1065 | # symbol resolution for symbols that jemalloc itself uses. While it | ||
1066 | # might be possible to find a way to avoid all such symbol resolutions, | ||
1067 | @@ -124,7 +124,7 @@ if CONFIG['OS_TARGET'] == 'Darwin': | ||
1068 | # for TLS. | ||
1069 | LDFLAGS += ['-Wl,-bind_at_load'] | ||
1070 | |||
1071 | -if CONFIG['MOZ_LINKER'] and CONFIG['TARGET_CPU'] == 'arm': | ||
1072 | +if CONFIG['MOZ_LINKER'] and str(CONFIG['TARGET_CPU']) == 'arm': | ||
1073 | LDFLAGS += ['-Wl,-version-script,%s/arm-eabi-filter' % SRCDIR] | ||
1074 | |||
1075 | DIST_INSTALL = True | ||
1076 | diff --git a/python/mozbuild/mozbuild/action/check_binary.py b/python/mozbuild/mozbuild/action/check_binary.py | ||
1077 | index 5665ef053..b696f73d6 100644 | ||
1078 | --- a/python/mozbuild/mozbuild/action/check_binary.py | ||
1079 | +++ b/python/mozbuild/mozbuild/action/check_binary.py | ||
1080 | @@ -104,6 +104,8 @@ def iter_readelf_symbols(target, binary): | ||
1081 | |||
1082 | def iter_readelf_dynamic(target, binary): | ||
1083 | for line in get_output(target['readelf'], '-d', binary): | ||
1084 | + if isinstance(line, bytes): | ||
1085 | + line=line.decode('utf-8') | ||
1086 | data = line.split(None, 2) | ||
1087 | if data and len(data) == 3 and data[0].startswith('0x'): | ||
1088 | yield data[1].rstrip(')').lstrip('('), data[2] | ||
1089 | diff --git a/python/mozbuild/mozbuild/action/process_define_files.py b/python/mozbuild/mozbuild/action/process_define_files.py | ||
1090 | index 563fbb8fa..c3df2869b 100644 | ||
1091 | --- a/python/mozbuild/mozbuild/action/process_define_files.py | ||
1092 | +++ b/python/mozbuild/mozbuild/action/process_define_files.py | ||
1093 | @@ -2,7 +2,7 @@ | ||
1094 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
1095 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
1096 | |||
1097 | -from __future__ import absolute_import, print_function, unicode_literals | ||
1098 | + | ||
1099 | |||
1100 | import argparse | ||
1101 | import os | ||
1102 | @@ -53,7 +53,7 @@ def process_define_file(output, input): | ||
1103 | 'CONFIGURE_DEFINE_FILE') | ||
1104 | defines = '\n'.join(sorted( | ||
1105 | '#define %s %s' % (name, val) | ||
1106 | - for name, val in config.defines['ALLDEFINES'].iteritems())) | ||
1107 | + for name, val in config.defines['ALLDEFINES'].items())) | ||
1108 | l = l[:m.start('cmd') - 1] \ | ||
1109 | + defines + l[m.end('name'):] | ||
1110 | elif cmd == 'define': | ||
1111 | diff --git a/python/mozbuild/mozbuild/backend/base.py b/python/mozbuild/mozbuild/backend/base.py | ||
1112 | index a8d5c94e0..7cda63475 100644 | ||
1113 | --- a/python/mozbuild/mozbuild/backend/base.py | ||
1114 | +++ b/python/mozbuild/mozbuild/backend/base.py | ||
1115 | @@ -2,7 +2,7 @@ | ||
1116 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
1117 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
1118 | |||
1119 | -from __future__ import absolute_import, unicode_literals | ||
1120 | + | ||
1121 | |||
1122 | from abc import ( | ||
1123 | ABCMeta, | ||
1124 | @@ -31,7 +31,7 @@ from .configenvironment import ConfigEnvironment | ||
1125 | from mozbuild.base import ExecutionSummary | ||
1126 | |||
1127 | |||
1128 | -class BuildBackend(LoggingMixin): | ||
1129 | +class BuildBackend(LoggingMixin, metaclass=ABCMeta): | ||
1130 | """Abstract base class for build backends. | ||
1131 | |||
1132 | A build backend is merely a consumer of the build configuration (the output | ||
1133 | @@ -39,8 +39,6 @@ class BuildBackend(LoggingMixin): | ||
1134 | is the discretion of the specific implementation. | ||
1135 | """ | ||
1136 | |||
1137 | - __metaclass__ = ABCMeta | ||
1138 | - | ||
1139 | def __init__(self, environment): | ||
1140 | assert isinstance(environment, (ConfigEnvironment, EmptyConfig)) | ||
1141 | self.populate_logger() | ||
1142 | @@ -311,7 +309,7 @@ class BuildBackend(LoggingMixin): | ||
1143 | srcdir = mozpath.dirname(obj.input_path) | ||
1144 | pp.context.update({ | ||
1145 | k: ' '.join(v) if isinstance(v, list) else v | ||
1146 | - for k, v in obj.config.substs.iteritems() | ||
1147 | + for k, v in obj.config.substs.items() | ||
1148 | }) | ||
1149 | pp.context.update( | ||
1150 | top_srcdir=obj.topsrcdir, | ||
1151 | diff --git a/python/mozbuild/mozbuild/backend/common.py b/python/mozbuild/mozbuild/backend/common.py | ||
1152 | index d00cbbcaf..f747df446 100644 | ||
1153 | --- a/python/mozbuild/mozbuild/backend/common.py | ||
1154 | +++ b/python/mozbuild/mozbuild/backend/common.py | ||
1155 | @@ -2,7 +2,7 @@ | ||
1156 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
1157 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
1158 | |||
1159 | -from __future__ import absolute_import, unicode_literals | ||
1160 | + | ||
1161 | |||
1162 | import json | ||
1163 | import os | ||
1164 | @@ -174,7 +174,7 @@ class CommonBackend(BuildBackend): | ||
1165 | if len(self._idl_manager.idls): | ||
1166 | self._write_rust_xpidl_summary(self._idl_manager) | ||
1167 | self._handle_idl_manager(self._idl_manager) | ||
1168 | - self._handle_generated_sources(mozpath.join(self.environment.topobjdir, 'dist/include/%s.h' % idl['root']) for idl in self._idl_manager.idls.values()) | ||
1169 | + self._handle_generated_sources(mozpath.join(self.environment.topobjdir, 'dist/include/%s.h' % idl['root']) for idl in list(self._idl_manager.idls.values())) | ||
1170 | |||
1171 | |||
1172 | for config in self._configs: | ||
1173 | @@ -372,14 +372,14 @@ class CommonBackend(BuildBackend): | ||
1174 | |||
1175 | with self._write_file(mozpath.join(topobjdir, 'dist', 'xpcrs', 'rt', 'all.rs')) as fh: | ||
1176 | fh.write("// THIS FILE IS GENERATED - DO NOT EDIT\n\n") | ||
1177 | - for idl in manager.idls.values(): | ||
1178 | + for idl in list(manager.idls.values()): | ||
1179 | fh.write(include_tmpl % ("rt", idl['root'])) | ||
1180 | fh.write(";\n") | ||
1181 | |||
1182 | with self._write_file(mozpath.join(topobjdir, 'dist', 'xpcrs', 'bt', 'all.rs')) as fh: | ||
1183 | fh.write("// THIS FILE IS GENERATED - DO NOT EDIT\n\n") | ||
1184 | fh.write("&[\n") | ||
1185 | - for idl in manager.idls.values(): | ||
1186 | + for idl in list(manager.idls.values()): | ||
1187 | fh.write(include_tmpl % ("bt", idl['root'])) | ||
1188 | fh.write(",\n") | ||
1189 | fh.write("]\n") | ||
1190 | diff --git a/python/mozbuild/mozbuild/backend/configenvironment.py b/python/mozbuild/mozbuild/backend/configenvironment.py | ||
1191 | index 3676a7d18..f0896cea4 100644 | ||
1192 | --- a/python/mozbuild/mozbuild/backend/configenvironment.py | ||
1193 | +++ b/python/mozbuild/mozbuild/backend/configenvironment.py | ||
1194 | @@ -2,14 +2,14 @@ | ||
1195 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
1196 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
1197 | |||
1198 | -from __future__ import absolute_import | ||
1199 | + | ||
1200 | |||
1201 | import os | ||
1202 | import sys | ||
1203 | import json | ||
1204 | |||
1205 | from collections import Iterable, OrderedDict | ||
1206 | -from types import StringTypes, ModuleType | ||
1207 | +from types import ModuleType | ||
1208 | |||
1209 | import mozpack.path as mozpath | ||
1210 | |||
1211 | @@ -22,7 +22,7 @@ from mozbuild.shellutil import quote as shell_quote | ||
1212 | |||
1213 | |||
1214 | if sys.version_info.major == 2: | ||
1215 | - text_type = unicode | ||
1216 | + text_type = str | ||
1217 | else: | ||
1218 | text_type = str | ||
1219 | |||
1220 | @@ -151,7 +151,7 @@ class ConfigEnvironment(object): | ||
1221 | shell_quote(self.defines[name]).replace('$', '$$')) | ||
1222 | for name in sorted(global_defines)]) | ||
1223 | def serialize(name, obj): | ||
1224 | - if isinstance(obj, StringTypes): | ||
1225 | + if isinstance(obj, str): | ||
1226 | return obj | ||
1227 | if isinstance(obj, Iterable): | ||
1228 | return ' '.join(obj) | ||
1229 | @@ -185,8 +185,8 @@ class ConfigEnvironment(object): | ||
1230 | except UnicodeDecodeError: | ||
1231 | return v.decode('utf-8', 'replace') | ||
1232 | |||
1233 | - for k, v in self.substs.items(): | ||
1234 | - if not isinstance(v, StringTypes): | ||
1235 | + for k, v in list(self.substs.items()): | ||
1236 | + if not isinstance(v, str): | ||
1237 | if isinstance(v, Iterable): | ||
1238 | type(v)(decode(i) for i in v) | ||
1239 | elif not isinstance(v, text_type): | ||
1240 | @@ -255,7 +255,7 @@ class PartialConfigDict(object): | ||
1241 | existing_files = self._load_config_track() | ||
1242 | |||
1243 | new_files = set() | ||
1244 | - for k, v in values.iteritems(): | ||
1245 | + for k, v in values.items(): | ||
1246 | new_files.add(self._write_file(k, v)) | ||
1247 | |||
1248 | for filename in existing_files - new_files: | ||
1249 | diff --git a/python/mozbuild/mozbuild/backend/fastermake.py b/python/mozbuild/mozbuild/backend/fastermake.py | ||
1250 | index b029aa10f..b66ade64f 100644 | ||
1251 | --- a/python/mozbuild/mozbuild/backend/fastermake.py | ||
1252 | +++ b/python/mozbuild/mozbuild/backend/fastermake.py | ||
1253 | @@ -2,7 +2,7 @@ | ||
1254 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
1255 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
1256 | |||
1257 | -from __future__ import absolute_import, unicode_literals, print_function | ||
1258 | + | ||
1259 | |||
1260 | from mozbuild.backend.base import PartialBackend | ||
1261 | from mozbuild.backend.common import CommonBackend | ||
1262 | @@ -140,7 +140,7 @@ class FasterMakeBackend(CommonBackend, PartialBackend): | ||
1263 | # Add information for chrome manifest generation | ||
1264 | manifest_targets = [] | ||
1265 | |||
1266 | - for target, entries in self._manifest_entries.iteritems(): | ||
1267 | + for target, entries in self._manifest_entries.items(): | ||
1268 | manifest_targets.append(target) | ||
1269 | install_target = mozpath.basedir(target, install_manifests_bases) | ||
1270 | self._install_manifests[install_target].add_content( | ||
1271 | @@ -152,13 +152,13 @@ class FasterMakeBackend(CommonBackend, PartialBackend): | ||
1272 | % ' '.join(self._install_manifests.keys())) | ||
1273 | |||
1274 | # Add dependencies we infered: | ||
1275 | - for target, deps in self._dependencies.iteritems(): | ||
1276 | + for target, deps in self._dependencies.items(): | ||
1277 | mk.create_rule([target]).add_dependencies( | ||
1278 | '$(TOPOBJDIR)/%s' % d for d in deps) | ||
1279 | |||
1280 | mk.add_statement('include $(TOPSRCDIR)/config/faster/rules.mk') | ||
1281 | |||
1282 | - for base, install_manifest in self._install_manifests.iteritems(): | ||
1283 | + for base, install_manifest in self._install_manifests.items(): | ||
1284 | with self._write_file( | ||
1285 | mozpath.join(self.environment.topobjdir, 'faster', | ||
1286 | 'install_%s' % base.replace('/', '_'))) as fh: | ||
1287 | @@ -167,7 +167,7 @@ class FasterMakeBackend(CommonBackend, PartialBackend): | ||
1288 | # For artifact builds only, write a single unified manifest for consumption by |mach watch|. | ||
1289 | if self.environment.is_artifact_build: | ||
1290 | unified_manifest = InstallManifest() | ||
1291 | - for base, install_manifest in self._install_manifests.iteritems(): | ||
1292 | + for base, install_manifest in self._install_manifests.items(): | ||
1293 | # Expect 'dist/bin/**', which includes 'dist/bin' with no trailing slash. | ||
1294 | assert base.startswith('dist/bin') | ||
1295 | base = base[len('dist/bin'):] | ||
1296 | diff --git a/python/mozbuild/mozbuild/backend/recursivemake.py b/python/mozbuild/mozbuild/backend/recursivemake.py | ||
1297 | index dd9020d62..aa89cc297 100644 | ||
1298 | --- a/python/mozbuild/mozbuild/backend/recursivemake.py | ||
1299 | +++ b/python/mozbuild/mozbuild/backend/recursivemake.py | ||
1300 | @@ -2,7 +2,7 @@ | ||
1301 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
1302 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
1303 | |||
1304 | -from __future__ import absolute_import, unicode_literals | ||
1305 | + | ||
1306 | |||
1307 | import logging | ||
1308 | import os | ||
1309 | @@ -12,7 +12,7 @@ from collections import ( | ||
1310 | defaultdict, | ||
1311 | namedtuple, | ||
1312 | ) | ||
1313 | -from StringIO import StringIO | ||
1314 | +from io import StringIO | ||
1315 | from itertools import chain | ||
1316 | |||
1317 | from mozpack.manifests import ( | ||
1318 | @@ -80,75 +80,76 @@ from ..util import ( | ||
1319 | ) | ||
1320 | from ..makeutil import Makefile | ||
1321 | from mozbuild.shellutil import quote as shell_quote | ||
1322 | +from functools import reduce | ||
1323 | |||
1324 | MOZBUILD_VARIABLES = [ | ||
1325 | - b'ASFLAGS', | ||
1326 | - b'CMSRCS', | ||
1327 | - b'CMMSRCS', | ||
1328 | - b'CPP_UNIT_TESTS', | ||
1329 | - b'DIRS', | ||
1330 | - b'DIST_INSTALL', | ||
1331 | - b'EXTRA_DSO_LDOPTS', | ||
1332 | - b'EXTRA_JS_MODULES', | ||
1333 | - b'EXTRA_PP_COMPONENTS', | ||
1334 | - b'EXTRA_PP_JS_MODULES', | ||
1335 | - b'FORCE_SHARED_LIB', | ||
1336 | - b'FORCE_STATIC_LIB', | ||
1337 | - b'FINAL_LIBRARY', | ||
1338 | - b'HOST_CFLAGS', | ||
1339 | - b'HOST_CSRCS', | ||
1340 | - b'HOST_CMMSRCS', | ||
1341 | - b'HOST_CXXFLAGS', | ||
1342 | - b'HOST_EXTRA_LIBS', | ||
1343 | - b'HOST_LIBRARY_NAME', | ||
1344 | - b'HOST_PROGRAM', | ||
1345 | - b'HOST_SIMPLE_PROGRAMS', | ||
1346 | - b'JAR_MANIFEST', | ||
1347 | - b'JAVA_JAR_TARGETS', | ||
1348 | - b'LIBRARY_NAME', | ||
1349 | - b'LIBS', | ||
1350 | - b'MAKE_FRAMEWORK', | ||
1351 | - b'MODULE', | ||
1352 | - b'NO_DIST_INSTALL', | ||
1353 | - b'NO_EXPAND_LIBS', | ||
1354 | - b'NO_INTERFACES_MANIFEST', | ||
1355 | - b'NO_JS_MANIFEST', | ||
1356 | - b'OS_LIBS', | ||
1357 | - b'PARALLEL_DIRS', | ||
1358 | - b'PREF_JS_EXPORTS', | ||
1359 | - b'PROGRAM', | ||
1360 | - b'RESOURCE_FILES', | ||
1361 | - b'SHARED_LIBRARY_LIBS', | ||
1362 | - b'SHARED_LIBRARY_NAME', | ||
1363 | - b'SIMPLE_PROGRAMS', | ||
1364 | - b'SONAME', | ||
1365 | - b'STATIC_LIBRARY_NAME', | ||
1366 | - b'TEST_DIRS', | ||
1367 | - b'TOOL_DIRS', | ||
1368 | + 'ASFLAGS', | ||
1369 | + 'CMSRCS', | ||
1370 | + 'CMMSRCS', | ||
1371 | + 'CPP_UNIT_TESTS', | ||
1372 | + 'DIRS', | ||
1373 | + 'DIST_INSTALL', | ||
1374 | + 'EXTRA_DSO_LDOPTS', | ||
1375 | + 'EXTRA_JS_MODULES', | ||
1376 | + 'EXTRA_PP_COMPONENTS', | ||
1377 | + 'EXTRA_PP_JS_MODULES', | ||
1378 | + 'FORCE_SHARED_LIB', | ||
1379 | + 'FORCE_STATIC_LIB', | ||
1380 | + 'FINAL_LIBRARY', | ||
1381 | + 'HOST_CFLAGS', | ||
1382 | + 'HOST_CSRCS', | ||
1383 | + 'HOST_CMMSRCS', | ||
1384 | + 'HOST_CXXFLAGS', | ||
1385 | + 'HOST_EXTRA_LIBS', | ||
1386 | + 'HOST_LIBRARY_NAME', | ||
1387 | + 'HOST_PROGRAM', | ||
1388 | + 'HOST_SIMPLE_PROGRAMS', | ||
1389 | + 'JAR_MANIFEST', | ||
1390 | + 'JAVA_JAR_TARGETS', | ||
1391 | + 'LIBRARY_NAME', | ||
1392 | + 'LIBS', | ||
1393 | + 'MAKE_FRAMEWORK', | ||
1394 | + 'MODULE', | ||
1395 | + 'NO_DIST_INSTALL', | ||
1396 | + 'NO_EXPAND_LIBS', | ||
1397 | + 'NO_INTERFACES_MANIFEST', | ||
1398 | + 'NO_JS_MANIFEST', | ||
1399 | + 'OS_LIBS', | ||
1400 | + 'PARALLEL_DIRS', | ||
1401 | + 'PREF_JS_EXPORTS', | ||
1402 | + 'PROGRAM', | ||
1403 | + 'RESOURCE_FILES', | ||
1404 | + 'SHARED_LIBRARY_LIBS', | ||
1405 | + 'SHARED_LIBRARY_NAME', | ||
1406 | + 'SIMPLE_PROGRAMS', | ||
1407 | + 'SONAME', | ||
1408 | + 'STATIC_LIBRARY_NAME', | ||
1409 | + 'TEST_DIRS', | ||
1410 | + 'TOOL_DIRS', | ||
1411 | # XXX config/Makefile.in specifies this in a make invocation | ||
1412 | #'USE_EXTENSION_MANIFEST', | ||
1413 | - b'XPCSHELL_TESTS', | ||
1414 | - b'XPIDL_MODULE', | ||
1415 | + 'XPCSHELL_TESTS', | ||
1416 | + 'XPIDL_MODULE', | ||
1417 | ] | ||
1418 | |||
1419 | DEPRECATED_VARIABLES = [ | ||
1420 | - b'EXPORT_LIBRARY', | ||
1421 | - b'EXTRA_LIBS', | ||
1422 | - b'HOST_LIBS', | ||
1423 | - b'LIBXUL_LIBRARY', | ||
1424 | - b'MOCHITEST_A11Y_FILES', | ||
1425 | - b'MOCHITEST_BROWSER_FILES', | ||
1426 | - b'MOCHITEST_BROWSER_FILES_PARTS', | ||
1427 | - b'MOCHITEST_CHROME_FILES', | ||
1428 | - b'MOCHITEST_FILES', | ||
1429 | - b'MOCHITEST_FILES_PARTS', | ||
1430 | - b'MOCHITEST_METRO_FILES', | ||
1431 | - b'MOCHITEST_ROBOCOP_FILES', | ||
1432 | - b'MODULE_OPTIMIZE_FLAGS', | ||
1433 | - b'MOZ_CHROME_FILE_FORMAT', | ||
1434 | - b'SHORT_LIBNAME', | ||
1435 | - b'TESTING_JS_MODULES', | ||
1436 | - b'TESTING_JS_MODULE_DIR', | ||
1437 | + 'EXPORT_LIBRARY', | ||
1438 | + 'EXTRA_LIBS', | ||
1439 | + 'HOST_LIBS', | ||
1440 | + 'LIBXUL_LIBRARY', | ||
1441 | + 'MOCHITEST_A11Y_FILES', | ||
1442 | + 'MOCHITEST_BROWSER_FILES', | ||
1443 | + 'MOCHITEST_BROWSER_FILES_PARTS', | ||
1444 | + 'MOCHITEST_CHROME_FILES', | ||
1445 | + 'MOCHITEST_FILES', | ||
1446 | + 'MOCHITEST_FILES_PARTS', | ||
1447 | + 'MOCHITEST_METRO_FILES', | ||
1448 | + 'MOCHITEST_ROBOCOP_FILES', | ||
1449 | + 'MODULE_OPTIMIZE_FLAGS', | ||
1450 | + 'MOZ_CHROME_FILE_FORMAT', | ||
1451 | + 'SHORT_LIBNAME', | ||
1452 | + 'TESTING_JS_MODULES', | ||
1453 | + 'TESTING_JS_MODULE_DIR', | ||
1454 | ] | ||
1455 | |||
1456 | MOZBUILD_VARIABLES_MESSAGE = 'It should only be defined in moz.build files.' | ||
1457 | @@ -207,7 +208,7 @@ class BackendMakeFile(object): | ||
1458 | self.fh.write(buf) | ||
1459 | |||
1460 | def write_once(self, buf): | ||
1461 | - if isinstance(buf, unicode): | ||
1462 | + if isinstance(buf, str): | ||
1463 | buf = buf.encode('utf-8') | ||
1464 | if b'\n' + buf not in self.fh.getvalue(): | ||
1465 | self.write(buf) | ||
1466 | @@ -280,7 +281,7 @@ class RecursiveMakeTraversal(object): | ||
1467 | Helper function to call a filter from compute_dependencies and | ||
1468 | traverse. | ||
1469 | """ | ||
1470 | - return filter(current, self.get_subdirs(current)) | ||
1471 | + return list(filter(current, self.get_subdirs(current))) | ||
1472 | |||
1473 | def compute_dependencies(self, filter=None): | ||
1474 | """ | ||
1475 | @@ -710,7 +711,7 @@ class RecursiveMakeBackend(CommonBackend): | ||
1476 | convenience variables, and the other dependency definitions for a | ||
1477 | hopefully proper directory traversal. | ||
1478 | """ | ||
1479 | - for tier, no_skip in self._no_skip.items(): | ||
1480 | + for tier, no_skip in list(self._no_skip.items()): | ||
1481 | self.log(logging.DEBUG, 'fill_root_mk', { | ||
1482 | 'number': len(no_skip), 'tier': tier | ||
1483 | }, 'Using {number} directories during {tier}') | ||
1484 | @@ -757,7 +758,7 @@ class RecursiveMakeBackend(CommonBackend): | ||
1485 | for tier, filter in filters: | ||
1486 | main, all_deps = \ | ||
1487 | self._traversal.compute_dependencies(filter) | ||
1488 | - for dir, deps in all_deps.items(): | ||
1489 | + for dir, deps in list(all_deps.items()): | ||
1490 | if deps is not None or (dir in self._idl_dirs \ | ||
1491 | and tier == 'export'): | ||
1492 | rule = root_deps_mk.create_rule(['%s/%s' % (dir, tier)]) | ||
1493 | @@ -770,7 +771,7 @@ class RecursiveMakeBackend(CommonBackend): | ||
1494 | rule.add_dependencies('%s/%s' % (d, tier) for d in main) | ||
1495 | |||
1496 | all_compile_deps = reduce(lambda x,y: x|y, | ||
1497 | - self._compile_graph.values()) if self._compile_graph else set() | ||
1498 | + list(self._compile_graph.values())) if self._compile_graph else set() | ||
1499 | # Include the following as dependencies of the top recursion target for | ||
1500 | # compilation: | ||
1501 | # - nodes that are not dependended upon by anything. Typically, this | ||
1502 | @@ -783,7 +784,7 @@ class RecursiveMakeBackend(CommonBackend): | ||
1503 | # as direct dependencies of the top recursion target, to somehow | ||
1504 | # prioritize them. | ||
1505 | # 1. See bug 1262241 comment 5. | ||
1506 | - compile_roots = [t for t, deps in self._compile_graph.iteritems() | ||
1507 | + compile_roots = [t for t, deps in list(self._compile_graph.items()) | ||
1508 | if not deps or t not in all_compile_deps] | ||
1509 | |||
1510 | rule = root_deps_mk.create_rule(['recurse_compile']) | ||
1511 | @@ -845,14 +846,14 @@ class RecursiveMakeBackend(CommonBackend): | ||
1512 | rule.add_dependencies(['$(CURDIR)/%: %']) | ||
1513 | |||
1514 | def _check_blacklisted_variables(self, makefile_in, makefile_content): | ||
1515 | - if b'EXTERNALLY_MANAGED_MAKE_FILE' in makefile_content: | ||
1516 | + if 'EXTERNALLY_MANAGED_MAKE_FILE' in makefile_content: | ||
1517 | # Bypass the variable restrictions for externally managed makefiles. | ||
1518 | return | ||
1519 | |||
1520 | for l in makefile_content.splitlines(): | ||
1521 | l = l.strip() | ||
1522 | # Don't check comments | ||
1523 | - if l.startswith(b'#'): | ||
1524 | + if l.startswith('#'): | ||
1525 | continue | ||
1526 | for x in chain(MOZBUILD_VARIABLES, DEPRECATED_VARIABLES): | ||
1527 | if x not in l: | ||
1528 | @@ -909,11 +910,11 @@ class RecursiveMakeBackend(CommonBackend): | ||
1529 | # Directories with a Makefile containing a tools target, or | ||
1530 | # XPI_PKGNAME or INSTALL_EXTENSION_ID can't be skipped and | ||
1531 | # must run during the 'tools' tier. | ||
1532 | - for t in (b'XPI_PKGNAME', b'INSTALL_EXTENSION_ID', | ||
1533 | - b'tools'): | ||
1534 | + for t in ('XPI_PKGNAME', 'INSTALL_EXTENSION_ID', | ||
1535 | + 'tools'): | ||
1536 | if t not in content: | ||
1537 | continue | ||
1538 | - if t == b'tools' and not re.search('(?:^|\s)tools.*::', content, re.M): | ||
1539 | + if t == 'tools' and not re.search('(?:^|\s)tools.*::', content, re.M): | ||
1540 | continue | ||
1541 | if objdir == self.environment.topobjdir: | ||
1542 | continue | ||
1543 | @@ -933,7 +934,7 @@ class RecursiveMakeBackend(CommonBackend): | ||
1544 | self._fill_root_mk() | ||
1545 | |||
1546 | # Make the master test manifest files. | ||
1547 | - for flavor, t in self._test_manifests.items(): | ||
1548 | + for flavor, t in list(self._test_manifests.items()): | ||
1549 | install_prefix, manifests = t | ||
1550 | manifest_stem = mozpath.join(install_prefix, '%s.ini' % flavor) | ||
1551 | self._write_master_test_manifest(mozpath.join( | ||
1552 | @@ -1039,7 +1040,7 @@ class RecursiveMakeBackend(CommonBackend): | ||
1553 | for p in ('Makefile', 'backend.mk', '.deps/.mkdir.done'): | ||
1554 | build_files.add_optional_exists(p) | ||
1555 | |||
1556 | - for idl in manager.idls.values(): | ||
1557 | + for idl in list(manager.idls.values()): | ||
1558 | self._install_manifests['dist_idl'].add_link(idl['source'], | ||
1559 | idl['basename']) | ||
1560 | self._install_manifests['dist_include'].add_optional_exists('%s.h' | ||
1561 | @@ -1086,7 +1087,7 @@ class RecursiveMakeBackend(CommonBackend): | ||
1562 | |||
1563 | interfaces_manifests = [] | ||
1564 | dist_dir = mozpath.join(self.environment.topobjdir, 'dist') | ||
1565 | - for manifest, entries in manager.interface_manifests.items(): | ||
1566 | + for manifest, entries in list(manager.interface_manifests.items()): | ||
1567 | interfaces_manifests.append(mozpath.join('$(DEPTH)', manifest)) | ||
1568 | for xpt in sorted(entries): | ||
1569 | registered_xpt_files.add(mozpath.join( | ||
1570 | @@ -1194,7 +1195,7 @@ class RecursiveMakeBackend(CommonBackend): | ||
1571 | # Don't allow files to be defined multiple times unless it is allowed. | ||
1572 | # We currently allow duplicates for non-test files or test files if | ||
1573 | # the manifest is listed as a duplicate. | ||
1574 | - for source, (dest, is_test) in obj.installs.items(): | ||
1575 | + for source, (dest, is_test) in list(obj.installs.items()): | ||
1576 | try: | ||
1577 | self._install_manifests['_test_files'].add_link(source, dest) | ||
1578 | except ValueError: | ||
1579 | @@ -1558,7 +1559,7 @@ class RecursiveMakeBackend(CommonBackend): | ||
1580 | man_dir = mozpath.join(self.environment.topobjdir, '_build_manifests', | ||
1581 | dest) | ||
1582 | |||
1583 | - for k, manifest in manifests.items(): | ||
1584 | + for k, manifest in list(manifests.items()): | ||
1585 | with self._write_file(mozpath.join(man_dir, k)) as fh: | ||
1586 | manifest.write(fileobj=fh) | ||
1587 | |||
1588 | @@ -1593,20 +1594,20 @@ class RecursiveMakeBackend(CommonBackend): | ||
1589 | pp.context.update(extra) | ||
1590 | if not pp.context.get('autoconfmk', ''): | ||
1591 | pp.context['autoconfmk'] = 'autoconf.mk' | ||
1592 | - pp.handleLine(b'# THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT MODIFY BY HAND.\n'); | ||
1593 | - pp.handleLine(b'DEPTH := @DEPTH@\n') | ||
1594 | - pp.handleLine(b'topobjdir := @topobjdir@\n') | ||
1595 | - pp.handleLine(b'topsrcdir := @top_srcdir@\n') | ||
1596 | - pp.handleLine(b'srcdir := @srcdir@\n') | ||
1597 | - pp.handleLine(b'VPATH := @srcdir@\n') | ||
1598 | - pp.handleLine(b'relativesrcdir := @relativesrcdir@\n') | ||
1599 | - pp.handleLine(b'include $(DEPTH)/config/@autoconfmk@\n') | ||
1600 | + pp.handleLine('# THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT MODIFY BY HAND.\n'); | ||
1601 | + pp.handleLine('DEPTH := @DEPTH@\n') | ||
1602 | + pp.handleLine('topobjdir := @topobjdir@\n') | ||
1603 | + pp.handleLine('topsrcdir := @top_srcdir@\n') | ||
1604 | + pp.handleLine('srcdir := @srcdir@\n') | ||
1605 | + pp.handleLine('VPATH := @srcdir@\n') | ||
1606 | + pp.handleLine('relativesrcdir := @relativesrcdir@\n') | ||
1607 | + pp.handleLine('include $(DEPTH)/config/@autoconfmk@\n') | ||
1608 | if not stub: | ||
1609 | pp.do_include(obj.input_path) | ||
1610 | # Empty line to avoid failures when last line in Makefile.in ends | ||
1611 | # with a backslash. | ||
1612 | - pp.handleLine(b'\n') | ||
1613 | - pp.handleLine(b'include $(topsrcdir)/config/recurse.mk\n') | ||
1614 | + pp.handleLine('\n') | ||
1615 | + pp.handleLine('include $(topsrcdir)/config/recurse.mk\n') | ||
1616 | if not stub: | ||
1617 | # Adding the Makefile.in here has the desired side-effect | ||
1618 | # that if the Makefile.in disappears, this will force | ||
1619 | diff --git a/python/mozbuild/mozbuild/config_status.py b/python/mozbuild/mozbuild/config_status.py | ||
1620 | index d46f1332d..a9a27a699 100644 | ||
1621 | --- a/python/mozbuild/mozbuild/config_status.py | ||
1622 | +++ b/python/mozbuild/mozbuild/config_status.py | ||
1623 | @@ -77,6 +77,7 @@ def config_status(topobjdir='.', topsrcdir='.', defines=None, | ||
1624 | See build/autoconf/config.status.m4. | ||
1625 | ''' | ||
1626 | |||
1627 | + print("config_status started") | ||
1628 | if 'CONFIG_FILES' in os.environ: | ||
1629 | raise Exception('Using the CONFIG_FILES environment variable is not ' | ||
1630 | 'supported.') | ||
1631 | @@ -119,7 +120,7 @@ def config_status(topobjdir='.', topsrcdir='.', defines=None, | ||
1632 | if 'WRITE_MOZINFO' in os.environ: | ||
1633 | write_mozinfo(os.path.join(topobjdir, 'mozinfo.json'), env, os.environ) | ||
1634 | |||
1635 | - cpu_start = time.clock() | ||
1636 | + cpu_start = time.perf_counter() | ||
1637 | time_start = time.time() | ||
1638 | |||
1639 | # Make appropriate backend instances, defaulting to RecursiveMakeBackend, | ||
1640 | @@ -155,7 +156,7 @@ def config_status(topobjdir='.', topsrcdir='.', defines=None, | ||
1641 | summary = obj.gyp_summary() | ||
1642 | print(summary, file=sys.stderr) | ||
1643 | |||
1644 | - cpu_time = time.clock() - cpu_start | ||
1645 | + cpu_time = time.perf_counter() - cpu_start | ||
1646 | wall_time = time.time() - time_start | ||
1647 | efficiency = cpu_time / wall_time if wall_time else 100 | ||
1648 | untracked = wall_time - execution_time | ||
1649 | @@ -179,3 +180,5 @@ def config_status(topobjdir='.', topsrcdir='.', defines=None, | ||
1650 | # Advertise Android Studio if it is appropriate. | ||
1651 | if MachCommandConditions.is_android(env): | ||
1652 | print(ANDROID_IDE_ADVERTISEMENT) | ||
1653 | + | ||
1654 | + print("config_status finished") | ||
1655 | diff --git a/python/mozbuild/mozbuild/configure/__init__.py b/python/mozbuild/mozbuild/configure/__init__.py | ||
1656 | index d03615707..13d623d4f 100644 | ||
1657 | --- a/python/mozbuild/mozbuild/configure/__init__.py | ||
1658 | +++ b/python/mozbuild/mozbuild/configure/__init__.py | ||
1659 | @@ -2,9 +2,9 @@ | ||
1660 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
1661 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
1662 | |||
1663 | -from __future__ import absolute_import, print_function, unicode_literals | ||
1664 | |||
1665 | -import __builtin__ | ||
1666 | + | ||
1667 | +import builtins | ||
1668 | import inspect | ||
1669 | import logging | ||
1670 | import os | ||
1671 | @@ -38,6 +38,8 @@ from mozbuild.util import ( | ||
1672 | |||
1673 | import mozpack.path as mozpath | ||
1674 | |||
1675 | +import traceback | ||
1676 | + | ||
1677 | |||
1678 | class ConfigureError(Exception): | ||
1679 | pass | ||
1680 | @@ -69,7 +71,7 @@ class SandboxDependsFunction(object): | ||
1681 | def __getattr__(self, key): | ||
1682 | return self._getattr(key).sandboxed | ||
1683 | |||
1684 | - def __nonzero__(self): | ||
1685 | + def __bool__(self): | ||
1686 | raise ConfigureError( | ||
1687 | 'Cannot do boolean operations on @depends functions.') | ||
1688 | |||
1689 | @@ -96,6 +98,7 @@ class DependsFunction(object): | ||
1690 | sandbox._value_for(self) | ||
1691 | elif not sandbox._help: | ||
1692 | sandbox._execution_queue.append((sandbox._value_for, (self,))) | ||
1693 | + sandbox.tasks_debug_out("DependsFunction.__init %s" % func.__name__) | ||
1694 | |||
1695 | @property | ||
1696 | def name(self): | ||
1697 | @@ -206,6 +209,15 @@ class CombinedDependsFunction(DependsFunction): | ||
1698 | def __ne__(self, other): | ||
1699 | return not self == other | ||
1700 | |||
1701 | + def __hash__(self): | ||
1702 | + # This was one was taken from [1] initially. Should not have done that: | ||
1703 | + # it causes explosion of ConfigureSandbox._execution_queue with 100% | ||
1704 | + # CPU load and eating all avaliable memory... | ||
1705 | + # | ||
1706 | + # [1] https://code.foxkit.us/adelie/packages/blob/f2b5773da19ab397fbe64fd32dacc383cfe4cd77/user/mozjs/python3.patch#L8068 | ||
1707 | + return hash((self._name, tuple(self.dependencies))) | ||
1708 | + | ||
1709 | + | ||
1710 | class SandboxedGlobal(dict): | ||
1711 | '''Identifiable dict type for use as function global''' | ||
1712 | |||
1713 | @@ -253,11 +265,12 @@ class ConfigureSandbox(dict): | ||
1714 | # The default set of builtins. We expose unicode as str to make sandboxed | ||
1715 | # files more python3-ready. | ||
1716 | BUILTINS = ReadOnlyDict({ | ||
1717 | - b: getattr(__builtin__, b) | ||
1718 | + b: getattr(builtins, b) | ||
1719 | for b in ('None', 'False', 'True', 'int', 'bool', 'any', 'all', 'len', | ||
1720 | 'list', 'tuple', 'set', 'dict', 'isinstance', 'getattr', | ||
1721 | - 'hasattr', 'enumerate', 'range', 'zip') | ||
1722 | - }, __import__=forbidden_import, str=unicode) | ||
1723 | + 'hasattr', 'enumerate', 'range', 'zip', '__build_class__', | ||
1724 | + 'bytes', 'exec') | ||
1725 | + }, __import__=forbidden_import, str=str) | ||
1726 | |||
1727 | # Expose a limited set of functions from os.path | ||
1728 | OS = ReadOnlyNamespace(path=ReadOnlyNamespace(**{ | ||
1729 | @@ -294,6 +307,11 @@ class ConfigureSandbox(dict): | ||
1730 | # Queue of functions to execute, with their arguments | ||
1731 | self._execution_queue = [] | ||
1732 | |||
1733 | + # For debugging: Show number of tasks started in run() / added elsewhere | ||
1734 | + # and some additional info | ||
1735 | + self.task_debug = False # set True to enable | ||
1736 | + self.tasks_started = 0 | ||
1737 | + | ||
1738 | # Store the `when`s associated to some options. | ||
1739 | self._conditions = {} | ||
1740 | |||
1741 | @@ -331,7 +349,7 @@ class ConfigureSandbox(dict): | ||
1742 | return method | ||
1743 | def wrapped(*args, **kwargs): | ||
1744 | out_args = [ | ||
1745 | - arg.decode(encoding) if isinstance(arg, str) else arg | ||
1746 | + arg.decode(encoding) if isinstance(arg, bytes) else arg | ||
1747 | for arg in args | ||
1748 | ] | ||
1749 | return method(*out_args, **kwargs) | ||
1750 | @@ -360,6 +378,14 @@ class ConfigureSandbox(dict): | ||
1751 | handler.setFormatter(formatter) | ||
1752 | logger.addHandler(handler) | ||
1753 | |||
1754 | + def tasks_debug_out(self, text): | ||
1755 | + if self.task_debug: | ||
1756 | + print("%s / queued %i / done %i" %(text, len(self._execution_queue), self.tasks_started)) | ||
1757 | + #if len(self._execution_queue) > 5000: | ||
1758 | + # traceback.print_stack(file=sys.stdout) | ||
1759 | + #if len(self._execution_queue) > 5010: | ||
1760 | + # raise Exception("Too many tasks") | ||
1761 | + | ||
1762 | def include_file(self, path): | ||
1763 | '''Include one file in the sandbox. Users of this class probably want | ||
1764 | to use `run` instead. | ||
1765 | @@ -380,6 +406,9 @@ class ConfigureSandbox(dict): | ||
1766 | if path in self._all_paths: | ||
1767 | raise ConfigureError( | ||
1768 | 'Cannot include `%s` because it was included already.' % path) | ||
1769 | + | ||
1770 | + if self.task_debug: | ||
1771 | + print("include_file", path) | ||
1772 | self._paths.append(path) | ||
1773 | self._all_paths.add(path) | ||
1774 | |||
1775 | @@ -398,7 +427,7 @@ class ConfigureSandbox(dict): | ||
1776 | if path: | ||
1777 | self.include_file(path) | ||
1778 | |||
1779 | - for option in self._options.itervalues(): | ||
1780 | + for option in self._options.values(): | ||
1781 | # All options must be referenced by some @depends function | ||
1782 | if option not in self._seen: | ||
1783 | raise ConfigureError( | ||
1784 | @@ -425,6 +454,8 @@ class ConfigureSandbox(dict): | ||
1785 | |||
1786 | # Run the execution queue | ||
1787 | for func, args in self._execution_queue: | ||
1788 | + self.tasks_started += 1 | ||
1789 | + self.tasks_debug_out("ConfigureSandbox.run(%s)" % func.__name__) | ||
1790 | func(*args) | ||
1791 | |||
1792 | if self._help: | ||
1793 | @@ -504,7 +535,7 @@ class ConfigureSandbox(dict): | ||
1794 | value = PositiveOptionValue() | ||
1795 | elif value is False or value == (): | ||
1796 | value = NegativeOptionValue() | ||
1797 | - elif isinstance(value, types.StringTypes): | ||
1798 | + elif isinstance(value, (str,)): | ||
1799 | value = PositiveOptionValue((value,)) | ||
1800 | elif isinstance(value, tuple): | ||
1801 | value = PositiveOptionValue(value) | ||
1802 | @@ -544,7 +575,7 @@ class ConfigureSandbox(dict): | ||
1803 | return value | ||
1804 | |||
1805 | def _dependency(self, arg, callee_name, arg_name=None): | ||
1806 | - if isinstance(arg, types.StringTypes): | ||
1807 | + if isinstance(arg, (str,)): | ||
1808 | prefix, name, values = Option.split_option(arg) | ||
1809 | if values != (): | ||
1810 | raise ConfigureError("Option must not contain an '='") | ||
1811 | @@ -608,7 +639,7 @@ class ConfigureSandbox(dict): | ||
1812 | ''' | ||
1813 | when = self._normalize_when(kwargs.get('when'), 'option') | ||
1814 | args = [self._resolve(arg) for arg in args] | ||
1815 | - kwargs = {k: self._resolve(v) for k, v in kwargs.iteritems() | ||
1816 | + kwargs = {k: self._resolve(v) for k, v in kwargs.items() | ||
1817 | if k != 'when'} | ||
1818 | option = Option(*args, **kwargs) | ||
1819 | if when: | ||
1820 | @@ -689,7 +720,7 @@ class ConfigureSandbox(dict): | ||
1821 | with self.only_when_impl(when): | ||
1822 | what = self._resolve(what) | ||
1823 | if what: | ||
1824 | - if not isinstance(what, types.StringTypes): | ||
1825 | + if not isinstance(what, (str,)): | ||
1826 | raise TypeError("Unexpected type: '%s'" % type(what).__name__) | ||
1827 | self.include_file(what) | ||
1828 | |||
1829 | @@ -707,7 +738,7 @@ class ConfigureSandbox(dict): | ||
1830 | (k[:-len('_impl')], getattr(self, k)) | ||
1831 | for k in dir(self) if k.endswith('_impl') and k != 'template_impl' | ||
1832 | ) | ||
1833 | - glob.update((k, v) for k, v in self.iteritems() if k not in glob) | ||
1834 | + glob.update((k, v) for k, v in self.items() if k not in glob) | ||
1835 | |||
1836 | # Any function argument to the template must be prepared to be sandboxed. | ||
1837 | # If the template itself returns a function (in which case, it's very | ||
1838 | @@ -731,7 +762,7 @@ class ConfigureSandbox(dict): | ||
1839 | def wrapper(*args, **kwargs): | ||
1840 | args = [maybe_prepare_function(arg) for arg in args] | ||
1841 | kwargs = {k: maybe_prepare_function(v) | ||
1842 | - for k, v in kwargs.iteritems()} | ||
1843 | + for k, v in kwargs.items()} | ||
1844 | ret = template(*args, **kwargs) | ||
1845 | if isfunction(ret): | ||
1846 | # We can't expect the sandboxed code to think about all the | ||
1847 | @@ -766,7 +797,7 @@ class ConfigureSandbox(dict): | ||
1848 | for value, required in ( | ||
1849 | (_import, True), (_from, False), (_as, False)): | ||
1850 | |||
1851 | - if not isinstance(value, types.StringTypes) and ( | ||
1852 | + if not isinstance(value, (str,)) and ( | ||
1853 | required or value is not None): | ||
1854 | raise TypeError("Unexpected type: '%s'" % type(value).__name__) | ||
1855 | if value is not None and not self.RE_MODULE.match(value): | ||
1856 | @@ -807,7 +838,7 @@ class ConfigureSandbox(dict): | ||
1857 | # Special case for the open() builtin, because otherwise, using it | ||
1858 | # fails with "IOError: file() constructor not accessible in | ||
1859 | # restricted mode" | ||
1860 | - if what == '__builtin__.open': | ||
1861 | + if what == 'builtins.open': | ||
1862 | return lambda *args, **kwargs: open(*args, **kwargs) | ||
1863 | # Until this proves to be a performance problem, just construct an | ||
1864 | # import statement and execute it. | ||
1865 | @@ -829,7 +860,7 @@ class ConfigureSandbox(dict): | ||
1866 | name = self._resolve(name, need_help_dependency=False) | ||
1867 | if name is None: | ||
1868 | return | ||
1869 | - if not isinstance(name, types.StringTypes): | ||
1870 | + if not isinstance(name, (str,)): | ||
1871 | raise TypeError("Unexpected type: '%s'" % type(name).__name__) | ||
1872 | if name in data: | ||
1873 | raise ConfigureError( | ||
1874 | @@ -850,6 +881,7 @@ class ConfigureSandbox(dict): | ||
1875 | |||
1876 | self._execution_queue.append(( | ||
1877 | self._resolve_and_set, (self._config, name, value, when))) | ||
1878 | + self.tasks_debug_out("ConfigureSandbox.set_config_impl / %s(%s" % (name, value)) | ||
1879 | |||
1880 | def set_define_impl(self, name, value, when=None): | ||
1881 | '''Implementation of set_define(). | ||
1882 | @@ -864,6 +896,7 @@ class ConfigureSandbox(dict): | ||
1883 | defines = self._config.setdefault('DEFINES', {}) | ||
1884 | self._execution_queue.append(( | ||
1885 | self._resolve_and_set, (defines, name, value, when))) | ||
1886 | + self.tasks_debug_out("ConfigureSandbox.set_define_impl / %s(%s)" % (name, value)) | ||
1887 | |||
1888 | def imply_option_impl(self, option, value, reason=None, when=None): | ||
1889 | '''Implementation of imply_option(). | ||
1890 | @@ -922,7 +955,7 @@ class ConfigureSandbox(dict): | ||
1891 | if isinstance(possible_reasons[0], Option): | ||
1892 | reason = possible_reasons[0] | ||
1893 | if not reason and (isinstance(value, (bool, tuple)) or | ||
1894 | - isinstance(value, types.StringTypes)): | ||
1895 | + isinstance(value, (str,))): | ||
1896 | # A reason can be provided automatically when imply_option | ||
1897 | # is called with an immediate value. | ||
1898 | _, filename, line, _, _, _ = inspect.stack()[1] | ||
1899 | @@ -955,10 +988,10 @@ class ConfigureSandbox(dict): | ||
1900 | if not inspect.isfunction(func): | ||
1901 | raise TypeError("Unexpected type: '%s'" % type(func).__name__) | ||
1902 | if func in self._prepared_functions: | ||
1903 | - return func, func.func_globals | ||
1904 | + return func, func.__globals__ | ||
1905 | |||
1906 | glob = SandboxedGlobal( | ||
1907 | - (k, v) for k, v in func.func_globals.iteritems() | ||
1908 | + (k, v) for k, v in func.__globals__.items() | ||
1909 | if (inspect.isfunction(v) and v not in self._templates) or ( | ||
1910 | inspect.isclass(v) and issubclass(v, Exception)) | ||
1911 | ) | ||
1912 | @@ -979,20 +1012,20 @@ class ConfigureSandbox(dict): | ||
1913 | # Note this is not entirely bullet proof (if the value is e.g. a list, | ||
1914 | # the list contents could have changed), but covers the bases. | ||
1915 | closure = None | ||
1916 | - if func.func_closure: | ||
1917 | + if func.__closure__: | ||
1918 | def makecell(content): | ||
1919 | def f(): | ||
1920 | content | ||
1921 | - return f.func_closure[0] | ||
1922 | + return f.__closure__[0] | ||
1923 | |||
1924 | closure = tuple(makecell(cell.cell_contents) | ||
1925 | - for cell in func.func_closure) | ||
1926 | + for cell in func.__closure__) | ||
1927 | |||
1928 | new_func = self.wraps(func)(types.FunctionType( | ||
1929 | - func.func_code, | ||
1930 | + func.__code__, | ||
1931 | glob, | ||
1932 | func.__name__, | ||
1933 | - func.func_defaults, | ||
1934 | + func.__defaults__, | ||
1935 | closure | ||
1936 | )) | ||
1937 | @self.wraps(new_func) | ||
1938 | diff --git a/python/mozbuild/mozbuild/configure/check_debug_ranges.py b/python/mozbuild/mozbuild/configure/check_debug_ranges.py | ||
1939 | index c0caa9cc5..a3e1f37e1 100644 | ||
1940 | --- a/python/mozbuild/mozbuild/configure/check_debug_ranges.py | ||
1941 | +++ b/python/mozbuild/mozbuild/configure/check_debug_ranges.py | ||
1942 | @@ -6,7 +6,7 @@ | ||
1943 | # to a given compilation unit. This is used as a helper to find a bug in some | ||
1944 | # versions of GNU ld. | ||
1945 | |||
1946 | -from __future__ import absolute_import | ||
1947 | + | ||
1948 | |||
1949 | import subprocess | ||
1950 | import sys | ||
1951 | @@ -45,6 +45,8 @@ def get_range_length(range, debug_ranges): | ||
1952 | def main(bin, compilation_unit): | ||
1953 | p = subprocess.Popen(['objdump', '-W', bin], stdout = subprocess.PIPE, stderr = subprocess.PIPE) | ||
1954 | (out, err) = p.communicate() | ||
1955 | + if isinstance(out, bytes): | ||
1956 | + out = out.decode('utf-8') | ||
1957 | sections = re.split('\n(Contents of the|The section) ', out) | ||
1958 | debug_info = [s for s in sections if s.startswith('.debug_info')] | ||
1959 | debug_ranges = [s for s in sections if s.startswith('.debug_ranges')] | ||
1960 | @@ -59,4 +61,4 @@ def main(bin, compilation_unit): | ||
1961 | |||
1962 | |||
1963 | if __name__ == '__main__': | ||
1964 | - print(main(*sys.argv[1:])) | ||
1965 | + print((main(*sys.argv[1:]))) | ||
1966 | diff --git a/python/mozbuild/mozbuild/configure/options.py b/python/mozbuild/mozbuild/configure/options.py | ||
1967 | index 53ae2ae6d..4d80cad86 100644 | ||
1968 | --- a/python/mozbuild/mozbuild/configure/options.py | ||
1969 | +++ b/python/mozbuild/mozbuild/configure/options.py | ||
1970 | @@ -2,7 +2,7 @@ | ||
1971 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
1972 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
1973 | |||
1974 | -from __future__ import absolute_import, print_function, unicode_literals | ||
1975 | + | ||
1976 | |||
1977 | import os | ||
1978 | import sys | ||
1979 | @@ -12,7 +12,7 @@ from collections import OrderedDict | ||
1980 | |||
1981 | def istupleofstrings(obj): | ||
1982 | return isinstance(obj, tuple) and len(obj) and all( | ||
1983 | - isinstance(o, types.StringTypes) for o in obj) | ||
1984 | + isinstance(o, (str,)) for o in obj) | ||
1985 | |||
1986 | |||
1987 | class OptionValue(tuple): | ||
1988 | @@ -88,7 +88,7 @@ class PositiveOptionValue(OptionValue): | ||
1989 | in the form of a tuple for when values are given to the option (in the form | ||
1990 | --option=value[,value2...]. | ||
1991 | ''' | ||
1992 | - def __nonzero__(self): | ||
1993 | + def __bool__(self): | ||
1994 | return True | ||
1995 | |||
1996 | |||
1997 | @@ -113,7 +113,7 @@ class ConflictingOptionError(InvalidOptionError): | ||
1998 | if format_data: | ||
1999 | message = message.format(**format_data) | ||
2000 | super(ConflictingOptionError, self).__init__(message) | ||
2001 | - for k, v in format_data.iteritems(): | ||
2002 | + for k, v in format_data.items(): | ||
2003 | setattr(self, k, v) | ||
2004 | |||
2005 | |||
2006 | @@ -149,7 +149,7 @@ class Option(object): | ||
2007 | 'At least an option name or an environment variable name must ' | ||
2008 | 'be given') | ||
2009 | if name: | ||
2010 | - if not isinstance(name, types.StringTypes): | ||
2011 | + if not isinstance(name, (str,)): | ||
2012 | raise InvalidOptionError('Option must be a string') | ||
2013 | if not name.startswith('--'): | ||
2014 | raise InvalidOptionError('Option must start with `--`') | ||
2015 | @@ -158,7 +158,7 @@ class Option(object): | ||
2016 | if not name.islower(): | ||
2017 | raise InvalidOptionError('Option must be all lowercase') | ||
2018 | if env: | ||
2019 | - if not isinstance(env, types.StringTypes): | ||
2020 | + if not isinstance(env, (str,)): | ||
2021 | raise InvalidOptionError( | ||
2022 | 'Environment variable name must be a string') | ||
2023 | if not env.isupper(): | ||
2024 | @@ -168,8 +168,8 @@ class Option(object): | ||
2025 | isinstance(nargs, int) and nargs >= 0): | ||
2026 | raise InvalidOptionError( | ||
2027 | "nargs must be a positive integer, '?', '*' or '+'") | ||
2028 | - if (not isinstance(default, types.StringTypes) and | ||
2029 | - not isinstance(default, (bool, types.NoneType)) and | ||
2030 | + if (not isinstance(default, (str,)) and | ||
2031 | + not isinstance(default, (bool, type(None))) and | ||
2032 | not istupleofstrings(default)): | ||
2033 | raise InvalidOptionError( | ||
2034 | 'default must be a bool, a string or a tuple of strings') | ||
2035 | @@ -241,7 +241,7 @@ class Option(object): | ||
2036 | ', '.join("'%s'" % c for c in choices)) | ||
2037 | elif has_choices: | ||
2038 | maxargs = self.maxargs | ||
2039 | - if len(choices) < maxargs and maxargs != sys.maxint: | ||
2040 | + if len(choices) < maxargs and maxargs != sys.maxsize: | ||
2041 | raise InvalidOptionError('Not enough `choices` for `nargs`') | ||
2042 | self.choices = choices | ||
2043 | self.help = help | ||
2044 | @@ -255,7 +255,7 @@ class Option(object): | ||
2045 | where prefix is one of 'with', 'without', 'enable' or 'disable'. | ||
2046 | The '=values' part is optional. Values are separated with commas. | ||
2047 | ''' | ||
2048 | - if not isinstance(option, types.StringTypes): | ||
2049 | + if not isinstance(option, (str,)): | ||
2050 | raise InvalidOptionError('Option must be a string') | ||
2051 | |||
2052 | elements = option.split('=', 1) | ||
2053 | @@ -308,7 +308,7 @@ class Option(object): | ||
2054 | def maxargs(self): | ||
2055 | if isinstance(self.nargs, int): | ||
2056 | return self.nargs | ||
2057 | - return 1 if self.nargs == '?' else sys.maxint | ||
2058 | + return 1 if self.nargs == '?' else sys.maxsize | ||
2059 | |||
2060 | def _validate_nargs(self, num): | ||
2061 | minargs, maxargs = self.minargs, self.maxargs | ||
2062 | @@ -499,5 +499,5 @@ class CommandLineHelper(object): | ||
2063 | |||
2064 | def __iter__(self): | ||
2065 | for d in (self._args, self._extra_args): | ||
2066 | - for arg, pos in d.itervalues(): | ||
2067 | + for arg, pos in d.values(): | ||
2068 | yield arg | ||
2069 | diff --git a/python/mozbuild/mozbuild/configure/util.py b/python/mozbuild/mozbuild/configure/util.py | ||
2070 | index 9d8b2eb0e..a12986e48 100644 | ||
2071 | --- a/python/mozbuild/mozbuild/configure/util.py | ||
2072 | +++ b/python/mozbuild/mozbuild/configure/util.py | ||
2073 | @@ -77,15 +77,7 @@ class ConfigureOutputHandler(logging.Handler): | ||
2074 | # Python has this feature where it sets the encoding of pipes to | ||
2075 | # ascii, which blatantly fails when trying to print out non-ascii. | ||
2076 | def fix_encoding(fh): | ||
2077 | - try: | ||
2078 | - isatty = fh.isatty() | ||
2079 | - except AttributeError: | ||
2080 | - isatty = True | ||
2081 | - | ||
2082 | - if not isatty: | ||
2083 | - encoding = getpreferredencoding() | ||
2084 | - if encoding: | ||
2085 | - return codecs.getwriter(encoding)(fh) | ||
2086 | + # no magic on oe / python3 | ||
2087 | return fh | ||
2088 | |||
2089 | self._stdout = fix_encoding(stdout) | ||
2090 | @@ -200,7 +192,7 @@ class LineIO(object): | ||
2091 | self._errors = errors | ||
2092 | |||
2093 | def write(self, buf): | ||
2094 | - if self._encoding and isinstance(buf, str): | ||
2095 | + if self._encoding and isinstance(buf, bytes): | ||
2096 | buf = buf.decode(self._encoding, self._errors) | ||
2097 | lines = buf.splitlines() | ||
2098 | if not lines: | ||
2099 | diff --git a/python/mozbuild/mozbuild/controller/building.py b/python/mozbuild/mozbuild/controller/building.py | ||
2100 | index d5af532f7..e9810fe58 100644 | ||
2101 | --- a/python/mozbuild/mozbuild/controller/building.py | ||
2102 | +++ b/python/mozbuild/mozbuild/controller/building.py | ||
2103 | @@ -2,7 +2,7 @@ | ||
2104 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
2105 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
2106 | |||
2107 | -from __future__ import absolute_import, unicode_literals | ||
2108 | + | ||
2109 | |||
2110 | import errno | ||
2111 | import getpass | ||
2112 | @@ -146,7 +146,7 @@ class TierStatus(object): | ||
2113 | """ | ||
2114 | o = [] | ||
2115 | |||
2116 | - for tier, state in self.tiers.items(): | ||
2117 | + for tier, state in list(self.tiers.items()): | ||
2118 | t_entry = dict( | ||
2119 | name=tier, | ||
2120 | start=state['begin_time'], | ||
2121 | @@ -574,7 +574,7 @@ class BuildProgressFooter(Footer): | ||
2122 | |||
2123 | def __init__(self, terminal, monitor): | ||
2124 | Footer.__init__(self, terminal) | ||
2125 | - self.tiers = monitor.tiers.tier_status.viewitems() | ||
2126 | + self.tiers = monitor.tiers.tier_status.items() | ||
2127 | |||
2128 | def draw(self): | ||
2129 | """Draws this footer in the terminal.""" | ||
2130 | @@ -911,8 +911,8 @@ class CCacheStats(object): | ||
2131 | |||
2132 | return '\n'.join(lines) | ||
2133 | |||
2134 | - def __nonzero__(self): | ||
2135 | - relative_values = [v for k, v in self._values.items() | ||
2136 | + def __bool__(self): | ||
2137 | + relative_values = [v for k, v in list(self._values.items()) | ||
2138 | if k not in self.ABSOLUTE_KEYS] | ||
2139 | return (all(v >= 0 for v in relative_values) and | ||
2140 | any(v > 0 for v in relative_values)) | ||
2141 | @@ -1156,7 +1156,7 @@ class BuildDriver(MozbuildObject): | ||
2142 | |||
2143 | high_finder, finder_percent = monitor.have_high_finder_usage() | ||
2144 | if high_finder: | ||
2145 | - print(FINDER_SLOW_MESSAGE % finder_percent) | ||
2146 | + print((FINDER_SLOW_MESSAGE % finder_percent)) | ||
2147 | |||
2148 | ccache_end = monitor.ccache_stats() | ||
2149 | |||
2150 | @@ -1276,8 +1276,8 @@ class BuildDriver(MozbuildObject): | ||
2151 | """Install test files.""" | ||
2152 | |||
2153 | if self.is_clobber_needed(): | ||
2154 | - print(INSTALL_TESTS_CLOBBER.format( | ||
2155 | - clobber_file=os.path.join(self.topobjdir, 'CLOBBER'))) | ||
2156 | + print((INSTALL_TESTS_CLOBBER.format( | ||
2157 | + clobber_file=os.path.join(self.topobjdir, 'CLOBBER')))) | ||
2158 | sys.exit(1) | ||
2159 | |||
2160 | if not test_objs: | ||
2161 | diff --git a/python/mozbuild/mozbuild/frontend/context.py b/python/mozbuild/mozbuild/frontend/context.py | ||
2162 | index fbdbefc1d..1aef6a65a 100644 | ||
2163 | --- a/python/mozbuild/mozbuild/frontend/context.py | ||
2164 | +++ b/python/mozbuild/mozbuild/frontend/context.py | ||
2165 | @@ -14,7 +14,7 @@ If you are looking for the absolute authority on what moz.build files can | ||
2166 | contain, you've come to the right place. | ||
2167 | """ | ||
2168 | |||
2169 | -from __future__ import absolute_import, unicode_literals | ||
2170 | + | ||
2171 | |||
2172 | import os | ||
2173 | |||
2174 | @@ -237,15 +237,15 @@ class Context(KeyedDefaultDict): | ||
2175 | This function is transactional: if setitem fails for one of the values, | ||
2176 | the context is not updated at all.""" | ||
2177 | if isinstance(iterable, dict): | ||
2178 | - iterable = iterable.items() | ||
2179 | + iterable = list(iterable.items()) | ||
2180 | |||
2181 | update = {} | ||
2182 | - for key, value in itertools.chain(iterable, kwargs.items()): | ||
2183 | + for key, value in itertools.chain(iterable, list(kwargs.items())): | ||
2184 | stored_type = self._validate(key, value) | ||
2185 | # Don't create an instance of stored_type if coercion is needed, | ||
2186 | # until all values are validated. | ||
2187 | update[key] = (value, stored_type) | ||
2188 | - for key, (value, stored_type) in update.items(): | ||
2189 | + for key, (value, stored_type) in list(update.items()): | ||
2190 | if not isinstance(value, stored_type): | ||
2191 | update[key] = stored_type(value) | ||
2192 | else: | ||
2193 | @@ -311,7 +311,7 @@ class BaseCompileFlags(ContextDerivedValue, dict): | ||
2194 | # a template were set and which were provided as defaults. | ||
2195 | template_name = getattr(context, 'template', None) | ||
2196 | if template_name in (None, 'Gyp'): | ||
2197 | - dict.__init__(self, ((k, v if v is None else TypedList(unicode)(v)) | ||
2198 | + dict.__init__(self, ((k, v if v is None else TypedList(str)(v)) | ||
2199 | for k, v, _ in self.flag_variables)) | ||
2200 | else: | ||
2201 | dict.__init__(self) | ||
2202 | @@ -520,13 +520,13 @@ class CompileFlags(BaseCompileFlags): | ||
2203 | if key in self and self[key] is None: | ||
2204 | raise ValueError('`%s` may not be set in COMPILE_FLAGS from moz.build, this ' | ||
2205 | 'value is resolved from the emitter.' % key) | ||
2206 | - if not (isinstance(value, list) and all(isinstance(v, basestring) for v in value)): | ||
2207 | + if not (isinstance(value, list) and all(isinstance(v, str) for v in value)): | ||
2208 | raise ValueError('A list of strings must be provided as a value for a ' | ||
2209 | 'compile flags category.') | ||
2210 | dict.__setitem__(self, key, value) | ||
2211 | |||
2212 | |||
2213 | -class FinalTargetValue(ContextDerivedValue, unicode): | ||
2214 | +class FinalTargetValue(ContextDerivedValue, str): | ||
2215 | def __new__(cls, context, value=""): | ||
2216 | if not value: | ||
2217 | value = 'dist/' | ||
2218 | @@ -536,7 +536,7 @@ class FinalTargetValue(ContextDerivedValue, unicode): | ||
2219 | value += 'bin' | ||
2220 | if context['DIST_SUBDIR']: | ||
2221 | value += '/' + context['DIST_SUBDIR'] | ||
2222 | - return unicode.__new__(cls, value) | ||
2223 | + return str.__new__(cls, value) | ||
2224 | |||
2225 | |||
2226 | def Enum(*values): | ||
2227 | @@ -584,7 +584,7 @@ class PathMeta(type): | ||
2228 | cls = SourcePath | ||
2229 | return super(PathMeta, cls).__call__(context, value) | ||
2230 | |||
2231 | -class Path(ContextDerivedValue, unicode): | ||
2232 | +class Path(ContextDerivedValue, str, metaclass=PathMeta): | ||
2233 | """Stores and resolves a source path relative to a given context | ||
2234 | |||
2235 | This class is used as a backing type for some of the sandbox variables. | ||
2236 | @@ -595,7 +595,6 @@ class Path(ContextDerivedValue, unicode): | ||
2237 | - '!objdir/relative/paths' | ||
2238 | - '%/filesystem/absolute/paths' | ||
2239 | """ | ||
2240 | - __metaclass__ = PathMeta | ||
2241 | |||
2242 | def __new__(cls, context, value=None): | ||
2243 | return super(Path, cls).__new__(cls, value) | ||
2244 | @@ -612,10 +611,14 @@ class Path(ContextDerivedValue, unicode): | ||
2245 | """ | ||
2246 | return Path(self.context, mozpath.join(self, *p)) | ||
2247 | |||
2248 | + @staticmethod | ||
2249 | + def cmp(a, b): | ||
2250 | + return (a > b) - (a < b) | ||
2251 | + | ||
2252 | def __cmp__(self, other): | ||
2253 | if isinstance(other, Path) and self.srcdir != other.srcdir: | ||
2254 | - return cmp(self.full_path, other.full_path) | ||
2255 | - return cmp(unicode(self), other) | ||
2256 | + return self.cmp(self.full_path, other.full_path) | ||
2257 | + return self.cmp(str(self), other) | ||
2258 | |||
2259 | # __cmp__ is not enough because unicode has __eq__, __ne__, etc. defined | ||
2260 | # and __cmp__ is only used for those when they don't exist. | ||
2261 | @@ -773,7 +776,7 @@ def ContextDerivedTypedRecord(*fields): | ||
2262 | __slots__ = tuple([name for name, _ in fields]) | ||
2263 | |||
2264 | def __init__(self, context): | ||
2265 | - for fname, ftype in self._fields.items(): | ||
2266 | + for fname, ftype in list(self._fields.items()): | ||
2267 | if issubclass(ftype, ContextDerivedValue): | ||
2268 | setattr(self, fname, self._fields[fname](context)) | ||
2269 | else: | ||
2270 | @@ -909,8 +912,8 @@ def TypedListWithAction(typ, action): | ||
2271 | return _TypedListWithAction | ||
2272 | |||
2273 | WebPlatformTestManifest = TypedNamedTuple("WebPlatformTestManifest", | ||
2274 | - [("manifest_path", unicode), | ||
2275 | - ("test_root", unicode)]) | ||
2276 | + [("manifest_path", str), | ||
2277 | + ("test_root", str)]) | ||
2278 | ManifestparserManifestList = OrderedPathListWithAction(read_manifestparser_manifest) | ||
2279 | ReftestManifestList = OrderedPathListWithAction(read_reftest_manifest) | ||
2280 | WptManifestList = TypedListWithAction(WebPlatformTestManifest, read_wpt_manifest) | ||
2281 | @@ -918,18 +921,18 @@ WptManifestList = TypedListWithAction(WebPlatformTestManifest, read_wpt_manifest | ||
2282 | OrderedSourceList = ContextDerivedTypedList(SourcePath, StrictOrderingOnAppendList) | ||
2283 | OrderedTestFlavorList = TypedList(Enum(*all_test_flavors()), | ||
2284 | StrictOrderingOnAppendList) | ||
2285 | -OrderedStringList = TypedList(unicode, StrictOrderingOnAppendList) | ||
2286 | +OrderedStringList = TypedList(str, StrictOrderingOnAppendList) | ||
2287 | DependentTestsEntry = ContextDerivedTypedRecord(('files', OrderedSourceList), | ||
2288 | ('tags', OrderedStringList), | ||
2289 | ('flavors', OrderedTestFlavorList)) | ||
2290 | BugzillaComponent = TypedNamedTuple('BugzillaComponent', | ||
2291 | - [('product', unicode), ('component', unicode)]) | ||
2292 | + [('product', str), ('component', str)]) | ||
2293 | SchedulingComponents = ContextDerivedTypedRecord( | ||
2294 | - ('inclusive', TypedList(unicode, StrictOrderingOnAppendList)), | ||
2295 | - ('exclusive', TypedList(unicode, StrictOrderingOnAppendList))) | ||
2296 | + ('inclusive', TypedList(str, StrictOrderingOnAppendList)), | ||
2297 | + ('exclusive', TypedList(str, StrictOrderingOnAppendList))) | ||
2298 | |||
2299 | GeneratedFilesList = StrictOrderingOnAppendListWithFlagsFactory({ | ||
2300 | - 'script': unicode, | ||
2301 | + 'script': str, | ||
2302 | 'inputs': list, | ||
2303 | 'flags': list, }) | ||
2304 | |||
2305 | @@ -1096,7 +1099,7 @@ class Files(SubContext): | ||
2306 | self.test_tags |= other.test_tags | ||
2307 | self.test_flavors |= other.test_flavors | ||
2308 | |||
2309 | - for k, v in other.items(): | ||
2310 | + for k, v in list(other.items()): | ||
2311 | if k == 'IMPACTED_TESTS': | ||
2312 | self.test_files |= set(mozpath.relpath(e.full_path, e.context.config.topsrcdir) | ||
2313 | for e in v.files) | ||
2314 | @@ -1154,7 +1157,7 @@ class Files(SubContext): | ||
2315 | |||
2316 | bug_components = Counter() | ||
2317 | |||
2318 | - for f in files.values(): | ||
2319 | + for f in list(files.values()): | ||
2320 | bug_component = f.get('BUG_COMPONENT') | ||
2321 | if bug_component: | ||
2322 | bug_components[bug_component] += 1 | ||
2323 | @@ -1232,7 +1235,7 @@ VARIABLES = { | ||
2324 | RustLibrary template instead. | ||
2325 | """), | ||
2326 | |||
2327 | - 'RUST_LIBRARY_TARGET_DIR': (unicode, unicode, | ||
2328 | + 'RUST_LIBRARY_TARGET_DIR': (str, str, | ||
2329 | """Where CARGO_TARGET_DIR should point when compiling this library. If | ||
2330 | not set, it defaults to the current objdir. It should be a relative path | ||
2331 | to the current objdir; absolute paths should not be used. | ||
2332 | @@ -1248,7 +1251,7 @@ VARIABLES = { | ||
2333 | HostRustLibrary template instead. | ||
2334 | """), | ||
2335 | |||
2336 | - 'RUST_TEST': (unicode, unicode, | ||
2337 | + 'RUST_TEST': (str, str, | ||
2338 | """Name of a Rust test to build and run via `cargo test`. | ||
2339 | |||
2340 | This variable should not be used directly; you should be using the | ||
2341 | @@ -1487,7 +1490,7 @@ VARIABLES = { | ||
2342 | """Like ``OBJDIR_FILES``, with preprocessing. Use sparingly. | ||
2343 | """), | ||
2344 | |||
2345 | - 'FINAL_LIBRARY': (unicode, unicode, | ||
2346 | + 'FINAL_LIBRARY': (str, str, | ||
2347 | """Library in which the objects of the current directory will be linked. | ||
2348 | |||
2349 | This variable contains the name of a library, defined elsewhere with | ||
2350 | @@ -1528,7 +1531,7 @@ VARIABLES = { | ||
2351 | with the host compiler. | ||
2352 | """), | ||
2353 | |||
2354 | - 'HOST_LIBRARY_NAME': (unicode, unicode, | ||
2355 | + 'HOST_LIBRARY_NAME': (str, str, | ||
2356 | """Name of target library generated when cross compiling. | ||
2357 | """), | ||
2358 | |||
2359 | @@ -1546,7 +1549,7 @@ VARIABLES = { | ||
2360 | libraries that link into this library via FINAL_LIBRARY. | ||
2361 | """), | ||
2362 | |||
2363 | - 'LIBRARY_NAME': (unicode, unicode, | ||
2364 | + 'LIBRARY_NAME': (str, str, | ||
2365 | """The code name of the library generated for a directory. | ||
2366 | |||
2367 | By default STATIC_LIBRARY_NAME and SHARED_LIBRARY_NAME take this name. | ||
2368 | @@ -1558,7 +1561,7 @@ VARIABLES = { | ||
2369 | ``example/components/xpcomsample.lib`` on Windows. | ||
2370 | """), | ||
2371 | |||
2372 | - 'SHARED_LIBRARY_NAME': (unicode, unicode, | ||
2373 | + 'SHARED_LIBRARY_NAME': (str, str, | ||
2374 | """The name of the static library generated for a directory, if it needs to | ||
2375 | differ from the library code name. | ||
2376 | |||
2377 | @@ -1572,7 +1575,7 @@ VARIABLES = { | ||
2378 | Implies FORCE_SHARED_LIB. | ||
2379 | """), | ||
2380 | |||
2381 | - 'STATIC_LIBRARY_NAME': (unicode, unicode, | ||
2382 | + 'STATIC_LIBRARY_NAME': (str, str, | ||
2383 | """The name of the static library generated for a directory, if it needs to | ||
2384 | differ from the library code name. | ||
2385 | |||
2386 | @@ -1604,31 +1607,31 @@ VARIABLES = { | ||
2387 | |||
2388 | This variable contains a list of system libaries to link against. | ||
2389 | """), | ||
2390 | - 'RCFILE': (unicode, unicode, | ||
2391 | + 'RCFILE': (str, str, | ||
2392 | """The program .rc file. | ||
2393 | |||
2394 | This variable can only be used on Windows. | ||
2395 | """), | ||
2396 | |||
2397 | - 'RESFILE': (unicode, unicode, | ||
2398 | + 'RESFILE': (str, str, | ||
2399 | """The program .res file. | ||
2400 | |||
2401 | This variable can only be used on Windows. | ||
2402 | """), | ||
2403 | |||
2404 | - 'RCINCLUDE': (unicode, unicode, | ||
2405 | + 'RCINCLUDE': (str, str, | ||
2406 | """The resource script file to be included in the default .res file. | ||
2407 | |||
2408 | This variable can only be used on Windows. | ||
2409 | """), | ||
2410 | |||
2411 | - 'DEFFILE': (unicode, unicode, | ||
2412 | + 'DEFFILE': (str, str, | ||
2413 | """The program .def (module definition) file. | ||
2414 | |||
2415 | This variable can only be used on Windows. | ||
2416 | """), | ||
2417 | |||
2418 | - 'SYMBOLS_FILE': (Path, unicode, | ||
2419 | + 'SYMBOLS_FILE': (Path, str, | ||
2420 | """A file containing a list of symbols to export from a shared library. | ||
2421 | |||
2422 | The given file contains a list of symbols to be exported, and is | ||
2423 | @@ -1649,7 +1652,7 @@ VARIABLES = { | ||
2424 | ``BIN_SUFFIX``, the name will remain unchanged. | ||
2425 | """), | ||
2426 | |||
2427 | - 'SONAME': (unicode, unicode, | ||
2428 | + 'SONAME': (str, str, | ||
2429 | """The soname of the shared object currently being linked | ||
2430 | |||
2431 | soname is the "logical name" of a shared object, often used to provide | ||
2432 | @@ -1719,7 +1722,7 @@ VARIABLES = { | ||
2433 | ``GENERATED_FILES``. | ||
2434 | """), | ||
2435 | |||
2436 | - 'PROGRAM' : (unicode, unicode, | ||
2437 | + 'PROGRAM' : (str, str, | ||
2438 | """Compiled executable name. | ||
2439 | |||
2440 | If the configuration token ``BIN_SUFFIX`` is set, its value will be | ||
2441 | @@ -1727,7 +1730,7 @@ VARIABLES = { | ||
2442 | ``BIN_SUFFIX``, ``PROGRAM`` will remain unchanged. | ||
2443 | """), | ||
2444 | |||
2445 | - 'HOST_PROGRAM' : (unicode, unicode, | ||
2446 | + 'HOST_PROGRAM' : (str, str, | ||
2447 | """Compiled host executable name. | ||
2448 | |||
2449 | If the configuration token ``HOST_BIN_SUFFIX`` is set, its value will be | ||
2450 | @@ -1765,7 +1768,7 @@ VARIABLES = { | ||
2451 | files. | ||
2452 | """), | ||
2453 | |||
2454 | - 'XPIDL_MODULE': (unicode, unicode, | ||
2455 | + 'XPIDL_MODULE': (str, str, | ||
2456 | """XPCOM Interface Definition Module Name. | ||
2457 | |||
2458 | This is the name of the ``.xpt`` file that is created by linking | ||
2459 | @@ -1924,14 +1927,14 @@ VARIABLES = { | ||
2460 | |||
2461 | |||
2462 | # The following variables are used to control the target of installed files. | ||
2463 | - 'XPI_NAME': (unicode, unicode, | ||
2464 | + 'XPI_NAME': (str, str, | ||
2465 | """The name of an extension XPI to generate. | ||
2466 | |||
2467 | When this variable is present, the results of this directory will end up | ||
2468 | being packaged into an extension instead of the main dist/bin results. | ||
2469 | """), | ||
2470 | |||
2471 | - 'DIST_SUBDIR': (unicode, unicode, | ||
2472 | + 'DIST_SUBDIR': (str, str, | ||
2473 | """The name of an alternate directory to install files to. | ||
2474 | |||
2475 | When this variable is present, the results of this directory will end up | ||
2476 | @@ -1939,7 +1942,7 @@ VARIABLES = { | ||
2477 | otherwise be placed. | ||
2478 | """), | ||
2479 | |||
2480 | - 'FINAL_TARGET': (FinalTargetValue, unicode, | ||
2481 | + 'FINAL_TARGET': (FinalTargetValue, str, | ||
2482 | """The name of the directory to install targets to. | ||
2483 | |||
2484 | The directory is relative to the top of the object directory. The | ||
2485 | @@ -1970,7 +1973,7 @@ VARIABLES = { | ||
2486 | |||
2487 | 'GYP_DIRS': (StrictOrderingOnAppendListWithFlagsFactory({ | ||
2488 | 'variables': dict, | ||
2489 | - 'input': unicode, | ||
2490 | + 'input': str, | ||
2491 | 'sandbox_vars': dict, | ||
2492 | 'no_chromium': bool, | ||
2493 | 'no_unified': bool, | ||
2494 | @@ -2194,7 +2197,7 @@ VARIABLES = { | ||
2495 | } | ||
2496 | |||
2497 | # Sanity check: we don't want any variable above to have a list as storage type. | ||
2498 | -for name, (storage_type, input_types, docs) in VARIABLES.items(): | ||
2499 | +for name, (storage_type, input_types, docs) in list(VARIABLES.items()): | ||
2500 | if storage_type == list: | ||
2501 | raise RuntimeError('%s has a "list" storage type. Use "List" instead.' | ||
2502 | % name) | ||
2503 | diff --git a/python/mozbuild/mozbuild/frontend/data.py b/python/mozbuild/mozbuild/frontend/data.py | ||
2504 | index 442fc9e0a..837453a9f 100644 | ||
2505 | --- a/python/mozbuild/mozbuild/frontend/data.py | ||
2506 | +++ b/python/mozbuild/mozbuild/frontend/data.py | ||
2507 | @@ -15,7 +15,7 @@ contains the code for converting executed mozbuild files into these data | ||
2508 | structures. | ||
2509 | """ | ||
2510 | |||
2511 | -from __future__ import absolute_import, unicode_literals | ||
2512 | + | ||
2513 | |||
2514 | from mozbuild.util import StrictOrderingOnAppendList | ||
2515 | from mozpack.chrome.manifest import ManifestEntry | ||
2516 | @@ -182,7 +182,7 @@ class ComputedFlags(ContextDerived): | ||
2517 | if value: | ||
2518 | for dest_var in dest_vars: | ||
2519 | flags[dest_var].extend(value) | ||
2520 | - return flags.items() | ||
2521 | + return list(flags.items()) | ||
2522 | |||
2523 | class XPIDLFile(ContextDerived): | ||
2524 | """Describes an XPIDL file to be compiled.""" | ||
2525 | @@ -213,7 +213,7 @@ class BaseDefines(ContextDerived): | ||
2526 | self.defines = defines | ||
2527 | |||
2528 | def get_defines(self): | ||
2529 | - for define, value in self.defines.iteritems(): | ||
2530 | + for define, value in self.defines.items(): | ||
2531 | if value is True: | ||
2532 | yield('-D%s' % define) | ||
2533 | elif value is False: | ||
2534 | @@ -494,7 +494,7 @@ class SimpleProgram(BaseProgram): | ||
2535 | KIND = 'target' | ||
2536 | |||
2537 | def source_files(self): | ||
2538 | - for srcs in self.sources.values(): | ||
2539 | + for srcs in list(self.sources.values()): | ||
2540 | for f in srcs: | ||
2541 | if mozpath.basename(mozpath.splitext(f)[0]) == mozpath.splitext(self.program)[0]: | ||
2542 | return [f] | ||
2543 | diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py | ||
2544 | index 642b381c0..c28344a75 100644 | ||
2545 | --- a/python/mozbuild/mozbuild/frontend/emitter.py | ||
2546 | +++ b/python/mozbuild/mozbuild/frontend/emitter.py | ||
2547 | @@ -2,7 +2,7 @@ | ||
2548 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
2549 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
2550 | |||
2551 | -from __future__ import absolute_import, unicode_literals | ||
2552 | + | ||
2553 | |||
2554 | import itertools | ||
2555 | import logging | ||
2556 | @@ -116,8 +116,8 @@ class TreeMetadataEmitter(LoggingMixin): | ||
2557 | # arguments. This gross hack works around the problem until we | ||
2558 | # rid ourselves of 2.6. | ||
2559 | self.info = {} | ||
2560 | - for k, v in mozinfo.info.items(): | ||
2561 | - if isinstance(k, unicode): | ||
2562 | + for k, v in list(mozinfo.info.items()): | ||
2563 | + if isinstance(k, str): | ||
2564 | k = k.encode('ascii') | ||
2565 | self.info[k] = v | ||
2566 | |||
2567 | @@ -234,7 +234,7 @@ class TreeMetadataEmitter(LoggingMixin): | ||
2568 | |||
2569 | |||
2570 | # Next do FINAL_LIBRARY linkage. | ||
2571 | - for lib in (l for libs in self._libs.values() for l in libs): | ||
2572 | + for lib in (l for libs in list(self._libs.values()) for l in libs): | ||
2573 | if not isinstance(lib, (StaticLibrary, RustLibrary)) or not lib.link_into: | ||
2574 | continue | ||
2575 | if lib.link_into not in self._libs: | ||
2576 | @@ -294,13 +294,13 @@ class TreeMetadataEmitter(LoggingMixin): | ||
2577 | lib.link_into == outerlib.basename): | ||
2578 | propagate_defines(lib, defines) | ||
2579 | |||
2580 | - for lib in (l for libs in self._libs.values() for l in libs): | ||
2581 | + for lib in (l for libs in list(self._libs.values()) for l in libs): | ||
2582 | if isinstance(lib, Library): | ||
2583 | propagate_defines(lib, lib.lib_defines) | ||
2584 | yield lib | ||
2585 | |||
2586 | |||
2587 | - for lib in (l for libs in self._libs.values() for l in libs): | ||
2588 | + for lib in (l for libs in list(self._libs.values()) for l in libs): | ||
2589 | lib_defines = list(lib.lib_defines.get_defines()) | ||
2590 | if lib_defines: | ||
2591 | objdir_flags = self._compile_flags[lib.objdir] | ||
2592 | @@ -310,13 +310,13 @@ class TreeMetadataEmitter(LoggingMixin): | ||
2593 | if objdir_flags: | ||
2594 | objdir_flags.resolve_flags('LIBRARY_DEFINES', lib_defines) | ||
2595 | |||
2596 | - for flags_obj in self._compile_flags.values(): | ||
2597 | + for flags_obj in list(self._compile_flags.values()): | ||
2598 | yield flags_obj | ||
2599 | |||
2600 | - for flags_obj in self._compile_as_flags.values(): | ||
2601 | + for flags_obj in list(self._compile_as_flags.values()): | ||
2602 | yield flags_obj | ||
2603 | |||
2604 | - for obj in self._binaries.values(): | ||
2605 | + for obj in list(self._binaries.values()): | ||
2606 | yield obj | ||
2607 | |||
2608 | |||
2609 | @@ -409,7 +409,7 @@ class TreeMetadataEmitter(LoggingMixin): | ||
2610 | libs[key] = l | ||
2611 | if key not in libs: | ||
2612 | libs[key] = l | ||
2613 | - candidates = libs.values() | ||
2614 | + candidates = list(libs.values()) | ||
2615 | if force_static and not candidates: | ||
2616 | if dir: | ||
2617 | raise SandboxValidationError( | ||
2618 | @@ -473,9 +473,9 @@ class TreeMetadataEmitter(LoggingMixin): | ||
2619 | |||
2620 | def _verify_deps(self, context, crate_dir, crate_name, dependencies, description='Dependency'): | ||
2621 | """Verify that a crate's dependencies all specify local paths.""" | ||
2622 | - for dep_crate_name, values in dependencies.iteritems(): | ||
2623 | + for dep_crate_name, values in dependencies.items(): | ||
2624 | # A simple version number. | ||
2625 | - if isinstance(values, (str, unicode)): | ||
2626 | + if isinstance(values, str): | ||
2627 | raise SandboxValidationError( | ||
2628 | '%s %s of crate %s does not list a path' % (description, dep_crate_name, crate_name), | ||
2629 | context) | ||
2630 | @@ -529,7 +529,7 @@ class TreeMetadataEmitter(LoggingMixin): | ||
2631 | |||
2632 | cargo_target_dir = context.get('RUST_LIBRARY_TARGET_DIR', '.') | ||
2633 | |||
2634 | - dependencies = set(config.get('dependencies', {}).iterkeys()) | ||
2635 | + dependencies = set(config.get('dependencies', {}).keys()) | ||
2636 | |||
2637 | features = context.get(cls.FEATURES_VAR, []) | ||
2638 | unique_features = set(features) | ||
2639 | @@ -863,7 +863,7 @@ class TreeMetadataEmitter(LoggingMixin): | ||
2640 | assert not gen_sources['UNIFIED_SOURCES'] | ||
2641 | |||
2642 | no_pgo = context.get('NO_PGO') | ||
2643 | - no_pgo_sources = [f for f, flags in all_flags.iteritems() | ||
2644 | + no_pgo_sources = [f for f, flags in all_flags.items() | ||
2645 | if flags.no_pgo] | ||
2646 | if no_pgo: | ||
2647 | if no_pgo_sources: | ||
2648 | @@ -890,7 +890,7 @@ class TreeMetadataEmitter(LoggingMixin): | ||
2649 | |||
2650 | # The inverse of the above, mapping suffixes to their canonical suffix. | ||
2651 | canonicalized_suffix_map = {} | ||
2652 | - for suffix, alternatives in suffix_map.iteritems(): | ||
2653 | + for suffix, alternatives in suffix_map.items(): | ||
2654 | alternatives.add(suffix) | ||
2655 | for a in alternatives: | ||
2656 | canonicalized_suffix_map[a] = suffix | ||
2657 | @@ -914,7 +914,7 @@ class TreeMetadataEmitter(LoggingMixin): | ||
2658 | # Source files to track for linkables associated with this context. | ||
2659 | ctxt_sources = defaultdict(lambda: defaultdict(list)) | ||
2660 | |||
2661 | - for variable, (klass, gen_klass, suffixes) in varmap.items(): | ||
2662 | + for variable, (klass, gen_klass, suffixes) in list(varmap.items()): | ||
2663 | allowed_suffixes = set().union(*[suffix_map[s] for s in suffixes]) | ||
2664 | |||
2665 | # First ensure that we haven't been given filetypes that we don't | ||
2666 | @@ -941,20 +941,20 @@ class TreeMetadataEmitter(LoggingMixin): | ||
2667 | obj = cls(*arglist) | ||
2668 | srcs = obj.files | ||
2669 | if isinstance(obj, UnifiedSources) and obj.have_unified_mapping: | ||
2670 | - srcs = dict(obj.unified_source_mapping).keys() | ||
2671 | + srcs = list(dict(obj.unified_source_mapping).keys()) | ||
2672 | ctxt_sources[variable][canonical_suffix] += sorted(srcs) | ||
2673 | yield obj | ||
2674 | |||
2675 | if ctxt_sources: | ||
2676 | for linkable in linkables: | ||
2677 | for target_var in ('SOURCES', 'UNIFIED_SOURCES'): | ||
2678 | - for suffix, srcs in ctxt_sources[target_var].items(): | ||
2679 | + for suffix, srcs in list(ctxt_sources[target_var].items()): | ||
2680 | linkable.sources[suffix] += srcs | ||
2681 | for host_linkable in host_linkables: | ||
2682 | - for suffix, srcs in ctxt_sources['HOST_SOURCES'].items(): | ||
2683 | + for suffix, srcs in list(ctxt_sources['HOST_SOURCES'].items()): | ||
2684 | host_linkable.sources[suffix] += srcs | ||
2685 | |||
2686 | - for f, flags in all_flags.iteritems(): | ||
2687 | + for f, flags in all_flags.items(): | ||
2688 | if flags.flags: | ||
2689 | ext = mozpath.splitext(f)[1] | ||
2690 | yield PerSourceFlag(context, f, flags.flags) | ||
2691 | @@ -1143,7 +1143,7 @@ class TreeMetadataEmitter(LoggingMixin): | ||
2692 | for obj in self._handle_linkables(context, passthru, generated_files): | ||
2693 | yield obj | ||
2694 | |||
2695 | - generated_files.update(['%s%s' % (k, self.config.substs.get('BIN_SUFFIX', '')) for k in self._binaries.keys()]) | ||
2696 | + generated_files.update(['%s%s' % (k, self.config.substs.get('BIN_SUFFIX', '')) for k in list(self._binaries.keys())]) | ||
2697 | |||
2698 | components = [] | ||
2699 | for var, cls in ( | ||
2700 | @@ -1277,7 +1277,7 @@ class TreeMetadataEmitter(LoggingMixin): | ||
2701 | for obj in self._process_jar_manifests(context): | ||
2702 | yield obj | ||
2703 | |||
2704 | - for name, jar in context.get('JAVA_JAR_TARGETS', {}).items(): | ||
2705 | + for name, jar in list(context.get('JAVA_JAR_TARGETS', {}).items()): | ||
2706 | yield ContextWrapped(context, jar) | ||
2707 | |||
2708 | computed_as_flags.resolve_flags('MOZBUILD', | ||
2709 | @@ -1346,7 +1346,7 @@ class TreeMetadataEmitter(LoggingMixin): | ||
2710 | script = mozpath.join(mozpath.dirname(mozpath.dirname(__file__)), | ||
2711 | 'action', 'process_define_files.py') | ||
2712 | yield GeneratedFile(context, script, 'process_define_file', | ||
2713 | - unicode(path), | ||
2714 | + str(path), | ||
2715 | [Path(context, path + '.in')]) | ||
2716 | |||
2717 | generated_files = context.get('GENERATED_FILES') or [] | ||
2718 | @@ -1393,7 +1393,7 @@ class TreeMetadataEmitter(LoggingMixin): | ||
2719 | flags.flags, localized=localized) | ||
2720 | |||
2721 | def _process_test_manifests(self, context): | ||
2722 | - for prefix, info in TEST_MANIFESTS.items(): | ||
2723 | + for prefix, info in list(TEST_MANIFESTS.items()): | ||
2724 | for path, manifest in context.get('%s_MANIFESTS' % prefix, []): | ||
2725 | for obj in self._process_test_manifest(context, info, path, manifest): | ||
2726 | yield obj | ||
2727 | @@ -1479,7 +1479,7 @@ class TreeMetadataEmitter(LoggingMixin): | ||
2728 | |||
2729 | process_support_files(test) | ||
2730 | |||
2731 | - for path, m_defaults in mpmanifest.manifest_defaults.items(): | ||
2732 | + for path, m_defaults in list(mpmanifest.manifest_defaults.items()): | ||
2733 | process_support_files(m_defaults) | ||
2734 | |||
2735 | # We also copy manifests into the output directory, | ||
2736 | diff --git a/python/mozbuild/mozbuild/frontend/reader.py b/python/mozbuild/mozbuild/frontend/reader.py | ||
2737 | index c1efc1c3d..0cdf8b8db 100644 | ||
2738 | --- a/python/mozbuild/mozbuild/frontend/reader.py | ||
2739 | +++ b/python/mozbuild/mozbuild/frontend/reader.py | ||
2740 | @@ -16,7 +16,7 @@ The BuildReader contains basic logic for traversing a tree of mozbuild files. | ||
2741 | It does this by examining specific variables populated during execution. | ||
2742 | """ | ||
2743 | |||
2744 | -from __future__ import absolute_import, print_function, unicode_literals | ||
2745 | + | ||
2746 | |||
2747 | import ast | ||
2748 | import inspect | ||
2749 | @@ -81,12 +81,13 @@ from .context import ( | ||
2750 | |||
2751 | from mozbuild.base import ExecutionSummary | ||
2752 | from concurrent.futures.process import ProcessPoolExecutor | ||
2753 | +from functools import reduce | ||
2754 | |||
2755 | |||
2756 | |||
2757 | if sys.version_info.major == 2: | ||
2758 | - text_type = unicode | ||
2759 | - type_type = types.TypeType | ||
2760 | + text_type = str | ||
2761 | + type_type = type | ||
2762 | else: | ||
2763 | text_type = str | ||
2764 | type_type = type | ||
2765 | @@ -127,7 +128,7 @@ class EmptyConfig(object): | ||
2766 | |||
2767 | self.substs = self.PopulateOnGetDict(EmptyValue, substs or self.default_substs) | ||
2768 | udict = {} | ||
2769 | - for k, v in self.substs.items(): | ||
2770 | + for k, v in list(self.substs.items()): | ||
2771 | if isinstance(v, str): | ||
2772 | udict[k.decode('utf-8')] = v.decode('utf-8') | ||
2773 | else: | ||
2774 | @@ -311,7 +312,7 @@ class MozbuildSandbox(Sandbox): | ||
2775 | raise Exception('`template` is a function decorator. You must ' | ||
2776 | 'use it as `@template` preceding a function declaration.') | ||
2777 | |||
2778 | - name = func.func_name | ||
2779 | + name = func.__name__ | ||
2780 | |||
2781 | if name in self.templates: | ||
2782 | raise KeyError( | ||
2783 | @@ -390,7 +391,7 @@ class MozbuildSandbox(Sandbox): | ||
2784 | klass = self._context.__class__ | ||
2785 | self._context.__class__ = TemplateContext | ||
2786 | # The sandbox will do all the necessary checks for these merges. | ||
2787 | - for key, value in context.items(): | ||
2788 | + for key, value in list(context.items()): | ||
2789 | if isinstance(value, dict): | ||
2790 | self[key].update(value) | ||
2791 | elif isinstance(value, (list, HierarchicalStringList)): | ||
2792 | @@ -407,12 +408,14 @@ class MozbuildSandbox(Sandbox): | ||
2793 | |||
2794 | class TemplateFunction(object): | ||
2795 | def __init__(self, func, sandbox): | ||
2796 | - self.path = func.func_code.co_filename | ||
2797 | - self.name = func.func_name | ||
2798 | + self.path = func.__code__.co_filename | ||
2799 | + self.name = func.__name__ | ||
2800 | |||
2801 | - code = func.func_code | ||
2802 | + code = func.__code__ | ||
2803 | firstlineno = code.co_firstlineno | ||
2804 | lines = sandbox._current_source.splitlines(True) | ||
2805 | + if len(lines) and isinstance(lines[0], bytes): | ||
2806 | + lines = [l.decode('utf-8') for l in lines] | ||
2807 | lines = inspect.getblock(lines[firstlineno - 1:]) | ||
2808 | |||
2809 | # The code lines we get out of inspect.getsourcelines look like | ||
2810 | @@ -430,7 +433,7 @@ class TemplateFunction(object): | ||
2811 | # actually never calls __getitem__ and __setitem__, so we need to | ||
2812 | # modify the AST so that accesses to globals are properly directed | ||
2813 | # to a dict. | ||
2814 | - self._global_name = b'_data' # AST wants str for this, not unicode | ||
2815 | + self._global_name = '_data' | ||
2816 | # In case '_data' is a name used for a variable in the function code, | ||
2817 | # prepend more underscores until we find an unused name. | ||
2818 | while (self._global_name in code.co_names or | ||
2819 | @@ -449,8 +452,8 @@ class TemplateFunction(object): | ||
2820 | compile(func_ast, self.path, 'exec'), | ||
2821 | glob, | ||
2822 | self.name, | ||
2823 | - func.func_defaults, | ||
2824 | - func.func_closure, | ||
2825 | + func.__defaults__, | ||
2826 | + func.__closure__, | ||
2827 | ) | ||
2828 | func() | ||
2829 | |||
2830 | @@ -464,11 +467,11 @@ class TemplateFunction(object): | ||
2831 | '__builtins__': sandbox._builtins | ||
2832 | } | ||
2833 | func = types.FunctionType( | ||
2834 | - self._func.func_code, | ||
2835 | + self._func.__code__, | ||
2836 | glob, | ||
2837 | self.name, | ||
2838 | - self._func.func_defaults, | ||
2839 | - self._func.func_closure | ||
2840 | + self._func.__defaults__, | ||
2841 | + self._func.__closure__ | ||
2842 | ) | ||
2843 | sandbox.exec_function(func, args, kwargs, self.path, | ||
2844 | becomes_current_path=False) | ||
2845 | @@ -484,7 +487,7 @@ class TemplateFunction(object): | ||
2846 | def visit_Str(self, node): | ||
2847 | # String nodes we got from the AST parser are str, but we want | ||
2848 | # unicode literals everywhere, so transform them. | ||
2849 | - node.s = unicode(node.s) | ||
2850 | + node.s = str(node.s) | ||
2851 | return node | ||
2852 | |||
2853 | def visit_Name(self, node): | ||
2854 | @@ -617,7 +620,7 @@ class BuildReaderError(Exception): | ||
2855 | |||
2856 | for l in traceback.format_exception(type(self.other), self.other, | ||
2857 | self.trace): | ||
2858 | - s.write(unicode(l)) | ||
2859 | + s.write(str(l)) | ||
2860 | |||
2861 | return s.getvalue() | ||
2862 | |||
2863 | @@ -767,7 +770,7 @@ class BuildReaderError(Exception): | ||
2864 | s.write(' %s\n' % inner.args[2]) | ||
2865 | s.write('\n') | ||
2866 | close_matches = difflib.get_close_matches(inner.args[2], | ||
2867 | - VARIABLES.keys(), 2) | ||
2868 | + list(VARIABLES.keys()), 2) | ||
2869 | if close_matches: | ||
2870 | s.write('Maybe you meant %s?\n' % ' or '.join(close_matches)) | ||
2871 | s.write('\n') | ||
2872 | @@ -1152,7 +1155,7 @@ class BuildReader(object): | ||
2873 | context) | ||
2874 | non_unified_sources.add(source) | ||
2875 | action_overrides = {} | ||
2876 | - for action, script in gyp_dir.action_overrides.iteritems(): | ||
2877 | + for action, script in gyp_dir.action_overrides.items(): | ||
2878 | action_overrides[action] = SourcePath(context, script) | ||
2879 | |||
2880 | gyp_processor = GypProcessor(context.config, | ||
2881 | @@ -1188,7 +1191,7 @@ class BuildReader(object): | ||
2882 | |||
2883 | recurse_info[d][key] = dict(sandbox.metadata[key]) | ||
2884 | |||
2885 | - for path, child_metadata in recurse_info.items(): | ||
2886 | + for path, child_metadata in list(recurse_info.items()): | ||
2887 | child_path = path.join('moz.build').full_path | ||
2888 | |||
2889 | # Ensure we don't break out of the topsrcdir. We don't do realpath | ||
2890 | @@ -1279,7 +1282,7 @@ class BuildReader(object): | ||
2891 | # There is room to improve this code (and the code in | ||
2892 | # _find_relevant_mozbuilds) to better handle multiple files in the same | ||
2893 | # directory. Bug 1136966 tracks. | ||
2894 | - for path, mbpaths in relevants.items(): | ||
2895 | + for path, mbpaths in list(relevants.items()): | ||
2896 | path_mozbuilds[path] = [mozpath.join(topsrcdir, p) for p in mbpaths] | ||
2897 | |||
2898 | for i, mbpath in enumerate(mbpaths[0:-1]): | ||
2899 | @@ -1316,7 +1319,7 @@ class BuildReader(object): | ||
2900 | all_contexts.append(context) | ||
2901 | |||
2902 | result = {} | ||
2903 | - for path, paths in path_mozbuilds.items(): | ||
2904 | + for path, paths in list(path_mozbuilds.items()): | ||
2905 | result[path] = reduce(lambda x, y: x + y, (contexts[p] for p in paths), []) | ||
2906 | |||
2907 | return result, all_contexts | ||
2908 | @@ -1356,7 +1359,7 @@ class BuildReader(object): | ||
2909 | |||
2910 | r = {} | ||
2911 | |||
2912 | - for path, ctxs in paths.items(): | ||
2913 | + for path, ctxs in list(paths.items()): | ||
2914 | # Should be normalized by read_relevant_mozbuilds. | ||
2915 | assert '\\' not in path | ||
2916 | |||
2917 | diff --git a/python/mozbuild/mozbuild/frontend/sandbox.py b/python/mozbuild/mozbuild/frontend/sandbox.py | ||
2918 | index b2090802e..6d94291ea 100644 | ||
2919 | --- a/python/mozbuild/mozbuild/frontend/sandbox.py | ||
2920 | +++ b/python/mozbuild/mozbuild/frontend/sandbox.py | ||
2921 | @@ -17,7 +17,7 @@ KeyError are machine parseable. This machine-friendly data is used to present | ||
2922 | user-friendly error messages in the case of errors. | ||
2923 | """ | ||
2924 | |||
2925 | -from __future__ import absolute_import, unicode_literals | ||
2926 | + | ||
2927 | |||
2928 | import os | ||
2929 | import sys | ||
2930 | @@ -112,6 +112,7 @@ class Sandbox(dict): | ||
2931 | 'int': int, | ||
2932 | 'set': set, | ||
2933 | 'tuple': tuple, | ||
2934 | + 'str': str, | ||
2935 | }) | ||
2936 | |||
2937 | def __init__(self, context, finder=default_finder): | ||
2938 | diff --git a/python/mozbuild/mozbuild/jar.py b/python/mozbuild/mozbuild/jar.py | ||
2939 | index 47a2eff63..96aea63ce 100644 | ||
2940 | --- a/python/mozbuild/mozbuild/jar.py | ||
2941 | +++ b/python/mozbuild/mozbuild/jar.py | ||
2942 | @@ -8,7 +8,7 @@ processing jar.mn files. | ||
2943 | See the documentation for jar.mn on MDC for further details on the format. | ||
2944 | ''' | ||
2945 | |||
2946 | -from __future__ import absolute_import | ||
2947 | + | ||
2948 | |||
2949 | import sys | ||
2950 | import os | ||
2951 | @@ -17,7 +17,7 @@ import re | ||
2952 | import logging | ||
2953 | from time import localtime | ||
2954 | from MozZipFile import ZipFile | ||
2955 | -from cStringIO import StringIO | ||
2956 | +from io import StringIO | ||
2957 | from collections import defaultdict | ||
2958 | |||
2959 | from mozbuild.preprocessor import Preprocessor | ||
2960 | @@ -302,9 +302,9 @@ class JarMaker(object): | ||
2961 | '''updateManifest replaces the % in the chrome registration entries | ||
2962 | with the given chrome base path, and updates the given manifest file. | ||
2963 | ''' | ||
2964 | - myregister = dict.fromkeys(map(lambda s: s.replace('%', | ||
2965 | - chromebasepath), register)) | ||
2966 | - addEntriesToListFile(manifestPath, myregister.iterkeys()) | ||
2967 | + myregister = dict.fromkeys([s.replace('%', | ||
2968 | + chromebasepath) for s in register]) | ||
2969 | + addEntriesToListFile(manifestPath, iter(myregister.keys())) | ||
2970 | |||
2971 | def makeJar(self, infile, jardir): | ||
2972 | '''makeJar is the main entry point to JarMaker. | ||
2973 | @@ -322,7 +322,7 @@ class JarMaker(object): | ||
2974 | elif self.relativesrcdir: | ||
2975 | self.localedirs = \ | ||
2976 | self.generateLocaleDirs(self.relativesrcdir) | ||
2977 | - if isinstance(infile, basestring): | ||
2978 | + if isinstance(infile, str): | ||
2979 | logging.info('processing ' + infile) | ||
2980 | self.sourcedirs.append(_normpath(os.path.dirname(infile))) | ||
2981 | pp = self.pp.clone() | ||
2982 | diff --git a/python/mozbuild/mozbuild/makeutil.py b/python/mozbuild/mozbuild/makeutil.py | ||
2983 | index fcd45bed2..f77c5d2c3 100644 | ||
2984 | --- a/python/mozbuild/mozbuild/makeutil.py | ||
2985 | +++ b/python/mozbuild/mozbuild/makeutil.py | ||
2986 | @@ -2,11 +2,10 @@ | ||
2987 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
2988 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
2989 | |||
2990 | -from __future__ import absolute_import | ||
2991 | + | ||
2992 | |||
2993 | import os | ||
2994 | import re | ||
2995 | -from types import StringTypes | ||
2996 | from collections import Iterable | ||
2997 | |||
2998 | |||
2999 | @@ -66,7 +65,7 @@ class _SimpleOrderedSet(object): | ||
3000 | self._list = [] | ||
3001 | self._set = set() | ||
3002 | |||
3003 | - def __nonzero__(self): | ||
3004 | + def __bool__(self): | ||
3005 | return bool(self._set) | ||
3006 | |||
3007 | def __iter__(self): | ||
3008 | @@ -103,19 +102,19 @@ class Rule(object): | ||
3009 | |||
3010 | def add_targets(self, targets): | ||
3011 | '''Add additional targets to the rule.''' | ||
3012 | - assert isinstance(targets, Iterable) and not isinstance(targets, StringTypes) | ||
3013 | + assert isinstance(targets, Iterable) and not isinstance(targets, str) | ||
3014 | self._targets.update(targets) | ||
3015 | return self | ||
3016 | |||
3017 | def add_dependencies(self, deps): | ||
3018 | '''Add dependencies to the rule.''' | ||
3019 | - assert isinstance(deps, Iterable) and not isinstance(deps, StringTypes) | ||
3020 | + assert isinstance(deps, Iterable) and not isinstance(deps, str) | ||
3021 | self._dependencies.update(deps) | ||
3022 | return self | ||
3023 | |||
3024 | def add_commands(self, commands): | ||
3025 | '''Add commands to the rule.''' | ||
3026 | - assert isinstance(commands, Iterable) and not isinstance(commands, StringTypes) | ||
3027 | + assert isinstance(commands, Iterable) and not isinstance(commands, str) | ||
3028 | self._commands.extend(commands) | ||
3029 | return self | ||
3030 | |||
3031 | @@ -139,13 +138,16 @@ class Rule(object): | ||
3032 | ''' | ||
3033 | if not self._targets: | ||
3034 | return | ||
3035 | - fh.write('%s:' % ' '.join(self._targets)) | ||
3036 | + wstring = '%s:' % ' '.join(self._targets) | ||
3037 | if self._dependencies: | ||
3038 | - fh.write(' %s' % ' '.join(self.dependencies())) | ||
3039 | - fh.write('\n') | ||
3040 | + wstring += ' %s' % ' '.join(self.dependencies()) | ||
3041 | + wstring += '\n' | ||
3042 | for cmd in self._commands: | ||
3043 | - fh.write('\t%s\n' % cmd) | ||
3044 | - | ||
3045 | + wstring += '\t%s\n' % cmd | ||
3046 | + try: | ||
3047 | + fh.write(wstring.encode('utf-8')) | ||
3048 | + except TypeError: | ||
3049 | + fh.write(wstring) | ||
3050 | |||
3051 | # colon followed by anything except a slash (Windows path detection) | ||
3052 | _depfilesplitter = re.compile(r':(?![\\/])') | ||
3053 | diff --git a/python/mozbuild/mozbuild/mozinfo.py b/python/mozbuild/mozbuild/mozinfo.py | ||
3054 | index 7e7ad1b2a..f03f20ba3 100755 | ||
3055 | --- a/python/mozbuild/mozbuild/mozinfo.py | ||
3056 | +++ b/python/mozbuild/mozbuild/mozinfo.py | ||
3057 | @@ -5,7 +5,7 @@ | ||
3058 | # This module produces a JSON file that provides basic build info and | ||
3059 | # configuration metadata. | ||
3060 | |||
3061 | -from __future__ import absolute_import | ||
3062 | + | ||
3063 | |||
3064 | import os | ||
3065 | import re | ||
3066 | @@ -33,7 +33,7 @@ def build_dict(config, env=os.environ): | ||
3067 | d['mozconfig'] = config.mozconfig | ||
3068 | |||
3069 | # os | ||
3070 | - o = substs["OS_TARGET"] | ||
3071 | + o = str(substs["OS_TARGET"]) | ||
3072 | known_os = {"Linux": "linux", | ||
3073 | "WINNT": "win", | ||
3074 | "Darwin": "mac", | ||
3075 | @@ -148,7 +148,7 @@ def write_mozinfo(file, config, env=os.environ): | ||
3076 | and what keys are produced. | ||
3077 | """ | ||
3078 | build_conf = build_dict(config, env) | ||
3079 | - if isinstance(file, basestring): | ||
3080 | - file = open(file, 'wb') | ||
3081 | + if isinstance(file, str): | ||
3082 | + file = open(file, 'w') | ||
3083 | |||
3084 | json.dump(build_conf, file, sort_keys=True, indent=4) | ||
3085 | diff --git a/python/mozbuild/mozbuild/preprocessor.py b/python/mozbuild/mozbuild/preprocessor.py | ||
3086 | index 6780b8b72..19e59884e 100644 | ||
3087 | --- a/python/mozbuild/mozbuild/preprocessor.py | ||
3088 | +++ b/python/mozbuild/mozbuild/preprocessor.py | ||
3089 | @@ -27,7 +27,8 @@ import os | ||
3090 | import re | ||
3091 | from optparse import OptionParser | ||
3092 | import errno | ||
3093 | -from makeutil import Makefile | ||
3094 | +from .makeutil import Makefile | ||
3095 | +from functools import reduce | ||
3096 | |||
3097 | # hack around win32 mangling our line endings | ||
3098 | # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65443 | ||
3099 | @@ -230,7 +231,7 @@ class Expression: | ||
3100 | def __repr__(self): | ||
3101 | return self.value.__repr__() | ||
3102 | |||
3103 | - class ParseError(StandardError): | ||
3104 | + class ParseError(Exception): | ||
3105 | """ | ||
3106 | Error raised when parsing fails. | ||
3107 | It has two members, offset and content, which give the offset of the | ||
3108 | @@ -278,7 +279,7 @@ class Preprocessor: | ||
3109 | self.context = Context() | ||
3110 | for k,v in {'FILE': '', | ||
3111 | 'LINE': 0, | ||
3112 | - 'DIRECTORY': os.path.abspath('.')}.iteritems(): | ||
3113 | + 'DIRECTORY': os.path.abspath('.')}.items(): | ||
3114 | self.context[k] = v | ||
3115 | self.actionLevel = 0 | ||
3116 | self.disableLevel = 0 | ||
3117 | @@ -292,21 +293,21 @@ class Preprocessor: | ||
3118 | self.cmds = {} | ||
3119 | for cmd, level in {'define': 0, | ||
3120 | 'undef': 0, | ||
3121 | - 'if': sys.maxint, | ||
3122 | - 'ifdef': sys.maxint, | ||
3123 | - 'ifndef': sys.maxint, | ||
3124 | + 'if': sys.maxsize, | ||
3125 | + 'ifdef': sys.maxsize, | ||
3126 | + 'ifndef': sys.maxsize, | ||
3127 | 'else': 1, | ||
3128 | 'elif': 1, | ||
3129 | 'elifdef': 1, | ||
3130 | 'elifndef': 1, | ||
3131 | - 'endif': sys.maxint, | ||
3132 | + 'endif': sys.maxsize, | ||
3133 | 'expand': 0, | ||
3134 | 'literal': 0, | ||
3135 | 'filter': 0, | ||
3136 | 'unfilter': 0, | ||
3137 | 'include': 0, | ||
3138 | 'includesubst': 0, | ||
3139 | - 'error': 0}.iteritems(): | ||
3140 | + 'error': 0}.items(): | ||
3141 | self.cmds[cmd] = (level, getattr(self, 'do_' + cmd)) | ||
3142 | self.out = sys.stdout | ||
3143 | self.setMarker(marker) | ||
3144 | @@ -434,7 +435,7 @@ class Preprocessor: | ||
3145 | filteredLine = self.applyFilters(aLine) | ||
3146 | if filteredLine != aLine: | ||
3147 | self.actionLevel = 2 | ||
3148 | - self.out.write(filteredLine) | ||
3149 | + self.out.write(filteredLine.encode('utf-8')) | ||
3150 | |||
3151 | def handleCommandLine(self, args, defaultToStdin = False): | ||
3152 | """ | ||
3153 | @@ -468,7 +469,7 @@ class Preprocessor: | ||
3154 | raise Preprocessor.Error(self, "--depend doesn't work with stdout", | ||
3155 | None) | ||
3156 | try: | ||
3157 | - from makeutil import Makefile | ||
3158 | + from .makeutil import Makefile | ||
3159 | except: | ||
3160 | raise Preprocessor.Error(self, "--depend requires the " | ||
3161 | "mozbuild.makeutil module", None) | ||
3162 | @@ -683,7 +684,7 @@ class Preprocessor: | ||
3163 | current = dict(self.filters) | ||
3164 | for f in filters: | ||
3165 | current[f] = getattr(self, 'filter_' + f) | ||
3166 | - filterNames = current.keys() | ||
3167 | + filterNames = list(current.keys()) | ||
3168 | filterNames.sort() | ||
3169 | self.filters = [(fn, current[fn]) for fn in filterNames] | ||
3170 | return | ||
3171 | @@ -693,7 +694,7 @@ class Preprocessor: | ||
3172 | for f in filters: | ||
3173 | if f in current: | ||
3174 | del current[f] | ||
3175 | - filterNames = current.keys() | ||
3176 | + filterNames = list(current.keys()) | ||
3177 | filterNames.sort() | ||
3178 | self.filters = [(fn, current[fn]) for fn in filterNames] | ||
3179 | return | ||
3180 | @@ -738,7 +739,7 @@ class Preprocessor: | ||
3181 | args can either be a file name, or a file-like object. | ||
3182 | Files should be opened, and will be closed after processing. | ||
3183 | """ | ||
3184 | - isName = type(args) == str or type(args) == unicode | ||
3185 | + isName = type(args) == str or type(args) == str | ||
3186 | oldCheckLineNumbers = self.checkLineNumbers | ||
3187 | self.checkLineNumbers = False | ||
3188 | if isName: | ||
3189 | diff --git a/python/mozbuild/mozbuild/shellutil.py b/python/mozbuild/mozbuild/shellutil.py | ||
3190 | index 185a970ee..c0c15f8f2 100644 | ||
3191 | --- a/python/mozbuild/mozbuild/shellutil.py | ||
3192 | +++ b/python/mozbuild/mozbuild/shellutil.py | ||
3193 | @@ -15,7 +15,7 @@ def _tokens2re(**tokens): | ||
3194 | # which matches the pattern and captures it in a named match group. | ||
3195 | # The group names and patterns are given as arguments. | ||
3196 | all_tokens = '|'.join('(?P<%s>%s)' % (name, value) | ||
3197 | - for name, value in tokens.iteritems()) | ||
3198 | + for name, value in tokens.items()) | ||
3199 | nonescaped = r'(?<!\\)(?:%s)' % all_tokens | ||
3200 | |||
3201 | # The final pattern matches either the above pattern, or an escaped | ||
3202 | @@ -96,7 +96,7 @@ class _ClineSplitter(object): | ||
3203 | self.cline = self.cline[m.end():] | ||
3204 | |||
3205 | match = {name: value | ||
3206 | - for name, value in m.groupdict().items() if value} | ||
3207 | + for name, value in list(m.groupdict().items()) if value} | ||
3208 | if 'quote' in match: | ||
3209 | # " or ' start a quoted string | ||
3210 | if match['quote'] == '"': | ||
3211 | @@ -144,7 +144,7 @@ class _ClineSplitter(object): | ||
3212 | self._push(self.cline[:m.start()]) | ||
3213 | self.cline = self.cline[m.end():] | ||
3214 | match = {name: value | ||
3215 | - for name, value in m.groupdict().items() if value} | ||
3216 | + for name, value in list(m.groupdict().items()) if value} | ||
3217 | if 'quote' in match: | ||
3218 | # a double quote ends the quoted string, so go back to | ||
3219 | # unquoted parsing | ||
3220 | diff --git a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py | ||
3221 | index a05059f8a..355a96165 100644 | ||
3222 | --- a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py | ||
3223 | +++ b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py | ||
3224 | @@ -2,9 +2,9 @@ | ||
3225 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
3226 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
3227 | |||
3228 | -from __future__ import unicode_literals | ||
3229 | |||
3230 | -import cPickle as pickle | ||
3231 | + | ||
3232 | +import pickle as pickle | ||
3233 | import json | ||
3234 | import os | ||
3235 | import unittest | ||
3236 | @@ -333,7 +333,7 @@ class TestRecursiveMakeBackend(BackendTester): | ||
3237 | ], | ||
3238 | } | ||
3239 | |||
3240 | - for var, val in expected.items(): | ||
3241 | + for var, val in list(expected.items()): | ||
3242 | # print("test_variable_passthru[%s]" % (var)) | ||
3243 | found = [str for str in lines if str.startswith(var)] | ||
3244 | self.assertEqual(found, val) | ||
3245 | @@ -372,7 +372,7 @@ class TestRecursiveMakeBackend(BackendTester): | ||
3246 | ], | ||
3247 | } | ||
3248 | |||
3249 | - for var, val in expected.items(): | ||
3250 | + for var, val in list(expected.items()): | ||
3251 | found = [str for str in lines if str.startswith(var)] | ||
3252 | self.assertEqual(found, val) | ||
3253 | |||
3254 | @@ -563,7 +563,7 @@ class TestRecursiveMakeBackend(BackendTester): | ||
3255 | |||
3256 | # This is not the most robust test in the world, but it gets the job | ||
3257 | # done. | ||
3258 | - entries = [e for e in m._dests.keys() if '**' in e] | ||
3259 | + entries = [e for e in list(m._dests.keys()) if '**' in e] | ||
3260 | self.assertEqual(len(entries), 1) | ||
3261 | self.assertIn('support/**', entries[0]) | ||
3262 | |||
3263 | @@ -590,11 +590,11 @@ class TestRecursiveMakeBackend(BackendTester): | ||
3264 | set(['child/test_sub.js', | ||
3265 | 'child/data/**', | ||
3266 | 'child/another-file.sjs'])) | ||
3267 | - for key in test_installs.keys(): | ||
3268 | + for key in list(test_installs.keys()): | ||
3269 | self.assertIn(key, test_installs) | ||
3270 | |||
3271 | synthesized_manifest = InstallManifest() | ||
3272 | - for item, installs in test_installs.items(): | ||
3273 | + for item, installs in list(test_installs.items()): | ||
3274 | for install_info in installs: | ||
3275 | if len(install_info) == 3: | ||
3276 | synthesized_manifest.add_pattern_link(*install_info) | ||
3277 | @@ -602,7 +602,7 @@ class TestRecursiveMakeBackend(BackendTester): | ||
3278 | synthesized_manifest.add_link(*install_info) | ||
3279 | |||
3280 | self.assertEqual(len(synthesized_manifest), 3) | ||
3281 | - for item, info in synthesized_manifest._dests.items(): | ||
3282 | + for item, info in list(synthesized_manifest._dests.items()): | ||
3283 | self.assertIn(item, m) | ||
3284 | self.assertEqual(info, m._dests[item]) | ||
3285 | |||
3286 | @@ -864,7 +864,7 @@ class TestRecursiveMakeBackend(BackendTester): | ||
3287 | expected[mozpath.join(env.topobjdir, 'final-target')] = [ | ||
3288 | 'FINAL_TARGET = $(DEPTH)/random-final-target' | ||
3289 | ] | ||
3290 | - for key, expected_rules in expected.iteritems(): | ||
3291 | + for key, expected_rules in expected.items(): | ||
3292 | backend_path = mozpath.join(key, 'backend.mk') | ||
3293 | lines = [l.strip() for l in open(backend_path, 'rt').readlines()[2:]] | ||
3294 | found = [str for str in lines if | ||
3295 | diff --git a/python/mozbuild/mozbuild/test/configure/common.py b/python/mozbuild/mozbuild/test/configure/common.py | ||
3296 | index 150c6e393..5e2c2afaa 100644 | ||
3297 | --- a/python/mozbuild/mozbuild/test/configure/common.py | ||
3298 | +++ b/python/mozbuild/mozbuild/test/configure/common.py | ||
3299 | @@ -2,7 +2,7 @@ | ||
3300 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
3301 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
3302 | |||
3303 | -from __future__ import absolute_import, print_function, unicode_literals | ||
3304 | + | ||
3305 | |||
3306 | import copy | ||
3307 | import errno | ||
3308 | @@ -16,7 +16,7 @@ from mozbuild.configure import ConfigureSandbox | ||
3309 | from mozbuild.util import ReadOnlyNamespace | ||
3310 | from mozpack import path as mozpath | ||
3311 | |||
3312 | -from StringIO import StringIO | ||
3313 | +from io import StringIO | ||
3314 | from which import WhichError | ||
3315 | |||
3316 | from buildconfig import ( | ||
3317 | @@ -77,10 +77,10 @@ class ConfigureTestSandbox(ConfigureSandbox): | ||
3318 | self._search_path = environ.get('PATH', '').split(os.pathsep) | ||
3319 | |||
3320 | self._subprocess_paths = { | ||
3321 | - mozpath.abspath(k): v for k, v in paths.iteritems() if v | ||
3322 | + mozpath.abspath(k): v for k, v in paths.items() if v | ||
3323 | } | ||
3324 | |||
3325 | - paths = paths.keys() | ||
3326 | + paths = list(paths.keys()) | ||
3327 | |||
3328 | environ = dict(environ) | ||
3329 | if 'CONFIG_SHELL' not in environ: | ||
3330 | diff --git a/python/mozbuild/mozbuild/test/configure/lint.py b/python/mozbuild/mozbuild/test/configure/lint.py | ||
3331 | index 98f5f4fe7..a549b4bcf 100644 | ||
3332 | --- a/python/mozbuild/mozbuild/test/configure/lint.py | ||
3333 | +++ b/python/mozbuild/mozbuild/test/configure/lint.py | ||
3334 | @@ -2,11 +2,11 @@ | ||
3335 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
3336 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
3337 | |||
3338 | -from __future__ import absolute_import, print_function, unicode_literals | ||
3339 | + | ||
3340 | |||
3341 | import os | ||
3342 | import unittest | ||
3343 | -from StringIO import StringIO | ||
3344 | +from io import StringIO | ||
3345 | from mozunit import main | ||
3346 | from buildconfig import ( | ||
3347 | topobjdir, | ||
3348 | @@ -40,9 +40,7 @@ class LintMeta(type): | ||
3349 | return type.__new__(mcs, name, bases, attrs) | ||
3350 | |||
3351 | |||
3352 | -class Lint(unittest.TestCase): | ||
3353 | - __metaclass__ = LintMeta | ||
3354 | - | ||
3355 | +class Lint(unittest.TestCase, metaclass=LintMeta): | ||
3356 | def setUp(self): | ||
3357 | self._curdir = os.getcwd() | ||
3358 | os.chdir(topobjdir) | ||
3359 | diff --git a/python/mozbuild/mozbuild/test/configure/test_checks_configure.py b/python/mozbuild/mozbuild/test/configure/test_checks_configure.py | ||
3360 | index c60000bb2..07091c077 100644 | ||
3361 | --- a/python/mozbuild/mozbuild/test/configure/test_checks_configure.py | ||
3362 | +++ b/python/mozbuild/mozbuild/test/configure/test_checks_configure.py | ||
3363 | @@ -2,9 +2,9 @@ | ||
3364 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
3365 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
3366 | |||
3367 | -from __future__ import absolute_import, print_function, unicode_literals | ||
3368 | |||
3369 | -from StringIO import StringIO | ||
3370 | + | ||
3371 | +from io import StringIO | ||
3372 | import os | ||
3373 | import sys | ||
3374 | import textwrap | ||
3375 | @@ -447,7 +447,7 @@ class TestChecksConfigure(unittest.TestCase): | ||
3376 | checking for a... %s | ||
3377 | ''' % self.OTHER_A)) | ||
3378 | |||
3379 | - dirs = map(mozpath.dirname, (self.OTHER_A, self.KNOWN_A)) | ||
3380 | + dirs = list(map(mozpath.dirname, (self.OTHER_A, self.KNOWN_A))) | ||
3381 | config, out, status = self.get_result(textwrap.dedent('''\ | ||
3382 | check_prog("A", ("known-a",), paths=["%s"]) | ||
3383 | ''' % os.pathsep.join(dirs))) | ||
3384 | @@ -457,7 +457,7 @@ class TestChecksConfigure(unittest.TestCase): | ||
3385 | checking for a... %s | ||
3386 | ''' % self.OTHER_A)) | ||
3387 | |||
3388 | - dirs = map(mozpath.dirname, (self.KNOWN_A, self.KNOWN_B)) | ||
3389 | + dirs = list(map(mozpath.dirname, (self.KNOWN_A, self.KNOWN_B))) | ||
3390 | config, out, status = self.get_result(textwrap.dedent('''\ | ||
3391 | check_prog("A", ("known-a",), paths=["%s", "%s"]) | ||
3392 | ''' % (os.pathsep.join(dirs), self.OTHER_A))) | ||
3393 | diff --git a/python/mozbuild/mozbuild/test/configure/test_compile_checks.py b/python/mozbuild/mozbuild/test/configure/test_compile_checks.py | ||
3394 | index b5be3bf2e..282000bb2 100644 | ||
3395 | --- a/python/mozbuild/mozbuild/test/configure/test_compile_checks.py | ||
3396 | +++ b/python/mozbuild/mozbuild/test/configure/test_compile_checks.py | ||
3397 | @@ -2,14 +2,14 @@ | ||
3398 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
3399 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
3400 | |||
3401 | -from __future__ import absolute_import, print_function, unicode_literals | ||
3402 | + | ||
3403 | |||
3404 | import os | ||
3405 | import textwrap | ||
3406 | import unittest | ||
3407 | import mozpack.path as mozpath | ||
3408 | |||
3409 | -from StringIO import StringIO | ||
3410 | +from io import StringIO | ||
3411 | |||
3412 | from buildconfig import topsrcdir | ||
3413 | from common import ConfigureTestSandbox | ||
3414 | diff --git a/python/mozbuild/mozbuild/test/configure/test_configure.py b/python/mozbuild/mozbuild/test/configure/test_configure.py | ||
3415 | index f37e2701f..eb0ca84fb 100644 | ||
3416 | --- a/python/mozbuild/mozbuild/test/configure/test_configure.py | ||
3417 | +++ b/python/mozbuild/mozbuild/test/configure/test_configure.py | ||
3418 | @@ -2,9 +2,9 @@ | ||
3419 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
3420 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
3421 | |||
3422 | -from __future__ import absolute_import, print_function, unicode_literals | ||
3423 | |||
3424 | -from StringIO import StringIO | ||
3425 | + | ||
3426 | +from io import StringIO | ||
3427 | import os | ||
3428 | import sys | ||
3429 | import textwrap | ||
3430 | @@ -43,7 +43,7 @@ class TestConfigure(unittest.TestCase): | ||
3431 | |||
3432 | if '--help' in options: | ||
3433 | return out.getvalue(), config | ||
3434 | - self.assertEquals('', out.getvalue()) | ||
3435 | + self.assertEqual('', out.getvalue()) | ||
3436 | return config | ||
3437 | |||
3438 | def moz_configure(self, source): | ||
3439 | @@ -55,7 +55,7 @@ class TestConfigure(unittest.TestCase): | ||
3440 | def test_defaults(self): | ||
3441 | config = self.get_config() | ||
3442 | self.maxDiff = None | ||
3443 | - self.assertEquals({ | ||
3444 | + self.assertEqual({ | ||
3445 | 'CHOICES': NegativeOptionValue(), | ||
3446 | 'DEFAULTED': PositiveOptionValue(('not-simple',)), | ||
3447 | 'IS_GCC': NegativeOptionValue(), | ||
3448 | @@ -71,9 +71,9 @@ class TestConfigure(unittest.TestCase): | ||
3449 | def test_help(self): | ||
3450 | help, config = self.get_config(['--help'], prog='configure') | ||
3451 | |||
3452 | - self.assertEquals({}, config) | ||
3453 | + self.assertEqual({}, config) | ||
3454 | self.maxDiff = None | ||
3455 | - self.assertEquals( | ||
3456 | + self.assertEqual( | ||
3457 | 'Usage: configure [options]\n' | ||
3458 | '\n' | ||
3459 | 'Options: [defaults in brackets after descriptions]\n' | ||
3460 | @@ -109,7 +109,7 @@ class TestConfigure(unittest.TestCase): | ||
3461 | ): | ||
3462 | self.assertNotIn('ENABLED_SIMPLE', config) | ||
3463 | self.assertIn('SIMPLE', config) | ||
3464 | - self.assertEquals(NegativeOptionValue(), config['SIMPLE']) | ||
3465 | + self.assertEqual(NegativeOptionValue(), config['SIMPLE']) | ||
3466 | |||
3467 | for config in ( | ||
3468 | self.get_config(['--enable-simple']), | ||
3469 | @@ -117,7 +117,7 @@ class TestConfigure(unittest.TestCase): | ||
3470 | ): | ||
3471 | self.assertIn('ENABLED_SIMPLE', config) | ||
3472 | self.assertIn('SIMPLE', config) | ||
3473 | - self.assertEquals(PositiveOptionValue(), config['SIMPLE']) | ||
3474 | + self.assertEqual(PositiveOptionValue(), config['SIMPLE']) | ||
3475 | self.assertIs(config['SIMPLE'], config['ENABLED_SIMPLE']) | ||
3476 | |||
3477 | # --enable-simple doesn't take values. | ||
3478 | @@ -135,7 +135,7 @@ class TestConfigure(unittest.TestCase): | ||
3479 | env={'MOZ_WITH_ENV': '1'}), | ||
3480 | ): | ||
3481 | self.assertIn('WITH_ENV', config) | ||
3482 | - self.assertEquals(NegativeOptionValue(), config['WITH_ENV']) | ||
3483 | + self.assertEqual(NegativeOptionValue(), config['WITH_ENV']) | ||
3484 | |||
3485 | for config in ( | ||
3486 | self.get_config(['--enable-with-env']), | ||
3487 | @@ -145,7 +145,7 @@ class TestConfigure(unittest.TestCase): | ||
3488 | env={'MOZ_WITH_ENV': ''}), | ||
3489 | ): | ||
3490 | self.assertIn('WITH_ENV', config) | ||
3491 | - self.assertEquals(PositiveOptionValue(), config['WITH_ENV']) | ||
3492 | + self.assertEqual(PositiveOptionValue(), config['WITH_ENV']) | ||
3493 | |||
3494 | with self.assertRaises(InvalidOptionError): | ||
3495 | self.get_config(['--enable-with-env=value']) | ||
3496 | @@ -160,23 +160,23 @@ class TestConfigure(unittest.TestCase): | ||
3497 | self.get_config(['--enable-values', '--disable-values']), | ||
3498 | ): | ||
3499 | self.assertIn(name, config) | ||
3500 | - self.assertEquals(NegativeOptionValue(), config[name]) | ||
3501 | + self.assertEqual(NegativeOptionValue(), config[name]) | ||
3502 | |||
3503 | for config in ( | ||
3504 | self.get_config(['--enable-values']), | ||
3505 | self.get_config(['--disable-values', '--enable-values']), | ||
3506 | ): | ||
3507 | self.assertIn(name, config) | ||
3508 | - self.assertEquals(PositiveOptionValue(), config[name]) | ||
3509 | + self.assertEqual(PositiveOptionValue(), config[name]) | ||
3510 | |||
3511 | config = self.get_config(['--enable-values=foo']) | ||
3512 | self.assertIn(name, config) | ||
3513 | - self.assertEquals(PositiveOptionValue(('foo',)), config[name]) | ||
3514 | + self.assertEqual(PositiveOptionValue(('foo',)), config[name]) | ||
3515 | |||
3516 | config = self.get_config(['--enable-values=foo,bar']) | ||
3517 | self.assertIn(name, config) | ||
3518 | self.assertTrue(config[name]) | ||
3519 | - self.assertEquals(PositiveOptionValue(('foo', 'bar')), config[name]) | ||
3520 | + self.assertEqual(PositiveOptionValue(('foo', 'bar')), config[name]) | ||
3521 | |||
3522 | def test_values2(self): | ||
3523 | self.test_values('VALUES2') | ||
3524 | @@ -187,12 +187,12 @@ class TestConfigure(unittest.TestCase): | ||
3525 | def test_returned_default(self): | ||
3526 | config = self.get_config(['--enable-simple']) | ||
3527 | self.assertIn('DEFAULTED', config) | ||
3528 | - self.assertEquals( | ||
3529 | + self.assertEqual( | ||
3530 | PositiveOptionValue(('simple',)), config['DEFAULTED']) | ||
3531 | |||
3532 | config = self.get_config(['--disable-simple']) | ||
3533 | self.assertIn('DEFAULTED', config) | ||
3534 | - self.assertEquals( | ||
3535 | + self.assertEqual( | ||
3536 | PositiveOptionValue(('not-simple',)), config['DEFAULTED']) | ||
3537 | |||
3538 | def test_returned_choices(self): | ||
3539 | @@ -200,13 +200,13 @@ class TestConfigure(unittest.TestCase): | ||
3540 | config = self.get_config( | ||
3541 | ['--enable-values=alpha', '--returned-choices=%s' % val]) | ||
3542 | self.assertIn('CHOICES', config) | ||
3543 | - self.assertEquals(PositiveOptionValue((val,)), config['CHOICES']) | ||
3544 | + self.assertEqual(PositiveOptionValue((val,)), config['CHOICES']) | ||
3545 | |||
3546 | for val in ('0', '1', '2'): | ||
3547 | config = self.get_config( | ||
3548 | ['--enable-values=numeric', '--returned-choices=%s' % val]) | ||
3549 | self.assertIn('CHOICES', config) | ||
3550 | - self.assertEquals(PositiveOptionValue((val,)), config['CHOICES']) | ||
3551 | + self.assertEqual(PositiveOptionValue((val,)), config['CHOICES']) | ||
3552 | |||
3553 | with self.assertRaises(InvalidOptionError): | ||
3554 | self.get_config(['--enable-values=numeric', | ||
3555 | @@ -218,12 +218,12 @@ class TestConfigure(unittest.TestCase): | ||
3556 | def test_included(self): | ||
3557 | config = self.get_config(env={'CC': 'gcc'}) | ||
3558 | self.assertIn('IS_GCC', config) | ||
3559 | - self.assertEquals(config['IS_GCC'], True) | ||
3560 | + self.assertEqual(config['IS_GCC'], True) | ||
3561 | |||
3562 | config = self.get_config( | ||
3563 | ['--enable-include=extra.configure', '--extra']) | ||
3564 | self.assertIn('EXTRA', config) | ||
3565 | - self.assertEquals(PositiveOptionValue(), config['EXTRA']) | ||
3566 | + self.assertEqual(PositiveOptionValue(), config['EXTRA']) | ||
3567 | |||
3568 | with self.assertRaises(InvalidOptionError): | ||
3569 | self.get_config(['--extra']) | ||
3570 | @@ -231,7 +231,7 @@ class TestConfigure(unittest.TestCase): | ||
3571 | def test_template(self): | ||
3572 | config = self.get_config(env={'CC': 'gcc'}) | ||
3573 | self.assertIn('CFLAGS', config) | ||
3574 | - self.assertEquals(config['CFLAGS'], ['-Werror=foobar']) | ||
3575 | + self.assertEqual(config['CFLAGS'], ['-Werror=foobar']) | ||
3576 | |||
3577 | config = self.get_config(env={'CC': 'clang'}) | ||
3578 | self.assertNotIn('CFLAGS', config) | ||
3579 | @@ -288,7 +288,7 @@ class TestConfigure(unittest.TestCase): | ||
3580 | sandbox | ||
3581 | ) | ||
3582 | |||
3583 | - import __builtin__ | ||
3584 | + import builtins | ||
3585 | self.assertIs(sandbox['foo'](), __builtin__) | ||
3586 | |||
3587 | exec_(textwrap.dedent(''' | ||
3588 | @@ -300,7 +300,7 @@ class TestConfigure(unittest.TestCase): | ||
3589 | ) | ||
3590 | |||
3591 | f = sandbox['foo']() | ||
3592 | - self.assertEquals(f.name, os.devnull) | ||
3593 | + self.assertEqual(f.name, os.devnull) | ||
3594 | f.close() | ||
3595 | |||
3596 | # This unlocks the sandbox | ||
3597 | @@ -336,8 +336,8 @@ class TestConfigure(unittest.TestCase): | ||
3598 | self.assertIs(sandbox['foo'](), sandbox) | ||
3599 | |||
3600 | # Nothing leaked from the function being executed | ||
3601 | - self.assertEquals(sandbox.keys(), ['__builtins__', 'foo']) | ||
3602 | - self.assertEquals(sandbox['__builtins__'], ConfigureSandbox.BUILTINS) | ||
3603 | + self.assertEqual(list(sandbox.keys()), ['__builtins__', 'foo']) | ||
3604 | + self.assertEqual(sandbox['__builtins__'], ConfigureSandbox.BUILTINS) | ||
3605 | |||
3606 | exec_(textwrap.dedent(''' | ||
3607 | @template | ||
3608 | @@ -354,7 +354,7 @@ class TestConfigure(unittest.TestCase): | ||
3609 | with self.assertRaises(NameError) as e: | ||
3610 | sandbox._depends[sandbox['bar']].result() | ||
3611 | |||
3612 | - self.assertEquals(e.exception.message, | ||
3613 | + self.assertEqual(e.exception.message, | ||
3614 | "global name 'sys' is not defined") | ||
3615 | |||
3616 | def test_apply_imports(self): | ||
3617 | @@ -380,28 +380,28 @@ class TestConfigure(unittest.TestCase): | ||
3618 | sandbox | ||
3619 | ) | ||
3620 | |||
3621 | - self.assertEquals(len(imports), 1) | ||
3622 | + self.assertEqual(len(imports), 1) | ||
3623 | |||
3624 | def test_os_path(self): | ||
3625 | config = self.get_config(['--with-imports=%s' % __file__]) | ||
3626 | self.assertIn('HAS_ABSPATH', config) | ||
3627 | - self.assertEquals(config['HAS_ABSPATH'], True) | ||
3628 | + self.assertEqual(config['HAS_ABSPATH'], True) | ||
3629 | self.assertIn('HAS_GETATIME', config) | ||
3630 | - self.assertEquals(config['HAS_GETATIME'], True) | ||
3631 | + self.assertEqual(config['HAS_GETATIME'], True) | ||
3632 | self.assertIn('HAS_GETATIME2', config) | ||
3633 | - self.assertEquals(config['HAS_GETATIME2'], False) | ||
3634 | + self.assertEqual(config['HAS_GETATIME2'], False) | ||
3635 | |||
3636 | def test_template_call(self): | ||
3637 | config = self.get_config(env={'CC': 'gcc'}) | ||
3638 | self.assertIn('TEMPLATE_VALUE', config) | ||
3639 | - self.assertEquals(config['TEMPLATE_VALUE'], 42) | ||
3640 | + self.assertEqual(config['TEMPLATE_VALUE'], 42) | ||
3641 | self.assertIn('TEMPLATE_VALUE_2', config) | ||
3642 | - self.assertEquals(config['TEMPLATE_VALUE_2'], 21) | ||
3643 | + self.assertEqual(config['TEMPLATE_VALUE_2'], 21) | ||
3644 | |||
3645 | def test_template_imports(self): | ||
3646 | config = self.get_config(['--enable-imports-in-template']) | ||
3647 | self.assertIn('PLATFORM', config) | ||
3648 | - self.assertEquals(config['PLATFORM'], sys.platform) | ||
3649 | + self.assertEqual(config['PLATFORM'], sys.platform) | ||
3650 | |||
3651 | def test_decorators(self): | ||
3652 | config = {} | ||
3653 | @@ -419,27 +419,27 @@ class TestConfigure(unittest.TestCase): | ||
3654 | return self.get_config(*args, configure='set_config.configure') | ||
3655 | |||
3656 | help, config = get_config(['--help']) | ||
3657 | - self.assertEquals(config, {}) | ||
3658 | + self.assertEqual(config, {}) | ||
3659 | |||
3660 | config = get_config(['--set-foo']) | ||
3661 | self.assertIn('FOO', config) | ||
3662 | - self.assertEquals(config['FOO'], True) | ||
3663 | + self.assertEqual(config['FOO'], True) | ||
3664 | |||
3665 | config = get_config(['--set-bar']) | ||
3666 | self.assertNotIn('FOO', config) | ||
3667 | self.assertIn('BAR', config) | ||
3668 | - self.assertEquals(config['BAR'], True) | ||
3669 | + self.assertEqual(config['BAR'], True) | ||
3670 | |||
3671 | config = get_config(['--set-value=qux']) | ||
3672 | self.assertIn('VALUE', config) | ||
3673 | - self.assertEquals(config['VALUE'], 'qux') | ||
3674 | + self.assertEqual(config['VALUE'], 'qux') | ||
3675 | |||
3676 | config = get_config(['--set-name=hoge']) | ||
3677 | self.assertIn('hoge', config) | ||
3678 | - self.assertEquals(config['hoge'], True) | ||
3679 | + self.assertEqual(config['hoge'], True) | ||
3680 | |||
3681 | config = get_config([]) | ||
3682 | - self.assertEquals(config, {'BAR': False}) | ||
3683 | + self.assertEqual(config, {'BAR': False}) | ||
3684 | |||
3685 | with self.assertRaises(ConfigureError): | ||
3686 | # Both --set-foo and --set-name=FOO are going to try to | ||
3687 | @@ -454,11 +454,11 @@ class TestConfigure(unittest.TestCase): | ||
3688 | set_config('QUX', 'qux', when='--with-qux') | ||
3689 | '''): | ||
3690 | config = self.get_config() | ||
3691 | - self.assertEquals(config, { | ||
3692 | + self.assertEqual(config, { | ||
3693 | 'FOO': 'foo', | ||
3694 | }) | ||
3695 | config = self.get_config(['--with-qux']) | ||
3696 | - self.assertEquals(config, { | ||
3697 | + self.assertEqual(config, { | ||
3698 | 'FOO': 'foo', | ||
3699 | 'QUX': 'qux', | ||
3700 | }) | ||
3701 | @@ -468,27 +468,27 @@ class TestConfigure(unittest.TestCase): | ||
3702 | return self.get_config(*args, configure='set_define.configure') | ||
3703 | |||
3704 | help, config = get_config(['--help']) | ||
3705 | - self.assertEquals(config, {'DEFINES': {}}) | ||
3706 | + self.assertEqual(config, {'DEFINES': {}}) | ||
3707 | |||
3708 | config = get_config(['--set-foo']) | ||
3709 | self.assertIn('FOO', config['DEFINES']) | ||
3710 | - self.assertEquals(config['DEFINES']['FOO'], True) | ||
3711 | + self.assertEqual(config['DEFINES']['FOO'], True) | ||
3712 | |||
3713 | config = get_config(['--set-bar']) | ||
3714 | self.assertNotIn('FOO', config['DEFINES']) | ||
3715 | self.assertIn('BAR', config['DEFINES']) | ||
3716 | - self.assertEquals(config['DEFINES']['BAR'], True) | ||
3717 | + self.assertEqual(config['DEFINES']['BAR'], True) | ||
3718 | |||
3719 | config = get_config(['--set-value=qux']) | ||
3720 | self.assertIn('VALUE', config['DEFINES']) | ||
3721 | - self.assertEquals(config['DEFINES']['VALUE'], 'qux') | ||
3722 | + self.assertEqual(config['DEFINES']['VALUE'], 'qux') | ||
3723 | |||
3724 | config = get_config(['--set-name=hoge']) | ||
3725 | self.assertIn('hoge', config['DEFINES']) | ||
3726 | - self.assertEquals(config['DEFINES']['hoge'], True) | ||
3727 | + self.assertEqual(config['DEFINES']['hoge'], True) | ||
3728 | |||
3729 | config = get_config([]) | ||
3730 | - self.assertEquals(config['DEFINES'], {'BAR': False}) | ||
3731 | + self.assertEqual(config['DEFINES'], {'BAR': False}) | ||
3732 | |||
3733 | with self.assertRaises(ConfigureError): | ||
3734 | # Both --set-foo and --set-name=FOO are going to try to | ||
3735 | @@ -503,11 +503,11 @@ class TestConfigure(unittest.TestCase): | ||
3736 | set_define('QUX', 'qux', when='--with-qux') | ||
3737 | '''): | ||
3738 | config = self.get_config() | ||
3739 | - self.assertEquals(config['DEFINES'], { | ||
3740 | + self.assertEqual(config['DEFINES'], { | ||
3741 | 'FOO': 'foo', | ||
3742 | }) | ||
3743 | config = self.get_config(['--with-qux']) | ||
3744 | - self.assertEquals(config['DEFINES'], { | ||
3745 | + self.assertEqual(config['DEFINES'], { | ||
3746 | 'FOO': 'foo', | ||
3747 | 'QUX': 'qux', | ||
3748 | }) | ||
3749 | @@ -518,19 +518,19 @@ class TestConfigure(unittest.TestCase): | ||
3750 | *args, configure='imply_option/simple.configure') | ||
3751 | |||
3752 | help, config = get_config(['--help']) | ||
3753 | - self.assertEquals(config, {}) | ||
3754 | + self.assertEqual(config, {}) | ||
3755 | |||
3756 | config = get_config([]) | ||
3757 | - self.assertEquals(config, {}) | ||
3758 | + self.assertEqual(config, {}) | ||
3759 | |||
3760 | config = get_config(['--enable-foo']) | ||
3761 | self.assertIn('BAR', config) | ||
3762 | - self.assertEquals(config['BAR'], PositiveOptionValue()) | ||
3763 | + self.assertEqual(config['BAR'], PositiveOptionValue()) | ||
3764 | |||
3765 | with self.assertRaises(InvalidOptionError) as e: | ||
3766 | get_config(['--enable-foo', '--disable-bar']) | ||
3767 | |||
3768 | - self.assertEquals( | ||
3769 | + self.assertEqual( | ||
3770 | e.exception.message, | ||
3771 | "'--enable-bar' implied by '--enable-foo' conflicts with " | ||
3772 | "'--disable-bar' from the command-line") | ||
3773 | @@ -541,31 +541,31 @@ class TestConfigure(unittest.TestCase): | ||
3774 | *args, configure='imply_option/negative.configure') | ||
3775 | |||
3776 | help, config = get_config(['--help']) | ||
3777 | - self.assertEquals(config, {}) | ||
3778 | + self.assertEqual(config, {}) | ||
3779 | |||
3780 | config = get_config([]) | ||
3781 | - self.assertEquals(config, {}) | ||
3782 | + self.assertEqual(config, {}) | ||
3783 | |||
3784 | config = get_config(['--enable-foo']) | ||
3785 | self.assertIn('BAR', config) | ||
3786 | - self.assertEquals(config['BAR'], NegativeOptionValue()) | ||
3787 | + self.assertEqual(config['BAR'], NegativeOptionValue()) | ||
3788 | |||
3789 | with self.assertRaises(InvalidOptionError) as e: | ||
3790 | get_config(['--enable-foo', '--enable-bar']) | ||
3791 | |||
3792 | - self.assertEquals( | ||
3793 | + self.assertEqual( | ||
3794 | e.exception.message, | ||
3795 | "'--disable-bar' implied by '--enable-foo' conflicts with " | ||
3796 | "'--enable-bar' from the command-line") | ||
3797 | |||
3798 | config = get_config(['--disable-hoge']) | ||
3799 | self.assertIn('BAR', config) | ||
3800 | - self.assertEquals(config['BAR'], NegativeOptionValue()) | ||
3801 | + self.assertEqual(config['BAR'], NegativeOptionValue()) | ||
3802 | |||
3803 | with self.assertRaises(InvalidOptionError) as e: | ||
3804 | get_config(['--disable-hoge', '--enable-bar']) | ||
3805 | |||
3806 | - self.assertEquals( | ||
3807 | + self.assertEqual( | ||
3808 | e.exception.message, | ||
3809 | "'--disable-bar' implied by '--disable-hoge' conflicts with " | ||
3810 | "'--enable-bar' from the command-line") | ||
3811 | @@ -576,23 +576,23 @@ class TestConfigure(unittest.TestCase): | ||
3812 | *args, configure='imply_option/values.configure') | ||
3813 | |||
3814 | help, config = get_config(['--help']) | ||
3815 | - self.assertEquals(config, {}) | ||
3816 | + self.assertEqual(config, {}) | ||
3817 | |||
3818 | config = get_config([]) | ||
3819 | - self.assertEquals(config, {}) | ||
3820 | + self.assertEqual(config, {}) | ||
3821 | |||
3822 | config = get_config(['--enable-foo=a']) | ||
3823 | self.assertIn('BAR', config) | ||
3824 | - self.assertEquals(config['BAR'], PositiveOptionValue(('a',))) | ||
3825 | + self.assertEqual(config['BAR'], PositiveOptionValue(('a',))) | ||
3826 | |||
3827 | config = get_config(['--enable-foo=a,b']) | ||
3828 | self.assertIn('BAR', config) | ||
3829 | - self.assertEquals(config['BAR'], PositiveOptionValue(('a','b'))) | ||
3830 | + self.assertEqual(config['BAR'], PositiveOptionValue(('a','b'))) | ||
3831 | |||
3832 | with self.assertRaises(InvalidOptionError) as e: | ||
3833 | get_config(['--enable-foo=a,b', '--disable-bar']) | ||
3834 | |||
3835 | - self.assertEquals( | ||
3836 | + self.assertEqual( | ||
3837 | e.exception.message, | ||
3838 | "'--enable-bar=a,b' implied by '--enable-foo' conflicts with " | ||
3839 | "'--disable-bar' from the command-line") | ||
3840 | @@ -603,15 +603,15 @@ class TestConfigure(unittest.TestCase): | ||
3841 | *args, configure='imply_option/infer.configure') | ||
3842 | |||
3843 | help, config = get_config(['--help']) | ||
3844 | - self.assertEquals(config, {}) | ||
3845 | + self.assertEqual(config, {}) | ||
3846 | |||
3847 | config = get_config([]) | ||
3848 | - self.assertEquals(config, {}) | ||
3849 | + self.assertEqual(config, {}) | ||
3850 | |||
3851 | with self.assertRaises(InvalidOptionError) as e: | ||
3852 | get_config(['--enable-foo', '--disable-bar']) | ||
3853 | |||
3854 | - self.assertEquals( | ||
3855 | + self.assertEqual( | ||
3856 | e.exception.message, | ||
3857 | "'--enable-bar' implied by '--enable-foo' conflicts with " | ||
3858 | "'--disable-bar' from the command-line") | ||
3859 | @@ -619,7 +619,7 @@ class TestConfigure(unittest.TestCase): | ||
3860 | with self.assertRaises(ConfigureError) as e: | ||
3861 | self.get_config([], configure='imply_option/infer_ko.configure') | ||
3862 | |||
3863 | - self.assertEquals( | ||
3864 | + self.assertEqual( | ||
3865 | e.exception.message, | ||
3866 | "Cannot infer what implies '--enable-bar'. Please add a `reason` " | ||
3867 | "to the `imply_option` call.") | ||
3868 | @@ -630,25 +630,25 @@ class TestConfigure(unittest.TestCase): | ||
3869 | *args, configure='imply_option/imm.configure') | ||
3870 | |||
3871 | help, config = get_config(['--help']) | ||
3872 | - self.assertEquals(config, {}) | ||
3873 | + self.assertEqual(config, {}) | ||
3874 | |||
3875 | config = get_config([]) | ||
3876 | - self.assertEquals(config, {}) | ||
3877 | + self.assertEqual(config, {}) | ||
3878 | |||
3879 | config_path = mozpath.abspath( | ||
3880 | mozpath.join(test_data_path, 'imply_option', 'imm.configure')) | ||
3881 | |||
3882 | - with self.assertRaisesRegexp(InvalidOptionError, | ||
3883 | + with self.assertRaisesRegex(InvalidOptionError, | ||
3884 | "--enable-foo' implied by 'imply_option at %s:7' conflicts with " | ||
3885 | "'--disable-foo' from the command-line" % config_path): | ||
3886 | get_config(['--disable-foo']) | ||
3887 | |||
3888 | - with self.assertRaisesRegexp(InvalidOptionError, | ||
3889 | + with self.assertRaisesRegex(InvalidOptionError, | ||
3890 | "--enable-bar=foo,bar' implied by 'imply_option at %s:16' conflicts" | ||
3891 | " with '--enable-bar=a,b,c' from the command-line" % config_path): | ||
3892 | get_config(['--enable-bar=a,b,c']) | ||
3893 | |||
3894 | - with self.assertRaisesRegexp(InvalidOptionError, | ||
3895 | + with self.assertRaisesRegex(InvalidOptionError, | ||
3896 | "--enable-baz=BAZ' implied by 'imply_option at %s:25' conflicts" | ||
3897 | " with '--enable-baz=QUUX' from the command-line" % config_path): | ||
3898 | get_config(['--enable-baz=QUUX']) | ||
3899 | @@ -660,7 +660,7 @@ class TestConfigure(unittest.TestCase): | ||
3900 | '''): | ||
3901 | self.get_config() | ||
3902 | |||
3903 | - self.assertEquals(e.exception.message, | ||
3904 | + self.assertEqual(e.exception.message, | ||
3905 | "`--with-foo`, emitted from `%s` line 2, is unknown." | ||
3906 | % mozpath.join(test_data_path, 'moz.configure')) | ||
3907 | |||
3908 | @@ -675,7 +675,7 @@ class TestConfigure(unittest.TestCase): | ||
3909 | '''): | ||
3910 | self.get_config() | ||
3911 | |||
3912 | - self.assertEquals(e.exception.message, | ||
3913 | + self.assertEqual(e.exception.message, | ||
3914 | "Unexpected type: 'int'") | ||
3915 | |||
3916 | def test_imply_option_when(self): | ||
3917 | @@ -686,12 +686,12 @@ class TestConfigure(unittest.TestCase): | ||
3918 | set_config('QUX', depends('--with-qux')(lambda x: x)) | ||
3919 | '''): | ||
3920 | config = self.get_config() | ||
3921 | - self.assertEquals(config, { | ||
3922 | + self.assertEqual(config, { | ||
3923 | 'QUX': NegativeOptionValue(), | ||
3924 | }) | ||
3925 | |||
3926 | config = self.get_config(['--with-foo']) | ||
3927 | - self.assertEquals(config, { | ||
3928 | + self.assertEqual(config, { | ||
3929 | 'QUX': PositiveOptionValue(), | ||
3930 | }) | ||
3931 | |||
3932 | @@ -700,7 +700,7 @@ class TestConfigure(unittest.TestCase): | ||
3933 | with self.moz_configure('option("--with-foo", help="foo")'): | ||
3934 | self.get_config() | ||
3935 | |||
3936 | - self.assertEquals( | ||
3937 | + self.assertEqual( | ||
3938 | e.exception.message, | ||
3939 | 'Option `--with-foo` is not handled ; reference it with a @depends' | ||
3940 | ) | ||
3941 | @@ -712,7 +712,7 @@ class TestConfigure(unittest.TestCase): | ||
3942 | '''): | ||
3943 | self.get_config() | ||
3944 | |||
3945 | - self.assertEquals( | ||
3946 | + self.assertEqual( | ||
3947 | e.exception.message, | ||
3948 | 'Option `--with-foo` already defined' | ||
3949 | ) | ||
3950 | @@ -724,7 +724,7 @@ class TestConfigure(unittest.TestCase): | ||
3951 | '''): | ||
3952 | self.get_config() | ||
3953 | |||
3954 | - self.assertEquals( | ||
3955 | + self.assertEqual( | ||
3956 | e.exception.message, | ||
3957 | 'Option `MOZ_FOO` already defined' | ||
3958 | ) | ||
3959 | @@ -736,7 +736,7 @@ class TestConfigure(unittest.TestCase): | ||
3960 | '''): | ||
3961 | self.get_config() | ||
3962 | |||
3963 | - self.assertEquals( | ||
3964 | + self.assertEqual( | ||
3965 | e.exception.message, | ||
3966 | 'Option `MOZ_FOO` already defined' | ||
3967 | ) | ||
3968 | @@ -748,7 +748,7 @@ class TestConfigure(unittest.TestCase): | ||
3969 | '''): | ||
3970 | self.get_config() | ||
3971 | |||
3972 | - self.assertEquals( | ||
3973 | + self.assertEqual( | ||
3974 | e.exception.message, | ||
3975 | 'Option `MOZ_FOO` already defined' | ||
3976 | ) | ||
3977 | @@ -760,7 +760,7 @@ class TestConfigure(unittest.TestCase): | ||
3978 | '''): | ||
3979 | self.get_config() | ||
3980 | |||
3981 | - self.assertEquals( | ||
3982 | + self.assertEqual( | ||
3983 | e.exception.message, | ||
3984 | 'Option `--with-foo` already defined' | ||
3985 | ) | ||
3986 | @@ -776,18 +776,18 @@ class TestConfigure(unittest.TestCase): | ||
3987 | set_config('QUX', depends('--with-qux', when='--with-foo')(lambda x: x)) | ||
3988 | '''): | ||
3989 | config = self.get_config() | ||
3990 | - self.assertEquals(config, { | ||
3991 | + self.assertEqual(config, { | ||
3992 | 'FOO': NegativeOptionValue(), | ||
3993 | }) | ||
3994 | |||
3995 | config = self.get_config(['--with-foo']) | ||
3996 | - self.assertEquals(config, { | ||
3997 | + self.assertEqual(config, { | ||
3998 | 'FOO': PositiveOptionValue(), | ||
3999 | 'QUX': NegativeOptionValue(), | ||
4000 | }) | ||
4001 | |||
4002 | config = self.get_config(['--with-foo', '--with-qux']) | ||
4003 | - self.assertEquals(config, { | ||
4004 | + self.assertEqual(config, { | ||
4005 | 'FOO': PositiveOptionValue(), | ||
4006 | 'QUX': PositiveOptionValue(), | ||
4007 | }) | ||
4008 | @@ -795,7 +795,7 @@ class TestConfigure(unittest.TestCase): | ||
4009 | with self.assertRaises(InvalidOptionError) as e: | ||
4010 | self.get_config(['--with-bar']) | ||
4011 | |||
4012 | - self.assertEquals( | ||
4013 | + self.assertEqual( | ||
4014 | e.exception.message, | ||
4015 | '--with-bar is not available in this configuration' | ||
4016 | ) | ||
4017 | @@ -803,7 +803,7 @@ class TestConfigure(unittest.TestCase): | ||
4018 | with self.assertRaises(InvalidOptionError) as e: | ||
4019 | self.get_config(['--with-qux']) | ||
4020 | |||
4021 | - self.assertEquals( | ||
4022 | + self.assertEqual( | ||
4023 | e.exception.message, | ||
4024 | '--with-qux is not available in this configuration' | ||
4025 | ) | ||
4026 | @@ -811,18 +811,18 @@ class TestConfigure(unittest.TestCase): | ||
4027 | with self.assertRaises(InvalidOptionError) as e: | ||
4028 | self.get_config(['QUX=1']) | ||
4029 | |||
4030 | - self.assertEquals( | ||
4031 | + self.assertEqual( | ||
4032 | e.exception.message, | ||
4033 | 'QUX is not available in this configuration' | ||
4034 | ) | ||
4035 | |||
4036 | config = self.get_config(env={'QUX': '1'}) | ||
4037 | - self.assertEquals(config, { | ||
4038 | + self.assertEqual(config, { | ||
4039 | 'FOO': NegativeOptionValue(), | ||
4040 | }) | ||
4041 | |||
4042 | help, config = self.get_config(['--help']) | ||
4043 | - self.assertEquals(help, textwrap.dedent('''\ | ||
4044 | + self.assertEqual(help, textwrap.dedent('''\ | ||
4045 | Usage: configure [options] | ||
4046 | |||
4047 | Options: [defaults in brackets after descriptions] | ||
4048 | @@ -833,7 +833,7 @@ class TestConfigure(unittest.TestCase): | ||
4049 | ''')) | ||
4050 | |||
4051 | help, config = self.get_config(['--help', '--with-foo']) | ||
4052 | - self.assertEquals(help, textwrap.dedent('''\ | ||
4053 | + self.assertEqual(help, textwrap.dedent('''\ | ||
4054 | Usage: configure [options] | ||
4055 | |||
4056 | Options: [defaults in brackets after descriptions] | ||
4057 | @@ -851,7 +851,7 @@ class TestConfigure(unittest.TestCase): | ||
4058 | with self.assertRaises(ConfigureError) as e: | ||
4059 | self.get_config() | ||
4060 | |||
4061 | - self.assertEquals(e.exception.message, | ||
4062 | + self.assertEqual(e.exception.message, | ||
4063 | '@depends function needs the same `when` as ' | ||
4064 | 'options it depends on') | ||
4065 | |||
4066 | @@ -868,7 +868,7 @@ class TestConfigure(unittest.TestCase): | ||
4067 | with self.assertRaises(ConfigureError) as e: | ||
4068 | self.get_config() | ||
4069 | |||
4070 | - self.assertEquals(e.exception.message, | ||
4071 | + self.assertEqual(e.exception.message, | ||
4072 | '@depends function needs the same `when` as ' | ||
4073 | 'options it depends on') | ||
4074 | |||
4075 | @@ -896,7 +896,7 @@ class TestConfigure(unittest.TestCase): | ||
4076 | with self.moz_configure('include("../foo.configure")'): | ||
4077 | self.get_config() | ||
4078 | |||
4079 | - self.assertEquals( | ||
4080 | + self.assertEqual( | ||
4081 | e.exception.message, | ||
4082 | 'Cannot include `%s` because it is not in a subdirectory of `%s`' | ||
4083 | % (mozpath.normpath(mozpath.join(test_data_path, '..', | ||
4084 | @@ -911,7 +911,7 @@ class TestConfigure(unittest.TestCase): | ||
4085 | '''): | ||
4086 | self.get_config() | ||
4087 | |||
4088 | - self.assertEquals( | ||
4089 | + self.assertEqual( | ||
4090 | e.exception.message, | ||
4091 | 'Cannot include `%s` because it was included already.' | ||
4092 | % mozpath.normpath(mozpath.join(test_data_path, | ||
4093 | @@ -924,7 +924,7 @@ class TestConfigure(unittest.TestCase): | ||
4094 | '''): | ||
4095 | self.get_config() | ||
4096 | |||
4097 | - self.assertEquals(e.exception.message, "Unexpected type: 'int'") | ||
4098 | + self.assertEqual(e.exception.message, "Unexpected type: 'int'") | ||
4099 | |||
4100 | def test_include_when(self): | ||
4101 | with MockedOpen({ | ||
4102 | @@ -967,26 +967,26 @@ class TestConfigure(unittest.TestCase): | ||
4103 | '''), | ||
4104 | }): | ||
4105 | config = self.get_config() | ||
4106 | - self.assertEquals(config, {}) | ||
4107 | + self.assertEqual(config, {}) | ||
4108 | |||
4109 | config = self.get_config(['--with-foo']) | ||
4110 | - self.assertEquals(config, {}) | ||
4111 | + self.assertEqual(config, {}) | ||
4112 | |||
4113 | config = self.get_config(['--with-bar']) | ||
4114 | - self.assertEquals(config, { | ||
4115 | + self.assertEqual(config, { | ||
4116 | 'BAR': 'bar', | ||
4117 | }) | ||
4118 | |||
4119 | with self.assertRaises(InvalidOptionError) as e: | ||
4120 | self.get_config(['--with-qux']) | ||
4121 | |||
4122 | - self.assertEquals( | ||
4123 | + self.assertEqual( | ||
4124 | e.exception.message, | ||
4125 | '--with-qux is not available in this configuration' | ||
4126 | ) | ||
4127 | |||
4128 | config = self.get_config(['--with-foo', '--with-foo-really']) | ||
4129 | - self.assertEquals(config, { | ||
4130 | + self.assertEqual(config, { | ||
4131 | 'FOO': 'foo', | ||
4132 | 'FOO2': True, | ||
4133 | }) | ||
4134 | @@ -998,7 +998,7 @@ class TestConfigure(unittest.TestCase): | ||
4135 | '''): | ||
4136 | self.get_config() | ||
4137 | |||
4138 | - self.assertEquals(e.exception.message, 'Cannot reassign builtins') | ||
4139 | + self.assertEqual(e.exception.message, 'Cannot reassign builtins') | ||
4140 | |||
4141 | with self.assertRaises(KeyError) as e: | ||
4142 | with self.moz_configure(''' | ||
4143 | @@ -1006,7 +1006,7 @@ class TestConfigure(unittest.TestCase): | ||
4144 | '''): | ||
4145 | self.get_config() | ||
4146 | |||
4147 | - self.assertEquals(e.exception.message, | ||
4148 | + self.assertEqual(e.exception.message, | ||
4149 | 'Cannot assign `foo` because it is neither a ' | ||
4150 | '@depends nor a @template') | ||
4151 | |||
4152 | @@ -1019,7 +1019,7 @@ class TestConfigure(unittest.TestCase): | ||
4153 | '''): | ||
4154 | self.get_config() | ||
4155 | |||
4156 | - self.assertEquals(e.exception.message, | ||
4157 | + self.assertEqual(e.exception.message, | ||
4158 | "@depends needs at least one argument") | ||
4159 | |||
4160 | with self.assertRaises(ConfigureError) as e: | ||
4161 | @@ -1030,7 +1030,7 @@ class TestConfigure(unittest.TestCase): | ||
4162 | '''): | ||
4163 | self.get_config() | ||
4164 | |||
4165 | - self.assertEquals(e.exception.message, | ||
4166 | + self.assertEqual(e.exception.message, | ||
4167 | "'--with-foo' is not a known option. Maybe it's " | ||
4168 | "declared too late?") | ||
4169 | |||
4170 | @@ -1042,7 +1042,7 @@ class TestConfigure(unittest.TestCase): | ||
4171 | '''): | ||
4172 | self.get_config() | ||
4173 | |||
4174 | - self.assertEquals(e.exception.message, | ||
4175 | + self.assertEqual(e.exception.message, | ||
4176 | "Option must not contain an '='") | ||
4177 | |||
4178 | with self.assertRaises(TypeError) as e: | ||
4179 | @@ -1053,7 +1053,7 @@ class TestConfigure(unittest.TestCase): | ||
4180 | '''): | ||
4181 | self.get_config() | ||
4182 | |||
4183 | - self.assertEquals(e.exception.message, | ||
4184 | + self.assertEqual(e.exception.message, | ||
4185 | "Cannot use object of type 'int' as argument " | ||
4186 | "to @depends") | ||
4187 | |||
4188 | @@ -1065,7 +1065,7 @@ class TestConfigure(unittest.TestCase): | ||
4189 | '''): | ||
4190 | self.get_config() | ||
4191 | |||
4192 | - self.assertEquals(e.exception.message, | ||
4193 | + self.assertEqual(e.exception.message, | ||
4194 | "Cannot decorate generator functions with @depends") | ||
4195 | |||
4196 | with self.assertRaises(TypeError) as e: | ||
4197 | @@ -1074,7 +1074,7 @@ class TestConfigure(unittest.TestCase): | ||
4198 | '''): | ||
4199 | self.get_config() | ||
4200 | |||
4201 | - self.assertEquals(e.exception.message, | ||
4202 | + self.assertEqual(e.exception.message, | ||
4203 | "Unexpected type: 'int'") | ||
4204 | |||
4205 | with self.assertRaises(ConfigureError) as e: | ||
4206 | @@ -1088,7 +1088,7 @@ class TestConfigure(unittest.TestCase): | ||
4207 | '''): | ||
4208 | self.get_config() | ||
4209 | |||
4210 | - self.assertEquals(e.exception.message, | ||
4211 | + self.assertEqual(e.exception.message, | ||
4212 | "The `foo` function may not be called") | ||
4213 | |||
4214 | with self.assertRaises(TypeError) as e: | ||
4215 | @@ -1099,7 +1099,7 @@ class TestConfigure(unittest.TestCase): | ||
4216 | '''): | ||
4217 | self.get_config() | ||
4218 | |||
4219 | - self.assertEquals(e.exception.message, | ||
4220 | + self.assertEqual(e.exception.message, | ||
4221 | "depends_impl() got an unexpected keyword argument 'foo'") | ||
4222 | |||
4223 | def test_depends_when(self): | ||
4224 | @@ -1124,12 +1124,12 @@ class TestConfigure(unittest.TestCase): | ||
4225 | set_config('QUX', qux) | ||
4226 | '''): | ||
4227 | config = self.get_config() | ||
4228 | - self.assertEquals(config, { | ||
4229 | + self.assertEqual(config, { | ||
4230 | 'FOO': 'foo', | ||
4231 | }) | ||
4232 | |||
4233 | config = self.get_config(['--with-qux']) | ||
4234 | - self.assertEquals(config, { | ||
4235 | + self.assertEqual(config, { | ||
4236 | 'FOO': 'foo', | ||
4237 | 'QUX': 'qux', | ||
4238 | }) | ||
4239 | @@ -1144,7 +1144,7 @@ class TestConfigure(unittest.TestCase): | ||
4240 | '''): | ||
4241 | self.get_config() | ||
4242 | |||
4243 | - self.assertEquals(e.exception.message, | ||
4244 | + self.assertEqual(e.exception.message, | ||
4245 | '@imports must appear after @template') | ||
4246 | |||
4247 | with self.assertRaises(ConfigureError) as e: | ||
4248 | @@ -1157,7 +1157,7 @@ class TestConfigure(unittest.TestCase): | ||
4249 | '''): | ||
4250 | self.get_config() | ||
4251 | |||
4252 | - self.assertEquals(e.exception.message, | ||
4253 | + self.assertEqual(e.exception.message, | ||
4254 | '@imports must appear after @depends') | ||
4255 | |||
4256 | for import_ in ( | ||
4257 | @@ -1174,7 +1174,7 @@ class TestConfigure(unittest.TestCase): | ||
4258 | ''' % import_): | ||
4259 | self.get_config() | ||
4260 | |||
4261 | - self.assertEquals(e.exception.message, "Unexpected type: 'int'") | ||
4262 | + self.assertEqual(e.exception.message, "Unexpected type: 'int'") | ||
4263 | |||
4264 | with self.assertRaises(TypeError) as e: | ||
4265 | with self.moz_configure(''' | ||
4266 | @@ -1185,7 +1185,7 @@ class TestConfigure(unittest.TestCase): | ||
4267 | '''): | ||
4268 | self.get_config() | ||
4269 | |||
4270 | - self.assertEquals(e.exception.message, "Unexpected type: 'int'") | ||
4271 | + self.assertEqual(e.exception.message, "Unexpected type: 'int'") | ||
4272 | |||
4273 | with self.assertRaises(ValueError) as e: | ||
4274 | with self.moz_configure(''' | ||
4275 | @@ -1195,7 +1195,7 @@ class TestConfigure(unittest.TestCase): | ||
4276 | '''): | ||
4277 | self.get_config() | ||
4278 | |||
4279 | - self.assertEquals(e.exception.message, | ||
4280 | + self.assertEqual(e.exception.message, | ||
4281 | "Invalid argument to @imports: 'os*'") | ||
4282 | |||
4283 | def test_only_when(self): | ||
4284 | @@ -1250,7 +1250,7 @@ class TestConfigure(unittest.TestCase): | ||
4285 | with self.assertRaises(InvalidOptionError) as e: | ||
4286 | self.get_config(['--foo']) | ||
4287 | |||
4288 | - self.assertEquals(e.exception.message, | ||
4289 | + self.assertEqual(e.exception.message, | ||
4290 | '--foo is not available in this configuration') | ||
4291 | |||
4292 | # Cannot depend on an option defined in a only_when block, because we | ||
4293 | @@ -1261,7 +1261,7 @@ class TestConfigure(unittest.TestCase): | ||
4294 | with self.assertRaises(ConfigureError) as e: | ||
4295 | self.get_config() | ||
4296 | |||
4297 | - self.assertEquals(e.exception.message, | ||
4298 | + self.assertEqual(e.exception.message, | ||
4299 | '@depends function needs the same `when` as ' | ||
4300 | 'options it depends on') | ||
4301 | |||
4302 | @@ -1278,7 +1278,7 @@ class TestConfigure(unittest.TestCase): | ||
4303 | with self.assertRaises(InvalidOptionError) as e: | ||
4304 | self.get_config() | ||
4305 | |||
4306 | - self.assertEquals(e.exception.message, | ||
4307 | + self.assertEqual(e.exception.message, | ||
4308 | '--foo is not available in this configuration') | ||
4309 | |||
4310 | # And similarly doesn't fail when the condition is true. | ||
4311 | diff --git a/python/mozbuild/mozbuild/test/configure/test_lint.py b/python/mozbuild/mozbuild/test/configure/test_lint.py | ||
4312 | index 6d8d4c49f..6ad897839 100644 | ||
4313 | --- a/python/mozbuild/mozbuild/test/configure/test_lint.py | ||
4314 | +++ b/python/mozbuild/mozbuild/test/configure/test_lint.py | ||
4315 | @@ -2,9 +2,9 @@ | ||
4316 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
4317 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
4318 | |||
4319 | -from __future__ import absolute_import, print_function, unicode_literals | ||
4320 | |||
4321 | -from StringIO import StringIO | ||
4322 | + | ||
4323 | +from io import StringIO | ||
4324 | import os | ||
4325 | import textwrap | ||
4326 | import unittest | ||
4327 | @@ -62,7 +62,7 @@ class TestLint(unittest.TestCase): | ||
4328 | '''): | ||
4329 | self.lint_test() | ||
4330 | |||
4331 | - self.assertEquals(e.exception.message, | ||
4332 | + self.assertEqual(e.exception.message, | ||
4333 | "`bar` depends on '--help' and `foo`. " | ||
4334 | "`foo` must depend on '--help'") | ||
4335 | |||
4336 | @@ -85,7 +85,7 @@ class TestLint(unittest.TestCase): | ||
4337 | '''): | ||
4338 | self.lint_test() | ||
4339 | |||
4340 | - self.assertEquals(e.exception.message, | ||
4341 | + self.assertEqual(e.exception.message, | ||
4342 | "`bar` depends on '--help' and `foo`. " | ||
4343 | "`foo` must depend on '--help'") | ||
4344 | |||
4345 | @@ -111,7 +111,7 @@ class TestLint(unittest.TestCase): | ||
4346 | '''): | ||
4347 | self.lint_test() | ||
4348 | |||
4349 | - self.assertEquals(e.exception.message, | ||
4350 | + self.assertEqual(e.exception.message, | ||
4351 | "Missing @depends for `foo`: '--help'") | ||
4352 | |||
4353 | with self.assertRaises(ConfigureError) as e: | ||
4354 | @@ -130,7 +130,7 @@ class TestLint(unittest.TestCase): | ||
4355 | '''): | ||
4356 | self.lint_test() | ||
4357 | |||
4358 | - self.assertEquals(e.exception.message, | ||
4359 | + self.assertEqual(e.exception.message, | ||
4360 | "Missing @depends for `foo`: '--help'") | ||
4361 | |||
4362 | with self.assertRaises(ConfigureError) as e: | ||
4363 | @@ -145,7 +145,7 @@ class TestLint(unittest.TestCase): | ||
4364 | '''): | ||
4365 | self.lint_test() | ||
4366 | |||
4367 | - self.assertEquals(e.exception.message, | ||
4368 | + self.assertEqual(e.exception.message, | ||
4369 | "Missing @depends for `foo`: '--help'") | ||
4370 | |||
4371 | # This would have failed with "Missing @depends for `foo`: '--help'" | ||
4372 | @@ -178,7 +178,7 @@ class TestLint(unittest.TestCase): | ||
4373 | '''): | ||
4374 | self.lint_test() | ||
4375 | |||
4376 | - self.assertEquals(e.exception.message, | ||
4377 | + self.assertEqual(e.exception.message, | ||
4378 | "Missing @depends for `foo`: '--help'") | ||
4379 | |||
4380 | # There is a default restricted `os` module when there is no explicit | ||
4381 | @@ -205,7 +205,7 @@ class TestLint(unittest.TestCase): | ||
4382 | '''): | ||
4383 | self.lint_test() | ||
4384 | |||
4385 | - self.assertEquals(e.exception.message, | ||
4386 | + self.assertEqual(e.exception.message, | ||
4387 | "%s:3: The dependency on `--foo` is unused." | ||
4388 | % mozpath.join(test_data_path, 'moz.configure')) | ||
4389 | |||
4390 | @@ -222,7 +222,7 @@ class TestLint(unittest.TestCase): | ||
4391 | '''): | ||
4392 | self.lint_test() | ||
4393 | |||
4394 | - self.assertEquals(e.exception.message, | ||
4395 | + self.assertEqual(e.exception.message, | ||
4396 | "%s:5: The dependency on `bar` is unused." | ||
4397 | % mozpath.join(test_data_path, 'moz.configure')) | ||
4398 | |||
4399 | @@ -236,7 +236,7 @@ class TestLint(unittest.TestCase): | ||
4400 | '''): | ||
4401 | self.lint_test() | ||
4402 | |||
4403 | - self.assertEquals(e.exception.message, | ||
4404 | + self.assertEqual(e.exception.message, | ||
4405 | "%s:2: The dependency on `<lambda>` is unused." | ||
4406 | % mozpath.join(test_data_path, 'moz.configure')) | ||
4407 | |||
4408 | @@ -257,7 +257,7 @@ class TestLint(unittest.TestCase): | ||
4409 | '''): | ||
4410 | self.lint_test() | ||
4411 | |||
4412 | - self.assertEquals(e.exception.message, | ||
4413 | + self.assertEqual(e.exception.message, | ||
4414 | "%s:9: The dependency on `qux` is unused." | ||
4415 | % mozpath.join(test_data_path, 'moz.configure')) | ||
4416 | |||
4417 | diff --git a/python/mozbuild/mozbuild/test/configure/test_moz_configure.py b/python/mozbuild/mozbuild/test/configure/test_moz_configure.py | ||
4418 | index b3342e268..7a26e9e09 100644 | ||
4419 | --- a/python/mozbuild/mozbuild/test/configure/test_moz_configure.py | ||
4420 | +++ b/python/mozbuild/mozbuild/test/configure/test_moz_configure.py | ||
4421 | @@ -2,7 +2,7 @@ | ||
4422 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
4423 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
4424 | |||
4425 | -from __future__ import absolute_import, print_function, unicode_literals | ||
4426 | + | ||
4427 | |||
4428 | from mozunit import main | ||
4429 | from mozpack import path as mozpath | ||
4430 | @@ -27,10 +27,10 @@ class TestMozConfigure(BaseConfigureTest): | ||
4431 | shell = mozpath.abspath('/bin/sh') | ||
4432 | return result.replace('CONFIG_SHELL=%s ' % shell, '') | ||
4433 | |||
4434 | - self.assertEquals('--enable-application=browser', | ||
4435 | + self.assertEqual('--enable-application=browser', | ||
4436 | get_value_for(['--enable-application=browser'])) | ||
4437 | |||
4438 | - self.assertEquals('--enable-application=browser ' | ||
4439 | + self.assertEqual('--enable-application=browser ' | ||
4440 | 'MOZ_VTUNE=1', | ||
4441 | get_value_for(['--enable-application=browser', | ||
4442 | 'MOZ_VTUNE=1'])) | ||
4443 | @@ -39,25 +39,25 @@ class TestMozConfigure(BaseConfigureTest): | ||
4444 | environ={'MOZ_VTUNE': '1'}, | ||
4445 | mozconfig='ac_add_options --enable-project=js') | ||
4446 | |||
4447 | - self.assertEquals('--enable-project=js MOZ_VTUNE=1', | ||
4448 | + self.assertEqual('--enable-project=js MOZ_VTUNE=1', | ||
4449 | value) | ||
4450 | |||
4451 | # --disable-js-shell is the default, so it's filtered out. | ||
4452 | - self.assertEquals('--enable-application=browser', | ||
4453 | + self.assertEqual('--enable-application=browser', | ||
4454 | get_value_for(['--enable-application=browser', | ||
4455 | '--disable-js-shell'])) | ||
4456 | |||
4457 | # Normally, --without-foo would be filtered out because that's the | ||
4458 | # default, but since it is a (fake) old-configure option, it always | ||
4459 | # appears. | ||
4460 | - self.assertEquals('--enable-application=browser --without-foo', | ||
4461 | + self.assertEqual('--enable-application=browser --without-foo', | ||
4462 | get_value_for(['--enable-application=browser', | ||
4463 | '--without-foo'])) | ||
4464 | - self.assertEquals('--enable-application=browser --with-foo', | ||
4465 | + self.assertEqual('--enable-application=browser --with-foo', | ||
4466 | get_value_for(['--enable-application=browser', | ||
4467 | '--with-foo'])) | ||
4468 | |||
4469 | - self.assertEquals("--enable-application=browser '--with-foo=foo bar'", | ||
4470 | + self.assertEqual("--enable-application=browser '--with-foo=foo bar'", | ||
4471 | get_value_for(['--enable-application=browser', | ||
4472 | '--with-foo=foo bar'])) | ||
4473 | |||
4474 | @@ -69,7 +69,7 @@ class TestMozConfigure(BaseConfigureTest): | ||
4475 | self.version = version | ||
4476 | |||
4477 | def __call__(self, stdin, args): | ||
4478 | - this.assertEquals(args, ('-version',)) | ||
4479 | + this.assertEqual(args, ('-version',)) | ||
4480 | return 0, self.version, '' | ||
4481 | |||
4482 | def check_nsis_version(version): | ||
4483 | @@ -84,13 +84,13 @@ class TestMozConfigure(BaseConfigureTest): | ||
4484 | with self.assertRaises(SystemExit) as e: | ||
4485 | check_nsis_version('v3.0a2') | ||
4486 | |||
4487 | - self.assertEquals(check_nsis_version('v3.0b1'), '3.0b1') | ||
4488 | - self.assertEquals(check_nsis_version('v3.0b2'), '3.0b2') | ||
4489 | - self.assertEquals(check_nsis_version('v3.0rc1'), '3.0rc1') | ||
4490 | - self.assertEquals(check_nsis_version('v3.0'), '3.0') | ||
4491 | - self.assertEquals(check_nsis_version('v3.0-2'), '3.0') | ||
4492 | - self.assertEquals(check_nsis_version('v3.0.1'), '3.0') | ||
4493 | - self.assertEquals(check_nsis_version('v3.1'), '3.1') | ||
4494 | + self.assertEqual(check_nsis_version('v3.0b1'), '3.0b1') | ||
4495 | + self.assertEqual(check_nsis_version('v3.0b2'), '3.0b2') | ||
4496 | + self.assertEqual(check_nsis_version('v3.0rc1'), '3.0rc1') | ||
4497 | + self.assertEqual(check_nsis_version('v3.0'), '3.0') | ||
4498 | + self.assertEqual(check_nsis_version('v3.0-2'), '3.0') | ||
4499 | + self.assertEqual(check_nsis_version('v3.0.1'), '3.0') | ||
4500 | + self.assertEqual(check_nsis_version('v3.1'), '3.1') | ||
4501 | |||
4502 | |||
4503 | if __name__ == '__main__': | ||
4504 | diff --git a/python/mozbuild/mozbuild/test/configure/test_options.py b/python/mozbuild/mozbuild/test/configure/test_options.py | ||
4505 | index 9defccb2c..330ce3b1f 100644 | ||
4506 | --- a/python/mozbuild/mozbuild/test/configure/test_options.py | ||
4507 | +++ b/python/mozbuild/mozbuild/test/configure/test_options.py | ||
4508 | @@ -2,7 +2,7 @@ | ||
4509 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
4510 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
4511 | |||
4512 | -from __future__ import absolute_import, print_function, unicode_literals | ||
4513 | + | ||
4514 | |||
4515 | import unittest | ||
4516 | |||
4517 | @@ -28,139 +28,139 @@ class Option(Option): | ||
4518 | class TestOption(unittest.TestCase): | ||
4519 | def test_option(self): | ||
4520 | option = Option('--option') | ||
4521 | - self.assertEquals(option.prefix, '') | ||
4522 | - self.assertEquals(option.name, 'option') | ||
4523 | - self.assertEquals(option.env, None) | ||
4524 | + self.assertEqual(option.prefix, '') | ||
4525 | + self.assertEqual(option.name, 'option') | ||
4526 | + self.assertEqual(option.env, None) | ||
4527 | self.assertFalse(option.default) | ||
4528 | |||
4529 | option = Option('--enable-option') | ||
4530 | - self.assertEquals(option.prefix, 'enable') | ||
4531 | - self.assertEquals(option.name, 'option') | ||
4532 | - self.assertEquals(option.env, None) | ||
4533 | + self.assertEqual(option.prefix, 'enable') | ||
4534 | + self.assertEqual(option.name, 'option') | ||
4535 | + self.assertEqual(option.env, None) | ||
4536 | self.assertFalse(option.default) | ||
4537 | |||
4538 | option = Option('--disable-option') | ||
4539 | - self.assertEquals(option.prefix, 'disable') | ||
4540 | - self.assertEquals(option.name, 'option') | ||
4541 | - self.assertEquals(option.env, None) | ||
4542 | + self.assertEqual(option.prefix, 'disable') | ||
4543 | + self.assertEqual(option.name, 'option') | ||
4544 | + self.assertEqual(option.env, None) | ||
4545 | self.assertTrue(option.default) | ||
4546 | |||
4547 | option = Option('--with-option') | ||
4548 | - self.assertEquals(option.prefix, 'with') | ||
4549 | - self.assertEquals(option.name, 'option') | ||
4550 | - self.assertEquals(option.env, None) | ||
4551 | + self.assertEqual(option.prefix, 'with') | ||
4552 | + self.assertEqual(option.name, 'option') | ||
4553 | + self.assertEqual(option.env, None) | ||
4554 | self.assertFalse(option.default) | ||
4555 | |||
4556 | option = Option('--without-option') | ||
4557 | - self.assertEquals(option.prefix, 'without') | ||
4558 | - self.assertEquals(option.name, 'option') | ||
4559 | - self.assertEquals(option.env, None) | ||
4560 | + self.assertEqual(option.prefix, 'without') | ||
4561 | + self.assertEqual(option.name, 'option') | ||
4562 | + self.assertEqual(option.env, None) | ||
4563 | self.assertTrue(option.default) | ||
4564 | |||
4565 | option = Option('--without-option-foo', env='MOZ_OPTION') | ||
4566 | - self.assertEquals(option.env, 'MOZ_OPTION') | ||
4567 | + self.assertEqual(option.env, 'MOZ_OPTION') | ||
4568 | |||
4569 | option = Option(env='MOZ_OPTION') | ||
4570 | - self.assertEquals(option.prefix, '') | ||
4571 | - self.assertEquals(option.name, None) | ||
4572 | - self.assertEquals(option.env, 'MOZ_OPTION') | ||
4573 | + self.assertEqual(option.prefix, '') | ||
4574 | + self.assertEqual(option.name, None) | ||
4575 | + self.assertEqual(option.env, 'MOZ_OPTION') | ||
4576 | self.assertFalse(option.default) | ||
4577 | |||
4578 | with self.assertRaises(InvalidOptionError) as e: | ||
4579 | Option('--option', nargs=0, default=('a',)) | ||
4580 | - self.assertEquals(e.exception.message, | ||
4581 | + self.assertEqual(e.exception.message, | ||
4582 | "The given `default` doesn't satisfy `nargs`") | ||
4583 | |||
4584 | with self.assertRaises(InvalidOptionError) as e: | ||
4585 | Option('--option', nargs=1, default=()) | ||
4586 | - self.assertEquals( | ||
4587 | + self.assertEqual( | ||
4588 | e.exception.message, | ||
4589 | 'default must be a bool, a string or a tuple of strings') | ||
4590 | |||
4591 | with self.assertRaises(InvalidOptionError) as e: | ||
4592 | Option('--option', nargs=1, default=True) | ||
4593 | - self.assertEquals(e.exception.message, | ||
4594 | + self.assertEqual(e.exception.message, | ||
4595 | "The given `default` doesn't satisfy `nargs`") | ||
4596 | |||
4597 | with self.assertRaises(InvalidOptionError) as e: | ||
4598 | Option('--option', nargs=1, default=('a', 'b')) | ||
4599 | - self.assertEquals(e.exception.message, | ||
4600 | + self.assertEqual(e.exception.message, | ||
4601 | "The given `default` doesn't satisfy `nargs`") | ||
4602 | |||
4603 | with self.assertRaises(InvalidOptionError) as e: | ||
4604 | Option('--option', nargs=2, default=()) | ||
4605 | - self.assertEquals( | ||
4606 | + self.assertEqual( | ||
4607 | e.exception.message, | ||
4608 | 'default must be a bool, a string or a tuple of strings') | ||
4609 | |||
4610 | with self.assertRaises(InvalidOptionError) as e: | ||
4611 | Option('--option', nargs=2, default=True) | ||
4612 | - self.assertEquals(e.exception.message, | ||
4613 | + self.assertEqual(e.exception.message, | ||
4614 | "The given `default` doesn't satisfy `nargs`") | ||
4615 | |||
4616 | with self.assertRaises(InvalidOptionError) as e: | ||
4617 | Option('--option', nargs=2, default=('a',)) | ||
4618 | - self.assertEquals(e.exception.message, | ||
4619 | + self.assertEqual(e.exception.message, | ||
4620 | "The given `default` doesn't satisfy `nargs`") | ||
4621 | |||
4622 | with self.assertRaises(InvalidOptionError) as e: | ||
4623 | Option('--option', nargs='?', default=('a', 'b')) | ||
4624 | - self.assertEquals(e.exception.message, | ||
4625 | + self.assertEqual(e.exception.message, | ||
4626 | "The given `default` doesn't satisfy `nargs`") | ||
4627 | |||
4628 | with self.assertRaises(InvalidOptionError) as e: | ||
4629 | Option('--option', nargs='+', default=()) | ||
4630 | - self.assertEquals( | ||
4631 | + self.assertEqual( | ||
4632 | e.exception.message, | ||
4633 | 'default must be a bool, a string or a tuple of strings') | ||
4634 | |||
4635 | with self.assertRaises(InvalidOptionError) as e: | ||
4636 | Option('--option', nargs='+', default=True) | ||
4637 | - self.assertEquals(e.exception.message, | ||
4638 | + self.assertEqual(e.exception.message, | ||
4639 | "The given `default` doesn't satisfy `nargs`") | ||
4640 | |||
4641 | # --disable options with a nargs value that requires at least one | ||
4642 | # argument need to be given a default. | ||
4643 | with self.assertRaises(InvalidOptionError) as e: | ||
4644 | Option('--disable-option', nargs=1) | ||
4645 | - self.assertEquals(e.exception.message, | ||
4646 | + self.assertEqual(e.exception.message, | ||
4647 | "The given `default` doesn't satisfy `nargs`") | ||
4648 | |||
4649 | with self.assertRaises(InvalidOptionError) as e: | ||
4650 | Option('--disable-option', nargs='+') | ||
4651 | - self.assertEquals(e.exception.message, | ||
4652 | + self.assertEqual(e.exception.message, | ||
4653 | "The given `default` doesn't satisfy `nargs`") | ||
4654 | |||
4655 | # Test nargs inference from default value | ||
4656 | option = Option('--with-foo', default=True) | ||
4657 | - self.assertEquals(option.nargs, 0) | ||
4658 | + self.assertEqual(option.nargs, 0) | ||
4659 | |||
4660 | option = Option('--with-foo', default=False) | ||
4661 | - self.assertEquals(option.nargs, 0) | ||
4662 | + self.assertEqual(option.nargs, 0) | ||
4663 | |||
4664 | option = Option('--with-foo', default='a') | ||
4665 | - self.assertEquals(option.nargs, '?') | ||
4666 | + self.assertEqual(option.nargs, '?') | ||
4667 | |||
4668 | option = Option('--with-foo', default=('a',)) | ||
4669 | - self.assertEquals(option.nargs, '?') | ||
4670 | + self.assertEqual(option.nargs, '?') | ||
4671 | |||
4672 | option = Option('--with-foo', default=('a', 'b')) | ||
4673 | - self.assertEquals(option.nargs, '*') | ||
4674 | + self.assertEqual(option.nargs, '*') | ||
4675 | |||
4676 | option = Option(env='FOO', default=True) | ||
4677 | - self.assertEquals(option.nargs, 0) | ||
4678 | + self.assertEqual(option.nargs, 0) | ||
4679 | |||
4680 | option = Option(env='FOO', default=False) | ||
4681 | - self.assertEquals(option.nargs, 0) | ||
4682 | + self.assertEqual(option.nargs, 0) | ||
4683 | |||
4684 | option = Option(env='FOO', default='a') | ||
4685 | - self.assertEquals(option.nargs, '?') | ||
4686 | + self.assertEqual(option.nargs, '?') | ||
4687 | |||
4688 | option = Option(env='FOO', default=('a',)) | ||
4689 | - self.assertEquals(option.nargs, '?') | ||
4690 | + self.assertEqual(option.nargs, '?') | ||
4691 | |||
4692 | option = Option(env='FOO', default=('a', 'b')) | ||
4693 | - self.assertEquals(option.nargs, '*') | ||
4694 | + self.assertEqual(option.nargs, '*') | ||
4695 | |||
4696 | def test_option_option(self): | ||
4697 | for option in ( | ||
4698 | @@ -170,70 +170,70 @@ class TestOption(unittest.TestCase): | ||
4699 | '--with-option', | ||
4700 | '--without-option', | ||
4701 | ): | ||
4702 | - self.assertEquals(Option(option).option, option) | ||
4703 | - self.assertEquals(Option(option, env='FOO').option, option) | ||
4704 | + self.assertEqual(Option(option).option, option) | ||
4705 | + self.assertEqual(Option(option, env='FOO').option, option) | ||
4706 | |||
4707 | opt = Option(option, default=False) | ||
4708 | - self.assertEquals(opt.option, | ||
4709 | + self.assertEqual(opt.option, | ||
4710 | option.replace('-disable-', '-enable-') | ||
4711 | .replace('-without-', '-with-')) | ||
4712 | |||
4713 | opt = Option(option, default=True) | ||
4714 | - self.assertEquals(opt.option, | ||
4715 | + self.assertEqual(opt.option, | ||
4716 | option.replace('-enable-', '-disable-') | ||
4717 | .replace('-with-', '-without-')) | ||
4718 | |||
4719 | - self.assertEquals(Option(env='FOO').option, 'FOO') | ||
4720 | + self.assertEqual(Option(env='FOO').option, 'FOO') | ||
4721 | |||
4722 | def test_option_choices(self): | ||
4723 | with self.assertRaises(InvalidOptionError) as e: | ||
4724 | Option('--option', nargs=3, choices=('a', 'b')) | ||
4725 | - self.assertEquals(e.exception.message, | ||
4726 | + self.assertEqual(e.exception.message, | ||
4727 | 'Not enough `choices` for `nargs`') | ||
4728 | |||
4729 | with self.assertRaises(InvalidOptionError) as e: | ||
4730 | Option('--without-option', nargs=1, choices=('a', 'b')) | ||
4731 | - self.assertEquals(e.exception.message, | ||
4732 | + self.assertEqual(e.exception.message, | ||
4733 | 'A `default` must be given along with `choices`') | ||
4734 | |||
4735 | with self.assertRaises(InvalidOptionError) as e: | ||
4736 | Option('--without-option', nargs='+', choices=('a', 'b')) | ||
4737 | - self.assertEquals(e.exception.message, | ||
4738 | + self.assertEqual(e.exception.message, | ||
4739 | 'A `default` must be given along with `choices`') | ||
4740 | |||
4741 | with self.assertRaises(InvalidOptionError) as e: | ||
4742 | Option('--without-option', default='c', choices=('a', 'b')) | ||
4743 | - self.assertEquals(e.exception.message, | ||
4744 | + self.assertEqual(e.exception.message, | ||
4745 | "The `default` value must be one of 'a', 'b'") | ||
4746 | |||
4747 | with self.assertRaises(InvalidOptionError) as e: | ||
4748 | Option('--without-option', default=('a', 'c',), choices=('a', 'b')) | ||
4749 | - self.assertEquals(e.exception.message, | ||
4750 | + self.assertEqual(e.exception.message, | ||
4751 | "The `default` value must be one of 'a', 'b'") | ||
4752 | |||
4753 | with self.assertRaises(InvalidOptionError) as e: | ||
4754 | Option('--without-option', default=('c',), choices=('a', 'b')) | ||
4755 | - self.assertEquals(e.exception.message, | ||
4756 | + self.assertEqual(e.exception.message, | ||
4757 | "The `default` value must be one of 'a', 'b'") | ||
4758 | |||
4759 | option = Option('--with-option', nargs='+', choices=('a', 'b')) | ||
4760 | with self.assertRaises(InvalidOptionError) as e: | ||
4761 | option.get_value('--with-option=c') | ||
4762 | - self.assertEquals(e.exception.message, "'c' is not one of 'a', 'b'") | ||
4763 | + self.assertEqual(e.exception.message, "'c' is not one of 'a', 'b'") | ||
4764 | |||
4765 | value = option.get_value('--with-option=b,a') | ||
4766 | self.assertTrue(value) | ||
4767 | - self.assertEquals(PositiveOptionValue(('b', 'a')), value) | ||
4768 | + self.assertEqual(PositiveOptionValue(('b', 'a')), value) | ||
4769 | |||
4770 | option = Option('--without-option', nargs='*', default='a', | ||
4771 | choices=('a', 'b')) | ||
4772 | with self.assertRaises(InvalidOptionError) as e: | ||
4773 | option.get_value('--with-option=c') | ||
4774 | - self.assertEquals(e.exception.message, "'c' is not one of 'a', 'b'") | ||
4775 | + self.assertEqual(e.exception.message, "'c' is not one of 'a', 'b'") | ||
4776 | |||
4777 | value = option.get_value('--with-option=b,a') | ||
4778 | self.assertTrue(value) | ||
4779 | - self.assertEquals(PositiveOptionValue(('b', 'a')), value) | ||
4780 | + self.assertEqual(PositiveOptionValue(('b', 'a')), value) | ||
4781 | |||
4782 | # Test nargs inference from choices | ||
4783 | option = Option('--with-option', choices=('a', 'b')) | ||
4784 | @@ -244,37 +244,37 @@ class TestOption(unittest.TestCase): | ||
4785 | choices=('a', 'b', 'c', 'd')) | ||
4786 | |||
4787 | value = option.get_value('--with-option=+d') | ||
4788 | - self.assertEquals(PositiveOptionValue(('b', 'c', 'd')), value) | ||
4789 | + self.assertEqual(PositiveOptionValue(('b', 'c', 'd')), value) | ||
4790 | |||
4791 | value = option.get_value('--with-option=-b') | ||
4792 | - self.assertEquals(PositiveOptionValue(('c',)), value) | ||
4793 | + self.assertEqual(PositiveOptionValue(('c',)), value) | ||
4794 | |||
4795 | value = option.get_value('--with-option=-b,+d') | ||
4796 | - self.assertEquals(PositiveOptionValue(('c','d')), value) | ||
4797 | + self.assertEqual(PositiveOptionValue(('c','d')), value) | ||
4798 | |||
4799 | # Adding something that is in the default is fine | ||
4800 | value = option.get_value('--with-option=+b') | ||
4801 | - self.assertEquals(PositiveOptionValue(('b', 'c')), value) | ||
4802 | + self.assertEqual(PositiveOptionValue(('b', 'c')), value) | ||
4803 | |||
4804 | # Removing something that is not in the default is fine, as long as it | ||
4805 | # is one of the choices | ||
4806 | value = option.get_value('--with-option=-a') | ||
4807 | - self.assertEquals(PositiveOptionValue(('b', 'c')), value) | ||
4808 | + self.assertEqual(PositiveOptionValue(('b', 'c')), value) | ||
4809 | |||
4810 | with self.assertRaises(InvalidOptionError) as e: | ||
4811 | option.get_value('--with-option=-e') | ||
4812 | - self.assertEquals(e.exception.message, | ||
4813 | + self.assertEqual(e.exception.message, | ||
4814 | "'e' is not one of 'a', 'b', 'c', 'd'") | ||
4815 | |||
4816 | # Other "not a choice" errors. | ||
4817 | with self.assertRaises(InvalidOptionError) as e: | ||
4818 | option.get_value('--with-option=+e') | ||
4819 | - self.assertEquals(e.exception.message, | ||
4820 | + self.assertEqual(e.exception.message, | ||
4821 | "'e' is not one of 'a', 'b', 'c', 'd'") | ||
4822 | |||
4823 | with self.assertRaises(InvalidOptionError) as e: | ||
4824 | option.get_value('--with-option=e') | ||
4825 | - self.assertEquals(e.exception.message, | ||
4826 | + self.assertEqual(e.exception.message, | ||
4827 | "'e' is not one of 'a', 'b', 'c', 'd'") | ||
4828 | |||
4829 | def test_option_value_compare(self): | ||
4830 | @@ -294,7 +294,7 @@ class TestOption(unittest.TestCase): | ||
4831 | |||
4832 | # For usability reasons, we raise TypeError when attempting to compare | ||
4833 | # against a non-tuple. | ||
4834 | - with self.assertRaisesRegexp(TypeError, 'cannot compare a'): | ||
4835 | + with self.assertRaisesRegex(TypeError, 'cannot compare a'): | ||
4836 | val == 'foo' | ||
4837 | |||
4838 | # But we allow empty option values to compare otherwise we can't | ||
4839 | @@ -313,36 +313,36 @@ class TestOption(unittest.TestCase): | ||
4840 | |||
4841 | def test_option_value_format(self): | ||
4842 | val = PositiveOptionValue() | ||
4843 | - self.assertEquals('--with-value', val.format('--with-value')) | ||
4844 | - self.assertEquals('--with-value', val.format('--without-value')) | ||
4845 | - self.assertEquals('--enable-value', val.format('--enable-value')) | ||
4846 | - self.assertEquals('--enable-value', val.format('--disable-value')) | ||
4847 | - self.assertEquals('--value', val.format('--value')) | ||
4848 | - self.assertEquals('VALUE=1', val.format('VALUE')) | ||
4849 | + self.assertEqual('--with-value', val.format('--with-value')) | ||
4850 | + self.assertEqual('--with-value', val.format('--without-value')) | ||
4851 | + self.assertEqual('--enable-value', val.format('--enable-value')) | ||
4852 | + self.assertEqual('--enable-value', val.format('--disable-value')) | ||
4853 | + self.assertEqual('--value', val.format('--value')) | ||
4854 | + self.assertEqual('VALUE=1', val.format('VALUE')) | ||
4855 | |||
4856 | val = PositiveOptionValue(('a',)) | ||
4857 | - self.assertEquals('--with-value=a', val.format('--with-value')) | ||
4858 | - self.assertEquals('--with-value=a', val.format('--without-value')) | ||
4859 | - self.assertEquals('--enable-value=a', val.format('--enable-value')) | ||
4860 | - self.assertEquals('--enable-value=a', val.format('--disable-value')) | ||
4861 | - self.assertEquals('--value=a', val.format('--value')) | ||
4862 | - self.assertEquals('VALUE=a', val.format('VALUE')) | ||
4863 | + self.assertEqual('--with-value=a', val.format('--with-value')) | ||
4864 | + self.assertEqual('--with-value=a', val.format('--without-value')) | ||
4865 | + self.assertEqual('--enable-value=a', val.format('--enable-value')) | ||
4866 | + self.assertEqual('--enable-value=a', val.format('--disable-value')) | ||
4867 | + self.assertEqual('--value=a', val.format('--value')) | ||
4868 | + self.assertEqual('VALUE=a', val.format('VALUE')) | ||
4869 | |||
4870 | val = PositiveOptionValue(('a', 'b')) | ||
4871 | - self.assertEquals('--with-value=a,b', val.format('--with-value')) | ||
4872 | - self.assertEquals('--with-value=a,b', val.format('--without-value')) | ||
4873 | - self.assertEquals('--enable-value=a,b', val.format('--enable-value')) | ||
4874 | - self.assertEquals('--enable-value=a,b', val.format('--disable-value')) | ||
4875 | - self.assertEquals('--value=a,b', val.format('--value')) | ||
4876 | - self.assertEquals('VALUE=a,b', val.format('VALUE')) | ||
4877 | + self.assertEqual('--with-value=a,b', val.format('--with-value')) | ||
4878 | + self.assertEqual('--with-value=a,b', val.format('--without-value')) | ||
4879 | + self.assertEqual('--enable-value=a,b', val.format('--enable-value')) | ||
4880 | + self.assertEqual('--enable-value=a,b', val.format('--disable-value')) | ||
4881 | + self.assertEqual('--value=a,b', val.format('--value')) | ||
4882 | + self.assertEqual('VALUE=a,b', val.format('VALUE')) | ||
4883 | |||
4884 | val = NegativeOptionValue() | ||
4885 | - self.assertEquals('--without-value', val.format('--with-value')) | ||
4886 | - self.assertEquals('--without-value', val.format('--without-value')) | ||
4887 | - self.assertEquals('--disable-value', val.format('--enable-value')) | ||
4888 | - self.assertEquals('--disable-value', val.format('--disable-value')) | ||
4889 | - self.assertEquals('', val.format('--value')) | ||
4890 | - self.assertEquals('VALUE=', val.format('VALUE')) | ||
4891 | + self.assertEqual('--without-value', val.format('--with-value')) | ||
4892 | + self.assertEqual('--without-value', val.format('--without-value')) | ||
4893 | + self.assertEqual('--disable-value', val.format('--enable-value')) | ||
4894 | + self.assertEqual('--disable-value', val.format('--disable-value')) | ||
4895 | + self.assertEqual('', val.format('--value')) | ||
4896 | + self.assertEqual('VALUE=', val.format('VALUE')) | ||
4897 | |||
4898 | def test_option_value(self, name='option', nargs=0, default=None): | ||
4899 | disabled = name.startswith(('disable-', 'without-')) | ||
4900 | @@ -359,28 +359,28 @@ class TestOption(unittest.TestCase): | ||
4901 | |||
4902 | if nargs in (0, '?', '*') or disabled: | ||
4903 | value = option.get_value('--%s' % name, 'option') | ||
4904 | - self.assertEquals(value, posOptionValue()) | ||
4905 | - self.assertEquals(value.origin, 'option') | ||
4906 | + self.assertEqual(value, posOptionValue()) | ||
4907 | + self.assertEqual(value.origin, 'option') | ||
4908 | else: | ||
4909 | with self.assertRaises(InvalidOptionError) as e: | ||
4910 | option.get_value('--%s' % name) | ||
4911 | if nargs == 1: | ||
4912 | - self.assertEquals(e.exception.message, | ||
4913 | + self.assertEqual(e.exception.message, | ||
4914 | '--%s takes 1 value' % name) | ||
4915 | elif nargs == '+': | ||
4916 | - self.assertEquals(e.exception.message, | ||
4917 | + self.assertEqual(e.exception.message, | ||
4918 | '--%s takes 1 or more values' % name) | ||
4919 | else: | ||
4920 | - self.assertEquals(e.exception.message, | ||
4921 | + self.assertEqual(e.exception.message, | ||
4922 | '--%s takes 2 values' % name) | ||
4923 | |||
4924 | value = option.get_value('') | ||
4925 | - self.assertEquals(value, defaultValue) | ||
4926 | - self.assertEquals(value.origin, 'default') | ||
4927 | + self.assertEqual(value, defaultValue) | ||
4928 | + self.assertEqual(value.origin, 'default') | ||
4929 | |||
4930 | value = option.get_value(None) | ||
4931 | - self.assertEquals(value, defaultValue) | ||
4932 | - self.assertEquals(value.origin, 'default') | ||
4933 | + self.assertEqual(value, defaultValue) | ||
4934 | + self.assertEqual(value.origin, 'default') | ||
4935 | |||
4936 | with self.assertRaises(AssertionError): | ||
4937 | value = option.get_value('MOZ_OPTION=', 'environment') | ||
4938 | @@ -393,47 +393,47 @@ class TestOption(unittest.TestCase): | ||
4939 | |||
4940 | if nargs in (1, '?', '*', '+') and not disabled: | ||
4941 | value = option.get_value('--%s=' % name, 'option') | ||
4942 | - self.assertEquals(value, PositiveOptionValue(('',))) | ||
4943 | - self.assertEquals(value.origin, 'option') | ||
4944 | + self.assertEqual(value, PositiveOptionValue(('',))) | ||
4945 | + self.assertEqual(value.origin, 'option') | ||
4946 | else: | ||
4947 | with self.assertRaises(InvalidOptionError) as e: | ||
4948 | option.get_value('--%s=' % name) | ||
4949 | if disabled: | ||
4950 | - self.assertEquals(e.exception.message, | ||
4951 | + self.assertEqual(e.exception.message, | ||
4952 | 'Cannot pass a value to --%s' % name) | ||
4953 | else: | ||
4954 | - self.assertEquals(e.exception.message, | ||
4955 | + self.assertEqual(e.exception.message, | ||
4956 | '--%s takes %d values' % (name, nargs)) | ||
4957 | |||
4958 | if nargs in (1, '?', '*', '+') and not disabled: | ||
4959 | value = option.get_value('--%s=foo' % name, 'option') | ||
4960 | - self.assertEquals(value, PositiveOptionValue(('foo',))) | ||
4961 | - self.assertEquals(value.origin, 'option') | ||
4962 | + self.assertEqual(value, PositiveOptionValue(('foo',))) | ||
4963 | + self.assertEqual(value.origin, 'option') | ||
4964 | else: | ||
4965 | with self.assertRaises(InvalidOptionError) as e: | ||
4966 | option.get_value('--%s=foo' % name) | ||
4967 | if disabled: | ||
4968 | - self.assertEquals(e.exception.message, | ||
4969 | + self.assertEqual(e.exception.message, | ||
4970 | 'Cannot pass a value to --%s' % name) | ||
4971 | else: | ||
4972 | - self.assertEquals(e.exception.message, | ||
4973 | + self.assertEqual(e.exception.message, | ||
4974 | '--%s takes %d values' % (name, nargs)) | ||
4975 | |||
4976 | if nargs in (2, '*', '+') and not disabled: | ||
4977 | value = option.get_value('--%s=foo,bar' % name, 'option') | ||
4978 | - self.assertEquals(value, PositiveOptionValue(('foo', 'bar'))) | ||
4979 | - self.assertEquals(value.origin, 'option') | ||
4980 | + self.assertEqual(value, PositiveOptionValue(('foo', 'bar'))) | ||
4981 | + self.assertEqual(value.origin, 'option') | ||
4982 | else: | ||
4983 | with self.assertRaises(InvalidOptionError) as e: | ||
4984 | option.get_value('--%s=foo,bar' % name, 'option') | ||
4985 | if disabled: | ||
4986 | - self.assertEquals(e.exception.message, | ||
4987 | + self.assertEqual(e.exception.message, | ||
4988 | 'Cannot pass a value to --%s' % name) | ||
4989 | elif nargs == '?': | ||
4990 | - self.assertEquals(e.exception.message, | ||
4991 | + self.assertEqual(e.exception.message, | ||
4992 | '--%s takes 0 or 1 values' % name) | ||
4993 | else: | ||
4994 | - self.assertEquals(e.exception.message, | ||
4995 | + self.assertEqual(e.exception.message, | ||
4996 | '--%s takes %d value%s' | ||
4997 | % (name, nargs, 's' if nargs != 1 else '')) | ||
4998 | |||
4999 | @@ -441,59 +441,59 @@ class TestOption(unittest.TestCase): | ||
5000 | default=default) | ||
5001 | if nargs in (0, '?', '*') or disabled: | ||
5002 | value = option.get_value('--%s' % name, 'option') | ||
5003 | - self.assertEquals(value, posOptionValue()) | ||
5004 | - self.assertEquals(value.origin, 'option') | ||
5005 | + self.assertEqual(value, posOptionValue()) | ||
5006 | + self.assertEqual(value.origin, 'option') | ||
5007 | else: | ||
5008 | with self.assertRaises(InvalidOptionError) as e: | ||
5009 | option.get_value('--%s' % name) | ||
5010 | if disabled: | ||
5011 | - self.assertEquals(e.exception.message, | ||
5012 | + self.assertEqual(e.exception.message, | ||
5013 | 'Cannot pass a value to --%s' % name) | ||
5014 | elif nargs == '+': | ||
5015 | - self.assertEquals(e.exception.message, | ||
5016 | + self.assertEqual(e.exception.message, | ||
5017 | '--%s takes 1 or more values' % name) | ||
5018 | else: | ||
5019 | - self.assertEquals(e.exception.message, | ||
5020 | + self.assertEqual(e.exception.message, | ||
5021 | '--%s takes %d value%s' | ||
5022 | % (name, nargs, 's' if nargs != 1 else '')) | ||
5023 | |||
5024 | value = option.get_value('') | ||
5025 | - self.assertEquals(value, defaultValue) | ||
5026 | - self.assertEquals(value.origin, 'default') | ||
5027 | + self.assertEqual(value, defaultValue) | ||
5028 | + self.assertEqual(value.origin, 'default') | ||
5029 | |||
5030 | value = option.get_value(None) | ||
5031 | - self.assertEquals(value, defaultValue) | ||
5032 | - self.assertEquals(value.origin, 'default') | ||
5033 | + self.assertEqual(value, defaultValue) | ||
5034 | + self.assertEqual(value.origin, 'default') | ||
5035 | |||
5036 | value = option.get_value('MOZ_OPTION=', 'environment') | ||
5037 | - self.assertEquals(value, NegativeOptionValue()) | ||
5038 | - self.assertEquals(value.origin, 'environment') | ||
5039 | + self.assertEqual(value, NegativeOptionValue()) | ||
5040 | + self.assertEqual(value.origin, 'environment') | ||
5041 | |||
5042 | if nargs in (0, '?', '*'): | ||
5043 | value = option.get_value('MOZ_OPTION=1', 'environment') | ||
5044 | - self.assertEquals(value, PositiveOptionValue()) | ||
5045 | - self.assertEquals(value.origin, 'environment') | ||
5046 | + self.assertEqual(value, PositiveOptionValue()) | ||
5047 | + self.assertEqual(value.origin, 'environment') | ||
5048 | elif nargs in (1, '+'): | ||
5049 | value = option.get_value('MOZ_OPTION=1', 'environment') | ||
5050 | - self.assertEquals(value, PositiveOptionValue(('1',))) | ||
5051 | - self.assertEquals(value.origin, 'environment') | ||
5052 | + self.assertEqual(value, PositiveOptionValue(('1',))) | ||
5053 | + self.assertEqual(value.origin, 'environment') | ||
5054 | else: | ||
5055 | with self.assertRaises(InvalidOptionError) as e: | ||
5056 | option.get_value('MOZ_OPTION=1', 'environment') | ||
5057 | - self.assertEquals(e.exception.message, 'MOZ_OPTION takes 2 values') | ||
5058 | + self.assertEqual(e.exception.message, 'MOZ_OPTION takes 2 values') | ||
5059 | |||
5060 | if nargs in (1, '?', '*', '+') and not disabled: | ||
5061 | value = option.get_value('--%s=' % name, 'option') | ||
5062 | - self.assertEquals(value, PositiveOptionValue(('',))) | ||
5063 | - self.assertEquals(value.origin, 'option') | ||
5064 | + self.assertEqual(value, PositiveOptionValue(('',))) | ||
5065 | + self.assertEqual(value.origin, 'option') | ||
5066 | else: | ||
5067 | with self.assertRaises(InvalidOptionError) as e: | ||
5068 | option.get_value('--%s=' % name, 'option') | ||
5069 | if disabled: | ||
5070 | - self.assertEquals(e.exception.message, | ||
5071 | + self.assertEqual(e.exception.message, | ||
5072 | 'Cannot pass a value to --%s' % name) | ||
5073 | else: | ||
5074 | - self.assertEquals(e.exception.message, | ||
5075 | + self.assertEqual(e.exception.message, | ||
5076 | '--%s takes %d values' % (name, nargs)) | ||
5077 | |||
5078 | with self.assertRaises(AssertionError): | ||
5079 | @@ -501,26 +501,26 @@ class TestOption(unittest.TestCase): | ||
5080 | |||
5081 | if nargs in (1, '?', '*', '+'): | ||
5082 | value = option.get_value('MOZ_OPTION=foo', 'environment') | ||
5083 | - self.assertEquals(value, PositiveOptionValue(('foo',))) | ||
5084 | - self.assertEquals(value.origin, 'environment') | ||
5085 | + self.assertEqual(value, PositiveOptionValue(('foo',))) | ||
5086 | + self.assertEqual(value.origin, 'environment') | ||
5087 | else: | ||
5088 | with self.assertRaises(InvalidOptionError) as e: | ||
5089 | option.get_value('MOZ_OPTION=foo', 'environment') | ||
5090 | - self.assertEquals(e.exception.message, | ||
5091 | + self.assertEqual(e.exception.message, | ||
5092 | 'MOZ_OPTION takes %d values' % nargs) | ||
5093 | |||
5094 | if nargs in (2, '*', '+'): | ||
5095 | value = option.get_value('MOZ_OPTION=foo,bar', 'environment') | ||
5096 | - self.assertEquals(value, PositiveOptionValue(('foo', 'bar'))) | ||
5097 | - self.assertEquals(value.origin, 'environment') | ||
5098 | + self.assertEqual(value, PositiveOptionValue(('foo', 'bar'))) | ||
5099 | + self.assertEqual(value.origin, 'environment') | ||
5100 | else: | ||
5101 | with self.assertRaises(InvalidOptionError) as e: | ||
5102 | option.get_value('MOZ_OPTION=foo,bar', 'environment') | ||
5103 | if nargs == '?': | ||
5104 | - self.assertEquals(e.exception.message, | ||
5105 | + self.assertEqual(e.exception.message, | ||
5106 | 'MOZ_OPTION takes 0 or 1 values') | ||
5107 | else: | ||
5108 | - self.assertEquals(e.exception.message, | ||
5109 | + self.assertEqual(e.exception.message, | ||
5110 | 'MOZ_OPTION takes %d value%s' | ||
5111 | % (nargs, 's' if nargs != 1 else '')) | ||
5112 | |||
5113 | @@ -532,26 +532,26 @@ class TestOption(unittest.TestCase): | ||
5114 | env_option.get_value('--%s' % name) | ||
5115 | |||
5116 | value = env_option.get_value('') | ||
5117 | - self.assertEquals(value, defaultValue) | ||
5118 | - self.assertEquals(value.origin, 'default') | ||
5119 | + self.assertEqual(value, defaultValue) | ||
5120 | + self.assertEqual(value.origin, 'default') | ||
5121 | |||
5122 | value = env_option.get_value('MOZ_OPTION=', 'environment') | ||
5123 | - self.assertEquals(value, negOptionValue()) | ||
5124 | - self.assertEquals(value.origin, 'environment') | ||
5125 | + self.assertEqual(value, negOptionValue()) | ||
5126 | + self.assertEqual(value.origin, 'environment') | ||
5127 | |||
5128 | if nargs in (0, '?', '*'): | ||
5129 | value = env_option.get_value('MOZ_OPTION=1', 'environment') | ||
5130 | - self.assertEquals(value, posOptionValue()) | ||
5131 | + self.assertEqual(value, posOptionValue()) | ||
5132 | self.assertTrue(value) | ||
5133 | - self.assertEquals(value.origin, 'environment') | ||
5134 | + self.assertEqual(value.origin, 'environment') | ||
5135 | elif nargs in (1, '+'): | ||
5136 | value = env_option.get_value('MOZ_OPTION=1', 'environment') | ||
5137 | - self.assertEquals(value, PositiveOptionValue(('1',))) | ||
5138 | - self.assertEquals(value.origin, 'environment') | ||
5139 | + self.assertEqual(value, PositiveOptionValue(('1',))) | ||
5140 | + self.assertEqual(value.origin, 'environment') | ||
5141 | else: | ||
5142 | with self.assertRaises(InvalidOptionError) as e: | ||
5143 | env_option.get_value('MOZ_OPTION=1', 'environment') | ||
5144 | - self.assertEquals(e.exception.message, 'MOZ_OPTION takes 2 values') | ||
5145 | + self.assertEqual(e.exception.message, 'MOZ_OPTION takes 2 values') | ||
5146 | |||
5147 | with self.assertRaises(AssertionError) as e: | ||
5148 | env_option.get_value('--%s' % name) | ||
5149 | @@ -561,26 +561,26 @@ class TestOption(unittest.TestCase): | ||
5150 | |||
5151 | if nargs in (1, '?', '*', '+'): | ||
5152 | value = env_option.get_value('MOZ_OPTION=foo', 'environment') | ||
5153 | - self.assertEquals(value, PositiveOptionValue(('foo',))) | ||
5154 | - self.assertEquals(value.origin, 'environment') | ||
5155 | + self.assertEqual(value, PositiveOptionValue(('foo',))) | ||
5156 | + self.assertEqual(value.origin, 'environment') | ||
5157 | else: | ||
5158 | with self.assertRaises(InvalidOptionError) as e: | ||
5159 | env_option.get_value('MOZ_OPTION=foo', 'environment') | ||
5160 | - self.assertEquals(e.exception.message, | ||
5161 | + self.assertEqual(e.exception.message, | ||
5162 | 'MOZ_OPTION takes %d values' % nargs) | ||
5163 | |||
5164 | if nargs in (2, '*', '+'): | ||
5165 | value = env_option.get_value('MOZ_OPTION=foo,bar', 'environment') | ||
5166 | - self.assertEquals(value, PositiveOptionValue(('foo', 'bar'))) | ||
5167 | - self.assertEquals(value.origin, 'environment') | ||
5168 | + self.assertEqual(value, PositiveOptionValue(('foo', 'bar'))) | ||
5169 | + self.assertEqual(value.origin, 'environment') | ||
5170 | else: | ||
5171 | with self.assertRaises(InvalidOptionError) as e: | ||
5172 | env_option.get_value('MOZ_OPTION=foo,bar', 'environment') | ||
5173 | if nargs == '?': | ||
5174 | - self.assertEquals(e.exception.message, | ||
5175 | + self.assertEqual(e.exception.message, | ||
5176 | 'MOZ_OPTION takes 0 or 1 values') | ||
5177 | else: | ||
5178 | - self.assertEquals(e.exception.message, | ||
5179 | + self.assertEqual(e.exception.message, | ||
5180 | 'MOZ_OPTION takes %d value%s' | ||
5181 | % (nargs, 's' if nargs != 1 else '')) | ||
5182 | |||
5183 | @@ -592,28 +592,28 @@ class TestOption(unittest.TestCase): | ||
5184 | default=default) | ||
5185 | |||
5186 | value = option.get_value('--%s-option' % disable, 'option') | ||
5187 | - self.assertEquals(value, NegativeOptionValue()) | ||
5188 | - self.assertEquals(value.origin, 'option') | ||
5189 | + self.assertEqual(value, NegativeOptionValue()) | ||
5190 | + self.assertEqual(value.origin, 'option') | ||
5191 | |||
5192 | option = self.test_option_value('%s-option' % disable, nargs=nargs, | ||
5193 | default=default) | ||
5194 | |||
5195 | if nargs in (0, '?', '*'): | ||
5196 | value = option.get_value('--%s-option' % enable, 'option') | ||
5197 | - self.assertEquals(value, PositiveOptionValue()) | ||
5198 | - self.assertEquals(value.origin, 'option') | ||
5199 | + self.assertEqual(value, PositiveOptionValue()) | ||
5200 | + self.assertEqual(value.origin, 'option') | ||
5201 | else: | ||
5202 | with self.assertRaises(InvalidOptionError) as e: | ||
5203 | option.get_value('--%s-option' % enable, 'option') | ||
5204 | if nargs == 1: | ||
5205 | - self.assertEquals(e.exception.message, | ||
5206 | + self.assertEqual(e.exception.message, | ||
5207 | '--%s-option takes 1 value' % enable) | ||
5208 | elif nargs == '+': | ||
5209 | - self.assertEquals(e.exception.message, | ||
5210 | + self.assertEqual(e.exception.message, | ||
5211 | '--%s-option takes 1 or more values' | ||
5212 | % enable) | ||
5213 | else: | ||
5214 | - self.assertEquals(e.exception.message, | ||
5215 | + self.assertEqual(e.exception.message, | ||
5216 | '--%s-option takes 2 values' % enable) | ||
5217 | |||
5218 | def test_option_value_with(self): | ||
5219 | @@ -622,12 +622,12 @@ class TestOption(unittest.TestCase): | ||
5220 | def test_option_value_invalid_nargs(self): | ||
5221 | with self.assertRaises(InvalidOptionError) as e: | ||
5222 | Option('--option', nargs='foo') | ||
5223 | - self.assertEquals(e.exception.message, | ||
5224 | + self.assertEqual(e.exception.message, | ||
5225 | "nargs must be a positive integer, '?', '*' or '+'") | ||
5226 | |||
5227 | with self.assertRaises(InvalidOptionError) as e: | ||
5228 | Option('--option', nargs=-2) | ||
5229 | - self.assertEquals(e.exception.message, | ||
5230 | + self.assertEqual(e.exception.message, | ||
5231 | "nargs must be a positive integer, '?', '*' or '+'") | ||
5232 | |||
5233 | def test_option_value_nargs_1(self): | ||
5234 | @@ -638,7 +638,7 @@ class TestOption(unittest.TestCase): | ||
5235 | # A default is required | ||
5236 | with self.assertRaises(InvalidOptionError) as e: | ||
5237 | Option('--disable-option', nargs=1) | ||
5238 | - self.assertEquals(e.exception.message, | ||
5239 | + self.assertEqual(e.exception.message, | ||
5240 | "The given `default` doesn't satisfy `nargs`") | ||
5241 | |||
5242 | def test_option_value_nargs_2(self): | ||
5243 | @@ -649,7 +649,7 @@ class TestOption(unittest.TestCase): | ||
5244 | # A default is required | ||
5245 | with self.assertRaises(InvalidOptionError) as e: | ||
5246 | Option('--disable-option', nargs=2) | ||
5247 | - self.assertEquals(e.exception.message, | ||
5248 | + self.assertEqual(e.exception.message, | ||
5249 | "The given `default` doesn't satisfy `nargs`") | ||
5250 | |||
5251 | def test_option_value_nargs_0_or_1(self): | ||
5252 | @@ -676,7 +676,7 @@ class TestOption(unittest.TestCase): | ||
5253 | # A default is required | ||
5254 | with self.assertRaises(InvalidOptionError) as e: | ||
5255 | Option('--disable-option', nargs='+') | ||
5256 | - self.assertEquals(e.exception.message, | ||
5257 | + self.assertEqual(e.exception.message, | ||
5258 | "The given `default` doesn't satisfy `nargs`") | ||
5259 | |||
5260 | |||
5261 | @@ -684,21 +684,21 @@ class TestCommandLineHelper(unittest.TestCase): | ||
5262 | def test_basic(self): | ||
5263 | helper = CommandLineHelper({}, ['cmd', '--foo', '--bar']) | ||
5264 | |||
5265 | - self.assertEquals(['--foo', '--bar'], list(helper)) | ||
5266 | + self.assertEqual(['--foo', '--bar'], list(helper)) | ||
5267 | |||
5268 | helper.add('--enable-qux') | ||
5269 | |||
5270 | - self.assertEquals(['--foo', '--bar', '--enable-qux'], list(helper)) | ||
5271 | + self.assertEqual(['--foo', '--bar', '--enable-qux'], list(helper)) | ||
5272 | |||
5273 | value, option = helper.handle(Option('--bar')) | ||
5274 | - self.assertEquals(['--foo', '--enable-qux'], list(helper)) | ||
5275 | - self.assertEquals(PositiveOptionValue(), value) | ||
5276 | - self.assertEquals('--bar', option) | ||
5277 | + self.assertEqual(['--foo', '--enable-qux'], list(helper)) | ||
5278 | + self.assertEqual(PositiveOptionValue(), value) | ||
5279 | + self.assertEqual('--bar', option) | ||
5280 | |||
5281 | value, option = helper.handle(Option('--baz')) | ||
5282 | - self.assertEquals(['--foo', '--enable-qux'], list(helper)) | ||
5283 | - self.assertEquals(NegativeOptionValue(), value) | ||
5284 | - self.assertEquals(None, option) | ||
5285 | + self.assertEqual(['--foo', '--enable-qux'], list(helper)) | ||
5286 | + self.assertEqual(NegativeOptionValue(), value) | ||
5287 | + self.assertEqual(None, option) | ||
5288 | |||
5289 | with self.assertRaises(AssertionError): | ||
5290 | CommandLineHelper({}, ['--foo', '--bar']) | ||
5291 | @@ -707,89 +707,89 @@ class TestCommandLineHelper(unittest.TestCase): | ||
5292 | foo = Option('--with-foo', nargs='*') | ||
5293 | helper = CommandLineHelper({}, ['cmd', '--with-foo=a,b']) | ||
5294 | value, option = helper.handle(foo) | ||
5295 | - self.assertEquals(PositiveOptionValue(('a', 'b')), value) | ||
5296 | - self.assertEquals('command-line', value.origin) | ||
5297 | - self.assertEquals('--with-foo=a,b', option) | ||
5298 | + self.assertEqual(PositiveOptionValue(('a', 'b')), value) | ||
5299 | + self.assertEqual('command-line', value.origin) | ||
5300 | + self.assertEqual('--with-foo=a,b', option) | ||
5301 | |||
5302 | helper = CommandLineHelper({}, ['cmd', '--with-foo=a,b', | ||
5303 | '--without-foo']) | ||
5304 | value, option = helper.handle(foo) | ||
5305 | - self.assertEquals(NegativeOptionValue(), value) | ||
5306 | - self.assertEquals('command-line', value.origin) | ||
5307 | - self.assertEquals('--without-foo', option) | ||
5308 | + self.assertEqual(NegativeOptionValue(), value) | ||
5309 | + self.assertEqual('command-line', value.origin) | ||
5310 | + self.assertEqual('--without-foo', option) | ||
5311 | |||
5312 | helper = CommandLineHelper({}, ['cmd', '--without-foo', | ||
5313 | '--with-foo=a,b']) | ||
5314 | value, option = helper.handle(foo) | ||
5315 | - self.assertEquals(PositiveOptionValue(('a', 'b')), value) | ||
5316 | - self.assertEquals('command-line', value.origin) | ||
5317 | - self.assertEquals('--with-foo=a,b', option) | ||
5318 | + self.assertEqual(PositiveOptionValue(('a', 'b')), value) | ||
5319 | + self.assertEqual('command-line', value.origin) | ||
5320 | + self.assertEqual('--with-foo=a,b', option) | ||
5321 | |||
5322 | foo = Option('--with-foo', env='FOO', nargs='*') | ||
5323 | helper = CommandLineHelper({'FOO': ''}, ['cmd', '--with-foo=a,b']) | ||
5324 | value, option = helper.handle(foo) | ||
5325 | - self.assertEquals(PositiveOptionValue(('a', 'b')), value) | ||
5326 | - self.assertEquals('command-line', value.origin) | ||
5327 | - self.assertEquals('--with-foo=a,b', option) | ||
5328 | + self.assertEqual(PositiveOptionValue(('a', 'b')), value) | ||
5329 | + self.assertEqual('command-line', value.origin) | ||
5330 | + self.assertEqual('--with-foo=a,b', option) | ||
5331 | |||
5332 | helper = CommandLineHelper({'FOO': 'a,b'}, ['cmd', '--without-foo']) | ||
5333 | value, option = helper.handle(foo) | ||
5334 | - self.assertEquals(NegativeOptionValue(), value) | ||
5335 | - self.assertEquals('command-line', value.origin) | ||
5336 | - self.assertEquals('--without-foo', option) | ||
5337 | + self.assertEqual(NegativeOptionValue(), value) | ||
5338 | + self.assertEqual('command-line', value.origin) | ||
5339 | + self.assertEqual('--without-foo', option) | ||
5340 | |||
5341 | helper = CommandLineHelper({'FOO': ''}, ['cmd', '--with-bar=a,b']) | ||
5342 | value, option = helper.handle(foo) | ||
5343 | - self.assertEquals(NegativeOptionValue(), value) | ||
5344 | - self.assertEquals('environment', value.origin) | ||
5345 | - self.assertEquals('FOO=', option) | ||
5346 | + self.assertEqual(NegativeOptionValue(), value) | ||
5347 | + self.assertEqual('environment', value.origin) | ||
5348 | + self.assertEqual('FOO=', option) | ||
5349 | |||
5350 | helper = CommandLineHelper({'FOO': 'a,b'}, ['cmd', '--without-bar']) | ||
5351 | value, option = helper.handle(foo) | ||
5352 | - self.assertEquals(PositiveOptionValue(('a', 'b')), value) | ||
5353 | - self.assertEquals('environment', value.origin) | ||
5354 | - self.assertEquals('FOO=a,b', option) | ||
5355 | + self.assertEqual(PositiveOptionValue(('a', 'b')), value) | ||
5356 | + self.assertEqual('environment', value.origin) | ||
5357 | + self.assertEqual('FOO=a,b', option) | ||
5358 | |||
5359 | helper = CommandLineHelper({}, ['cmd', '--with-foo=a,b', 'FOO=']) | ||
5360 | value, option = helper.handle(foo) | ||
5361 | - self.assertEquals(NegativeOptionValue(), value) | ||
5362 | - self.assertEquals('command-line', value.origin) | ||
5363 | - self.assertEquals('FOO=', option) | ||
5364 | + self.assertEqual(NegativeOptionValue(), value) | ||
5365 | + self.assertEqual('command-line', value.origin) | ||
5366 | + self.assertEqual('FOO=', option) | ||
5367 | |||
5368 | helper = CommandLineHelper({}, ['cmd', '--without-foo', 'FOO=a,b']) | ||
5369 | value, option = helper.handle(foo) | ||
5370 | - self.assertEquals(PositiveOptionValue(('a', 'b')), value) | ||
5371 | - self.assertEquals('command-line', value.origin) | ||
5372 | - self.assertEquals('FOO=a,b', option) | ||
5373 | + self.assertEqual(PositiveOptionValue(('a', 'b')), value) | ||
5374 | + self.assertEqual('command-line', value.origin) | ||
5375 | + self.assertEqual('FOO=a,b', option) | ||
5376 | |||
5377 | helper = CommandLineHelper({}, ['cmd', 'FOO=', '--with-foo=a,b']) | ||
5378 | value, option = helper.handle(foo) | ||
5379 | - self.assertEquals(PositiveOptionValue(('a', 'b')), value) | ||
5380 | - self.assertEquals('command-line', value.origin) | ||
5381 | - self.assertEquals('--with-foo=a,b', option) | ||
5382 | + self.assertEqual(PositiveOptionValue(('a', 'b')), value) | ||
5383 | + self.assertEqual('command-line', value.origin) | ||
5384 | + self.assertEqual('--with-foo=a,b', option) | ||
5385 | |||
5386 | helper = CommandLineHelper({}, ['cmd', 'FOO=a,b', '--without-foo']) | ||
5387 | value, option = helper.handle(foo) | ||
5388 | - self.assertEquals(NegativeOptionValue(), value) | ||
5389 | - self.assertEquals('command-line', value.origin) | ||
5390 | - self.assertEquals('--without-foo', option) | ||
5391 | + self.assertEqual(NegativeOptionValue(), value) | ||
5392 | + self.assertEqual('command-line', value.origin) | ||
5393 | + self.assertEqual('--without-foo', option) | ||
5394 | |||
5395 | def test_extra_args(self): | ||
5396 | foo = Option('--with-foo', env='FOO', nargs='*') | ||
5397 | helper = CommandLineHelper({}, ['cmd']) | ||
5398 | helper.add('FOO=a,b,c', 'other-origin') | ||
5399 | value, option = helper.handle(foo) | ||
5400 | - self.assertEquals(PositiveOptionValue(('a', 'b', 'c')), value) | ||
5401 | - self.assertEquals('other-origin', value.origin) | ||
5402 | - self.assertEquals('FOO=a,b,c', option) | ||
5403 | + self.assertEqual(PositiveOptionValue(('a', 'b', 'c')), value) | ||
5404 | + self.assertEqual('other-origin', value.origin) | ||
5405 | + self.assertEqual('FOO=a,b,c', option) | ||
5406 | |||
5407 | helper = CommandLineHelper({}, ['cmd']) | ||
5408 | helper.add('FOO=a,b,c', 'other-origin') | ||
5409 | helper.add('--with-foo=a,b,c', 'other-origin') | ||
5410 | value, option = helper.handle(foo) | ||
5411 | - self.assertEquals(PositiveOptionValue(('a', 'b', 'c')), value) | ||
5412 | - self.assertEquals('other-origin', value.origin) | ||
5413 | - self.assertEquals('--with-foo=a,b,c', option) | ||
5414 | + self.assertEqual(PositiveOptionValue(('a', 'b', 'c')), value) | ||
5415 | + self.assertEqual('other-origin', value.origin) | ||
5416 | + self.assertEqual('--with-foo=a,b,c', option) | ||
5417 | |||
5418 | # Adding conflicting options is not allowed. | ||
5419 | helper = CommandLineHelper({}, ['cmd']) | ||
5420 | @@ -809,9 +809,9 @@ class TestCommandLineHelper(unittest.TestCase): | ||
5421 | # But adding the same is allowed. | ||
5422 | helper.add('FOO=a,b,c', 'other-origin') | ||
5423 | value, option = helper.handle(foo) | ||
5424 | - self.assertEquals(PositiveOptionValue(('a', 'b', 'c')), value) | ||
5425 | - self.assertEquals('other-origin', value.origin) | ||
5426 | - self.assertEquals('FOO=a,b,c', option) | ||
5427 | + self.assertEqual(PositiveOptionValue(('a', 'b', 'c')), value) | ||
5428 | + self.assertEqual('other-origin', value.origin) | ||
5429 | + self.assertEqual('FOO=a,b,c', option) | ||
5430 | |||
5431 | # The same rule as above applies when using the option form vs. the | ||
5432 | # variable form. But we can't detect it when .add is called. | ||
5433 | @@ -837,9 +837,9 @@ class TestCommandLineHelper(unittest.TestCase): | ||
5434 | helper.add('FOO=a,b,c', 'other-origin') | ||
5435 | helper.add('--with-foo=a,b,c', 'other-origin') | ||
5436 | value, option = helper.handle(foo) | ||
5437 | - self.assertEquals(PositiveOptionValue(('a', 'b', 'c')), value) | ||
5438 | - self.assertEquals('other-origin', value.origin) | ||
5439 | - self.assertEquals('--with-foo=a,b,c', option) | ||
5440 | + self.assertEqual(PositiveOptionValue(('a', 'b', 'c')), value) | ||
5441 | + self.assertEqual('other-origin', value.origin) | ||
5442 | + self.assertEqual('--with-foo=a,b,c', option) | ||
5443 | |||
5444 | # Conflicts are also not allowed against what is in the | ||
5445 | # environment/on the command line. | ||
5446 | @@ -869,19 +869,19 @@ class TestCommandLineHelper(unittest.TestCase): | ||
5447 | foo = Option('--foo', | ||
5448 | possible_origins=('command-line',)) | ||
5449 | value, option = helper.handle(foo) | ||
5450 | - self.assertEquals(PositiveOptionValue(), value) | ||
5451 | - self.assertEquals('command-line', value.origin) | ||
5452 | - self.assertEquals('--foo', option) | ||
5453 | + self.assertEqual(PositiveOptionValue(), value) | ||
5454 | + self.assertEqual('command-line', value.origin) | ||
5455 | + self.assertEqual('--foo', option) | ||
5456 | |||
5457 | bar = Option('--bar', | ||
5458 | possible_origins=('mozconfig',)) | ||
5459 | - with self.assertRaisesRegexp(InvalidOptionError, | ||
5460 | + with self.assertRaisesRegex(InvalidOptionError, | ||
5461 | "--bar can not be set by command-line. Values are accepted from: mozconfig"): | ||
5462 | helper.handle(bar) | ||
5463 | |||
5464 | baz = Option(env='BAZ', | ||
5465 | possible_origins=('implied',)) | ||
5466 | - with self.assertRaisesRegexp(InvalidOptionError, | ||
5467 | + with self.assertRaisesRegex(InvalidOptionError, | ||
5468 | "BAZ=1 can not be set by environment. Values are accepted from: implied"): | ||
5469 | helper.handle(baz) | ||
5470 | |||
5471 | diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py | ||
5472 | index cb7ff709e..c339a32bf 100755 | ||
5473 | --- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py | ||
5474 | +++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py | ||
5475 | @@ -2,12 +2,12 @@ | ||
5476 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
5477 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
5478 | |||
5479 | -from __future__ import absolute_import, print_function, unicode_literals | ||
5480 | + | ||
5481 | |||
5482 | import logging | ||
5483 | import os | ||
5484 | |||
5485 | -from StringIO import StringIO | ||
5486 | +from io import StringIO | ||
5487 | |||
5488 | from mozunit import main | ||
5489 | |||
5490 | @@ -366,9 +366,9 @@ class BaseToolchainTest(BaseConfigureTest): | ||
5491 | compiler = sandbox._value_for(sandbox[var]) | ||
5492 | # Add var on both ends to make it clear which of the | ||
5493 | # variables is failing the test when that happens. | ||
5494 | - self.assertEquals((var, compiler), (var, result)) | ||
5495 | + self.assertEqual((var, compiler), (var, result)) | ||
5496 | except SystemExit: | ||
5497 | - self.assertEquals((var, result), | ||
5498 | + self.assertEqual((var, result), | ||
5499 | (var, self.out.getvalue().strip())) | ||
5500 | return | ||
5501 | |||
5502 | @@ -407,7 +407,7 @@ class BaseToolchainTest(BaseConfigureTest): | ||
5503 | 'RUST_LIB_SUFFIX', | ||
5504 | 'OBJ_SUFFIX', | ||
5505 | ): | ||
5506 | - self.assertEquals('%s=%s' % (k, sandbox.get_config(k)), | ||
5507 | + self.assertEqual('%s=%s' % (k, sandbox.get_config(k)), | ||
5508 | '%s=%s' % (k, library_name_info[k])) | ||
5509 | |||
5510 | |||
5511 | @@ -584,7 +584,7 @@ class LinuxToolchainTest(BaseToolchainTest): | ||
5512 | # We'll try gcc and clang, but since there is no gcc (gcc-x.y doesn't | ||
5513 | # count), find clang. | ||
5514 | paths = { | ||
5515 | - k: v for k, v in self.PATHS.iteritems() | ||
5516 | + k: v for k, v in self.PATHS.items() | ||
5517 | if os.path.basename(k) not in ('gcc', 'g++') | ||
5518 | } | ||
5519 | self.do_toolchain_test(paths, { | ||
5520 | @@ -619,7 +619,7 @@ class LinuxToolchainTest(BaseToolchainTest): | ||
5521 | # Even if there are gcc-x.y or clang-x.y compilers available, we | ||
5522 | # don't try them. This could be considered something to improve. | ||
5523 | paths = { | ||
5524 | - k: v for k, v in self.PATHS.iteritems() | ||
5525 | + k: v for k, v in self.PATHS.items() | ||
5526 | if os.path.basename(k) not in ('gcc', 'g++', 'clang', 'clang++') | ||
5527 | } | ||
5528 | self.do_toolchain_test(paths, { | ||
5529 | @@ -800,7 +800,7 @@ class OSXToolchainTest(BaseToolchainTest): | ||
5530 | def test_not_gcc(self): | ||
5531 | # We won't pick GCC if it's the only thing available. | ||
5532 | paths = { | ||
5533 | - k: v for k, v in self.PATHS.iteritems() | ||
5534 | + k: v for k, v in self.PATHS.items() | ||
5535 | if os.path.basename(k) not in ('clang', 'clang++') | ||
5536 | } | ||
5537 | self.do_toolchain_test(paths, { | ||
5538 | @@ -976,7 +976,7 @@ class WindowsToolchainTest(BaseToolchainTest): | ||
5539 | def test_clang_cl(self): | ||
5540 | # We'll pick clang-cl if msvc can't be found. | ||
5541 | paths = { | ||
5542 | - k: v for k, v in self.PATHS.iteritems() | ||
5543 | + k: v for k, v in self.PATHS.items() | ||
5544 | if os.path.basename(k) != 'cl' | ||
5545 | } | ||
5546 | self.do_toolchain_test(paths, { | ||
5547 | @@ -987,7 +987,7 @@ class WindowsToolchainTest(BaseToolchainTest): | ||
5548 | def test_gcc(self): | ||
5549 | # We'll pick GCC if msvc and clang-cl can't be found. | ||
5550 | paths = { | ||
5551 | - k: v for k, v in self.PATHS.iteritems() | ||
5552 | + k: v for k, v in self.PATHS.items() | ||
5553 | if os.path.basename(k) not in ('cl', 'clang-cl') | ||
5554 | } | ||
5555 | self.do_toolchain_test(paths, { | ||
5556 | @@ -1006,7 +1006,7 @@ class WindowsToolchainTest(BaseToolchainTest): | ||
5557 | def test_clang(self): | ||
5558 | # We'll pick clang if nothing else is found. | ||
5559 | paths = { | ||
5560 | - k: v for k, v in self.PATHS.iteritems() | ||
5561 | + k: v for k, v in self.PATHS.items() | ||
5562 | if os.path.basename(k) not in ('cl', 'clang-cl', 'gcc') | ||
5563 | } | ||
5564 | self.do_toolchain_test(paths, { | ||
5565 | diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_helpers.py b/python/mozbuild/mozbuild/test/configure/test_toolchain_helpers.py | ||
5566 | index 8ec33a8b7..ba046ed12 100644 | ||
5567 | --- a/python/mozbuild/mozbuild/test/configure/test_toolchain_helpers.py | ||
5568 | +++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_helpers.py | ||
5569 | @@ -2,7 +2,7 @@ | ||
5570 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
5571 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
5572 | |||
5573 | -from __future__ import absolute_import, print_function, unicode_literals | ||
5574 | + | ||
5575 | |||
5576 | import copy | ||
5577 | import re | ||
5578 | @@ -10,7 +10,7 @@ import types | ||
5579 | import unittest | ||
5580 | |||
5581 | from fnmatch import fnmatch | ||
5582 | -from StringIO import StringIO | ||
5583 | +from io import StringIO | ||
5584 | from textwrap import dedent | ||
5585 | |||
5586 | from mozunit import ( | ||
5587 | @@ -43,7 +43,7 @@ class CompilerPreprocessor(Preprocessor): | ||
5588 | # Hack around it enough that the configure tests work properly. | ||
5589 | context = self.context | ||
5590 | def normalize_numbers(value): | ||
5591 | - if isinstance(value, types.StringTypes): | ||
5592 | + if isinstance(value, (str,)): | ||
5593 | if value[-1:] == 'L' and value[:-1].isdigit(): | ||
5594 | value = int(value[:-1]) | ||
5595 | return value | ||
5596 | @@ -53,7 +53,7 @@ class CompilerPreprocessor(Preprocessor): | ||
5597 | return self.HAS_FEATURE.sub(r'\1\2', expr) | ||
5598 | self.context = self.Context( | ||
5599 | (normalize_has_feature(k), normalize_numbers(v)) | ||
5600 | - for k, v in context.iteritems() | ||
5601 | + for k, v in context.items() | ||
5602 | ) | ||
5603 | try: | ||
5604 | return Preprocessor.do_if(self, normalize_has_feature(expression), | ||
5605 | @@ -95,7 +95,7 @@ class TestCompilerPreprocessor(unittest.TestCase): | ||
5606 | input.name = 'foo' | ||
5607 | pp.do_include(input) | ||
5608 | |||
5609 | - self.assertEquals(pp.out.getvalue(), '1 . 2 . c "D"') | ||
5610 | + self.assertEqual(pp.out.getvalue(), '1 . 2 . c "D"') | ||
5611 | |||
5612 | def test_condition(self): | ||
5613 | pp = CompilerPreprocessor({ | ||
5614 | @@ -125,7 +125,7 @@ class TestCompilerPreprocessor(unittest.TestCase): | ||
5615 | input.name = 'foo' | ||
5616 | pp.do_include(input) | ||
5617 | |||
5618 | - self.assertEquals('IFDEF_A\nIF_A\nIF_B\nIF_NOT_C\n', pp.out.getvalue()) | ||
5619 | + self.assertEqual('IFDEF_A\nIF_A\nIF_B\nIF_NOT_C\n', pp.out.getvalue()) | ||
5620 | |||
5621 | |||
5622 | class FakeCompiler(dict): | ||
5623 | @@ -164,9 +164,9 @@ class FakeCompiler(dict): | ||
5624 | ''' | ||
5625 | def __init__(self, *definitions): | ||
5626 | for definition in definitions: | ||
5627 | - if all(not isinstance(d, dict) for d in definition.itervalues()): | ||
5628 | + if all(not isinstance(d, dict) for d in definition.values()): | ||
5629 | definition = {None: definition} | ||
5630 | - for key, value in definition.iteritems(): | ||
5631 | + for key, value in definition.items(): | ||
5632 | self.setdefault(key, {}).update(value) | ||
5633 | |||
5634 | def __call__(self, stdin, args): | ||
5635 | @@ -178,14 +178,14 @@ class FakeCompiler(dict): | ||
5636 | pp = CompilerPreprocessor(self[None]) | ||
5637 | |||
5638 | def apply_defn(defn): | ||
5639 | - for k, v in defn.iteritems(): | ||
5640 | + for k, v in defn.items(): | ||
5641 | if v is False: | ||
5642 | if k in pp.context: | ||
5643 | del pp.context[k] | ||
5644 | else: | ||
5645 | pp.context[k] = v | ||
5646 | |||
5647 | - for glob, defn in self.iteritems(): | ||
5648 | + for glob, defn in self.items(): | ||
5649 | if glob and not glob.startswith('-') and fnmatch(file, glob): | ||
5650 | apply_defn(defn) | ||
5651 | |||
5652 | @@ -216,7 +216,7 @@ class TestFakeCompiler(unittest.TestCase): | ||
5653 | 'A': '1', | ||
5654 | 'B': '2', | ||
5655 | }) | ||
5656 | - self.assertEquals(compiler(None, ['-E', 'file']), | ||
5657 | + self.assertEqual(compiler(None, ['-E', 'file']), | ||
5658 | (0, '1 2 C', '')) | ||
5659 | |||
5660 | compiler = FakeCompiler({ | ||
5661 | @@ -238,25 +238,25 @@ class TestFakeCompiler(unittest.TestCase): | ||
5662 | 'B': '42', | ||
5663 | }, | ||
5664 | }) | ||
5665 | - self.assertEquals(compiler(None, ['-E', 'file']), | ||
5666 | + self.assertEqual(compiler(None, ['-E', 'file']), | ||
5667 | (0, '1 2 C', '')) | ||
5668 | - self.assertEquals(compiler(None, ['-E', '-foo', 'file']), | ||
5669 | + self.assertEqual(compiler(None, ['-E', '-foo', 'file']), | ||
5670 | (0, '1 2 foo', '')) | ||
5671 | - self.assertEquals(compiler(None, ['-E', '-bar', 'file']), | ||
5672 | + self.assertEqual(compiler(None, ['-E', '-bar', 'file']), | ||
5673 | (0, '1 bar bar', '')) | ||
5674 | - self.assertEquals(compiler(None, ['-E', '-qux', 'file']), | ||
5675 | + self.assertEqual(compiler(None, ['-E', '-qux', 'file']), | ||
5676 | (0, '1 B C', '')) | ||
5677 | - self.assertEquals(compiler(None, ['-E', '-foo', '-bar', 'file']), | ||
5678 | + self.assertEqual(compiler(None, ['-E', '-foo', '-bar', 'file']), | ||
5679 | (0, '1 bar bar', '')) | ||
5680 | - self.assertEquals(compiler(None, ['-E', '-bar', '-foo', 'file']), | ||
5681 | + self.assertEqual(compiler(None, ['-E', '-bar', '-foo', 'file']), | ||
5682 | (0, '1 bar foo', '')) | ||
5683 | - self.assertEquals(compiler(None, ['-E', '-bar', '-qux', 'file']), | ||
5684 | + self.assertEqual(compiler(None, ['-E', '-bar', '-qux', 'file']), | ||
5685 | (0, '1 B bar', '')) | ||
5686 | - self.assertEquals(compiler(None, ['-E', '-qux', '-bar', 'file']), | ||
5687 | + self.assertEqual(compiler(None, ['-E', '-qux', '-bar', 'file']), | ||
5688 | (0, '1 bar bar', '')) | ||
5689 | - self.assertEquals(compiler(None, ['-E', 'file.c']), | ||
5690 | + self.assertEqual(compiler(None, ['-E', 'file.c']), | ||
5691 | (0, '1 42 C', '')) | ||
5692 | - self.assertEquals(compiler(None, ['-E', '-bar', 'file.c']), | ||
5693 | + self.assertEqual(compiler(None, ['-E', '-bar', 'file.c']), | ||
5694 | (0, '1 bar bar', '')) | ||
5695 | |||
5696 | def test_multiple_definitions(self): | ||
5697 | @@ -267,7 +267,7 @@ class TestFakeCompiler(unittest.TestCase): | ||
5698 | 'C': 3, | ||
5699 | }) | ||
5700 | |||
5701 | - self.assertEquals(compiler, { | ||
5702 | + self.assertEqual(compiler, { | ||
5703 | None: { | ||
5704 | 'A': 1, | ||
5705 | 'B': 2, | ||
5706 | @@ -282,7 +282,7 @@ class TestFakeCompiler(unittest.TestCase): | ||
5707 | 'C': 3, | ||
5708 | }) | ||
5709 | |||
5710 | - self.assertEquals(compiler, { | ||
5711 | + self.assertEqual(compiler, { | ||
5712 | None: { | ||
5713 | 'A': 1, | ||
5714 | 'B': 4, | ||
5715 | @@ -302,7 +302,7 @@ class TestFakeCompiler(unittest.TestCase): | ||
5716 | }, | ||
5717 | }) | ||
5718 | |||
5719 | - self.assertEquals(compiler, { | ||
5720 | + self.assertEqual(compiler, { | ||
5721 | None: { | ||
5722 | 'A': 1, | ||
5723 | 'B': 4, | ||
5724 | @@ -330,7 +330,7 @@ class TestFakeCompiler(unittest.TestCase): | ||
5725 | }, | ||
5726 | }) | ||
5727 | |||
5728 | - self.assertEquals(compiler, { | ||
5729 | + self.assertEqual(compiler, { | ||
5730 | None: { | ||
5731 | 'A': 1, | ||
5732 | 'B': 2, | ||
5733 | @@ -370,7 +370,7 @@ class CompilerResult(ReadOnlyNamespace): | ||
5734 | def __add__(self, other): | ||
5735 | assert isinstance(other, dict) | ||
5736 | result = copy.deepcopy(self.__dict__) | ||
5737 | - for k, v in other.iteritems(): | ||
5738 | + for k, v in other.items(): | ||
5739 | if k == 'flags': | ||
5740 | result.setdefault(k, []).extend(v) | ||
5741 | else: | ||
5742 | @@ -381,7 +381,7 @@ class CompilerResult(ReadOnlyNamespace): | ||
5743 | class TestCompilerResult(unittest.TestCase): | ||
5744 | def test_compiler_result(self): | ||
5745 | result = CompilerResult() | ||
5746 | - self.assertEquals(result.__dict__, { | ||
5747 | + self.assertEqual(result.__dict__, { | ||
5748 | 'wrapper': [], | ||
5749 | 'compiler': mozpath.abspath(''), | ||
5750 | 'version': '', | ||
5751 | @@ -397,7 +397,7 @@ class TestCompilerResult(unittest.TestCase): | ||
5752 | language='C', | ||
5753 | flags=['-std=gnu99'], | ||
5754 | ) | ||
5755 | - self.assertEquals(result.__dict__, { | ||
5756 | + self.assertEqual(result.__dict__, { | ||
5757 | 'wrapper': [], | ||
5758 | 'compiler': mozpath.abspath('/usr/bin/gcc'), | ||
5759 | 'version': '4.2.1', | ||
5760 | @@ -407,7 +407,7 @@ class TestCompilerResult(unittest.TestCase): | ||
5761 | }) | ||
5762 | |||
5763 | result2 = result + {'flags': ['-m32']} | ||
5764 | - self.assertEquals(result2.__dict__, { | ||
5765 | + self.assertEqual(result2.__dict__, { | ||
5766 | 'wrapper': [], | ||
5767 | 'compiler': mozpath.abspath('/usr/bin/gcc'), | ||
5768 | 'version': '4.2.1', | ||
5769 | @@ -416,14 +416,14 @@ class TestCompilerResult(unittest.TestCase): | ||
5770 | 'flags': ['-std=gnu99', '-m32'], | ||
5771 | }) | ||
5772 | # Original flags are untouched. | ||
5773 | - self.assertEquals(result.flags, ['-std=gnu99']) | ||
5774 | + self.assertEqual(result.flags, ['-std=gnu99']) | ||
5775 | |||
5776 | result3 = result + { | ||
5777 | 'compiler': '/usr/bin/gcc-4.7', | ||
5778 | 'version': '4.7.3', | ||
5779 | 'flags': ['-m32'], | ||
5780 | } | ||
5781 | - self.assertEquals(result3.__dict__, { | ||
5782 | + self.assertEqual(result3.__dict__, { | ||
5783 | 'wrapper': [], | ||
5784 | 'compiler': mozpath.abspath('/usr/bin/gcc-4.7'), | ||
5785 | 'version': '4.7.3', | ||
5786 | diff --git a/python/mozbuild/mozbuild/test/configure/test_toolkit_moz_configure.py b/python/mozbuild/mozbuild/test/configure/test_toolkit_moz_configure.py | ||
5787 | index ac35d745f..cdd8ece1b 100644 | ||
5788 | --- a/python/mozbuild/mozbuild/test/configure/test_toolkit_moz_configure.py | ||
5789 | +++ b/python/mozbuild/mozbuild/test/configure/test_toolkit_moz_configure.py | ||
5790 | @@ -2,7 +2,7 @@ | ||
5791 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
5792 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
5793 | |||
5794 | -from __future__ import absolute_import, print_function, unicode_literals | ||
5795 | + | ||
5796 | |||
5797 | import os | ||
5798 | |||
5799 | diff --git a/python/mozbuild/mozbuild/test/configure/test_util.py b/python/mozbuild/mozbuild/test/configure/test_util.py | ||
5800 | index 9f9575fd0..c2db1a628 100644 | ||
5801 | --- a/python/mozbuild/mozbuild/test/configure/test_util.py | ||
5802 | +++ b/python/mozbuild/mozbuild/test/configure/test_util.py | ||
5803 | @@ -2,7 +2,7 @@ | ||
5804 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
5805 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
5806 | |||
5807 | -from __future__ import absolute_import, print_function, unicode_literals | ||
5808 | + | ||
5809 | |||
5810 | import logging | ||
5811 | import os | ||
5812 | @@ -11,7 +11,7 @@ import textwrap | ||
5813 | import unittest | ||
5814 | import sys | ||
5815 | |||
5816 | -from StringIO import StringIO | ||
5817 | +from io import StringIO | ||
5818 | |||
5819 | from mozunit import main | ||
5820 | from mozpack import path as mozpath | ||
5821 | @@ -434,11 +434,11 @@ class TestLogSubprocessOutput(unittest.TestCase): | ||
5822 | except SystemExit as e: | ||
5823 | status = e.code | ||
5824 | |||
5825 | - self.assertEquals(status, 0) | ||
5826 | + self.assertEqual(status, 0) | ||
5827 | quote_char = "'" | ||
5828 | if getpreferredencoding().lower() == 'utf-8': | ||
5829 | quote_char = '\u00B4'.encode('utf-8') | ||
5830 | - self.assertEquals(out.getvalue().strip(), quote_char) | ||
5831 | + self.assertEqual(out.getvalue().strip(), quote_char) | ||
5832 | |||
5833 | |||
5834 | class TestVersion(unittest.TestCase): | ||
5835 | diff --git a/python/mozbuild/mozbuild/testing.py b/python/mozbuild/mozbuild/testing.py | ||
5836 | index 3229c3f77..82d250fab 100644 | ||
5837 | --- a/python/mozbuild/mozbuild/testing.py | ||
5838 | +++ b/python/mozbuild/mozbuild/testing.py | ||
5839 | @@ -2,9 +2,9 @@ | ||
5840 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
5841 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
5842 | |||
5843 | -from __future__ import absolute_import, unicode_literals | ||
5844 | |||
5845 | -import cPickle as pickle | ||
5846 | + | ||
5847 | +import pickle as pickle | ||
5848 | import os | ||
5849 | import sys | ||
5850 | |||
5851 | @@ -70,7 +70,7 @@ REFTEST_FLAVORS = ('crashtest', 'reftest') | ||
5852 | WEB_PLATFORM_TESTS_FLAVORS = ('web-platform-tests',) | ||
5853 | |||
5854 | def all_test_flavors(): | ||
5855 | - return ([v[0] for v in TEST_MANIFESTS.values()] + | ||
5856 | + return ([v[0] for v in list(TEST_MANIFESTS.values())] + | ||
5857 | list(REFTEST_FLAVORS) + | ||
5858 | list(WEB_PLATFORM_TESTS_FLAVORS)) | ||
5859 | |||
5860 | @@ -210,7 +210,7 @@ def install_test_files(topsrcdir, topobjdir, tests_root, test_objs): | ||
5861 | only a few tests need to be run. | ||
5862 | """ | ||
5863 | flavor_info = {flavor: (root, prefix, install) | ||
5864 | - for (flavor, root, prefix, install) in TEST_MANIFESTS.values()} | ||
5865 | + for (flavor, root, prefix, install) in list(TEST_MANIFESTS.values())} | ||
5866 | objdir_dest = mozpath.join(topobjdir, tests_root) | ||
5867 | |||
5868 | converter = SupportFilesConverter() | ||
5869 | @@ -292,7 +292,7 @@ def read_wpt_manifest(context, paths): | ||
5870 | paths_file = os.path.join(context.config.topsrcdir, "testing", | ||
5871 | "web-platform", "tests", "tools", "localpaths.py") | ||
5872 | _globals = {"__file__": paths_file} | ||
5873 | - execfile(paths_file, _globals) | ||
5874 | + exec(compile(open(paths_file, "rb").read(), paths_file, 'exec'), _globals) | ||
5875 | import manifest as wptmanifest | ||
5876 | finally: | ||
5877 | sys.path = old_path | ||
5878 | diff --git a/python/mozbuild/mozbuild/util.py b/python/mozbuild/mozbuild/util.py | ||
5879 | index 4ea227dc0..79cb15713 100644 | ||
5880 | --- a/python/mozbuild/mozbuild/util.py | ||
5881 | +++ b/python/mozbuild/mozbuild/util.py | ||
5882 | @@ -5,7 +5,7 @@ | ||
5883 | # This file contains miscellaneous utility functions that don't belong anywhere | ||
5884 | # in particular. | ||
5885 | |||
5886 | -from __future__ import absolute_import, unicode_literals, print_function | ||
5887 | + | ||
5888 | |||
5889 | import argparse | ||
5890 | import collections | ||
5891 | @@ -21,6 +21,9 @@ import stat | ||
5892 | import sys | ||
5893 | import time | ||
5894 | import types | ||
5895 | +import pprint | ||
5896 | +import six | ||
5897 | +import subprocess | ||
5898 | |||
5899 | from collections import ( | ||
5900 | defaultdict, | ||
5901 | @@ -36,7 +39,7 @@ from io import ( | ||
5902 | if sys.version_info[0] == 3: | ||
5903 | str_type = str | ||
5904 | else: | ||
5905 | - str_type = basestring | ||
5906 | + str_type = str | ||
5907 | |||
5908 | if sys.platform == 'win32': | ||
5909 | _kernel32 = ctypes.windll.kernel32 | ||
5910 | @@ -78,7 +81,7 @@ def hash_file(path, hasher=None): | ||
5911 | return h.hexdigest() | ||
5912 | |||
5913 | |||
5914 | -class EmptyValue(unicode): | ||
5915 | +class EmptyValue(str): | ||
5916 | """A dummy type that behaves like an empty string and sequence. | ||
5917 | |||
5918 | This type exists in order to support | ||
5919 | @@ -92,7 +95,7 @@ class EmptyValue(unicode): | ||
5920 | class ReadOnlyNamespace(object): | ||
5921 | """A class for objects with immutable attributes set at initialization.""" | ||
5922 | def __init__(self, **kwargs): | ||
5923 | - for k, v in kwargs.iteritems(): | ||
5924 | + for k, v in kwargs.items(): | ||
5925 | super(ReadOnlyNamespace, self).__setattr__(k, v) | ||
5926 | |||
5927 | def __delattr__(self, key): | ||
5928 | @@ -224,7 +227,7 @@ class FileAvoidWrite(BytesIO): | ||
5929 | self.mode = mode | ||
5930 | |||
5931 | def write(self, buf): | ||
5932 | - if isinstance(buf, unicode): | ||
5933 | + if isinstance(buf, str): | ||
5934 | buf = buf.encode('utf-8') | ||
5935 | BytesIO.write(self, buf) | ||
5936 | |||
5937 | @@ -267,6 +270,10 @@ class FileAvoidWrite(BytesIO): | ||
5938 | if 'b' in self.mode: | ||
5939 | writemode += 'b' | ||
5940 | with open(self.name, writemode) as file: | ||
5941 | + if 'b' in self.mode and isinstance(buf, str): | ||
5942 | + buf = buf.encode('utf-8') | ||
5943 | + elif 'b' not in self.mode and isinstance(buf, bytes): | ||
5944 | + buf = buf.decode('utf-8') | ||
5945 | file.write(buf) | ||
5946 | |||
5947 | if self._capture_diff: | ||
5948 | @@ -381,7 +388,7 @@ class ListMixin(object): | ||
5949 | def __add__(self, other): | ||
5950 | # Allow None and EmptyValue is a special case because it makes undefined | ||
5951 | # variable references in moz.build behave better. | ||
5952 | - other = [] if isinstance(other, (types.NoneType, EmptyValue)) else other | ||
5953 | + other = [] if isinstance(other, (type(None), EmptyValue)) else other | ||
5954 | if not isinstance(other, list): | ||
5955 | raise ValueError('Only lists can be appended to lists.') | ||
5956 | |||
5957 | @@ -390,7 +397,7 @@ class ListMixin(object): | ||
5958 | return new_list | ||
5959 | |||
5960 | def __iadd__(self, other): | ||
5961 | - other = [] if isinstance(other, (types.NoneType, EmptyValue)) else other | ||
5962 | + other = [] if isinstance(other, (type(None), EmptyValue)) else other | ||
5963 | if not isinstance(other, list): | ||
5964 | raise ValueError('Only lists can be appended to lists.') | ||
5965 | |||
5966 | @@ -561,14 +568,14 @@ def FlagsFactory(flags): | ||
5967 | functions below. | ||
5968 | """ | ||
5969 | assert isinstance(flags, dict) | ||
5970 | - assert all(isinstance(v, type) for v in flags.values()) | ||
5971 | + assert all(isinstance(v, type) for v in list(flags.values())) | ||
5972 | |||
5973 | class Flags(object): | ||
5974 | - __slots__ = flags.keys() | ||
5975 | + __slots__ = list(flags.keys()) | ||
5976 | _flags = flags | ||
5977 | |||
5978 | def update(self, **kwargs): | ||
5979 | - for k, v in kwargs.iteritems(): | ||
5980 | + for k, v in kwargs.items(): | ||
5981 | setattr(self, k, v) | ||
5982 | |||
5983 | def __getattr__(self, name): | ||
5984 | @@ -1006,8 +1013,6 @@ def TypedNamedTuple(name, fields): | ||
5985 | 'got %s, expected %s' % (fname, | ||
5986 | type(value), ftype)) | ||
5987 | |||
5988 | - super(TypedTuple, self).__init__(*args, **kwargs) | ||
5989 | - | ||
5990 | TypedTuple._fields = fields | ||
5991 | |||
5992 | return TypedTuple | ||
5993 | @@ -1099,14 +1104,14 @@ def group_unified_files(files, unified_prefix, unified_suffix, | ||
5994 | # issue. So we do a little dance to filter it out ourselves. | ||
5995 | dummy_fill_value = ("dummy",) | ||
5996 | def filter_out_dummy(iterable): | ||
5997 | - return itertools.ifilter(lambda x: x != dummy_fill_value, | ||
5998 | + return filter(lambda x: x != dummy_fill_value, | ||
5999 | iterable) | ||
6000 | |||
6001 | # From the itertools documentation, slightly modified: | ||
6002 | def grouper(n, iterable): | ||
6003 | "grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx" | ||
6004 | args = [iter(iterable)] * n | ||
6005 | - return itertools.izip_longest(fillvalue=dummy_fill_value, *args) | ||
6006 | + return itertools.zip_longest(fillvalue=dummy_fill_value, *args) | ||
6007 | |||
6008 | for i, unified_group in enumerate(grouper(files_per_unified_file, | ||
6009 | files)): | ||
6010 | @@ -1123,7 +1128,7 @@ def pair(iterable): | ||
6011 | [(1,2), (3,4), (5,6)] | ||
6012 | ''' | ||
6013 | i = iter(iterable) | ||
6014 | - return itertools.izip_longest(i, i) | ||
6015 | + return itertools.zip_longest(i, i) | ||
6016 | |||
6017 | |||
6018 | VARIABLES_RE = re.compile('\$\((\w+)\)') | ||
6019 | @@ -1141,7 +1146,7 @@ def expand_variables(s, variables): | ||
6020 | value = variables.get(name) | ||
6021 | if not value: | ||
6022 | continue | ||
6023 | - if not isinstance(value, types.StringTypes): | ||
6024 | + if not isinstance(value, (str,)): | ||
6025 | value = ' '.join(value) | ||
6026 | result += value | ||
6027 | return result | ||
6028 | @@ -1168,7 +1173,7 @@ class EnumStringComparisonError(Exception): | ||
6029 | pass | ||
6030 | |||
6031 | |||
6032 | -class EnumString(unicode): | ||
6033 | +class EnumString(str): | ||
6034 | '''A string type that only can have a limited set of values, similarly to | ||
6035 | an Enum, and can only be compared against that set of values. | ||
6036 | |||
6037 | @@ -1185,8 +1190,8 @@ class EnumString(unicode): | ||
6038 | def __eq__(self, other): | ||
6039 | if other not in self.POSSIBLE_VALUES: | ||
6040 | raise EnumStringComparisonError( | ||
6041 | - 'Can only compare with %s' | ||
6042 | - % ', '.join("'%s'" % v for v in self.POSSIBLE_VALUES)) | ||
6043 | + '%s is not in %s' | ||
6044 | + % (other, ', '.join("'%s'" % v for v in self.POSSIBLE_VALUES))) | ||
6045 | return super(EnumString, self).__eq__(other) | ||
6046 | |||
6047 | def __ne__(self, other): | ||
6048 | @@ -1204,14 +1209,14 @@ def _escape_char(c): | ||
6049 | # quoting could be done with either ' or ". | ||
6050 | if c == "'": | ||
6051 | return "\\'" | ||
6052 | - return unicode(c.encode('unicode_escape')) | ||
6053 | + return str(c.encode('unicode_escape')) | ||
6054 | |||
6055 | # Mapping table between raw characters below \x80 and their escaped | ||
6056 | # counterpart, when they differ | ||
6057 | _INDENTED_REPR_TABLE = { | ||
6058 | c: e | ||
6059 | for c, e in map(lambda x: (x, _escape_char(x)), | ||
6060 | - map(unichr, range(128))) | ||
6061 | + map(chr, range(128))) | ||
6062 | if c != e | ||
6063 | } | ||
6064 | # Regexp matching all characters to escape. | ||
6065 | @@ -1219,7 +1224,33 @@ _INDENTED_REPR_RE = re.compile( | ||
6066 | '([' + ''.join(_INDENTED_REPR_TABLE.values()) + ']+)') | ||
6067 | |||
6068 | |||
6069 | +# Stolen from gecko master [1] | ||
6070 | +# [1] https://github.com/mozilla/gecko-dev/blob/4165a2e843c494bfb3e35d8a1fbf9c61209e3675/python/mozbuild/mozbuild/util.py#L1286 | ||
6071 | + | ||
6072 | +# The default PrettyPrinter has some issues with UTF-8, so we need to override | ||
6073 | +# some stuff here. | ||
6074 | +class _PrettyPrinter(pprint.PrettyPrinter): | ||
6075 | + def format(self, object, context, maxlevels, level): | ||
6076 | + if not (isinstance(object, six.text_type) or | ||
6077 | + isinstance(object, six.binary_type)): | ||
6078 | + return super(_PrettyPrinter, self).format( | ||
6079 | + object, context, maxlevels, level) | ||
6080 | + # This is super hacky and weird, but the output of 'repr' actually | ||
6081 | + # varies based on the default I/O encoding of the process, which isn't | ||
6082 | + # necessarily utf-8. Instead we open a new shell and ask what the repr | ||
6083 | + # WOULD be assuming the default encoding is utf-8. If you can come up | ||
6084 | + # with a better way of doing this without simply re-implementing the | ||
6085 | + # logic of "repr", please replace this. | ||
6086 | + env = dict(os.environ) | ||
6087 | + env['PYTHONIOENCODING'] = 'utf-8' | ||
6088 | + ret = six.ensure_text(subprocess.check_output( | ||
6089 | + [sys.executable], input='print(repr(%s))' % repr(object), | ||
6090 | + universal_newlines=True, env=env, encoding='utf-8')).strip() | ||
6091 | + return (ret, True, False) | ||
6092 | + | ||
6093 | def indented_repr(o, indent=4): | ||
6094 | + return _PrettyPrinter(indent=indent).pformat(o) | ||
6095 | + | ||
6096 | '''Similar to repr(), but returns an indented representation of the object | ||
6097 | |||
6098 | One notable difference with repr is that the returned representation | ||
6099 | @@ -1242,7 +1273,7 @@ def indented_repr(o, indent=4): | ||
6100 | elif isinstance(o, bytes): | ||
6101 | yield 'b' | ||
6102 | yield repr(o) | ||
6103 | - elif isinstance(o, unicode): | ||
6104 | + elif isinstance(o, str): | ||
6105 | yield "'" | ||
6106 | # We want a readable string (non escaped unicode), but some | ||
6107 | # special characters need escaping (e.g. \n, \t, etc.) | ||
6108 | @@ -1272,11 +1303,11 @@ def encode(obj, encoding='utf-8'): | ||
6109 | if isinstance(obj, dict): | ||
6110 | return { | ||
6111 | encode(k, encoding): encode(v, encoding) | ||
6112 | - for k, v in obj.iteritems() | ||
6113 | + for k, v in obj.items() | ||
6114 | } | ||
6115 | if isinstance(obj, bytes): | ||
6116 | return obj | ||
6117 | - if isinstance(obj, unicode): | ||
6118 | + if isinstance(obj, str): | ||
6119 | return obj.encode(encoding) | ||
6120 | if isinstance(obj, Iterable): | ||
6121 | return [encode(i, encoding) for i in obj] | ||
6122 | diff --git a/python/mozbuild/mozbuild/virtualenv.py b/python/mozbuild/mozbuild/virtualenv.py | ||
6123 | index 38d06d71d..c67c046f3 100644 | ||
6124 | --- a/python/mozbuild/mozbuild/virtualenv.py | ||
6125 | +++ b/python/mozbuild/mozbuild/virtualenv.py | ||
6126 | @@ -531,9 +531,9 @@ def verify_python_version(log_handle): | ||
6127 | |||
6128 | our = LooseVersion('%d.%d.%d' % (major, minor, micro)) | ||
6129 | |||
6130 | - if major != MINIMUM_PYTHON_MAJOR or our < MINIMUM_PYTHON_VERSION: | ||
6131 | - log_handle.write('Python %s or greater (but not Python 3) is ' | ||
6132 | - 'required to build. ' % MINIMUM_PYTHON_VERSION) | ||
6133 | + if our < MINIMUM_PYTHON_VERSION: | ||
6134 | + log_handle.write('Python %s or greater is required to build. ' | ||
6135 | + % MINIMUM_PYTHON_VERSION) | ||
6136 | log_handle.write('You are running Python %s.\n' % our) | ||
6137 | |||
6138 | if os.name in ('nt', 'ce'): | ||
6139 | diff --git a/python/mozbuild/mozpack/chrome/manifest.py b/python/mozbuild/mozpack/chrome/manifest.py | ||
6140 | index c91b99cf1..02eac0dbb 100644 | ||
6141 | --- a/python/mozbuild/mozpack/chrome/manifest.py | ||
6142 | +++ b/python/mozbuild/mozpack/chrome/manifest.py | ||
6143 | @@ -2,11 +2,11 @@ | ||
6144 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
6145 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
6146 | |||
6147 | -from __future__ import absolute_import | ||
6148 | + | ||
6149 | |||
6150 | import re | ||
6151 | import os | ||
6152 | -from urlparse import urlparse | ||
6153 | +from urllib.parse import urlparse | ||
6154 | import mozpack.path as mozpath | ||
6155 | from mozpack.chrome.flags import Flags | ||
6156 | from mozpack.errors import errors | ||
6157 | @@ -316,7 +316,7 @@ class ManifestContract(ManifestEntry): | ||
6158 | return self.serialize(self.contractID, self.cid) | ||
6159 | |||
6160 | # All manifest classes by their type name. | ||
6161 | -MANIFESTS_TYPES = dict([(c.type, c) for c in globals().values() | ||
6162 | +MANIFESTS_TYPES = dict([(c.type, c) for c in list(globals().values()) | ||
6163 | if type(c) == type and issubclass(c, ManifestEntry) | ||
6164 | and hasattr(c, 'type') and c.type]) | ||
6165 | |||
6166 | diff --git a/python/mozbuild/mozpack/copier.py b/python/mozbuild/mozpack/copier.py | ||
6167 | index 1e521e52b..43ed9be4a 100644 | ||
6168 | --- a/python/mozbuild/mozpack/copier.py | ||
6169 | +++ b/python/mozbuild/mozpack/copier.py | ||
6170 | @@ -2,7 +2,7 @@ | ||
6171 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
6172 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
6173 | |||
6174 | -from __future__ import absolute_import | ||
6175 | + | ||
6176 | |||
6177 | import os | ||
6178 | import stat | ||
6179 | @@ -113,7 +113,7 @@ class FileRegistry(object): | ||
6180 | ''' | ||
6181 | Return all paths stored in the container, in the order they were added. | ||
6182 | ''' | ||
6183 | - return self._files.keys() | ||
6184 | + return list(self._files.keys()) | ||
6185 | |||
6186 | def __len__(self): | ||
6187 | ''' | ||
6188 | @@ -146,7 +146,7 @@ class FileRegistry(object): | ||
6189 | for path, file in registry: | ||
6190 | (...) | ||
6191 | ''' | ||
6192 | - return self._files.iteritems() | ||
6193 | + return iter(self._files.items()) | ||
6194 | |||
6195 | def required_directories(self): | ||
6196 | ''' | ||
6197 | @@ -155,7 +155,7 @@ class FileRegistry(object): | ||
6198 | unspecified (virtual) root directory (and do not include said root | ||
6199 | directory). | ||
6200 | ''' | ||
6201 | - return set(k for k, v in self._required_directories.items() if v > 0) | ||
6202 | + return set(k for k, v in list(self._required_directories.items()) if v > 0) | ||
6203 | |||
6204 | def output_to_inputs_tree(self): | ||
6205 | ''' | ||
6206 | @@ -295,7 +295,7 @@ class FileCopier(FileRegistry): | ||
6207 | |||
6208 | Returns a FileCopyResult that details what changed. | ||
6209 | ''' | ||
6210 | - assert isinstance(destination, basestring) | ||
6211 | + assert isinstance(destination, str) | ||
6212 | assert not os.path.exists(destination) or os.path.isdir(destination) | ||
6213 | |||
6214 | result = FileCopyResult() | ||
6215 | @@ -563,7 +563,7 @@ class Jarrer(FileRegistry, BaseFile): | ||
6216 | def exists(self): | ||
6217 | return self.deflater is not None | ||
6218 | |||
6219 | - if isinstance(dest, basestring): | ||
6220 | + if isinstance(dest, str): | ||
6221 | dest = Dest(dest) | ||
6222 | assert isinstance(dest, Dest) | ||
6223 | |||
6224 | diff --git a/python/mozbuild/mozpack/files.py b/python/mozbuild/mozpack/files.py | ||
6225 | index 8ce353375..bf35e39b8 100644 | ||
6226 | --- a/python/mozbuild/mozpack/files.py | ||
6227 | +++ b/python/mozbuild/mozpack/files.py | ||
6228 | @@ -2,7 +2,7 @@ | ||
6229 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
6230 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
6231 | |||
6232 | -from __future__ import absolute_import | ||
6233 | + | ||
6234 | |||
6235 | import errno | ||
6236 | import os | ||
6237 | @@ -57,7 +57,7 @@ else: | ||
6238 | |||
6239 | def _copyfile(src, dest): | ||
6240 | # False indicates `dest` should be overwritten if it exists already. | ||
6241 | - if isinstance(src, unicode) and isinstance(dest, unicode): | ||
6242 | + if isinstance(src, str) and isinstance(dest, str): | ||
6243 | _CopyFileW(src, dest, False) | ||
6244 | elif isinstance(src, str) and isinstance(dest, str): | ||
6245 | _CopyFileA(src, dest, False) | ||
6246 | @@ -164,7 +164,7 @@ class BaseFile(object): | ||
6247 | disabled when skip_if_older is False. | ||
6248 | Returns whether a copy was actually performed (True) or not (False). | ||
6249 | ''' | ||
6250 | - if isinstance(dest, basestring): | ||
6251 | + if isinstance(dest, str): | ||
6252 | dest = Dest(dest) | ||
6253 | else: | ||
6254 | assert isinstance(dest, Dest) | ||
6255 | @@ -278,11 +278,11 @@ class ExecutableFile(File): | ||
6256 | ''' | ||
6257 | def copy(self, dest, skip_if_older=True): | ||
6258 | real_dest = dest | ||
6259 | - if not isinstance(dest, basestring): | ||
6260 | + if not isinstance(dest, str): | ||
6261 | fd, dest = mkstemp() | ||
6262 | os.close(fd) | ||
6263 | os.remove(dest) | ||
6264 | - assert isinstance(dest, basestring) | ||
6265 | + assert isinstance(dest, str) | ||
6266 | # If File.copy didn't actually copy because dest is newer, check the | ||
6267 | # file sizes. If dest is smaller, it means it is already stripped and | ||
6268 | # elfhacked, so we can skip. | ||
6269 | @@ -319,7 +319,7 @@ class AbsoluteSymlinkFile(File): | ||
6270 | File.__init__(self, path) | ||
6271 | |||
6272 | def copy(self, dest, skip_if_older=True): | ||
6273 | - assert isinstance(dest, basestring) | ||
6274 | + assert isinstance(dest, str) | ||
6275 | |||
6276 | # The logic in this function is complicated by the fact that symlinks | ||
6277 | # aren't universally supported. So, where symlinks aren't supported, we | ||
6278 | @@ -410,7 +410,7 @@ class HardlinkFile(File): | ||
6279 | ''' | ||
6280 | |||
6281 | def copy(self, dest, skip_if_older=True): | ||
6282 | - assert isinstance(dest, basestring) | ||
6283 | + assert isinstance(dest, str) | ||
6284 | |||
6285 | if not hasattr(os, 'link'): | ||
6286 | return super(HardlinkFile, self).copy( | ||
6287 | @@ -471,7 +471,7 @@ class ExistingFile(BaseFile): | ||
6288 | self.required = required | ||
6289 | |||
6290 | def copy(self, dest, skip_if_older=True): | ||
6291 | - if isinstance(dest, basestring): | ||
6292 | + if isinstance(dest, str): | ||
6293 | dest = Dest(dest) | ||
6294 | else: | ||
6295 | assert isinstance(dest, Dest) | ||
6296 | @@ -517,7 +517,7 @@ class PreprocessedFile(BaseFile): | ||
6297 | ''' | ||
6298 | Invokes the preprocessor to create the destination file. | ||
6299 | ''' | ||
6300 | - if isinstance(dest, basestring): | ||
6301 | + if isinstance(dest, str): | ||
6302 | dest = Dest(dest) | ||
6303 | else: | ||
6304 | assert isinstance(dest, Dest) | ||
6305 | @@ -657,7 +657,7 @@ class XPTFile(GeneratedFile): | ||
6306 | the individual XPTs to link. | ||
6307 | skip_if_older is ignored. | ||
6308 | ''' | ||
6309 | - if isinstance(dest, basestring): | ||
6310 | + if isinstance(dest, str): | ||
6311 | dest = Dest(dest) | ||
6312 | assert isinstance(dest, Dest) | ||
6313 | |||
6314 | @@ -1108,7 +1108,7 @@ class ComposedFinder(BaseFinder): | ||
6315 | from mozpack.copier import FileRegistry | ||
6316 | self.files = FileRegistry() | ||
6317 | |||
6318 | - for base, finder in sorted(finders.iteritems()): | ||
6319 | + for base, finder in sorted(finders.items()): | ||
6320 | if self.files.contains(base): | ||
6321 | self.files.remove(base) | ||
6322 | for p, f in finder.find(''): | ||
6323 | diff --git a/python/mozbuild/mozpack/manifests.py b/python/mozbuild/mozpack/manifests.py | ||
6324 | index 27c66634b..f79b40086 100644 | ||
6325 | --- a/python/mozbuild/mozpack/manifests.py | ||
6326 | +++ b/python/mozbuild/mozpack/manifests.py | ||
6327 | @@ -2,8 +2,6 @@ | ||
6328 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
6329 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
6330 | |||
6331 | -from __future__ import absolute_import, unicode_literals | ||
6332 | - | ||
6333 | from contextlib import contextmanager | ||
6334 | import json | ||
6335 | |||
6336 | @@ -116,7 +114,7 @@ class InstallManifest(object): | ||
6337 | self._source_files = set() | ||
6338 | |||
6339 | if path or fileobj: | ||
6340 | - with _auto_fileobj(path, fileobj, 'rb') as fh: | ||
6341 | + with _auto_fileobj(path, fileobj, 'r') as fh: | ||
6342 | self._source_files.add(fh.name) | ||
6343 | self._load_from_fileobj(fh) | ||
6344 | |||
6345 | @@ -175,7 +173,7 @@ class InstallManifest(object): | ||
6346 | dest, content = fields[1:] | ||
6347 | |||
6348 | self.add_content( | ||
6349 | - self._decode_field_entry(content).encode('utf-8'), dest) | ||
6350 | + self._decode_field_entry(content), dest) | ||
6351 | continue | ||
6352 | |||
6353 | # Don't fail for non-actionable items, allowing | ||
6354 | @@ -228,7 +226,7 @@ class InstallManifest(object): | ||
6355 | |||
6356 | It is an error if both are specified. | ||
6357 | """ | ||
6358 | - with _auto_fileobj(path, fileobj, 'wb') as fh: | ||
6359 | + with _auto_fileobj(path, fileobj, 'w') as fh: | ||
6360 | fh.write('%d\n' % self.CURRENT_VERSION) | ||
6361 | |||
6362 | for dest in sorted(self._dests): | ||
6363 | @@ -242,13 +240,11 @@ class InstallManifest(object): | ||
6364 | for path in paths: | ||
6365 | source = mozpath.join(base, path) | ||
6366 | parts = ['%d' % type, mozpath.join(dest, path), source] | ||
6367 | - fh.write('%s\n' % self.FIELD_SEPARATOR.join( | ||
6368 | - p.encode('utf-8') for p in parts)) | ||
6369 | + fh.write('%s\n' % self.FIELD_SEPARATOR.join(parts)) | ||
6370 | else: | ||
6371 | parts = ['%d' % entry[0], dest] | ||
6372 | parts.extend(entry[1:]) | ||
6373 | - fh.write('%s\n' % self.FIELD_SEPARATOR.join( | ||
6374 | - p.encode('utf-8') for p in parts)) | ||
6375 | + fh.write('%s\n' % self.FIELD_SEPARATOR.join(parts)) | ||
6376 | |||
6377 | def add_link(self, source, dest): | ||
6378 | """Add a link to this manifest. | ||
6379 | @@ -439,7 +435,7 @@ class InstallManifest(object): | ||
6380 | if install_type == self.CONTENT: | ||
6381 | # GeneratedFile expect the buffer interface, which the unicode | ||
6382 | # type doesn't have, so encode to a str. | ||
6383 | - content = self._decode_field_entry(entry[1]).encode('utf-8') | ||
6384 | + content = self._decode_field_entry(entry[1]) | ||
6385 | registry.add(dest, GeneratedFile(content)) | ||
6386 | continue | ||
6387 | |||
6388 | diff --git a/python/mozbuild/mozpack/mozjar.py b/python/mozbuild/mozpack/mozjar.py | ||
6389 | index a723fd2c0..0b04d233c 100644 | ||
6390 | --- a/python/mozbuild/mozpack/mozjar.py | ||
6391 | +++ b/python/mozbuild/mozpack/mozjar.py | ||
6392 | @@ -2,7 +2,7 @@ | ||
6393 | # License, v. 2.0. If a copy of the MPL was not distributed with this | ||
6394 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
6395 | |||
6396 | -from __future__ import absolute_import | ||
6397 | + | ||
6398 | |||
6399 | from io import BytesIO | ||
6400 | import struct | ||
6401 | @@ -14,9 +14,10 @@ from zipfile import ( | ||
6402 | ZIP_DEFLATED, | ||
6403 | ) | ||
6404 | from collections import OrderedDict | ||
6405 | -from urlparse import urlparse, ParseResult | ||
6406 | +from urllib.parse import urlparse, ParseResult | ||
6407 | import mozpack.path as mozpath | ||
6408 | from mozbuild.util import memoize | ||
6409 | +from functools import reduce | ||
6410 | |||
6411 | |||
6412 | JAR_STORED = ZIP_STORED | ||
6413 | @@ -72,7 +73,7 @@ class JarStruct(object): | ||
6414 | an instance with empty fields. | ||
6415 | ''' | ||
6416 | assert self.MAGIC and isinstance(self.STRUCT, OrderedDict) | ||
6417 | - self.size_fields = set(t for t in self.STRUCT.itervalues() | ||
6418 | + self.size_fields = set(t for t in self.STRUCT.values() | ||
6419 | if not t in JarStruct.TYPE_MAPPING) | ||
6420 | self._values = {} | ||
6421 | if data: | ||
6422 | @@ -94,7 +95,7 @@ class JarStruct(object): | ||
6423 | # For all fields used as other fields sizes, keep track of their value | ||
6424 | # separately. | ||
6425 | sizes = dict((t, 0) for t in self.size_fields) | ||
6426 | - for name, t in self.STRUCT.iteritems(): | ||
6427 | + for name, t in self.STRUCT.items(): | ||
6428 | if t in JarStruct.TYPE_MAPPING: | ||
6429 | value, size = JarStruct.get_data(t, data[offset:]) | ||
6430 | else: | ||
6431 | @@ -113,7 +114,7 @@ class JarStruct(object): | ||
6432 | Initialize an instance with empty fields. | ||
6433 | ''' | ||
6434 | self.signature = self.MAGIC | ||
6435 | - for name, t in self.STRUCT.iteritems(): | ||
6436 | + for name, t in self.STRUCT.items(): | ||
6437 | if name in self.size_fields: | ||
6438 | continue | ||
6439 | self._values[name] = 0 if t in JarStruct.TYPE_MAPPING else '' | ||
6440 | @@ -138,9 +139,9 @@ class JarStruct(object): | ||
6441 | from self.STRUCT. | ||
6442 | ''' | ||
6443 | serialized = struct.pack('<I', self.signature) | ||
6444 | - sizes = dict((t, name) for name, t in self.STRUCT.iteritems() | ||
6445 | + sizes = dict((t, name) for name, t in self.STRUCT.items() | ||
6446 | if not t in JarStruct.TYPE_MAPPING) | ||
6447 | - for name, t in self.STRUCT.iteritems(): | ||
6448 | + for name, t in self.STRUCT.items(): | ||
6449 | if t in JarStruct.TYPE_MAPPING: | ||
6450 | format, size = JarStruct.TYPE_MAPPING[t] | ||
6451 | if name in sizes: | ||
6452 | @@ -159,7 +160,7 @@ class JarStruct(object): | ||
6453 | variable length fields. | ||
6454 | ''' | ||
6455 | size = JarStruct.TYPE_MAPPING['uint32'][1] | ||
6456 | - for name, type in self.STRUCT.iteritems(): | ||
6457 | + for name, type in self.STRUCT.items(): | ||
6458 | if type in JarStruct.TYPE_MAPPING: | ||
6459 | size += JarStruct.TYPE_MAPPING[type][1] | ||
6460 | else: | ||
6461 | @@ -180,7 +181,7 @@ class JarStruct(object): | ||
6462 | return key in self._values | ||
6463 | |||
6464 | def __iter__(self): | ||
6465 | - return self._values.iteritems() | ||
6466 | + return iter(self._values.items()) | ||
6467 | |||
6468 | def __repr__(self): | ||
6469 | return "<%s %s>" % (self.__class__.__name__, | ||
6470 | @@ -374,7 +375,7 @@ class JarReader(object): | ||
6471 | entries = self.entries | ||
6472 | if not entries: | ||
6473 | return JAR_STORED | ||
6474 | - return max(f['compression'] for f in entries.itervalues()) | ||
6475 | + return max(f['compression'] for f in entries.values()) | ||
6476 | |||
6477 | @property | ||
6478 | def entries(self): | ||
6479 | @@ -390,7 +391,7 @@ class JarReader(object): | ||
6480 | preload = JarStruct.get_data('uint32', self._data)[0] | ||
6481 | entries = OrderedDict() | ||
6482 | offset = self._cdir_end['cdir_offset'] | ||
6483 | - for e in xrange(self._cdir_end['cdir_entries']): | ||
6484 | + for e in range(self._cdir_end['cdir_entries']): | ||
6485 | entry = JarCdirEntry(self._data[offset:]) | ||
6486 | offset += entry.size | ||
6487 | # Creator host system. 0 is MSDOS, 3 is Unix | ||
6488 | @@ -452,7 +453,7 @@ class JarReader(object): | ||
6489 | for file in jarReader: | ||
6490 | ... | ||
6491 | ''' | ||
6492 | - for entry in self.entries.itervalues(): | ||
6493 | + for entry in self.entries.values(): | ||
6494 | yield self._getreader(entry) | ||
6495 | |||
6496 | def __getitem__(self, name): | ||
6497 | @@ -547,7 +548,7 @@ class JarWriter(object): | ||
6498 | headers = {} | ||
6499 | preload_size = 0 | ||
6500 | # Prepare central directory entries | ||
6501 | - for entry, content in self._contents.itervalues(): | ||
6502 | + for entry, content in self._contents.values(): | ||
6503 | header = JarLocalFileHeader() | ||
6504 | for name in entry.STRUCT: | ||
6505 | if name in header: | ||
6506 | @@ -562,7 +563,7 @@ class JarWriter(object): | ||
6507 | end['disk_entries'] = len(self._contents) | ||
6508 | end['cdir_entries'] = end['disk_entries'] | ||
6509 | end['cdir_size'] = reduce(lambda x, y: x + y[0].size, | ||
6510 | - self._contents.values(), 0) | ||
6511 | + list(self._contents.values()), 0) | ||
6512 | # On optimized archives, store the preloaded size and the central | ||
6513 | # directory entries, followed by the first end of central directory. | ||
6514 | if self._optimize: | ||
6515 | @@ -571,18 +572,18 @@ class JarWriter(object): | ||
6516 | if preload_size: | ||
6517 | preload_size += offset | ||
6518 | self._data.write(struct.pack('<I', preload_size)) | ||
6519 | - for entry, _ in self._contents.itervalues(): | ||
6520 | + for entry, _ in self._contents.values(): | ||
6521 | entry['offset'] += offset | ||
6522 | self._data.write(entry.serialize()) | ||
6523 | self._data.write(end.serialize()) | ||
6524 | # Store local file entries followed by compressed data | ||
6525 | - for entry, content in self._contents.itervalues(): | ||
6526 | + for entry, content in self._contents.values(): | ||
6527 | self._data.write(headers[entry].serialize()) | ||
6528 | self._data.write(content) | ||
6529 | # On non optimized archives, store the central directory entries. | ||
6530 | if not self._optimize: | ||
6531 | end['cdir_offset'] = offset | ||
6532 | - for entry, _ in self._contents.itervalues(): | ||
6533 | + for entry, _ in self._contents.values(): | ||
6534 | self._data.write(entry.serialize()) | ||
6535 | # Store the end of central directory. | ||
6536 | self._data.write(end.serialize()) | ||
6537 | @@ -622,7 +623,7 @@ class JarWriter(object): | ||
6538 | deflater = data | ||
6539 | else: | ||
6540 | deflater = Deflater(compress, compress_level=self._compress_level) | ||
6541 | - if isinstance(data, basestring): | ||
6542 | + if isinstance(data, str): | ||
6543 | deflater.write(data) | ||
6544 | elif hasattr(data, 'read'): | ||
6545 | if hasattr(data, 'seek'): | ||
6546 | diff --git a/testing/mozbase/manifestparser/manifestparser/ini.py b/testing/mozbase/manifestparser/manifestparser/ini.py | ||
6547 | index e5ba249c1..c141a18b7 100644 | ||
6548 | --- a/testing/mozbase/manifestparser/manifestparser/ini.py | ||
6549 | +++ b/testing/mozbase/manifestparser/manifestparser/ini.py | ||
6550 | @@ -2,7 +2,7 @@ | ||
6551 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
6552 | # You can obtain one at http://mozilla.org/MPL/2.0/. | ||
6553 | |||
6554 | -from __future__ import absolute_import | ||
6555 | + | ||
6556 | |||
6557 | import os | ||
6558 | import sys | ||
6559 | @@ -12,7 +12,7 @@ __all__ = ['read_ini', 'combine_fields'] | ||
6560 | |||
6561 | class IniParseError(Exception): | ||
6562 | def __init__(self, fp, linenum, msg): | ||
6563 | - if isinstance(fp, basestring): | ||
6564 | + if isinstance(fp, str): | ||
6565 | path = fp | ||
6566 | elif hasattr(fp, 'name'): | ||
6567 | path = fp.name | ||
6568 | @@ -43,12 +43,15 @@ def read_ini(fp, variables=None, default='DEFAULT', defaults_only=False, | ||
6569 | sections = [] | ||
6570 | key = value = None | ||
6571 | section_names = set() | ||
6572 | - if isinstance(fp, basestring): | ||
6573 | + if isinstance(fp, str): | ||
6574 | fp = file(fp) | ||
6575 | |||
6576 | # read the lines | ||
6577 | for (linenum, line) in enumerate(fp.read().splitlines(), start=1): | ||
6578 | |||
6579 | + if isinstance(line, bytes): | ||
6580 | + line = line.decode('utf-8') | ||
6581 | + | ||
6582 | stripped = line.strip() | ||
6583 | |||
6584 | # ignore blank lines | ||
6585 | @@ -66,7 +69,7 @@ def read_ini(fp, variables=None, default='DEFAULT', defaults_only=False, | ||
6586 | inline_prefixes = {p: -1 for p in comments} | ||
6587 | while comment_start == sys.maxsize and inline_prefixes: | ||
6588 | next_prefixes = {} | ||
6589 | - for prefix, index in inline_prefixes.items(): | ||
6590 | + for prefix, index in list(inline_prefixes.items()): | ||
6591 | index = line.find(prefix, index+1) | ||
6592 | if index == -1: | ||
6593 | continue | ||
6594 | @@ -163,7 +166,7 @@ def combine_fields(global_vars, local_vars): | ||
6595 | 'support-files': '%s %s', | ||
6596 | } | ||
6597 | final_mapping = global_vars.copy() | ||
6598 | - for field_name, value in local_vars.items(): | ||
6599 | + for field_name, value in list(local_vars.items()): | ||
6600 | if field_name not in field_patterns or field_name not in global_vars: | ||
6601 | final_mapping[field_name] = value | ||
6602 | continue | ||
6603 | diff --git a/testing/mozbase/manifestparser/manifestparser/manifestparser.py b/testing/mozbase/manifestparser/manifestparser/manifestparser.py | ||
6604 | index 921369fd2..5b2f4c453 100755 | ||
6605 | --- a/testing/mozbase/manifestparser/manifestparser/manifestparser.py | ||
6606 | +++ b/testing/mozbase/manifestparser/manifestparser/manifestparser.py | ||
6607 | @@ -2,9 +2,9 @@ | ||
6608 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
6609 | # You can obtain one at http://mozilla.org/MPL/2.0/. | ||
6610 | |||
6611 | -from __future__ import absolute_import, print_function | ||
6612 | |||
6613 | -from StringIO import StringIO | ||
6614 | + | ||
6615 | +from io import StringIO | ||
6616 | import json | ||
6617 | import fnmatch | ||
6618 | import os | ||
6619 | @@ -23,7 +23,7 @@ from .filters import ( | ||
6620 | __all__ = ['ManifestParser', 'TestManifest', 'convert'] | ||
6621 | |||
6622 | relpath = os.path.relpath | ||
6623 | -string = (basestring,) | ||
6624 | +string = (str,) | ||
6625 | |||
6626 | |||
6627 | # path normalization | ||
6628 | @@ -195,7 +195,7 @@ class ManifestParser(object): | ||
6629 | |||
6630 | # otherwise an item | ||
6631 | # apply ancestor defaults, while maintaining current file priority | ||
6632 | - data = dict(self._ancestor_defaults.items() + data.items()) | ||
6633 | + data = dict(list(self._ancestor_defaults.items()) + list(data.items())) | ||
6634 | |||
6635 | test = data | ||
6636 | test['name'] = section | ||
6637 | @@ -323,19 +323,19 @@ class ManifestParser(object): | ||
6638 | # make some check functions | ||
6639 | if inverse: | ||
6640 | def has_tags(test): | ||
6641 | - return not tags.intersection(test.keys()) | ||
6642 | + return not tags.intersection(list(test.keys())) | ||
6643 | |||
6644 | def dict_query(test): | ||
6645 | - for key, value in kwargs.items(): | ||
6646 | + for key, value in list(kwargs.items()): | ||
6647 | if test.get(key) == value: | ||
6648 | return False | ||
6649 | return True | ||
6650 | else: | ||
6651 | def has_tags(test): | ||
6652 | - return tags.issubset(test.keys()) | ||
6653 | + return tags.issubset(list(test.keys())) | ||
6654 | |||
6655 | def dict_query(test): | ||
6656 | - for key, value in kwargs.items(): | ||
6657 | + for key, value in list(kwargs.items()): | ||
6658 | if test.get(key) != value: | ||
6659 | return False | ||
6660 | return True | ||
6661 | @@ -359,7 +359,7 @@ class ManifestParser(object): | ||
6662 | if tests is None: | ||
6663 | manifests = [] | ||
6664 | # Make sure to return all the manifests, even ones without tests. | ||
6665 | - for manifest in self.manifest_defaults.keys(): | ||
6666 | + for manifest in list(self.manifest_defaults.keys()): | ||
6667 | if isinstance(manifest, tuple): | ||
6668 | parentmanifest, manifest = manifest | ||
6669 | if manifest not in manifests: | ||
6670 | @@ -409,7 +409,7 @@ class ManifestParser(object): | ||
6671 | """ | ||
6672 | |||
6673 | files = set([]) | ||
6674 | - if isinstance(directories, basestring): | ||
6675 | + if isinstance(directories, str): | ||
6676 | directories = [directories] | ||
6677 | |||
6678 | # get files in directories | ||
6679 | @@ -476,7 +476,7 @@ class ManifestParser(object): | ||
6680 | print('[DEFAULT]', file=fp) | ||
6681 | for tag in global_tags: | ||
6682 | print('%s =' % tag, file=fp) | ||
6683 | - for key, value in global_kwargs.items(): | ||
6684 | + for key, value in list(global_kwargs.items()): | ||
6685 | print('%s = %s' % (key, value), file=fp) | ||
6686 | print(file=fp) | ||
6687 | |||
6688 | @@ -602,7 +602,7 @@ class ManifestParser(object): | ||
6689 | internal function to import directories | ||
6690 | """ | ||
6691 | |||
6692 | - if isinstance(pattern, basestring): | ||
6693 | + if isinstance(pattern, str): | ||
6694 | patterns = [pattern] | ||
6695 | else: | ||
6696 | patterns = pattern | ||
6697 | diff --git a/testing/mozbase/mozinfo/mozinfo/mozinfo.py b/testing/mozbase/mozinfo/mozinfo/mozinfo.py | ||
6698 | index 90c187568..6c5a1f322 100755 | ||
6699 | --- a/testing/mozbase/mozinfo/mozinfo/mozinfo.py | ||
6700 | +++ b/testing/mozbase/mozinfo/mozinfo/mozinfo.py | ||
6701 | @@ -8,7 +8,7 @@ | ||
6702 | # linux) to the information; I certainly wouldn't want anyone parsing this | ||
6703 | # information and having behaviour depend on it | ||
6704 | |||
6705 | -from __future__ import absolute_import, print_function | ||
6706 | + | ||
6707 | |||
6708 | import os | ||
6709 | import platform | ||
6710 | @@ -24,7 +24,7 @@ _os = os | ||
6711 | class unknown(object): | ||
6712 | """marker class for unknown information""" | ||
6713 | |||
6714 | - def __nonzero__(self): | ||
6715 | + def __bool__(self): | ||
6716 | return False | ||
6717 | |||
6718 | def __str__(self): | ||
6719 | @@ -96,20 +96,17 @@ elif system.startswith(('MINGW', 'MSYS_NT')): | ||
6720 | info['os'] = 'win' | ||
6721 | os_version = version = unknown | ||
6722 | elif system == "Linux": | ||
6723 | - if hasattr(platform, "linux_distribution"): | ||
6724 | - (distro, os_version, codename) = platform.linux_distribution() | ||
6725 | - else: | ||
6726 | - (distro, os_version, codename) = platform.dist() | ||
6727 | if not processor: | ||
6728 | processor = machine | ||
6729 | - version = "%s %s" % (distro, os_version) | ||
6730 | + | ||
6731 | + distro = 'OE/Yocto' | ||
6732 | + os_version = version = unknown | ||
6733 | |||
6734 | # Bug in Python 2's `platform` library: | ||
6735 | # It will return a triple of empty strings if the distribution is not supported. | ||
6736 | # It works on Python 3. If we don't have an OS version, | ||
6737 | # the unit tests fail to run. | ||
6738 | if not distro and not os_version and not codename: | ||
6739 | - distro = 'lfs' | ||
6740 | version = release | ||
6741 | os_version = release | ||
6742 | |||
6743 | @@ -131,7 +128,7 @@ else: | ||
6744 | os_version = version = unknown | ||
6745 | |||
6746 | info['version'] = version | ||
6747 | -info['os_version'] = StringVersion(os_version) | ||
6748 | +info['os_version'] = version | ||
6749 | |||
6750 | # processor type and bits | ||
6751 | if processor in ["i386", "i686"]: | ||
6752 | @@ -188,12 +185,7 @@ def update(new_info): | ||
6753 | to a json file containing the new info. | ||
6754 | """ | ||
6755 | |||
6756 | - PY3 = sys.version_info[0] == 3 | ||
6757 | - if PY3: | ||
6758 | - string_types = str, | ||
6759 | - else: | ||
6760 | - string_types = basestring, | ||
6761 | - if isinstance(new_info, string_types): | ||
6762 | + if isinstance(new_info, str): | ||
6763 | # lazy import | ||
6764 | import mozfile | ||
6765 | import json | ||
6766 | @@ -295,7 +287,7 @@ def main(args=None): | ||
6767 | |||
6768 | # print out choices if requested | ||
6769 | flag = False | ||
6770 | - for key, value in options.__dict__.items(): | ||
6771 | + for key, value in list(options.__dict__.items()): | ||
6772 | if value is True: | ||
6773 | print('%s choices: %s' % (key, ' '.join([str(choice) | ||
6774 | for choice in choices[key]]))) | ||
6775 | @@ -304,7 +296,7 @@ def main(args=None): | ||
6776 | return | ||
6777 | |||
6778 | # otherwise, print out all info | ||
6779 | - for key, value in info.items(): | ||
6780 | + for key, value in list(info.items()): | ||
6781 | print('%s: %s' % (key, value)) | ||
6782 | |||
6783 | |||
6784 | diff --git a/testing/mozbase/mozprocess/mozprocess/processhandler.py b/testing/mozbase/mozprocess/mozprocess/processhandler.py | ||
6785 | index 3efb650b7..2575a4702 100644 | ||
6786 | --- a/testing/mozbase/mozprocess/mozprocess/processhandler.py | ||
6787 | +++ b/testing/mozbase/mozprocess/mozprocess/processhandler.py | ||
6788 | @@ -2,7 +2,7 @@ | ||
6789 | # License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
6790 | # You can obtain one at http://mozilla.org/MPL/2.0/. | ||
6791 | |||
6792 | -from __future__ import absolute_import, print_function | ||
6793 | + | ||
6794 | |||
6795 | import errno | ||
6796 | import os | ||
6797 | @@ -13,7 +13,7 @@ import threading | ||
6798 | import time | ||
6799 | import traceback | ||
6800 | |||
6801 | -from Queue import Queue, Empty | ||
6802 | +from queue import Queue, Empty | ||
6803 | from datetime import datetime | ||
6804 | |||
6805 | |||
6806 | @@ -124,14 +124,14 @@ class ProcessHandlerMixin(object): | ||
6807 | thread = threading.current_thread().name | ||
6808 | print("DBG::MOZPROC PID:{} ({}) | {}".format(self.pid, thread, msg)) | ||
6809 | |||
6810 | - def __del__(self, _maxint=sys.maxint): | ||
6811 | + def __del__(self, _maxint=sys.maxsize): | ||
6812 | if isWin: | ||
6813 | handle = getattr(self, '_handle', None) | ||
6814 | if handle: | ||
6815 | if hasattr(self, '_internal_poll'): | ||
6816 | self._internal_poll(_deadstate=_maxint) | ||
6817 | else: | ||
6818 | - self.poll(_deadstate=sys.maxint) | ||
6819 | + self.poll(_deadstate=sys.maxsize) | ||
6820 | if handle or self._job or self._io_port: | ||
6821 | self._cleanup() | ||
6822 | else: | ||
6823 | @@ -243,7 +243,7 @@ class ProcessHandlerMixin(object): | ||
6824 | p2cread, p2cwrite, | ||
6825 | c2pread, c2pwrite, | ||
6826 | errread, errwrite) = args_tuple | ||
6827 | - if not isinstance(args, basestring): | ||
6828 | + if not isinstance(args, str): | ||
6829 | args = subprocess.list2cmdline(args) | ||
6830 | |||
6831 | # Always or in the create new process group | ||
6832 | diff --git a/third_party/python/which/which.py b/third_party/python/which/which.py | ||
6833 | index 9c7d10835..f02b2616e 100644 | ||
6834 | --- a/third_party/python/which/which.py | ||
6835 | +++ b/third_party/python/which/which.py | ||
6836 | @@ -90,13 +90,13 @@ def _getRegisteredExecutable(exeName): | ||
6837 | if sys.platform.startswith('win'): | ||
6838 | if os.path.splitext(exeName)[1].lower() != '.exe': | ||
6839 | exeName += '.exe' | ||
6840 | - import _winreg | ||
6841 | + import winreg | ||
6842 | try: | ||
6843 | key = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\" +\ | ||
6844 | exeName | ||
6845 | - value = _winreg.QueryValue(_winreg.HKEY_LOCAL_MACHINE, key) | ||
6846 | + value = winreg.QueryValue(winreg.HKEY_LOCAL_MACHINE, key) | ||
6847 | registered = (value, "from HKLM\\"+key) | ||
6848 | - except _winreg.error: | ||
6849 | + except winreg.error: | ||
6850 | pass | ||
6851 | if registered and not os.path.exists(registered[0]): | ||
6852 | registered = None | ||
6853 | @@ -244,7 +244,7 @@ def which(command, path=None, verbose=0, exts=None): | ||
6854 | If no match is found for the command, a WhichError is raised. | ||
6855 | """ | ||
6856 | try: | ||
6857 | - match = whichgen(command, path, verbose, exts).next() | ||
6858 | + match = next(whichgen(command, path, verbose, exts)) | ||
6859 | except StopIteration: | ||
6860 | raise WhichError("Could not find '%s' on the path." % command) | ||
6861 | return match | ||
6862 | @@ -281,17 +281,17 @@ def main(argv): | ||
6863 | try: | ||
6864 | optlist, args = getopt.getopt(argv[1:], 'haVvqp:e:', | ||
6865 | ['help', 'all', 'version', 'verbose', 'quiet', 'path=', 'exts=']) | ||
6866 | - except getopt.GetoptError, msg: | ||
6867 | + except getopt.GetoptError as msg: | ||
6868 | sys.stderr.write("which: error: %s. Your invocation was: %s\n"\ | ||
6869 | % (msg, argv)) | ||
6870 | sys.stderr.write("Try 'which --help'.\n") | ||
6871 | return 1 | ||
6872 | for opt, optarg in optlist: | ||
6873 | if opt in ('-h', '--help'): | ||
6874 | - print _cmdlnUsage | ||
6875 | + print(_cmdlnUsage) | ||
6876 | return 0 | ||
6877 | elif opt in ('-V', '--version'): | ||
6878 | - print "which %s" % __version__ | ||
6879 | + print("which %s" % __version__) | ||
6880 | return 0 | ||
6881 | elif opt in ('-a', '--all'): | ||
6882 | all = 1 | ||
6883 | @@ -319,9 +319,9 @@ def main(argv): | ||
6884 | nmatches = 0 | ||
6885 | for match in whichgen(arg, path=altpath, verbose=verbose, exts=exts): | ||
6886 | if verbose: | ||
6887 | - print "%s (%s)" % match | ||
6888 | + print("%s (%s)" % match) | ||
6889 | else: | ||
6890 | - print match | ||
6891 | + print(match) | ||
6892 | nmatches += 1 | ||
6893 | if not all: | ||
6894 | break | ||
6895 | -- | ||
6896 | 2.21.0 | ||
6897 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0002-js.pc.in-do-not-include-RequiredDefines.h-for-depend.patch b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0002-js.pc.in-do-not-include-RequiredDefines.h-for-depend.patch new file mode 100644 index 0000000000..e3f1883a99 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0002-js.pc.in-do-not-include-RequiredDefines.h-for-depend.patch | |||
@@ -0,0 +1,33 @@ | |||
1 | From 0a61b0b98c152f10404ccbdeeac583a486638a7a Mon Sep 17 00:00:00 2001 | ||
2 | From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@googlemail.com> | ||
3 | Date: Thu, 6 Jun 2013 18:36:01 +0200 | ||
4 | Subject: [PATCH] js.pc.in: do not include RequiredDefines.h for depending | ||
5 | packages | ||
6 | |||
7 | in our cross environment the would fail with: | ||
8 | |||
9 | | cc1: fatal error: /usr/include/js-17.0/js/RequiredDefines.h: No such file or directory | ||
10 | |||
11 | and currently it only defines __STDC_LIMIT_MACROS | ||
12 | Upstream-Status: Inappropriate [embedded specific] | ||
13 | Signed-off-by: Andreas MĂ¼ller <schnitzeltony@googlemail.com> | ||
14 | |||
15 | Rebase to 52.8.1 | ||
16 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
17 | --- | ||
18 | js/src/build/js.pc.in | 2 +- | ||
19 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
20 | |||
21 | diff --git a/js/src/build/js.pc.in b/js/src/build/js.pc.in | ||
22 | index 2eae393..c2dea62 100644 | ||
23 | --- a/js/src/build/js.pc.in | ||
24 | +++ b/js/src/build/js.pc.in | ||
25 | @@ -8,4 +8,4 @@ Description: The Mozilla library for JavaScript | ||
26 | Version: @MOZILLA_VERSION@ | ||
27 | @PKGCONF_REQUIRES_PRIVATE@ | ||
28 | Libs: -L${libdir} -l@JS_LIBRARY_NAME@ | ||
29 | -Cflags: -include ${includedir}/@JS_LIBRARY_NAME@/js/RequiredDefines.h -I${includedir}/@JS_LIBRARY_NAME@ | ||
30 | +Cflags: -I${includedir}/@JS_LIBRARY_NAME@ | ||
31 | -- | ||
32 | 2.7.4 | ||
33 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0003-fix-cross-compilation-on-i586-targets.patch b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0003-fix-cross-compilation-on-i586-targets.patch new file mode 100644 index 0000000000..e0929a8a8f --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0003-fix-cross-compilation-on-i586-targets.patch | |||
@@ -0,0 +1,38 @@ | |||
1 | From a452138a1dd274bfad381a701729783360dc86fb Mon Sep 17 00:00:00 2001 | ||
2 | From: Maciej Borzecki <maciej.borzecki@open-rnd.pl> | ||
3 | Date: Tue, 5 Jan 2016 22:04:17 +0100 | ||
4 | Subject: [PATCH] fix cross compilation on i586 targets | ||
5 | |||
6 | Remove offending -Wl,-rpath-link that may cause host libraries to be picked | ||
7 | during linking. The patch applies a fix to configure.in. So as not to | ||
8 | regenerate configure, similar fix is applied there. | ||
9 | |||
10 | Upstream-Status: Inappropriate [embedded specific] | ||
11 | |||
12 | Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl> | ||
13 | |||
14 | Rebase to 52.8.1 | ||
15 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
16 | |||
17 | Rebase to 60.9.0 (firefox-esr sources) | ||
18 | Signed-off-by: Andreas MĂ¼ller <schnitzeltony@gmail.com> | ||
19 | --- | ||
20 | js/src/old-configure.in | 2 +- | ||
21 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
22 | |||
23 | diff --git a/js/src/old-configure.in b/js/src/old-configure.in | ||
24 | index 3d53ee1..11c3d5a 100644 | ||
25 | --- a/js/src/old-configure.in | ||
26 | +++ b/js/src/old-configure.in | ||
27 | @@ -405,7 +405,7 @@ AS='$(CC)' | ||
28 | AS_DASH_C_FLAG='-c' | ||
29 | MOZ_USER_DIR=".mozilla" | ||
30 | |||
31 | -MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin -Wl,-rpath-link,${prefix}/lib" | ||
32 | +MOZ_FIX_LINK_PATHS="-Wl,-rpath-link,${DIST}/bin" | ||
33 | |||
34 | dnl Configure platform-specific CPU architecture compiler options. | ||
35 | dnl ============================================================== | ||
36 | -- | ||
37 | 2.21.0 | ||
38 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0004-do-not-create-python-environment.patch b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0004-do-not-create-python-environment.patch new file mode 100644 index 0000000000..985fc36c18 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0004-do-not-create-python-environment.patch | |||
@@ -0,0 +1,64 @@ | |||
1 | From 5028d1cd669c179ed49061316d04c8e8862a5bd8 Mon Sep 17 00:00:00 2001 | ||
2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
3 | Date: Thu, 12 Jul 2018 15:04:47 +0800 | ||
4 | Subject: [PATCH 1/5] do not create python environment | ||
5 | |||
6 | Use oe's python environment rather than create one of host | ||
7 | |||
8 | Upstream-Status: Inappropriate [oe specific] | ||
9 | |||
10 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
11 | |||
12 | Rebase to 60.9.0 (firefox-esr sources) | ||
13 | Signed-off-by: Andreas MĂ¼ller <schnitzeltony@gmail.com> | ||
14 | --- | ||
15 | build/moz.configure/init.configure | 18 ------------------ | ||
16 | configure.py | 10 +++++++++- | ||
17 | 3 files changed, 11 insertions(+), 21 deletions(-) | ||
18 | |||
19 | --- a/build/moz.configure/init.configure | ||
20 | +++ b/build/moz.configure/init.configure | ||
21 | @@ -250,24 +250,6 @@ def virtualenv_python(env_python, build_ | ||
22 | else: | ||
23 | python = sys.executable | ||
24 | |||
25 | - if not manager.up_to_date(python): | ||
26 | - log.info('Creating Python environment') | ||
27 | - manager.build(python) | ||
28 | - | ||
29 | - python = normsep(manager.python_path) | ||
30 | - | ||
31 | - if python != normsep(sys.executable): | ||
32 | - log.info('Reexecuting in the virtualenv') | ||
33 | - if env_python: | ||
34 | - del os.environ['PYTHON'] | ||
35 | - # One would prefer to use os.execl, but that's completely borked on | ||
36 | - # Windows. | ||
37 | - sys.exit(subprocess.call([python] + sys.argv)) | ||
38 | - | ||
39 | - # We are now in the virtualenv | ||
40 | - if not distutils.sysconfig.get_python_lib(): | ||
41 | - die('Could not determine python site packages directory') | ||
42 | - | ||
43 | return python | ||
44 | |||
45 | |||
46 | --- a/configure.py | ||
47 | +++ b/configure.py | ||
48 | @@ -12,7 +12,15 @@ import textwrap | ||
49 | |||
50 | |||
51 | base_dir = os.path.abspath(os.path.dirname(__file__)) | ||
52 | -sys.path.insert(0, os.path.join(base_dir, 'python', 'mozbuild')) | ||
53 | +sys.path.insert(0, os.path.join(base_dir, 'config')) | ||
54 | +def get_immediate_subdirectories(a_dir): | ||
55 | + return [name for name in os.listdir(a_dir) | ||
56 | + if os.path.isdir(os.path.join(a_dir, name))] | ||
57 | +for s in ["python", "testing/mozbase"]: | ||
58 | + sub_dir = os.path.join(base_dir, s) | ||
59 | + for module_dir in get_immediate_subdirectories(sub_dir): | ||
60 | + sys.path.insert(0, os.path.join(sub_dir, module_dir)) | ||
61 | + | ||
62 | from mozbuild.configure import ConfigureSandbox | ||
63 | from mozbuild.makeutil import Makefile | ||
64 | from mozbuild.pythonutil import iter_modules_in_path | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0005-fix-cannot-find-link.patch b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0005-fix-cannot-find-link.patch new file mode 100644 index 0000000000..4f7ebc68d7 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0005-fix-cannot-find-link.patch | |||
@@ -0,0 +1,34 @@ | |||
1 | From e6dcee5f8a0f80ce99946b81fa1233611a149fe6 Mon Sep 17 00:00:00 2001 | ||
2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
3 | Date: Thu, 12 Jul 2018 18:00:52 +0800 | ||
4 | Subject: [PATCH 2/5] fix cannot find link | ||
5 | |||
6 | .. | ||
7 | |DEBUG: link: Trying 'mips64-wrs-linux-ld --sysroot=tmp-glibc/work/ | ||
8 | mips64-wrs-linux/mozjs/52.8.1-r0/recipe-sysroot ' | ||
9 | |ERROR: Cannot find link | ||
10 | ... | ||
11 | |||
12 | Upstream-Status: Inappropriate [oe specific] | ||
13 | |||
14 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
15 | --- | ||
16 | build/moz.configure/checks.configure | 2 +- | ||
17 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
18 | |||
19 | diff --git a/build/moz.configure/checks.configure b/build/moz.configure/checks.configure | ||
20 | index 8c2dbc0..83bffc3 100644 | ||
21 | --- a/build/moz.configure/checks.configure | ||
22 | +++ b/build/moz.configure/checks.configure | ||
23 | @@ -128,7 +128,7 @@ def check_prog(var, progs, what=None, input=None, allow_missing=False, | ||
24 | |||
25 | for prog in value or progs: | ||
26 | log.debug('%s: Trying %s', var.lower(), quote(prog)) | ||
27 | - result = find_program(prog, paths) | ||
28 | + result = find_program(prog.split()[0], paths) | ||
29 | if result: | ||
30 | return result | ||
31 | |||
32 | -- | ||
33 | 2.7.4 | ||
34 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0006-workaround-autoconf-2.13-detection-failed.patch b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0006-workaround-autoconf-2.13-detection-failed.patch new file mode 100644 index 0000000000..a754ff16cf --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0006-workaround-autoconf-2.13-detection-failed.patch | |||
@@ -0,0 +1,28 @@ | |||
1 | From 646a78262b18e19721cd41ee515215221dd241b6 Mon Sep 17 00:00:00 2001 | ||
2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
3 | Date: Thu, 12 Jul 2018 18:12:42 +0800 | ||
4 | Subject: [PATCH 3/5] workaround autoconf 2.13 detection failed | ||
5 | |||
6 | Upstream-Status: Inappropriate [oe specific] | ||
7 | |||
8 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
9 | --- | ||
10 | build/moz.configure/old.configure | 2 +- | ||
11 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
12 | |||
13 | diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure | ||
14 | index b32c3f7..ece47f4 100644 | ||
15 | --- a/build/moz.configure/old.configure | ||
16 | +++ b/build/moz.configure/old.configure | ||
17 | @@ -31,7 +31,7 @@ def autoconf(mozconfig, autoconf): | ||
18 | autoconf = autoconf[0] if autoconf else None | ||
19 | |||
20 | for ac in (mozconfig_autoconf, autoconf, 'autoconf-2.13', 'autoconf2.13', | ||
21 | - 'autoconf213'): | ||
22 | + 'autoconf213', 'autoconf'): | ||
23 | if ac: | ||
24 | autoconf = find_program(ac) | ||
25 | if autoconf: | ||
26 | -- | ||
27 | 2.7.4 | ||
28 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0007-fix-do_compile-failed-on-mips.patch b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0007-fix-do_compile-failed-on-mips.patch new file mode 100644 index 0000000000..d1da109720 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0007-fix-do_compile-failed-on-mips.patch | |||
@@ -0,0 +1,33 @@ | |||
1 | From 55d833dc3c194f1eb7841f308ad3b9ec3800d3b3 Mon Sep 17 00:00:00 2001 | ||
2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
3 | Date: Fri, 13 Jul 2018 15:48:32 +0800 | ||
4 | Subject: [PATCH 5/5] fix do_compile failed on mips | ||
5 | |||
6 | Link with var-OS_LDFLAGS to fix the issue. | ||
7 | Such as on mips: | ||
8 | ... | ||
9 | |mips-wrsmllib32-linux-g++ -meb -mabi=32 -mhard-float ... -o libmozjs-52.so | ||
10 | |/usr/include/c++/8.1.0/bits/atomic_base.h:514: error: undefined | ||
11 | reference to '__atomic_fetch_add_8' | ||
12 | ... | ||
13 | |||
14 | In recipe, set OS_LDFLAGS="-Wl,-latomic" could fix the issue. | ||
15 | |||
16 | Upstream-Status: Inappropriate [oe specific] | ||
17 | |||
18 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
19 | --- | ||
20 | config/config.mk | 2 +- | ||
21 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
22 | |||
23 | --- a/config/config.mk | ||
24 | +++ b/config/config.mk | ||
25 | @@ -423,7 +423,7 @@ EXPAND_MKSHLIB_ARGS = --uselist | ||
26 | ifdef SYMBOL_ORDER | ||
27 | EXPAND_MKSHLIB_ARGS += --symbol-order $(SYMBOL_ORDER) | ||
28 | endif | ||
29 | -EXPAND_MKSHLIB = $(EXPAND_LIBS_EXEC) $(EXPAND_MKSHLIB_ARGS) -- $(MKSHLIB) | ||
30 | +EXPAND_MKSHLIB = $(EXPAND_LIBS_EXEC) $(EXPAND_MKSHLIB_ARGS) -- $(MKSHLIB) $(OS_LDFLAGS) | ||
31 | |||
32 | # autoconf.mk sets OBJ_SUFFIX to an error to avoid use before including | ||
33 | # this file | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0008-add-riscv-support.patch b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0008-add-riscv-support.patch new file mode 100644 index 0000000000..0a41485610 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0008-add-riscv-support.patch | |||
@@ -0,0 +1,50 @@ | |||
1 | Add RISC-V support | ||
2 | |||
3 | Upstream-Status: Submitted [https://bugzilla.mozilla.org/show_bug.cgi?id=1318905] | ||
4 | |||
5 | Signed-off-by: Ricardo Salveti <ricardo@foundries.io> | ||
6 | |||
7 | --- a/build/autoconf/config.guess | ||
8 | +++ b/build/autoconf/config.guess | ||
9 | @@ -1029,6 +1029,9 @@ EOF | ||
10 | ppcle:Linux:*:*) | ||
11 | echo powerpcle-unknown-linux-${LIBC} | ||
12 | exit ;; | ||
13 | + riscv32:Linux:*:* | riscv64:Linux:*:*) | ||
14 | + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} | ||
15 | + exit ;; | ||
16 | s390:Linux:*:* | s390x:Linux:*:*) | ||
17 | echo ${UNAME_MACHINE}-ibm-linux-${LIBC} | ||
18 | exit ;; | ||
19 | --- a/build/moz.configure/init.configure | ||
20 | +++ b/build/moz.configure/init.configure | ||
21 | @@ -658,6 +658,9 @@ def split_triplet(triplet, allow_unknown | ||
22 | elif cpu == 'sh4': | ||
23 | canonical_cpu = 'sh4' | ||
24 | endianness = 'little' | ||
25 | + elif cpu in ('riscv32', 'riscv64'): | ||
26 | + canonical_cpu = cpu | ||
27 | + endianness = 'little' | ||
28 | elif allow_unknown: | ||
29 | canonical_cpu = cpu | ||
30 | endianness = 'unknown' | ||
31 | --- a/python/mozbuild/mozbuild/configure/constants.py | ||
32 | +++ b/python/mozbuild/mozbuild/configure/constants.py | ||
33 | @@ -50,6 +50,8 @@ CPU_bitness = { | ||
34 | 'mips64': 64, | ||
35 | 'ppc': 32, | ||
36 | 'ppc64': 64, | ||
37 | + 'riscv32': 32, | ||
38 | + 'riscv64': 64, | ||
39 | 's390': 32, | ||
40 | 's390x': 64, | ||
41 | 'sh4': 32, | ||
42 | @@ -82,6 +84,8 @@ CPU_preprocessor_checks = OrderedDict(( | ||
43 | ('s390', '__s390__'), | ||
44 | ('ppc64', '__powerpc64__'), | ||
45 | ('ppc', '__powerpc__'), | ||
46 | + ('riscv32', '__riscv && __SIZEOF_POINTER__ == 4'), | ||
47 | + ('riscv64', '__riscv && __SIZEOF_POINTER__ == 8'), | ||
48 | ('Alpha', '__alpha__'), | ||
49 | ('hppa', '__hppa__'), | ||
50 | ('sparc64', '__sparc__ && __arch64__'), | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0009-mozjs-fix-coredump-caused-by-getenv.patch b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0009-mozjs-fix-coredump-caused-by-getenv.patch new file mode 100644 index 0000000000..477f73a2f7 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0009-mozjs-fix-coredump-caused-by-getenv.patch | |||
@@ -0,0 +1,27 @@ | |||
1 | From 20b639b7364f9953fdacb058f9ba800bcbf029b4 Mon Sep 17 00:00:00 2001 | ||
2 | From: Changqing Li <changqing.li@windriver.com> | ||
3 | Date: Thu, 2 Aug 2018 09:40:48 +0800 | ||
4 | Subject: [PATCH] mozjs: fix coredump caused by getenv | ||
5 | |||
6 | Upstream-Status: Submitted [https://bugzilla.mozilla.org/show_bug.cgi?id=1480315] | ||
7 | |||
8 | Signed-off-by: Changqing Li <changqing.li@windriver.com> | ||
9 | --- | ||
10 | mozglue/misc/TimeStamp.cpp | 1 + | ||
11 | 1 file changed, 1 insertion(+) | ||
12 | |||
13 | diff --git a/mozglue/misc/TimeStamp.cpp b/mozglue/misc/TimeStamp.cpp | ||
14 | index 932b75c..7a4d71b 100644 | ||
15 | --- a/mozglue/misc/TimeStamp.cpp | ||
16 | +++ b/mozglue/misc/TimeStamp.cpp | ||
17 | @@ -11,6 +11,7 @@ | ||
18 | #include "mozilla/TimeStamp.h" | ||
19 | #include <stdio.h> | ||
20 | #include <string.h> | ||
21 | +#include <stdlib.h> | ||
22 | |||
23 | namespace mozilla { | ||
24 | |||
25 | -- | ||
26 | 2.7.4 | ||
27 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0010-format-overflow.patch b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0010-format-overflow.patch new file mode 100644 index 0000000000..e257fc6f62 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0010-format-overflow.patch | |||
@@ -0,0 +1,21 @@ | |||
1 | Drop enable format string warnings to help gcc9 | ||
2 | |||
3 | Fixes | ||
4 | | /mnt/a/yoe/build/tmp/work/core2-64-yoe-linux-musl/mozjs/52.9.1-r0/mozjs-52.9.1/js/src/jit/x64/BaseAssembler-x64.h:596:13: error: '%s' directive argument is null [-Werror=format-overflow=] | ||
5 | | 596 | spew("movq " MEM_obs ", %s", ADDR_obs(offset, base, index, scale), GPReg64Name(dst)); | ||
6 | | | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
7 | |||
8 | Upstream-Status: Inappropriate [Workaround for gcc9] | ||
9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
10 | |||
11 | --- a/js/src/moz.build | ||
12 | +++ b/js/src/moz.build | ||
13 | @@ -785,7 +785,7 @@ if CONFIG['JS_HAS_CTYPES']: | ||
14 | if CONFIG['CC_TYPE'] in ('clang', 'gcc'): | ||
15 | # Also disable strict-aliasing for GCC compiler, that is enabled by default | ||
16 | # starting with version 7.1, see Bug 1363009 | ||
17 | - CXXFLAGS += ['-Wno-shadow', '-Werror=format', '-fno-strict-aliasing'] | ||
18 | + CXXFLAGS += ['-Wno-shadow', '-fno-strict-aliasing'] | ||
19 | |||
20 | # Suppress warnings in third-party code. | ||
21 | if CONFIG['CC_TYPE'] in ('clang', 'gcc'): | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0011-To-fix-build-error-on-arm32BE.patch b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0011-To-fix-build-error-on-arm32BE.patch new file mode 100644 index 0000000000..056f74a529 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0011-To-fix-build-error-on-arm32BE.patch | |||
@@ -0,0 +1,28 @@ | |||
1 | From 9afb0e4d3b9209ea198052cea0401bef7ee25ad8 Mon Sep 17 00:00:00 2001 | ||
2 | From: Lei Maohui <leimaohui@cn.fujitsu.com> | ||
3 | Date: Thu, 9 May 2019 12:23:40 +0900 | ||
4 | Subject: [PATCH] To fix build error on arm32BE. | ||
5 | |||
6 | error: #error Target architecture was not detected as supported by Double-Conversion. | ||
7 | |||
8 | Signed-off-by: Lei Maohui <leimaohui@cn.fujitsu.com> | ||
9 | --- | ||
10 | mfbt/double-conversion/double-conversion/utils.h | 2 +- | ||
11 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
12 | |||
13 | diff --git a/mfbt/double-conversion/double-conversion/utils.h b/mfbt/double-conversion/double-conversion/utils.h | ||
14 | index 4f37218..93575cb 100644 | ||
15 | --- a/mfbt/double-conversion/double-conversion/utils.h | ||
16 | +++ b/mfbt/double-conversion/double-conversion/utils.h | ||
17 | @@ -53,7 +53,7 @@ | ||
18 | // disabled.) | ||
19 | // On Linux,x86 89255e-22 != Div_double(89255.0/1e22) | ||
20 | #if defined(_M_X64) || defined(__x86_64__) || \ | ||
21 | - defined(__ARMEL__) || defined(__avr32__) || \ | ||
22 | + defined(__arm__) || defined(__avr32__) || \ | ||
23 | defined(__hppa__) || defined(__ia64__) || \ | ||
24 | defined(__mips__) || \ | ||
25 | defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) || \ | ||
26 | -- | ||
27 | 2.7.4 | ||
28 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0012-JS_PUBLIC_API.patch b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0012-JS_PUBLIC_API.patch new file mode 100644 index 0000000000..56b18ba8c6 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0012-JS_PUBLIC_API.patch | |||
@@ -0,0 +1,55 @@ | |||
1 | patch from https://bugzilla.mozilla.org/show_bug.cgi?id=1426865 | ||
2 | |||
3 | Upstream-Status: Submitted [https://bugzilla.mozilla.org/show_bug.cgi?id=1426865] | ||
4 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
5 | --- a/js/public/TypeDecls.h | ||
6 | +++ b/js/public/TypeDecls.h | ||
7 | @@ -21,31 +21,32 @@ | ||
8 | #include <stdint.h> | ||
9 | |||
10 | #include "js-config.h" | ||
11 | +#include "jstypes.h" | ||
12 | |||
13 | typedef uint8_t jsbytecode; | ||
14 | |||
15 | -class JSAtom; | ||
16 | -struct JSCompartment; | ||
17 | -struct JSContext; | ||
18 | -class JSFunction; | ||
19 | -class JSObject; | ||
20 | -struct JSRuntime; | ||
21 | -class JSScript; | ||
22 | -class JSString; | ||
23 | -class JSAddonId; | ||
24 | -struct JSFreeOp; | ||
25 | +class JS_PUBLIC_API JSAtom; | ||
26 | +struct JS_PUBLIC_API JSCompartment; | ||
27 | +struct JS_PUBLIC_API JSContext; | ||
28 | +class JS_PUBLIC_API JSFunction; | ||
29 | +class JS_PUBLIC_API JSObject; | ||
30 | +struct JS_PUBLIC_API JSRuntime; | ||
31 | +class JS_PUBLIC_API JSScript; | ||
32 | +class JS_PUBLIC_API JSString; | ||
33 | +class JS_PUBLIC_API JSAddonId; | ||
34 | +struct JS_PUBLIC_API JSFreeOp; | ||
35 | |||
36 | -struct jsid; | ||
37 | +struct JS_PUBLIC_API jsid; | ||
38 | |||
39 | namespace JS { | ||
40 | |||
41 | typedef unsigned char Latin1Char; | ||
42 | |||
43 | -class Symbol; | ||
44 | -class Value; | ||
45 | -class Realm; | ||
46 | -struct Runtime; | ||
47 | -struct Zone; | ||
48 | +class JS_PUBLIC_API Symbol; | ||
49 | +class JS_PUBLIC_API Value; | ||
50 | +class JS_PUBLIC_API Realm; | ||
51 | +struct JS_PUBLIC_API Runtime; | ||
52 | +struct JS_PUBLIC_API Zone; | ||
53 | |||
54 | template <typename T> | ||
55 | class Handle; | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0013-riscv-Disable-atomic-operations.patch b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0013-riscv-Disable-atomic-operations.patch new file mode 100644 index 0000000000..2e810c87f9 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0013-riscv-Disable-atomic-operations.patch | |||
@@ -0,0 +1,38 @@ | |||
1 | From 64ad80e6d95871f17be4cd01da15581f41ac0b2b Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Mon, 27 May 2019 21:10:34 -0700 | ||
4 | Subject: [PATCH] riscv: Disable atomic operations | ||
5 | |||
6 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
7 | --- | ||
8 | js/src/jit/AtomicOperations.h | 2 ++ | ||
9 | 1 file changed, 2 insertions(+) | ||
10 | |||
11 | --- a/js/src/jit/AtomicOperations.h | ||
12 | +++ b/js/src/jit/AtomicOperations.h | ||
13 | @@ -393,6 +393,8 @@ inline bool AtomicOperations::isLockfree | ||
14 | #include "jit/none/AtomicOperations-feeling-lucky.h" | ||
15 | #elif defined(__s390__) || defined(__s390x__) | ||
16 | #include "jit/none/AtomicOperations-feeling-lucky.h" | ||
17 | +#elif defined(__riscv) | ||
18 | +#include "jit/none/AtomicOperations-feeling-lucky.h" | ||
19 | #else | ||
20 | #error "No AtomicOperations support provided for this platform" | ||
21 | #endif | ||
22 | --- a/js/src/jit/none/AtomicOperations-feeling-lucky.h | ||
23 | +++ b/js/src/jit/none/AtomicOperations-feeling-lucky.h | ||
24 | @@ -80,6 +80,14 @@ | ||
25 | #define GNUC_COMPATIBLE | ||
26 | #endif | ||
27 | |||
28 | +#ifdef __riscv | ||
29 | +#define GNUC_COMPATIBLE | ||
30 | +#ifdef __riscv_xlen == 64 | ||
31 | +#define HAS_64BIT_ATOMICS | ||
32 | +#define HAS_64BIT_LOCKFREE | ||
33 | +#endif | ||
34 | +#endif | ||
35 | + | ||
36 | // The default implementation tactic for gcc/clang is to use the newer | ||
37 | // __atomic intrinsics added for use in C++11 <atomic>. Where that | ||
38 | // isn't available, we use GCC's older __sync functions instead. | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0014-fallback-to-2011-C++-standard.patch b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0014-fallback-to-2011-C++-standard.patch new file mode 100644 index 0000000000..7a0d286e14 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/0014-fallback-to-2011-C++-standard.patch | |||
@@ -0,0 +1,42 @@ | |||
1 | Option '-std=gnu++14' has been supported from gcc 4.9. But on some build hosts | ||
2 | such as CentOS 7.6 which only has gcc 4.8.5 and fails to configure: | ||
3 | |||
4 | | checking whether the host C compiler can be used... no | ||
5 | | ERROR: Only GCC 4.9 or newer is supported (found version 4.8.5). | ||
6 | |||
7 | Fallback to 2011 C++ standard and lower required gcc version to 4.8.0 which is | ||
8 | the same as in previous version 52.9.1 of mozjs. | ||
9 | |||
10 | Upstream-Status: Inappropriate [Workaround] | ||
11 | |||
12 | Signed-off-by: Kai Kang <kai.kang@windriver.com> | ||
13 | --- | ||
14 | diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure | ||
15 | index 9c772a8..fc640c7 100755 | ||
16 | --- a/build/moz.configure/toolchain.configure | ||
17 | +++ b/build/moz.configure/toolchain.configure | ||
18 | @@ -502,10 +502,8 @@ def check_compiler(compiler, language, target): | ||
19 | append_flag('-std=c++14') | ||
20 | # GCC 4.9 indicates that it implements draft C++14 features | ||
21 | # instead of the full language. | ||
22 | - elif info.type == 'gcc' and \ | ||
23 | - info.language_version not in (draft_cxx14_version, | ||
24 | - cxx14_version): | ||
25 | - append_flag('-std=gnu++14') | ||
26 | + elif info.type == 'gcc' and info.language_version != 201103: | ||
27 | + append_flag('-std=gnu++11') | ||
28 | |||
29 | # We force clang-cl to emulate Visual C++ 2017 version 15.4 | ||
30 | if info.type == 'clang-cl' and info.version != '19.11.25547': | ||
31 | @@ -903,9 +901,9 @@ def compiler(language, host_or_target, c_compiler=None, other_compiler=None, | ||
32 | # Check the compiler version here instead of in `compiler_version` so | ||
33 | # that the `checking` message doesn't pretend the compiler can be used | ||
34 | # to then bail out one line later. | ||
35 | - if info.type == 'gcc' and info.version < '4.9.0': | ||
36 | + if info.type == 'gcc' and info.version < '4.8.0': | ||
37 | raise FatalCheckError( | ||
38 | - 'Only GCC 4.9 or newer is supported (found version %s).' | ||
39 | + 'Only GCC 4.8 or newer is supported (found version %s).' | ||
40 | % info.version) | ||
41 | |||
42 | if info.type == 'gcc' and host_or_target.os == 'Android': | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/mipsarchn32/0001-fix-compiling-failure-on-mips64-n32-bsp.patch b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/mipsarchn32/0001-fix-compiling-failure-on-mips64-n32-bsp.patch new file mode 100644 index 0000000000..b882d76ec2 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/mipsarchn32/0001-fix-compiling-failure-on-mips64-n32-bsp.patch | |||
@@ -0,0 +1,80 @@ | |||
1 | From f2f8be496c8e34b4d909b688a95c6f8565201081 Mon Sep 17 00:00:00 2001 | ||
2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
3 | Date: Wed, 19 Jun 2019 14:30:44 +0800 | ||
4 | Subject: [PATCH] fix compiling failure on mips64-n32 bsp | ||
5 | |||
6 | - Tweak mips64-n32 with mips32 | ||
7 | |||
8 | - The toolchain of mips64-n32 supports both of macro | ||
9 | `__mips64' and `__mips__', but 32bit is required here. | ||
10 | |||
11 | - N32 uses 64-bit registers but restricts addresses to 32 bits. | ||
12 | https://www.linux-mips.org/pub/linux/mips/doc/ABI/MIPS-N32-ABI-Handbook.pdf | ||
13 | Table 2-1 specifies the use of registers in n32 and native 64-bit mode. | ||
14 | From the table, N32 and N64 have the same registers | ||
15 | |||
16 | Upstream-Status: Inappropriate [oe specific] | ||
17 | |||
18 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
19 | Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com> | ||
20 | --- | ||
21 | build/moz.configure/init.configure | 5 ++++- | ||
22 | js/src/jit/mips-shared/Architecture-mips-shared.h | 4 +++- | ||
23 | python/mozbuild/mozbuild/configure/constants.py | 2 +- | ||
24 | 3 files changed, 8 insertions(+), 3 deletions(-) | ||
25 | |||
26 | diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure | ||
27 | index 648ac2d..d0bcaf8 100644 | ||
28 | --- a/build/moz.configure/init.configure | ||
29 | +++ b/build/moz.configure/init.configure | ||
30 | @@ -650,7 +650,10 @@ def split_triplet(triplet, allow_unknown=False): | ||
31 | canonical_cpu = 'mips32' | ||
32 | endianness = 'little' if 'el' in cpu else 'big' | ||
33 | elif cpu in ('mips64', 'mips64el'): | ||
34 | - canonical_cpu = 'mips64' | ||
35 | + if 'n32' in triplet: | ||
36 | + canonical_cpu = 'mips32' | ||
37 | + else: | ||
38 | + canonical_cpu = 'mips64' | ||
39 | endianness = 'little' if 'el' in cpu else 'big' | ||
40 | elif cpu.startswith('aarch64'): | ||
41 | canonical_cpu = 'aarch64' | ||
42 | diff --git a/js/src/jit/mips-shared/Architecture-mips-shared.h b/js/src/jit/mips-shared/Architecture-mips-shared.h | ||
43 | index e95ffd4..caf83f7 100644 | ||
44 | --- a/js/src/jit/mips-shared/Architecture-mips-shared.h | ||
45 | +++ b/js/src/jit/mips-shared/Architecture-mips-shared.h | ||
46 | @@ -28,6 +28,8 @@ | ||
47 | #elif (defined(_MIPS_SIM) && (_MIPS_SIM == _ABI64)) || \ | ||
48 | defined(JS_SIMULATOR_MIPS64) | ||
49 | #define USES_N64_ABI | ||
50 | +#elif (defined(_MIPS_SIM) && (_MIPS_SIM == _ABIN32)) | ||
51 | +#define USES_N32_ABI | ||
52 | #else | ||
53 | #error "Unsupported ABI" | ||
54 | #endif | ||
55 | @@ -94,7 +96,7 @@ class Registers { | ||
56 | ta1 = t5, | ||
57 | ta2 = t6, | ||
58 | ta3 = t7, | ||
59 | -#elif defined(USES_N64_ABI) | ||
60 | +#elif defined(USES_N64_ABI) || defined(USES_N32_ABI) | ||
61 | a4 = r8, | ||
62 | a5 = r9, | ||
63 | a6 = r10, | ||
64 | diff --git a/python/mozbuild/mozbuild/configure/constants.py b/python/mozbuild/mozbuild/configure/constants.py | ||
65 | index 1067b6a..e0f0405 100644 | ||
66 | --- a/python/mozbuild/mozbuild/configure/constants.py | ||
67 | +++ b/python/mozbuild/mozbuild/configure/constants.py | ||
68 | @@ -90,8 +90,8 @@ CPU_preprocessor_checks = OrderedDict(( | ||
69 | ('hppa', '__hppa__'), | ||
70 | ('sparc64', '__sparc__ && __arch64__'), | ||
71 | ('sparc', '__sparc__'), | ||
72 | - ('mips64', '__mips64'), | ||
73 | ('mips32', '__mips__'), | ||
74 | + ('mips64', '__mips64'), | ||
75 | ('sh4', '__sh__'), | ||
76 | )) | ||
77 | |||
78 | -- | ||
79 | 2.7.4 | ||
80 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/musl/0001-support-musl.patch b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/musl/0001-support-musl.patch new file mode 100644 index 0000000000..770d5e0aaa --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/musl/0001-support-musl.patch | |||
@@ -0,0 +1,98 @@ | |||
1 | From 04e8a611e958f0da1ccac61acae3a6f1a5168b20 Mon Sep 17 00:00:00 2001 | ||
2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
3 | Date: Fri, 13 Jul 2018 18:08:14 +0800 | ||
4 | Subject: [PATCH] support musl | ||
5 | |||
6 | Upstream-Status: Pending | ||
7 | |||
8 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
9 | --- | ||
10 | mozglue/misc/TimeStamp_darwin.cpp | 1 - | ||
11 | mozglue/misc/TimeStamp_posix.cpp | 1 - | ||
12 | nsprpub/pr/src/misc/prsystem.c | 1 - | ||
13 | python/psutil/psutil/_psutil_bsd.c | 1 - | ||
14 | python/psutil/psutil/_psutil_osx.c | 1 - | ||
15 | python/psutil/psutil/arch/bsd/process_info.c | 1 - | ||
16 | python/psutil/psutil/arch/osx/process_info.c | 1 - | ||
17 | 9 files changed, 3 insertions(+), 12 deletions(-) | ||
18 | |||
19 | --- a/mozglue/misc/TimeStamp_darwin.cpp | ||
20 | +++ b/mozglue/misc/TimeStamp_darwin.cpp | ||
21 | @@ -19,7 +19,6 @@ | ||
22 | |||
23 | #include <mach/mach_time.h> | ||
24 | #include <sys/time.h> | ||
25 | -#include <sys/sysctl.h> | ||
26 | #include <time.h> | ||
27 | #include <unistd.h> | ||
28 | |||
29 | --- a/mozglue/misc/TimeStamp_posix.cpp | ||
30 | +++ b/mozglue/misc/TimeStamp_posix.cpp | ||
31 | @@ -21,7 +21,6 @@ | ||
32 | #if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || \ | ||
33 | defined(__OpenBSD__) | ||
34 | #include <sys/param.h> | ||
35 | -#include <sys/sysctl.h> | ||
36 | #endif | ||
37 | |||
38 | #if defined(__DragonFly__) || defined(__FreeBSD__) | ||
39 | --- a/nsprpub/pr/src/misc/prsystem.c | ||
40 | +++ b/nsprpub/pr/src/misc/prsystem.c | ||
41 | @@ -27,7 +27,6 @@ | ||
42 | || defined(OPENBSD) || defined(DRAGONFLY) || defined(DARWIN) | ||
43 | #define _PR_HAVE_SYSCTL | ||
44 | #include <sys/param.h> | ||
45 | -#include <sys/sysctl.h> | ||
46 | #endif | ||
47 | |||
48 | #if defined(DARWIN) | ||
49 | --- a/third_party/python/psutil/psutil/_psutil_bsd.c | ||
50 | +++ b/third_party/python/psutil/psutil/_psutil_bsd.c | ||
51 | @@ -29,7 +29,6 @@ | ||
52 | #include <paths.h> | ||
53 | #include <sys/types.h> | ||
54 | #include <sys/param.h> | ||
55 | -#include <sys/sysctl.h> | ||
56 | #include <sys/user.h> | ||
57 | #include <sys/proc.h> | ||
58 | #include <sys/file.h> | ||
59 | --- a/third_party/python/psutil/psutil/_psutil_osx.c | ||
60 | +++ b/third_party/python/psutil/psutil/_psutil_osx.c | ||
61 | @@ -13,7 +13,6 @@ | ||
62 | #include <stdlib.h> | ||
63 | #include <stdio.h> | ||
64 | #include <utmpx.h> | ||
65 | -#include <sys/sysctl.h> | ||
66 | #include <sys/vmmeter.h> | ||
67 | #include <libproc.h> | ||
68 | #include <sys/proc_info.h> | ||
69 | --- a/third_party/python/psutil/psutil/arch/osx/process_info.c | ||
70 | +++ b/third_party/python/psutil/psutil/arch/osx/process_info.c | ||
71 | @@ -16,7 +16,6 @@ | ||
72 | #include <stdlib.h> | ||
73 | #include <stdio.h> | ||
74 | #include <signal.h> | ||
75 | -#include <sys/sysctl.h> | ||
76 | #include <libproc.h> | ||
77 | |||
78 | #include "process_info.h" | ||
79 | --- a/memory/build/Mutex.h | ||
80 | +++ b/memory/build/Mutex.h | ||
81 | @@ -42,7 +42,7 @@ struct Mutex { | ||
82 | if (pthread_mutexattr_init(&attr) != 0) { | ||
83 | return false; | ||
84 | } | ||
85 | - pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP); | ||
86 | + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_STALLED); | ||
87 | if (pthread_mutex_init(&mMutex, &attr) != 0) { | ||
88 | pthread_mutexattr_destroy(&attr); | ||
89 | return false; | ||
90 | @@ -102,7 +102,7 @@ typedef Mutex StaticMutex; | ||
91 | |||
92 | #if defined(XP_DARWIN) | ||
93 | #define STATIC_MUTEX_INIT OS_SPINLOCK_INIT | ||
94 | -#elif defined(XP_LINUX) && !defined(ANDROID) | ||
95 | +#elif defined(XP_LINUX) && !defined(ANDROID) && defined(__GLIBC__) | ||
96 | #define STATIC_MUTEX_INIT PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP | ||
97 | #else | ||
98 | #define STATIC_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/musl/0002-js-Fix-build-with-musl.patch b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/musl/0002-js-Fix-build-with-musl.patch new file mode 100644 index 0000000000..f4c6e2768d --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs/musl/0002-js-Fix-build-with-musl.patch | |||
@@ -0,0 +1,31 @@ | |||
1 | From 0c9e8f586ba52a9aef5ed298e8315b2598b8fb72 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sat, 25 May 2019 16:54:45 -0700 | ||
4 | Subject: [PATCH] js: Fix build with musl | ||
5 | |||
6 | The MIPS specific header <sgidefs.h> is not provided by musl | ||
7 | linux kernel headers provide <asm/sgidefs.h> which has same definitions | ||
8 | |||
9 | Upstream-Status: Pending | ||
10 | |||
11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
12 | --- | ||
13 | js/src/jsmath.cpp | 2 +- | ||
14 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
15 | |||
16 | diff --git a/js/src/jsmath.cpp b/js/src/jsmath.cpp | ||
17 | index a28968be..8facaa81 100644 | ||
18 | --- a/js/src/jsmath.cpp | ||
19 | +++ b/js/src/jsmath.cpp | ||
20 | @@ -71,7 +71,7 @@ | ||
21 | #elif defined(__s390__) | ||
22 | #define GETRANDOM_NR 349 | ||
23 | #elif defined(__mips__) | ||
24 | -#include <sgidefs.h> | ||
25 | +#include <asm/sgidefs.h> | ||
26 | #if _MIPS_SIM == _MIPS_SIM_ABI32 | ||
27 | #define GETRANDOM_NR 4353 | ||
28 | #elif _MIPS_SIM == _MIPS_SIM_ABI64 | ||
29 | -- | ||
30 | 2.21.0 | ||
31 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs_60.9.0.bb b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs_60.9.0.bb new file mode 100644 index 0000000000..9466c62aac --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-extended/mozjs/mozjs_60.9.0.bb | |||
@@ -0,0 +1,135 @@ | |||
1 | SUMMARY = "SpiderMonkey is Mozilla's JavaScript engine written in C/C++" | ||
2 | HOMEPAGE = "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey" | ||
3 | LICENSE = "MPL-2.0" | ||
4 | LIC_FILES_CHKSUM = "file://LICENSE;md5=dc9b6ecd19a14a54a628edaaf23733bf" | ||
5 | |||
6 | SRC_URI = " \ | ||
7 | https://archive.mozilla.org/pub/firefox/releases/${PV}esr/source/firefox-${PV}esr.source.tar.xz \ | ||
8 | file://0001-Port-build-to-python3.patch \ | ||
9 | file://0002-js.pc.in-do-not-include-RequiredDefines.h-for-depend.patch \ | ||
10 | file://0003-fix-cross-compilation-on-i586-targets.patch \ | ||
11 | file://0004-do-not-create-python-environment.patch \ | ||
12 | file://0005-fix-cannot-find-link.patch \ | ||
13 | file://0006-workaround-autoconf-2.13-detection-failed.patch \ | ||
14 | file://0007-fix-do_compile-failed-on-mips.patch \ | ||
15 | file://0008-add-riscv-support.patch \ | ||
16 | file://0009-mozjs-fix-coredump-caused-by-getenv.patch \ | ||
17 | file://0010-format-overflow.patch \ | ||
18 | file://0011-To-fix-build-error-on-arm32BE.patch \ | ||
19 | file://0012-JS_PUBLIC_API.patch \ | ||
20 | file://0013-riscv-Disable-atomic-operations.patch \ | ||
21 | file://0014-fallback-to-2011-C++-standard.patch \ | ||
22 | " | ||
23 | SRC_URI_append_libc-musl = " \ | ||
24 | file://musl/0001-support-musl.patch \ | ||
25 | file://musl/0002-js-Fix-build-with-musl.patch \ | ||
26 | " | ||
27 | SRC_URI_append_mipsarchn32 = " \ | ||
28 | file://mipsarchn32/0001-fix-compiling-failure-on-mips64-n32-bsp.patch \ | ||
29 | " | ||
30 | SRC_URI[md5sum] = "69a0be9ce695e5dc4941ed0c78ef00c2" | ||
31 | SRC_URI[sha256sum] = "9f453c8cc5669e46e38f977764d49a36295bf0d023619d9aac782e6bb3e8c53f" | ||
32 | |||
33 | S = "${WORKDIR}/firefox-${@d.getVar("PV").replace("esr", "")}" | ||
34 | |||
35 | inherit autotools pkgconfig perlnative python3native | ||
36 | |||
37 | inherit features_check | ||
38 | CONFLICT_DISTRO_FEATURES_mipsarchn32 = "ld-is-gold" | ||
39 | |||
40 | DEPENDS += " \ | ||
41 | nspr zlib autoconf-2.13-native \ | ||
42 | python3-six-native python3-pytoml-native \ | ||
43 | python3-jsmin-native python3-six \ | ||
44 | " | ||
45 | |||
46 | # Disable null pointer optimization in gcc >= 6 | ||
47 | # https://bugzilla.redhat.com/show_bug.cgi?id=1328045 | ||
48 | CFLAGS += "-fno-tree-vrp -fno-strict-aliasing -fno-delete-null-pointer-checks" | ||
49 | CXXFLAGS += "-fno-tree-vrp -fno-strict-aliasing -fno-delete-null-pointer-checks" | ||
50 | |||
51 | # nspr's package-config is ignored so set libs manually | ||
52 | EXTRA_OECONF = " \ | ||
53 | --target=${TARGET_SYS} \ | ||
54 | --host=${BUILD_SYS} \ | ||
55 | --prefix=${prefix} \ | ||
56 | --libdir=${libdir} \ | ||
57 | --disable-tests --disable-strip --disable-optimize \ | ||
58 | --disable-jemalloc \ | ||
59 | --with-nspr-cflags='-I${STAGING_INCDIR}/nspr -I${STAGING_INCDIR}/nss3' \ | ||
60 | --with-nspr-libs='-lplds4 -lplc4 -lnspr4' \ | ||
61 | ${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', "--enable-gold", '--disable-gold', d)} \ | ||
62 | " | ||
63 | |||
64 | # Without this, JS_Init() will fail for mips64. | ||
65 | EXTRA_OECONF_append_mipsarch = " --with-intl-api=build" | ||
66 | EXTRA_OECONF_append_powerpc = " --with-intl-api=build" | ||
67 | |||
68 | EXTRA_OECONF_append_mipsarch = " --disable-ion" | ||
69 | EXTRA_OECONF_append_riscv64 = " --disable-ion" | ||
70 | EXTRA_OECONF_append_riscv32 = " --disable-ion" | ||
71 | |||
72 | PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}" | ||
73 | PACKAGECONFIG[x11] = "--x-includes=${STAGING_INCDIR} --x-libraries=${STAGING_LIBDIR},--x-includes=no --x-libraries=no,virtual/libx11" | ||
74 | |||
75 | EXTRA_OEMAKE_task-compile += "BUILD_OPT=1 OS_LDFLAGS='-Wl,-latomic ${LDFLAGS}'" | ||
76 | EXTRA_OEMAKE_task-install += "STATIC_LIBRARY_NAME=js_static" | ||
77 | |||
78 | export HOST_CC = "${BUILD_CC}" | ||
79 | export HOST_CXX = "${BUILD_CXX}" | ||
80 | export HOST_CFLAGS = "${BUILD_CFLAGS}" | ||
81 | export HOST_CPPFLAGS = "${BUILD_CPPFLAGS}" | ||
82 | export HOST_CXXFLAGS = "${BUILD_CXXFLAGS}" | ||
83 | |||
84 | do_configure() { | ||
85 | export SHELL="/bin/sh" | ||
86 | cd ${S} | ||
87 | # Add mozjs python-modules necessary | ||
88 | PYTHONPATH="${S}/third_party/python/which:${S}/config:${S}/build" | ||
89 | for sub_dir in python testing/mozbase; do | ||
90 | for module_dir in `ls $sub_dir -1`;do | ||
91 | [ $module_dir = "virtualenv" ] && continue | ||
92 | if [ -d "${S}/$sub_dir/$module_dir" ];then | ||
93 | PYTHONPATH="$PYTHONPATH:${S}/$sub_dir/$module_dir" | ||
94 | fi | ||
95 | done | ||
96 | done | ||
97 | echo "$PYTHONPATH" > ${B}/PYTHONPATH | ||
98 | export PYTHONPATH=`cat ${B}/PYTHONPATH` | ||
99 | |||
100 | cd ${S}/js/src | ||
101 | autoconf213 --macrodir=${STAGING_DATADIR_NATIVE}/autoconf213 old-configure.in > old-configure | ||
102 | |||
103 | cd ${B} | ||
104 | ${S}/js/src/configure ${EXTRA_OECONF} | ||
105 | |||
106 | # Make standard Makefile checks pass | ||
107 | touch ${S}/js/src/configure | ||
108 | touch ${B}/config.status | ||
109 | } | ||
110 | |||
111 | do_compile_prepend() { | ||
112 | export SHELL="/bin/sh" | ||
113 | export PYTHONPATH=`cat ${B}/PYTHONPATH` | ||
114 | } | ||
115 | |||
116 | do_install_prepend() { | ||
117 | export SHELL="/bin/sh" | ||
118 | export PYTHONPATH=`cat ${B}/PYTHONPATH` | ||
119 | } | ||
120 | |||
121 | PACKAGES =+ "lib${BPN}" | ||
122 | FILES_lib${BPN} += "${libdir}/lib*.so" | ||
123 | FILES_${PN}-dev += "${bindir}/js60-config" | ||
124 | |||
125 | # Fails to build with thumb-1 (qemuarm) | ||
126 | #| {standard input}: Assembler messages: | ||
127 | #| {standard input}:2172: Error: shifts in CMP/MOV instructions are only supported in unified syntax -- `mov r2,r1,LSR#20' | ||
128 | #| {standard input}:2173: Error: unshifted register required -- `bic r2,r2,#(1<<11)' | ||
129 | #| {standard input}:2174: Error: unshifted register required -- `orr r1,r1,#(1<<20)' | ||
130 | #| {standard input}:2176: Error: instruction not supported in Thumb16 mode -- `subs r2,r2,#0x300' | ||
131 | #| {standard input}:2178: Error: instruction not supported in Thumb16 mode -- `subs r5,r2,#52' | ||
132 | ARM_INSTRUCTION_SET_armv5 = "arm" | ||
133 | ARM_INSTRUCTION_SET_armv4 = "arm" | ||
134 | |||
135 | DISABLE_STATIC = "" | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-support/smem/smem/0001-smem-fix-support-for-source-option-python3.patch b/meta-oe/dynamic-layers/meta-python/recipes-support/smem/smem/0001-smem-fix-support-for-source-option-python3.patch new file mode 100644 index 0000000000..5c1be5a0a2 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-support/smem/smem/0001-smem-fix-support-for-source-option-python3.patch | |||
@@ -0,0 +1,53 @@ | |||
1 | From 3ff78f1f00973393d1a7ee4e467a2bacf1c807f3 Mon Sep 17 00:00:00 2001 | ||
2 | From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <git@andred.net> | ||
3 | Date: Wed, 5 Feb 2020 16:14:21 +0000 | ||
4 | Subject: [PATCH] smem: fix support for --source option (python3) | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=UTF-8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | Using --source doesn't work without this patch: | ||
10 | Traceback (most recent call last): | ||
11 | File "./smem", line 727, in <module> | ||
12 | showpids() | ||
13 | File "./smem", line 299, in showpids | ||
14 | showtable(pt.keys(), fields, columns.split(), options.sort or 'pss') | ||
15 | File "./smem", line 519, in showtable | ||
16 | mt = totalmem() | ||
17 | File "./smem", line 118, in totalmem | ||
18 | _totalmem = memory()['memtotal'] | ||
19 | File "./smem", line 193, in memory | ||
20 | m = f.match(l) | ||
21 | TypeError: cannot use a string pattern on a bytes-like object | ||
22 | |||
23 | python3's tarfile returns bytes, whereas all of the rest of | ||
24 | the code assumes str. | ||
25 | |||
26 | Fix the tarfile usage to convert to str before returning the | ||
27 | results. | ||
28 | |||
29 | Signed-off-by: André Draszik <git@andred.net> | ||
30 | Upstream-Status: Inappropriate [upstream wants to support python2 & python3] | ||
31 | --- | ||
32 | smem | 4 ++-- | ||
33 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
34 | |||
35 | diff --git a/smem b/smem | ||
36 | index 46a3189..54d40dd 100755 | ||
37 | --- a/smem | ||
38 | +++ b/smem | ||
39 | @@ -90,9 +90,9 @@ class tardata(procdata): | ||
40 | d,f = ti.name.split('/') | ||
41 | yield d | ||
42 | def _read(self, f): | ||
43 | - return self.tar.extractfile(f).read() | ||
44 | + return self.tar.extractfile(f).read().decode() | ||
45 | def _readlines(self, f): | ||
46 | - return self.tar.extractfile(f).readlines() | ||
47 | + return [l.decode() for l in self.tar.extractfile(f).readlines()] | ||
48 | def piduser(self, p): | ||
49 | t = self.tar.getmember("%d" % p) | ||
50 | if t.uname: | ||
51 | -- | ||
52 | 2.23.0.rc1 | ||
53 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-support/smem/smem_1.5.bb b/meta-oe/dynamic-layers/meta-python/recipes-support/smem/smem_1.5.bb new file mode 100644 index 0000000000..90db9c3f3e --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-support/smem/smem_1.5.bb | |||
@@ -0,0 +1,43 @@ | |||
1 | SUMMARY = "Report application memory usage in a meaningful way" | ||
2 | DESCRIPTION = "smem is a tool that can give numerous reports on memory usage on Linux \ | ||
3 | systems. Unlike existing tools, smem can report proportional set size (PSS), \ | ||
4 | which is a more meaningful representation of the amount of memory used by \ | ||
5 | libraries and applications in a virtual memory system." | ||
6 | HOMEPAGE = "http://www.selenic.com/smem/" | ||
7 | SECTION = "Applications/System" | ||
8 | |||
9 | LICENSE = "GPLv2+" | ||
10 | LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" | ||
11 | |||
12 | HG_CHANGESET = "98273ce331bb" | ||
13 | SRC_URI = "https://selenic.com/repo/${BPN}/archive/${HG_CHANGESET}.tar.bz2;downloadfilename=${BP}.tar.bz2 \ | ||
14 | file://0001-smem-fix-support-for-source-option-python3.patch" | ||
15 | SRC_URI[md5sum] = "51c3989779360f42b42ef46b2831be3a" | ||
16 | SRC_URI[sha256sum] = "161131c686a6d9962a0e96912526dd46308e022d62e3f8acaed5a56fda8e08ce" | ||
17 | |||
18 | UPSTREAM_CHECK_URI = "https://selenic.com/repo/smem/tags" | ||
19 | UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)" | ||
20 | |||
21 | S = "${WORKDIR}/${BPN}-${HG_CHANGESET}" | ||
22 | |||
23 | do_compile() { | ||
24 | ${CC} ${CFLAGS} ${LDFLAGS} smemcap.c -o smemcap | ||
25 | } | ||
26 | |||
27 | do_install() { | ||
28 | install -d ${D}/${bindir}/ | ||
29 | install -d ${D}/${mandir}/man8 | ||
30 | install -m 0755 ${S}/smem ${D}${bindir}/ | ||
31 | sed -i -e '1s,#!.*python.*,#!${USRBINPATH}/env python3,' ${D}${bindir}/smem | ||
32 | install -m 0755 ${S}/smemcap ${D}${bindir}/ | ||
33 | install -m 0644 ${S}/smem.8 ${D}/${mandir}/man8/ | ||
34 | } | ||
35 | |||
36 | RDEPENDS_${PN} = "python3-core python3-compression" | ||
37 | RRECOMMENDS_${PN} = "python3-matplotlib python3-numpy" | ||
38 | |||
39 | PACKAGE_BEFORE_PN = "smemcap" | ||
40 | |||
41 | FILES_smemcap = "${bindir}/smemcap" | ||
42 | |||
43 | BBCLASSEXTEND = "native" | ||