summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-oe/recipes-extended/mozjs/mozjs/0001-Port-build-to-python3.patch6888
-rw-r--r--meta-oe/recipes-extended/mozjs/mozjs/0002-js.pc.in-do-not-include-RequiredDefines.h-for-depend.patch (renamed from meta-oe/recipes-extended/mozjs/mozjs/0001-js.pc.in-do-not-include-RequiredDefines.h-for-depend.patch)0
-rw-r--r--meta-oe/recipes-extended/mozjs/mozjs/0003-fix-cross-compilation-on-i586-targets.patch (renamed from meta-oe/recipes-extended/mozjs/mozjs/0010-fix-cross-compilation-on-i586-targets.patch)0
-rw-r--r--meta-oe/recipes-extended/mozjs/mozjs/0004-do-not-create-python-environment.patch (renamed from meta-oe/recipes-extended/mozjs/mozjs/0001-do-not-create-python-environment.patch)0
-rw-r--r--meta-oe/recipes-extended/mozjs/mozjs/0005-fix-cannot-find-link.patch (renamed from meta-oe/recipes-extended/mozjs/mozjs/0002-fix-cannot-find-link.patch)0
-rw-r--r--meta-oe/recipes-extended/mozjs/mozjs/0006-workaround-autoconf-2.13-detection-failed.patch (renamed from meta-oe/recipes-extended/mozjs/mozjs/0003-workaround-autoconf-2.13-detection-failed.patch)0
-rw-r--r--meta-oe/recipes-extended/mozjs/mozjs/0007-fix-do_compile-failed-on-mips.patch (renamed from meta-oe/recipes-extended/mozjs/mozjs/0005-fix-do_compile-failed-on-mips.patch)0
-rw-r--r--meta-oe/recipes-extended/mozjs/mozjs/0008-add-riscv-support.patch (renamed from meta-oe/recipes-extended/mozjs/mozjs/add-riscv-support.patch)0
-rw-r--r--meta-oe/recipes-extended/mozjs/mozjs/0009-mozjs-fix-coredump-caused-by-getenv.patch (renamed from meta-oe/recipes-extended/mozjs/mozjs/0001-mozjs-fix-coredump-caused-by-getenv.patch)0
-rw-r--r--meta-oe/recipes-extended/mozjs/mozjs/0010-format-overflow.patch (renamed from meta-oe/recipes-extended/mozjs/mozjs/format-overflow.patch)0
-rw-r--r--meta-oe/recipes-extended/mozjs/mozjs/0011-To-fix-build-error-on-arm32BE.patch (renamed from meta-oe/recipes-extended/mozjs/mozjs/0001-To-fix-build-error-on-arm32BE.patch)0
-rw-r--r--meta-oe/recipes-extended/mozjs/mozjs/0012-JS_PUBLIC_API.patch (renamed from meta-oe/recipes-extended/mozjs/mozjs/JS_PUBLIC_API.patch)0
-rw-r--r--meta-oe/recipes-extended/mozjs/mozjs/0013-riscv-Disable-atomic-operations.patch (renamed from meta-oe/recipes-extended/mozjs/mozjs/0001-riscv-Disable-atomic-operations.patch)0
-rw-r--r--meta-oe/recipes-extended/mozjs/mozjs/0014-fallback-to-2011-C++-standard.patch (renamed from meta-oe/recipes-extended/mozjs/mozjs/fallback-to-2011-C++-standard.patch)0
-rw-r--r--meta-oe/recipes-extended/mozjs/mozjs/mipsarchn32/0001-fix-compiling-failure-on-mips64-n32-bsp.patch (renamed from meta-oe/recipes-extended/mozjs/mozjs/0001-fix-compiling-failure-on-mips64-n32-bsp.patch)0
-rw-r--r--meta-oe/recipes-extended/mozjs/mozjs/musl/0001-support-musl.patch (renamed from meta-oe/recipes-extended/mozjs/mozjs/0006-support-musl.patch)0
-rw-r--r--meta-oe/recipes-extended/mozjs/mozjs/musl/0002-js-Fix-build-with-musl.patch (renamed from meta-oe/recipes-extended/mozjs/mozjs/0001-js-Fix-build-with-musl.patch)0
-rw-r--r--meta-oe/recipes-extended/mozjs/mozjs_60.9.0.bb56
18 files changed, 6917 insertions, 27 deletions
diff --git a/meta-oe/recipes-extended/mozjs/mozjs/0001-Port-build-to-python3.patch b/meta-oe/recipes-extended/mozjs/mozjs/0001-Port-build-to-python3.patch
new file mode 100644
index 0000000000..695dd97f6b
--- /dev/null
+++ b/meta-oe/recipes-extended/mozjs/mozjs/0001-Port-build-to-python3.patch
@@ -0,0 +1,6888 @@
1From 33a373ba41d978af60c2f0230bcba6ad27357ec8 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
3Date: Wed, 29 Jan 2020 16:25:11 +0100
4Subject: [PATCH] Port build to python3
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-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
28Upstream-Status: Inaproppriate [Some Hacks]
29
30Signed-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 | 16 +-
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
106diff --git a/build/autoconf/config.status.m4 b/build/autoconf/config.status.m4
107index 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
119diff --git a/build/moz.configure/android-ndk.configure b/build/moz.configure/android-ndk.configure
120index 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.
141diff --git a/build/moz.configure/checks.configure b/build/moz.configure/checks.configure
142index 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')
163diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure
164index 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.
280diff --git a/build/moz.configure/keyfiles.configure b/build/moz.configure/keyfiles.configure
281index 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:
295diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure
296index 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()
392diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
393index 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(
454diff --git a/build/moz.configure/util.configure b/build/moz.configure/util.configure
455index 3284fd8b5..218813e2d 100644
456--- a/build/moz.configure/util.configure
457+++ b/build/moz.configure/util.configure
458@@ -25,7 +25,6 @@ def configure_error(message):
459 # does not.
460
461
462-@imports(_from='__builtin__', _import='unicode')
463 @imports('subprocess')
464 @imports('sys')
465 @imports(_from='mozbuild.configure.util', _import='LineIO')
466@@ -39,10 +38,10 @@ def check_cmd_output(*args, **kwargs):
467 if 'env' in kwargs:
468 normalized_env = {}
469 for k, v in kwargs['env'].items():
470- if isinstance(k, unicode):
471+ if isinstance(k, str):
472 k = k.encode('utf-8', 'strict')
473
474- if isinstance(v, unicode):
475+ if isinstance(v, str):
476 v = v.encode('utf-8', 'strict')
477
478 normalized_env[k] = v
479@@ -285,7 +284,7 @@ def unique_list(l):
480 # ('19.0', 'x64', r'C:\...\amd64\cl.exe')
481 # ('19.0', 'x86', r'C:\...\amd64_x86\cl.exe')
482 @imports(_import='_winreg', _as='winreg')
483-@imports(_from='__builtin__', _import='WindowsError')
484+@imports(_from='builtins', _import='WindowsError')
485 @imports(_from='fnmatch', _import='fnmatch')
486 def get_registry_values(pattern, get_32_and_64_bit=False):
487 def enum_helper(func, key):
488@@ -360,6 +359,8 @@ def get_registry_values(pattern, get_32_and_64_bit=False):
489 @imports(_from='mozbuild.configure.util', _import='Version', _as='_Version')
490 def Version(v):
491 'A version number that can be compared usefully.'
492+ if isinstance(v, bytes):
493+ v = v.decode('utf-8')
494 return _Version(v)
495
496 # Denotes a deprecated option. Combines option() and @depends:
497diff --git a/build/moz.configure/windows.configure b/build/moz.configure/windows.configure
498index a5b790e3b..2b88fc447 100644
499--- a/build/moz.configure/windows.configure
500+++ b/build/moz.configure/windows.configure
501@@ -10,7 +10,7 @@ option('--with-windows-version', nargs=1, default='603',
502
503
504 @depends('--with-windows-version')
505-@imports(_from='__builtin__', _import='ValueError')
506+@imports(_from='builtins', _import='ValueError')
507 def valid_windows_version(value):
508 if not value:
509 die('Cannot build with --without-windows-version')
510@@ -50,8 +50,8 @@ def windows_sdk_dir(value, host):
511
512 @imports('os')
513 @imports('re')
514-@imports(_from='__builtin__', _import='sorted')
515-@imports(_from='__builtin__', _import='WindowsError')
516+@imports(_from='builtins', _import='sorted')
517+@imports(_from='builtins', _import='WindowsError')
518 def get_sdk_dirs(sdk, subdir):
519 def get_dirs_containing(sdk, stem, subdir):
520 base = os.path.join(sdk, stem)
521@@ -96,7 +96,7 @@ def valid_windows_sdk_dir_result(value):
522
523 @depends(c_compiler, windows_sdk_dir, valid_windows_version, 'WINDOWSSDKDIR')
524 @checking('for Windows SDK', valid_windows_sdk_dir_result)
525-@imports(_from='__builtin__', _import='sorted')
526+@imports(_from='builtins', _import='sorted')
527 @imports(_from='textwrap', _import='dedent')
528 def valid_windows_sdk_dir(compiler, windows_sdk_dir, target_version,
529 windows_sdk_dir_env):
530@@ -174,7 +174,7 @@ def valid_ucrt_sdk_dir_result(value):
531 @depends(windows_sdk_dir, 'WINDOWSSDKDIR', c_compiler)
532 @checking('for Universal CRT SDK', valid_ucrt_sdk_dir_result)
533 @imports('os')
534-@imports(_from='__builtin__', _import='sorted')
535+@imports(_from='builtins', _import='sorted')
536 @imports(_import='mozpack.path', _as='mozpath')
537 def valid_ucrt_sdk_dir(windows_sdk_dir, windows_sdk_dir_env, c_compiler):
538 if windows_sdk_dir_env:
539diff --git a/build/templates.mozbuild b/build/templates.mozbuild
540index 3da850ce5..ae5e410fe 100644
541--- a/build/templates.mozbuild
542+++ b/build/templates.mozbuild
543@@ -10,7 +10,7 @@ def Binary():
544 templates.'''
545
546 # Add -llog by default, since we use it all over the place.
547- if CONFIG['OS_TARGET'] == 'Android':
548+ if str(CONFIG['OS_TARGET']) == 'Android':
549 OS_LIBS += ['log']
550
551
552diff --git a/config/MozZipFile.py b/config/MozZipFile.py
553index 337fe0521..dc7add4c3 100644
554--- a/config/MozZipFile.py
555+++ b/config/MozZipFile.py
556@@ -18,7 +18,7 @@ class ZipFile(zipfile.ZipFile):
557 def __init__(self, file, mode="r", compression=zipfile.ZIP_STORED,
558 lock = False):
559 if lock:
560- assert isinstance(file, basestring)
561+ assert isinstance(file, str)
562 self.lockfile = lock_file(file + '.lck')
563 else:
564 self.lockfile = None
565@@ -46,7 +46,7 @@ class ZipFile(zipfile.ZipFile):
566 date_time=time.localtime(time.time()))
567 zinfo.compress_type = self.compression
568 # Add some standard UNIX file access permissions (-rw-r--r--).
569- zinfo.external_attr = (0x81a4 & 0xFFFF) << 16L
570+ zinfo.external_attr = (0x81a4 & 0xFFFF) << 16
571 else:
572 zinfo = zinfo_or_arcname
573
574@@ -58,7 +58,7 @@ class ZipFile(zipfile.ZipFile):
575 # as the old, reuse the existing entry.
576
577 doSeek = False # store if we need to seek to the eof after overwriting
578- if self.NameToInfo.has_key(zinfo.filename):
579+ if zinfo.filename in self.NameToInfo:
580 # Find the last ZipInfo with our name.
581 # Last, because that's catching multiple overwrites
582 i = len(self.filelist)
583@@ -109,14 +109,14 @@ class ZipFile(zipfile.ZipFile):
584 # adjust file mode if we originally just wrote, now we rewrite
585 self.fp.close()
586 self.fp = open(self.filename, 'r+b')
587- all = map(lambda zi: (zi, True), self.filelist) + \
588- map(lambda zi: (zi, False), self._remove)
589+ all = [(zi, True) for zi in self.filelist] + \
590+ [(zi, False) for zi in self._remove]
591 all.sort(lambda l, r: cmp(l[0].header_offset, r[0].header_offset))
592 # empty _remove for multiple closes
593 self._remove = []
594
595 lengths = [all[i+1][0].header_offset - all[i][0].header_offset
596- for i in xrange(len(all)-1)]
597+ for i in range(len(all)-1)]
598 lengths.append(self.end - all[-1][0].header_offset)
599 to_pos = 0
600 for (zi, keep), length in zip(all, lengths):
601diff --git a/config/expandlibs.py b/config/expandlibs.py
602index ac06c432f..df1fed15d 100644
603--- a/config/expandlibs.py
604+++ b/config/expandlibs.py
605@@ -26,7 +26,7 @@ ${LIB_PREFIX}${ROOT}.${LIB_SUFFIX} following these rules:
606 descriptor contains. And for each of these LIBS, also apply the same
607 rules.
608 '''
609-from __future__ import with_statement
610+
611 import sys, os, errno
612 import expandlibs_config as conf
613
614@@ -36,7 +36,7 @@ def ensureParentDir(file):
615 if dir and not os.path.exists(dir):
616 try:
617 os.makedirs(dir)
618- except OSError, error:
619+ except OSError as error:
620 if error.errno != errno.EEXIST:
621 raise
622
623@@ -140,4 +140,4 @@ class ExpandArgs(list):
624 return [relativize(arg)]
625
626 if __name__ == '__main__':
627- print " ".join(ExpandArgs(sys.argv[1:]))
628+ print(" ".join(ExpandArgs(sys.argv[1:])))
629diff --git a/config/expandlibs_exec.py b/config/expandlibs_exec.py
630index df656016c..fb786a6a8 100644
631--- a/config/expandlibs_exec.py
632+++ b/config/expandlibs_exec.py
633@@ -20,7 +20,7 @@ With the --symbol-order argument, followed by a file name, it will add the
634 relevant linker options to change the order in which the linker puts the
635 symbols appear in the resulting binary. Only works for ELF targets.
636 '''
637-from __future__ import with_statement
638+
639 import sys
640 import os
641 from expandlibs import (
642@@ -304,11 +304,11 @@ class SectionFinder(object):
643 return syms
644
645 def print_command(out, args):
646- print >>out, "Executing: " + " ".join(args)
647+ print("Executing: " + " ".join(args), file=out)
648 for tmp in [f for f in args.tmp if os.path.isfile(f)]:
649- print >>out, tmp + ":"
650+ print(tmp + ":", file=out)
651 with open(tmp) as file:
652- print >>out, "".join([" " + l for l in file.readlines()])
653+ print("".join([" " + l for l in file.readlines()]), file=out)
654 out.flush()
655
656 def main(args, proc_callback=None):
657@@ -338,13 +338,13 @@ def main(args, proc_callback=None):
658 proc = subprocess.Popen(args, stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
659 if proc_callback:
660 proc_callback(proc)
661- except Exception, e:
662- print >>sys.stderr, 'error: Launching', args, ':', e
663+ except Exception as e:
664+ print('error: Launching', args, ':', e, file=sys.stderr)
665 raise e
666 (stdout, stderr) = proc.communicate()
667 if proc.returncode and not options.verbose:
668 print_command(sys.stderr, args)
669- sys.stderr.write(stdout)
670+ sys.stderr.write(stdout.decode("utf-8"))
671 sys.stderr.flush()
672 if proc.returncode:
673 return proc.returncode
674diff --git a/config/expandlibs_gen.py b/config/expandlibs_gen.py
675index b1de63cd0..dc62bd184 100644
676--- a/config/expandlibs_gen.py
677+++ b/config/expandlibs_gen.py
678@@ -5,7 +5,7 @@
679 '''Given a list of object files and library names, prints a library
680 descriptor to standard output'''
681
682-from __future__ import with_statement
683+
684 import sys
685 import os
686 import expandlibs_config as conf
687@@ -38,4 +38,4 @@ if __name__ == '__main__':
688
689 ensureParentDir(options.output)
690 with open(options.output, 'w') as outfile:
691- print >>outfile, generate(args)
692+ print(generate(args), file=outfile)
693diff --git a/configure.py b/configure.py
694index 771e34e38..bee329d7c 100644
695--- a/configure.py
696+++ b/configure.py
697@@ -2,10 +2,11 @@
698 # License, v. 2.0. If a copy of the MPL was not distributed with this
699 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
700
701-from __future__ import print_function, unicode_literals
702+
703
704 import codecs
705 import itertools
706+import logging
707 import os
708 import sys
709 import textwrap
710@@ -34,7 +35,9 @@ from mozbuild.util import (
711 def main(argv):
712 config = {}
713 sandbox = ConfigureSandbox(config, os.environ, argv)
714+ print('sandbox.run started')
715 sandbox.run(os.path.join(os.path.dirname(__file__), 'moz.configure'))
716+ print('sandbox.run finished')
717
718 if sandbox._help:
719 return 0
720@@ -56,12 +59,21 @@ def config_status(config):
721
722 sanitized_config = {}
723 sanitized_config['substs'] = {
724- k: sanitized_bools(v) for k, v in config.iteritems()
725+ k: sanitized_bools(v) for k, v in config.items()
726 if k not in ('DEFINES', 'non_global_defines', 'TOPSRCDIR', 'TOPOBJDIR',
727 'ALL_CONFIGURE_PATHS')
728 }
729+
730+ # Hack around OptionValue entries unknown during compile
731+ for opt in ('BUILD_BACKENDS', 'MOZ_UI_LOCALE', 'RUSTFLAGS' ):
732+ old = sanitized_config['substs'][opt]
733+ new = []
734+ for setting in old:
735+ new.append(setting)
736+ sanitized_config['substs'][opt] = new
737+
738 sanitized_config['defines'] = {
739- k: sanitized_bools(v) for k, v in config['DEFINES'].iteritems()
740+ k: sanitized_bools(v) for k, v in config['DEFINES'].items()
741 }
742 sanitized_config['non_global_defines'] = config['non_global_defines']
743 sanitized_config['topsrcdir'] = config['TOPSRCDIR']
744@@ -71,20 +83,17 @@ def config_status(config):
745 # Create config.status. Eventually, we'll want to just do the work it does
746 # here, when we're able to skip configure tests/use cached results/not rely
747 # on autoconf.
748- print("Creating config.status", file=sys.stderr)
749- encoding = 'mbcs' if sys.platform == 'win32' else 'utf-8'
750- with codecs.open('config.status', 'w', encoding) as fh:
751+ logging.getLogger('moz.configure').info('Creating config.status')
752+ with codecs.open('config.status', 'w', 'utf-8') as fh:
753 fh.write(textwrap.dedent('''\
754 #!%(python)s
755- # coding=%(encoding)s
756- from __future__ import unicode_literals
757- from mozbuild.util import encode
758- encoding = '%(encoding)s'
759- ''') % {'python': config['PYTHON'], 'encoding': encoding})
760+ # coding=utf-8
761+ print("config.status started")
762+ ''') % {'python': config['PYTHON']})
763 # A lot of the build backend code is currently expecting byte
764 # strings and breaks in subtle ways with unicode strings. (bug 1296508)
765- for k, v in sanitized_config.iteritems():
766- fh.write('%s = encode(%s, encoding)\n' % (k, indented_repr(v)))
767+ for k, v in sanitized_config.items():
768+ fh.write('%s = %s\n' % (k, indented_repr(v)))
769 fh.write("__all__ = ['topobjdir', 'topsrcdir', 'defines', "
770 "'non_global_defines', 'substs', 'mozconfig']")
771
772@@ -97,6 +106,9 @@ def config_status(config):
773 args = dict([(name, globals()[name]) for name in __all__])
774 config_status(**args)
775 '''))
776+ fh.write(textwrap.dedent('''
777+ print("config.status finished")
778+ '''))
779
780 partial_config = PartialConfigEnvironment(config['TOPOBJDIR'])
781 partial_config.write_vars(sanitized_config)
782@@ -116,7 +128,7 @@ def config_status(config):
783 # executable permissions.
784 os.chmod('config.status', 0o755)
785 if config.get('MOZ_BUILD_APP') != 'js' or config.get('JS_STANDALONE'):
786- os.environ[b'WRITE_MOZINFO'] = b'1'
787+ os.environ['WRITE_MOZINFO'] = '1'
788 from mozbuild.config_status import config_status
789
790 # Some values in sanitized_config also have more complex types, such as
791@@ -127,7 +139,7 @@ def config_status(config):
792
793 # A lot of the build backend code is currently expecting byte strings
794 # and breaks in subtle ways with unicode strings.
795- return config_status(args=[], **encode(sanitized_config, encoding))
796+ return config_status(args=[], **sanitized_config)
797 return 0
798
799
800diff --git a/js/src/build/moz.build b/js/src/build/moz.build
801index a7f5fa4ce..856cae32d 100644
802--- a/js/src/build/moz.build
803+++ b/js/src/build/moz.build
804@@ -47,22 +47,22 @@ USE_LIBS += [
805 'zlib',
806 ]
807
808-if CONFIG['OS_ARCH'] not in ('WINNT', 'HP-UX'):
809+if str(CONFIG['OS_ARCH']) not in ('WINNT', 'HP-UX'):
810 OS_LIBS += [
811 'm',
812 ]
813
814-if CONFIG['OS_ARCH'] == 'FreeBSD':
815+if str(CONFIG['OS_ARCH']) == 'FreeBSD':
816 OS_LIBS += [
817 '-pthread',
818 ]
819
820-if CONFIG['OS_ARCH'] == 'Linux':
821+if str(CONFIG['OS_ARCH']) == 'Linux':
822 OS_LIBS += [
823 'dl',
824 ]
825
826-if CONFIG['OS_ARCH'] == 'SunOS':
827+if str(CONFIG['OS_ARCH']) == 'SunOS':
828 OS_LIBS += [
829 'posix4',
830 'dl',
831diff --git a/js/src/builtin/embedjs.py b/js/src/builtin/embedjs.py
832index ba25e71c1..d4f2de122 100644
833--- a/js/src/builtin/embedjs.py
834+++ b/js/src/builtin/embedjs.py
835@@ -36,7 +36,7 @@
836 #
837 # It uses the C preprocessor to process its inputs.
838
839-from __future__ import with_statement
840+
841 import re, sys, os, subprocess
842 import shlex
843 import which
844@@ -52,8 +52,8 @@ def ToCAsciiArray(lines):
845
846 def ToCArray(lines):
847 result = []
848- for chr in lines:
849- result.append(str(ord(chr)))
850+ for char in lines:
851+ result.append("0x%0.2X" % char)
852 return ", ".join(result)
853
854 HEADER_TEMPLATE = """\
855@@ -87,7 +87,7 @@ def embed(cxx, preprocessorOption, cppflags, msgs, sources, c_out, js_out, names
856
857 js_out.write(processed)
858 import zlib
859- compressed = zlib.compress(processed)
860+ compressed = zlib.compress(processed.encode('utf-8'))
861 data = ToCArray(compressed)
862 c_out.write(HEADER_TEMPLATE % {
863 'sources_type': 'unsigned char',
864@@ -107,7 +107,7 @@ def preprocess(cxx, preprocessorOption, source, args = []):
865 tmpOut = 'self-hosting-preprocessed.pp';
866 outputArg = shlex.split(preprocessorOption + tmpOut)
867
868- with open(tmpIn, 'wb') as input:
869+ with open(tmpIn, 'w') as input:
870 input.write(source)
871 print(' '.join(cxx + outputArg + args + [tmpIn]))
872 result = subprocess.Popen(cxx + outputArg + args + [tmpIn]).wait()
873diff --git a/js/src/configure b/js/src/configure
874index 3b3a39af3..8f5ea41d0 100755
875--- a/js/src/configure
876+++ b/js/src/configure
877@@ -24,4 +24,4 @@ export OLD_CONFIGURE="$SRCDIR"/old-configure
878
879 set -- "$@" --enable-project=js
880
881-which python2.7 > /dev/null && exec python2.7 "$TOPSRCDIR/configure.py" "$@" || exec python "$TOPSRCDIR/configure.py" "$@"
882+which python3 > /dev/null && exec python3 "$TOPSRCDIR/configure.py" "$@" || exec python "$TOPSRCDIR/configure.py" "$@"
883diff --git a/js/src/frontend/GenerateReservedWords.py b/js/src/frontend/GenerateReservedWords.py
884index 3aa2307b9..381c8e2b4 100644
885--- a/js/src/frontend/GenerateReservedWords.py
886+++ b/js/src/frontend/GenerateReservedWords.py
887@@ -80,14 +80,14 @@ def split_list_per_column(reserved_word_list, column):
888 per_column = column_dict.setdefault(word[column], [])
889 per_column.append(item)
890
891- return sorted(column_dict.items(), key=lambda (char, word): ord(char))
892+ return sorted(list(column_dict.items()), key=lambda char_word: ord(char_word[0]))
893
894 def generate_letter_switch(opt, unprocessed_columns, reserved_word_list,
895 columns=None):
896 assert(len(reserved_word_list) != 0);
897
898 if not columns:
899- columns = range(0, unprocessed_columns)
900+ columns = list(range(0, unprocessed_columns))
901
902 if len(reserved_word_list) == 1:
903 index, word = reserved_word_list[0]
904@@ -161,7 +161,7 @@ def split_list_per_length(reserved_word_list):
905 per_length = length_dict.setdefault(len(word), [])
906 per_length.append(item)
907
908- return sorted(length_dict.items(), key=lambda (length, word): length)
909+ return sorted(list(length_dict.items()), key=lambda length_word: length_word[0])
910
911 def generate_switch(opt, reserved_word_list):
912 assert(len(reserved_word_list) != 0);
913diff --git a/js/src/gc/GenerateStatsPhases.py b/js/src/gc/GenerateStatsPhases.py
914index 2daf83555..e39a26a4b 100644
915--- a/js/src/gc/GenerateStatsPhases.py
916+++ b/js/src/gc/GenerateStatsPhases.py
917@@ -267,7 +267,7 @@ def generateHeader(out):
918 #
919 # Generate PhaseKind enum.
920 #
921- phaseKindNames = map(lambda phaseKind: phaseKind.name, AllPhaseKinds)
922+ phaseKindNames = [phaseKind.name for phaseKind in AllPhaseKinds]
923 extraPhaseKinds = [
924 "NONE = LIMIT",
925 "EXPLICIT_SUSPENSION = LIMIT",
926@@ -279,7 +279,7 @@ def generateHeader(out):
927 #
928 # Generate Phase enum.
929 #
930- phaseNames = map(lambda phase: phase.name, AllPhases)
931+ phaseNames = [phase.name for phase in AllPhases]
932 extraPhases = [
933 "NONE = LIMIT",
934 "EXPLICIT_SUSPENSION = LIMIT",
935diff --git a/js/src/old-configure.in b/js/src/old-configure.in
936index 11c3d5a2e..389265404 100644
937--- a/js/src/old-configure.in
938+++ b/js/src/old-configure.in
939@@ -1884,3 +1884,5 @@ if test "$JS_STANDALONE"; then
940 fi
941
942 rm -fr confdefs* $ac_clean_files
943+echo confdefs* $ac_clean_files removed
944+echo "old-configure done"
945diff --git a/memory/build/moz.build b/memory/build/moz.build
946index e2c715271..f09ce7935 100644
947--- a/memory/build/moz.build
948+++ b/memory/build/moz.build
949@@ -30,7 +30,7 @@ else:
950 'fallback.cpp',
951 ]
952
953-if CONFIG['OS_TARGET'] == 'Darwin' and (CONFIG['MOZ_REPLACE_MALLOC'] or
954+if str(CONFIG['OS_TARGET']) == 'Darwin' and (CONFIG['MOZ_REPLACE_MALLOC'] or
955 CONFIG['MOZ_MEMORY']):
956 SOURCES += [
957 'zone.c',
958@@ -38,15 +38,15 @@ if CONFIG['OS_TARGET'] == 'Darwin' and (CONFIG['MOZ_REPLACE_MALLOC'] or
959
960 Library('memory')
961
962-if CONFIG['OS_TARGET'] == 'Android' and CONFIG['CC_TYPE'] == 'clang':
963+if str(CONFIG['OS_TARGET']) == 'Android' and str(CONFIG['CC_TYPE']) == 'clang':
964 CXXFLAGS += [
965 '-Wno-tautological-pointer-compare',
966 ]
967
968-if CONFIG['MOZ_BUILD_APP'] != 'memory':
969+if str(CONFIG['MOZ_BUILD_APP']) != 'memory':
970 FINAL_LIBRARY = 'mozglue'
971
972-if CONFIG['CC_TYPE'] in ('msvc', 'clang-cl'):
973+if str(CONFIG['CC_TYPE']) in ('msvc', 'clang-cl'):
974 CXXFLAGS += ['-wd4273'] # inconsistent dll linkage (bug 558163)
975
976 if CONFIG['MOZ_REPLACE_MALLOC_STATIC']:
977diff --git a/mozglue/build/moz.build b/mozglue/build/moz.build
978index 53758485a..5e9308802 100644
979--- a/mozglue/build/moz.build
980+++ b/mozglue/build/moz.build
981@@ -9,12 +9,12 @@
982 # If this is ever changed, update MOZ_SHARED_MOZGLUE in browser/installer/Makefile.in
983 if CONFIG['JS_STANDALONE'] and not CONFIG['MOZ_MEMORY']:
984 Library('mozglue')
985-elif CONFIG['OS_TARGET'] in ('WINNT', 'Darwin', 'Android'):
986+elif str(CONFIG['OS_TARGET']) in ('WINNT', 'Darwin', 'Android'):
987 SharedLibrary('mozglue')
988 else:
989 Library('mozglue')
990
991-if CONFIG['OS_TARGET'] == 'Android':
992+if str(CONFIG['OS_TARGET']) == 'Android':
993 SOURCES += [
994 'BionicGlue.cpp',
995 ]
996@@ -24,14 +24,14 @@ if CONFIG['MOZ_ASAN']:
997 'AsanOptions.cpp',
998 ]
999
1000-if CONFIG['OS_TARGET'] == 'WINNT':
1001+if str(CONFIG['OS_TARGET']) == 'WINNT':
1002 DEFFILE = 'mozglue.def'
1003 # We'll break the DLL blocklist if we immediately load user32.dll
1004 DELAYLOAD_DLLS += [
1005 'user32.dll',
1006 ]
1007
1008- if CONFIG['CC_TYPE'] == "msvc":
1009+ if str(CONFIG['CC_TYPE']) == "msvc":
1010 CFLAGS += ['-guard:cf']
1011 CXXFLAGS += ['-guard:cf']
1012 LDFLAGS += ['-guard:cf']
1013@@ -48,12 +48,12 @@ if CONFIG['MOZ_WIDGET_TOOLKIT']:
1014 'dummy.cpp',
1015 ]
1016
1017- if CONFIG['OS_TARGET'] == 'WINNT':
1018+ if str(CONFIG['OS_TARGET']) == 'WINNT':
1019 LOCAL_INCLUDES += [
1020 '/memory/build',
1021 ]
1022
1023- if CONFIG['CC_TYPE'] == "msvc":
1024+ if str(CONFIG['CC_TYPE']) == "msvc":
1025 SOURCES += ['WindowsCFGStatus.cpp']
1026 SOURCES += [
1027 'Authenticode.cpp',
1028@@ -85,17 +85,17 @@ if CONFIG['MOZ_WIDGET_TOOLKIT']:
1029 'WindowsDllBlocklist.h',
1030 ]
1031
1032- if CONFIG['CPU_ARCH'].startswith('x86'):
1033+ if str(CONFIG['CPU_ARCH']).startswith('x86'):
1034 SOURCES += [
1035 'SSE.cpp',
1036 ]
1037
1038- if CONFIG['CPU_ARCH'] == 'arm':
1039+ if str(CONFIG['CPU_ARCH']) == 'arm':
1040 SOURCES += [
1041 'arm.cpp',
1042 ]
1043
1044- if CONFIG['CPU_ARCH'].startswith('mips'):
1045+ if str(CONFIG['CPU_ARCH']).startswith('mips'):
1046 SOURCES += [
1047 'mips.cpp',
1048 ]
1049@@ -114,7 +114,7 @@ LIBRARY_DEFINES['MOZ_HAS_MOZGLUE'] = True
1050
1051 LDFLAGS += CONFIG['MOZ_GLUE_WRAP_LDFLAGS']
1052
1053-if CONFIG['OS_TARGET'] == 'Darwin':
1054+if str(CONFIG['OS_TARGET']) == 'Darwin':
1055 # On OSX 10.10.3, a dead lock happens in some cases involving dynamic
1056 # symbol resolution for symbols that jemalloc itself uses. While it
1057 # might be possible to find a way to avoid all such symbol resolutions,
1058@@ -124,7 +124,7 @@ if CONFIG['OS_TARGET'] == 'Darwin':
1059 # for TLS.
1060 LDFLAGS += ['-Wl,-bind_at_load']
1061
1062-if CONFIG['MOZ_LINKER'] and CONFIG['TARGET_CPU'] == 'arm':
1063+if CONFIG['MOZ_LINKER'] and str(CONFIG['TARGET_CPU']) == 'arm':
1064 LDFLAGS += ['-Wl,-version-script,%s/arm-eabi-filter' % SRCDIR]
1065
1066 DIST_INSTALL = True
1067diff --git a/python/mozbuild/mozbuild/action/check_binary.py b/python/mozbuild/mozbuild/action/check_binary.py
1068index 5665ef053..b696f73d6 100644
1069--- a/python/mozbuild/mozbuild/action/check_binary.py
1070+++ b/python/mozbuild/mozbuild/action/check_binary.py
1071@@ -104,6 +104,8 @@ def iter_readelf_symbols(target, binary):
1072
1073 def iter_readelf_dynamic(target, binary):
1074 for line in get_output(target['readelf'], '-d', binary):
1075+ if isinstance(line, bytes):
1076+ line=line.decode('utf-8')
1077 data = line.split(None, 2)
1078 if data and len(data) == 3 and data[0].startswith('0x'):
1079 yield data[1].rstrip(')').lstrip('('), data[2]
1080diff --git a/python/mozbuild/mozbuild/action/process_define_files.py b/python/mozbuild/mozbuild/action/process_define_files.py
1081index 563fbb8fa..c3df2869b 100644
1082--- a/python/mozbuild/mozbuild/action/process_define_files.py
1083+++ b/python/mozbuild/mozbuild/action/process_define_files.py
1084@@ -2,7 +2,7 @@
1085 # License, v. 2.0. If a copy of the MPL was not distributed with this
1086 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
1087
1088-from __future__ import absolute_import, print_function, unicode_literals
1089+
1090
1091 import argparse
1092 import os
1093@@ -53,7 +53,7 @@ def process_define_file(output, input):
1094 'CONFIGURE_DEFINE_FILE')
1095 defines = '\n'.join(sorted(
1096 '#define %s %s' % (name, val)
1097- for name, val in config.defines['ALLDEFINES'].iteritems()))
1098+ for name, val in config.defines['ALLDEFINES'].items()))
1099 l = l[:m.start('cmd') - 1] \
1100 + defines + l[m.end('name'):]
1101 elif cmd == 'define':
1102diff --git a/python/mozbuild/mozbuild/backend/base.py b/python/mozbuild/mozbuild/backend/base.py
1103index a8d5c94e0..7cda63475 100644
1104--- a/python/mozbuild/mozbuild/backend/base.py
1105+++ b/python/mozbuild/mozbuild/backend/base.py
1106@@ -2,7 +2,7 @@
1107 # License, v. 2.0. If a copy of the MPL was not distributed with this
1108 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
1109
1110-from __future__ import absolute_import, unicode_literals
1111+
1112
1113 from abc import (
1114 ABCMeta,
1115@@ -31,7 +31,7 @@ from .configenvironment import ConfigEnvironment
1116 from mozbuild.base import ExecutionSummary
1117
1118
1119-class BuildBackend(LoggingMixin):
1120+class BuildBackend(LoggingMixin, metaclass=ABCMeta):
1121 """Abstract base class for build backends.
1122
1123 A build backend is merely a consumer of the build configuration (the output
1124@@ -39,8 +39,6 @@ class BuildBackend(LoggingMixin):
1125 is the discretion of the specific implementation.
1126 """
1127
1128- __metaclass__ = ABCMeta
1129-
1130 def __init__(self, environment):
1131 assert isinstance(environment, (ConfigEnvironment, EmptyConfig))
1132 self.populate_logger()
1133@@ -311,7 +309,7 @@ class BuildBackend(LoggingMixin):
1134 srcdir = mozpath.dirname(obj.input_path)
1135 pp.context.update({
1136 k: ' '.join(v) if isinstance(v, list) else v
1137- for k, v in obj.config.substs.iteritems()
1138+ for k, v in obj.config.substs.items()
1139 })
1140 pp.context.update(
1141 top_srcdir=obj.topsrcdir,
1142diff --git a/python/mozbuild/mozbuild/backend/common.py b/python/mozbuild/mozbuild/backend/common.py
1143index d00cbbcaf..f747df446 100644
1144--- a/python/mozbuild/mozbuild/backend/common.py
1145+++ b/python/mozbuild/mozbuild/backend/common.py
1146@@ -2,7 +2,7 @@
1147 # License, v. 2.0. If a copy of the MPL was not distributed with this
1148 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
1149
1150-from __future__ import absolute_import, unicode_literals
1151+
1152
1153 import json
1154 import os
1155@@ -174,7 +174,7 @@ class CommonBackend(BuildBackend):
1156 if len(self._idl_manager.idls):
1157 self._write_rust_xpidl_summary(self._idl_manager)
1158 self._handle_idl_manager(self._idl_manager)
1159- self._handle_generated_sources(mozpath.join(self.environment.topobjdir, 'dist/include/%s.h' % idl['root']) for idl in self._idl_manager.idls.values())
1160+ self._handle_generated_sources(mozpath.join(self.environment.topobjdir, 'dist/include/%s.h' % idl['root']) for idl in list(self._idl_manager.idls.values()))
1161
1162
1163 for config in self._configs:
1164@@ -372,14 +372,14 @@ class CommonBackend(BuildBackend):
1165
1166 with self._write_file(mozpath.join(topobjdir, 'dist', 'xpcrs', 'rt', 'all.rs')) as fh:
1167 fh.write("// THIS FILE IS GENERATED - DO NOT EDIT\n\n")
1168- for idl in manager.idls.values():
1169+ for idl in list(manager.idls.values()):
1170 fh.write(include_tmpl % ("rt", idl['root']))
1171 fh.write(";\n")
1172
1173 with self._write_file(mozpath.join(topobjdir, 'dist', 'xpcrs', 'bt', 'all.rs')) as fh:
1174 fh.write("// THIS FILE IS GENERATED - DO NOT EDIT\n\n")
1175 fh.write("&[\n")
1176- for idl in manager.idls.values():
1177+ for idl in list(manager.idls.values()):
1178 fh.write(include_tmpl % ("bt", idl['root']))
1179 fh.write(",\n")
1180 fh.write("]\n")
1181diff --git a/python/mozbuild/mozbuild/backend/configenvironment.py b/python/mozbuild/mozbuild/backend/configenvironment.py
1182index 3676a7d18..f0896cea4 100644
1183--- a/python/mozbuild/mozbuild/backend/configenvironment.py
1184+++ b/python/mozbuild/mozbuild/backend/configenvironment.py
1185@@ -2,14 +2,14 @@
1186 # License, v. 2.0. If a copy of the MPL was not distributed with this
1187 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
1188
1189-from __future__ import absolute_import
1190+
1191
1192 import os
1193 import sys
1194 import json
1195
1196 from collections import Iterable, OrderedDict
1197-from types import StringTypes, ModuleType
1198+from types import ModuleType
1199
1200 import mozpack.path as mozpath
1201
1202@@ -22,7 +22,7 @@ from mozbuild.shellutil import quote as shell_quote
1203
1204
1205 if sys.version_info.major == 2:
1206- text_type = unicode
1207+ text_type = str
1208 else:
1209 text_type = str
1210
1211@@ -151,7 +151,7 @@ class ConfigEnvironment(object):
1212 shell_quote(self.defines[name]).replace('$', '$$'))
1213 for name in sorted(global_defines)])
1214 def serialize(name, obj):
1215- if isinstance(obj, StringTypes):
1216+ if isinstance(obj, str):
1217 return obj
1218 if isinstance(obj, Iterable):
1219 return ' '.join(obj)
1220@@ -185,8 +185,8 @@ class ConfigEnvironment(object):
1221 except UnicodeDecodeError:
1222 return v.decode('utf-8', 'replace')
1223
1224- for k, v in self.substs.items():
1225- if not isinstance(v, StringTypes):
1226+ for k, v in list(self.substs.items()):
1227+ if not isinstance(v, str):
1228 if isinstance(v, Iterable):
1229 type(v)(decode(i) for i in v)
1230 elif not isinstance(v, text_type):
1231@@ -255,7 +255,7 @@ class PartialConfigDict(object):
1232 existing_files = self._load_config_track()
1233
1234 new_files = set()
1235- for k, v in values.iteritems():
1236+ for k, v in values.items():
1237 new_files.add(self._write_file(k, v))
1238
1239 for filename in existing_files - new_files:
1240diff --git a/python/mozbuild/mozbuild/backend/fastermake.py b/python/mozbuild/mozbuild/backend/fastermake.py
1241index b029aa10f..b66ade64f 100644
1242--- a/python/mozbuild/mozbuild/backend/fastermake.py
1243+++ b/python/mozbuild/mozbuild/backend/fastermake.py
1244@@ -2,7 +2,7 @@
1245 # License, v. 2.0. If a copy of the MPL was not distributed with this
1246 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
1247
1248-from __future__ import absolute_import, unicode_literals, print_function
1249+
1250
1251 from mozbuild.backend.base import PartialBackend
1252 from mozbuild.backend.common import CommonBackend
1253@@ -140,7 +140,7 @@ class FasterMakeBackend(CommonBackend, PartialBackend):
1254 # Add information for chrome manifest generation
1255 manifest_targets = []
1256
1257- for target, entries in self._manifest_entries.iteritems():
1258+ for target, entries in self._manifest_entries.items():
1259 manifest_targets.append(target)
1260 install_target = mozpath.basedir(target, install_manifests_bases)
1261 self._install_manifests[install_target].add_content(
1262@@ -152,13 +152,13 @@ class FasterMakeBackend(CommonBackend, PartialBackend):
1263 % ' '.join(self._install_manifests.keys()))
1264
1265 # Add dependencies we infered:
1266- for target, deps in self._dependencies.iteritems():
1267+ for target, deps in self._dependencies.items():
1268 mk.create_rule([target]).add_dependencies(
1269 '$(TOPOBJDIR)/%s' % d for d in deps)
1270
1271 mk.add_statement('include $(TOPSRCDIR)/config/faster/rules.mk')
1272
1273- for base, install_manifest in self._install_manifests.iteritems():
1274+ for base, install_manifest in self._install_manifests.items():
1275 with self._write_file(
1276 mozpath.join(self.environment.topobjdir, 'faster',
1277 'install_%s' % base.replace('/', '_'))) as fh:
1278@@ -167,7 +167,7 @@ class FasterMakeBackend(CommonBackend, PartialBackend):
1279 # For artifact builds only, write a single unified manifest for consumption by |mach watch|.
1280 if self.environment.is_artifact_build:
1281 unified_manifest = InstallManifest()
1282- for base, install_manifest in self._install_manifests.iteritems():
1283+ for base, install_manifest in self._install_manifests.items():
1284 # Expect 'dist/bin/**', which includes 'dist/bin' with no trailing slash.
1285 assert base.startswith('dist/bin')
1286 base = base[len('dist/bin'):]
1287diff --git a/python/mozbuild/mozbuild/backend/recursivemake.py b/python/mozbuild/mozbuild/backend/recursivemake.py
1288index dd9020d62..aa89cc297 100644
1289--- a/python/mozbuild/mozbuild/backend/recursivemake.py
1290+++ b/python/mozbuild/mozbuild/backend/recursivemake.py
1291@@ -2,7 +2,7 @@
1292 # License, v. 2.0. If a copy of the MPL was not distributed with this
1293 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
1294
1295-from __future__ import absolute_import, unicode_literals
1296+
1297
1298 import logging
1299 import os
1300@@ -12,7 +12,7 @@ from collections import (
1301 defaultdict,
1302 namedtuple,
1303 )
1304-from StringIO import StringIO
1305+from io import StringIO
1306 from itertools import chain
1307
1308 from mozpack.manifests import (
1309@@ -80,75 +80,76 @@ from ..util import (
1310 )
1311 from ..makeutil import Makefile
1312 from mozbuild.shellutil import quote as shell_quote
1313+from functools import reduce
1314
1315 MOZBUILD_VARIABLES = [
1316- b'ASFLAGS',
1317- b'CMSRCS',
1318- b'CMMSRCS',
1319- b'CPP_UNIT_TESTS',
1320- b'DIRS',
1321- b'DIST_INSTALL',
1322- b'EXTRA_DSO_LDOPTS',
1323- b'EXTRA_JS_MODULES',
1324- b'EXTRA_PP_COMPONENTS',
1325- b'EXTRA_PP_JS_MODULES',
1326- b'FORCE_SHARED_LIB',
1327- b'FORCE_STATIC_LIB',
1328- b'FINAL_LIBRARY',
1329- b'HOST_CFLAGS',
1330- b'HOST_CSRCS',
1331- b'HOST_CMMSRCS',
1332- b'HOST_CXXFLAGS',
1333- b'HOST_EXTRA_LIBS',
1334- b'HOST_LIBRARY_NAME',
1335- b'HOST_PROGRAM',
1336- b'HOST_SIMPLE_PROGRAMS',
1337- b'JAR_MANIFEST',
1338- b'JAVA_JAR_TARGETS',
1339- b'LIBRARY_NAME',
1340- b'LIBS',
1341- b'MAKE_FRAMEWORK',
1342- b'MODULE',
1343- b'NO_DIST_INSTALL',
1344- b'NO_EXPAND_LIBS',
1345- b'NO_INTERFACES_MANIFEST',
1346- b'NO_JS_MANIFEST',
1347- b'OS_LIBS',
1348- b'PARALLEL_DIRS',
1349- b'PREF_JS_EXPORTS',
1350- b'PROGRAM',
1351- b'RESOURCE_FILES',
1352- b'SHARED_LIBRARY_LIBS',
1353- b'SHARED_LIBRARY_NAME',
1354- b'SIMPLE_PROGRAMS',
1355- b'SONAME',
1356- b'STATIC_LIBRARY_NAME',
1357- b'TEST_DIRS',
1358- b'TOOL_DIRS',
1359+ 'ASFLAGS',
1360+ 'CMSRCS',
1361+ 'CMMSRCS',
1362+ 'CPP_UNIT_TESTS',
1363+ 'DIRS',
1364+ 'DIST_INSTALL',
1365+ 'EXTRA_DSO_LDOPTS',
1366+ 'EXTRA_JS_MODULES',
1367+ 'EXTRA_PP_COMPONENTS',
1368+ 'EXTRA_PP_JS_MODULES',
1369+ 'FORCE_SHARED_LIB',
1370+ 'FORCE_STATIC_LIB',
1371+ 'FINAL_LIBRARY',
1372+ 'HOST_CFLAGS',
1373+ 'HOST_CSRCS',
1374+ 'HOST_CMMSRCS',
1375+ 'HOST_CXXFLAGS',
1376+ 'HOST_EXTRA_LIBS',
1377+ 'HOST_LIBRARY_NAME',
1378+ 'HOST_PROGRAM',
1379+ 'HOST_SIMPLE_PROGRAMS',
1380+ 'JAR_MANIFEST',
1381+ 'JAVA_JAR_TARGETS',
1382+ 'LIBRARY_NAME',
1383+ 'LIBS',
1384+ 'MAKE_FRAMEWORK',
1385+ 'MODULE',
1386+ 'NO_DIST_INSTALL',
1387+ 'NO_EXPAND_LIBS',
1388+ 'NO_INTERFACES_MANIFEST',
1389+ 'NO_JS_MANIFEST',
1390+ 'OS_LIBS',
1391+ 'PARALLEL_DIRS',
1392+ 'PREF_JS_EXPORTS',
1393+ 'PROGRAM',
1394+ 'RESOURCE_FILES',
1395+ 'SHARED_LIBRARY_LIBS',
1396+ 'SHARED_LIBRARY_NAME',
1397+ 'SIMPLE_PROGRAMS',
1398+ 'SONAME',
1399+ 'STATIC_LIBRARY_NAME',
1400+ 'TEST_DIRS',
1401+ 'TOOL_DIRS',
1402 # XXX config/Makefile.in specifies this in a make invocation
1403 #'USE_EXTENSION_MANIFEST',
1404- b'XPCSHELL_TESTS',
1405- b'XPIDL_MODULE',
1406+ 'XPCSHELL_TESTS',
1407+ 'XPIDL_MODULE',
1408 ]
1409
1410 DEPRECATED_VARIABLES = [
1411- b'EXPORT_LIBRARY',
1412- b'EXTRA_LIBS',
1413- b'HOST_LIBS',
1414- b'LIBXUL_LIBRARY',
1415- b'MOCHITEST_A11Y_FILES',
1416- b'MOCHITEST_BROWSER_FILES',
1417- b'MOCHITEST_BROWSER_FILES_PARTS',
1418- b'MOCHITEST_CHROME_FILES',
1419- b'MOCHITEST_FILES',
1420- b'MOCHITEST_FILES_PARTS',
1421- b'MOCHITEST_METRO_FILES',
1422- b'MOCHITEST_ROBOCOP_FILES',
1423- b'MODULE_OPTIMIZE_FLAGS',
1424- b'MOZ_CHROME_FILE_FORMAT',
1425- b'SHORT_LIBNAME',
1426- b'TESTING_JS_MODULES',
1427- b'TESTING_JS_MODULE_DIR',
1428+ 'EXPORT_LIBRARY',
1429+ 'EXTRA_LIBS',
1430+ 'HOST_LIBS',
1431+ 'LIBXUL_LIBRARY',
1432+ 'MOCHITEST_A11Y_FILES',
1433+ 'MOCHITEST_BROWSER_FILES',
1434+ 'MOCHITEST_BROWSER_FILES_PARTS',
1435+ 'MOCHITEST_CHROME_FILES',
1436+ 'MOCHITEST_FILES',
1437+ 'MOCHITEST_FILES_PARTS',
1438+ 'MOCHITEST_METRO_FILES',
1439+ 'MOCHITEST_ROBOCOP_FILES',
1440+ 'MODULE_OPTIMIZE_FLAGS',
1441+ 'MOZ_CHROME_FILE_FORMAT',
1442+ 'SHORT_LIBNAME',
1443+ 'TESTING_JS_MODULES',
1444+ 'TESTING_JS_MODULE_DIR',
1445 ]
1446
1447 MOZBUILD_VARIABLES_MESSAGE = 'It should only be defined in moz.build files.'
1448@@ -207,7 +208,7 @@ class BackendMakeFile(object):
1449 self.fh.write(buf)
1450
1451 def write_once(self, buf):
1452- if isinstance(buf, unicode):
1453+ if isinstance(buf, str):
1454 buf = buf.encode('utf-8')
1455 if b'\n' + buf not in self.fh.getvalue():
1456 self.write(buf)
1457@@ -280,7 +281,7 @@ class RecursiveMakeTraversal(object):
1458 Helper function to call a filter from compute_dependencies and
1459 traverse.
1460 """
1461- return filter(current, self.get_subdirs(current))
1462+ return list(filter(current, self.get_subdirs(current)))
1463
1464 def compute_dependencies(self, filter=None):
1465 """
1466@@ -710,7 +711,7 @@ class RecursiveMakeBackend(CommonBackend):
1467 convenience variables, and the other dependency definitions for a
1468 hopefully proper directory traversal.
1469 """
1470- for tier, no_skip in self._no_skip.items():
1471+ for tier, no_skip in list(self._no_skip.items()):
1472 self.log(logging.DEBUG, 'fill_root_mk', {
1473 'number': len(no_skip), 'tier': tier
1474 }, 'Using {number} directories during {tier}')
1475@@ -757,7 +758,7 @@ class RecursiveMakeBackend(CommonBackend):
1476 for tier, filter in filters:
1477 main, all_deps = \
1478 self._traversal.compute_dependencies(filter)
1479- for dir, deps in all_deps.items():
1480+ for dir, deps in list(all_deps.items()):
1481 if deps is not None or (dir in self._idl_dirs \
1482 and tier == 'export'):
1483 rule = root_deps_mk.create_rule(['%s/%s' % (dir, tier)])
1484@@ -770,7 +771,7 @@ class RecursiveMakeBackend(CommonBackend):
1485 rule.add_dependencies('%s/%s' % (d, tier) for d in main)
1486
1487 all_compile_deps = reduce(lambda x,y: x|y,
1488- self._compile_graph.values()) if self._compile_graph else set()
1489+ list(self._compile_graph.values())) if self._compile_graph else set()
1490 # Include the following as dependencies of the top recursion target for
1491 # compilation:
1492 # - nodes that are not dependended upon by anything. Typically, this
1493@@ -783,7 +784,7 @@ class RecursiveMakeBackend(CommonBackend):
1494 # as direct dependencies of the top recursion target, to somehow
1495 # prioritize them.
1496 # 1. See bug 1262241 comment 5.
1497- compile_roots = [t for t, deps in self._compile_graph.iteritems()
1498+ compile_roots = [t for t, deps in list(self._compile_graph.items())
1499 if not deps or t not in all_compile_deps]
1500
1501 rule = root_deps_mk.create_rule(['recurse_compile'])
1502@@ -845,14 +846,14 @@ class RecursiveMakeBackend(CommonBackend):
1503 rule.add_dependencies(['$(CURDIR)/%: %'])
1504
1505 def _check_blacklisted_variables(self, makefile_in, makefile_content):
1506- if b'EXTERNALLY_MANAGED_MAKE_FILE' in makefile_content:
1507+ if 'EXTERNALLY_MANAGED_MAKE_FILE' in makefile_content:
1508 # Bypass the variable restrictions for externally managed makefiles.
1509 return
1510
1511 for l in makefile_content.splitlines():
1512 l = l.strip()
1513 # Don't check comments
1514- if l.startswith(b'#'):
1515+ if l.startswith('#'):
1516 continue
1517 for x in chain(MOZBUILD_VARIABLES, DEPRECATED_VARIABLES):
1518 if x not in l:
1519@@ -909,11 +910,11 @@ class RecursiveMakeBackend(CommonBackend):
1520 # Directories with a Makefile containing a tools target, or
1521 # XPI_PKGNAME or INSTALL_EXTENSION_ID can't be skipped and
1522 # must run during the 'tools' tier.
1523- for t in (b'XPI_PKGNAME', b'INSTALL_EXTENSION_ID',
1524- b'tools'):
1525+ for t in ('XPI_PKGNAME', 'INSTALL_EXTENSION_ID',
1526+ 'tools'):
1527 if t not in content:
1528 continue
1529- if t == b'tools' and not re.search('(?:^|\s)tools.*::', content, re.M):
1530+ if t == 'tools' and not re.search('(?:^|\s)tools.*::', content, re.M):
1531 continue
1532 if objdir == self.environment.topobjdir:
1533 continue
1534@@ -933,7 +934,7 @@ class RecursiveMakeBackend(CommonBackend):
1535 self._fill_root_mk()
1536
1537 # Make the master test manifest files.
1538- for flavor, t in self._test_manifests.items():
1539+ for flavor, t in list(self._test_manifests.items()):
1540 install_prefix, manifests = t
1541 manifest_stem = mozpath.join(install_prefix, '%s.ini' % flavor)
1542 self._write_master_test_manifest(mozpath.join(
1543@@ -1039,7 +1040,7 @@ class RecursiveMakeBackend(CommonBackend):
1544 for p in ('Makefile', 'backend.mk', '.deps/.mkdir.done'):
1545 build_files.add_optional_exists(p)
1546
1547- for idl in manager.idls.values():
1548+ for idl in list(manager.idls.values()):
1549 self._install_manifests['dist_idl'].add_link(idl['source'],
1550 idl['basename'])
1551 self._install_manifests['dist_include'].add_optional_exists('%s.h'
1552@@ -1086,7 +1087,7 @@ class RecursiveMakeBackend(CommonBackend):
1553
1554 interfaces_manifests = []
1555 dist_dir = mozpath.join(self.environment.topobjdir, 'dist')
1556- for manifest, entries in manager.interface_manifests.items():
1557+ for manifest, entries in list(manager.interface_manifests.items()):
1558 interfaces_manifests.append(mozpath.join('$(DEPTH)', manifest))
1559 for xpt in sorted(entries):
1560 registered_xpt_files.add(mozpath.join(
1561@@ -1194,7 +1195,7 @@ class RecursiveMakeBackend(CommonBackend):
1562 # Don't allow files to be defined multiple times unless it is allowed.
1563 # We currently allow duplicates for non-test files or test files if
1564 # the manifest is listed as a duplicate.
1565- for source, (dest, is_test) in obj.installs.items():
1566+ for source, (dest, is_test) in list(obj.installs.items()):
1567 try:
1568 self._install_manifests['_test_files'].add_link(source, dest)
1569 except ValueError:
1570@@ -1558,7 +1559,7 @@ class RecursiveMakeBackend(CommonBackend):
1571 man_dir = mozpath.join(self.environment.topobjdir, '_build_manifests',
1572 dest)
1573
1574- for k, manifest in manifests.items():
1575+ for k, manifest in list(manifests.items()):
1576 with self._write_file(mozpath.join(man_dir, k)) as fh:
1577 manifest.write(fileobj=fh)
1578
1579@@ -1593,20 +1594,20 @@ class RecursiveMakeBackend(CommonBackend):
1580 pp.context.update(extra)
1581 if not pp.context.get('autoconfmk', ''):
1582 pp.context['autoconfmk'] = 'autoconf.mk'
1583- pp.handleLine(b'# THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT MODIFY BY HAND.\n');
1584- pp.handleLine(b'DEPTH := @DEPTH@\n')
1585- pp.handleLine(b'topobjdir := @topobjdir@\n')
1586- pp.handleLine(b'topsrcdir := @top_srcdir@\n')
1587- pp.handleLine(b'srcdir := @srcdir@\n')
1588- pp.handleLine(b'VPATH := @srcdir@\n')
1589- pp.handleLine(b'relativesrcdir := @relativesrcdir@\n')
1590- pp.handleLine(b'include $(DEPTH)/config/@autoconfmk@\n')
1591+ pp.handleLine('# THIS FILE WAS AUTOMATICALLY GENERATED. DO NOT MODIFY BY HAND.\n');
1592+ pp.handleLine('DEPTH := @DEPTH@\n')
1593+ pp.handleLine('topobjdir := @topobjdir@\n')
1594+ pp.handleLine('topsrcdir := @top_srcdir@\n')
1595+ pp.handleLine('srcdir := @srcdir@\n')
1596+ pp.handleLine('VPATH := @srcdir@\n')
1597+ pp.handleLine('relativesrcdir := @relativesrcdir@\n')
1598+ pp.handleLine('include $(DEPTH)/config/@autoconfmk@\n')
1599 if not stub:
1600 pp.do_include(obj.input_path)
1601 # Empty line to avoid failures when last line in Makefile.in ends
1602 # with a backslash.
1603- pp.handleLine(b'\n')
1604- pp.handleLine(b'include $(topsrcdir)/config/recurse.mk\n')
1605+ pp.handleLine('\n')
1606+ pp.handleLine('include $(topsrcdir)/config/recurse.mk\n')
1607 if not stub:
1608 # Adding the Makefile.in here has the desired side-effect
1609 # that if the Makefile.in disappears, this will force
1610diff --git a/python/mozbuild/mozbuild/config_status.py b/python/mozbuild/mozbuild/config_status.py
1611index d46f1332d..a9a27a699 100644
1612--- a/python/mozbuild/mozbuild/config_status.py
1613+++ b/python/mozbuild/mozbuild/config_status.py
1614@@ -77,6 +77,7 @@ def config_status(topobjdir='.', topsrcdir='.', defines=None,
1615 See build/autoconf/config.status.m4.
1616 '''
1617
1618+ print("config_status started")
1619 if 'CONFIG_FILES' in os.environ:
1620 raise Exception('Using the CONFIG_FILES environment variable is not '
1621 'supported.')
1622@@ -119,7 +120,7 @@ def config_status(topobjdir='.', topsrcdir='.', defines=None,
1623 if 'WRITE_MOZINFO' in os.environ:
1624 write_mozinfo(os.path.join(topobjdir, 'mozinfo.json'), env, os.environ)
1625
1626- cpu_start = time.clock()
1627+ cpu_start = time.perf_counter()
1628 time_start = time.time()
1629
1630 # Make appropriate backend instances, defaulting to RecursiveMakeBackend,
1631@@ -155,7 +156,7 @@ def config_status(topobjdir='.', topsrcdir='.', defines=None,
1632 summary = obj.gyp_summary()
1633 print(summary, file=sys.stderr)
1634
1635- cpu_time = time.clock() - cpu_start
1636+ cpu_time = time.perf_counter() - cpu_start
1637 wall_time = time.time() - time_start
1638 efficiency = cpu_time / wall_time if wall_time else 100
1639 untracked = wall_time - execution_time
1640@@ -179,3 +180,5 @@ def config_status(topobjdir='.', topsrcdir='.', defines=None,
1641 # Advertise Android Studio if it is appropriate.
1642 if MachCommandConditions.is_android(env):
1643 print(ANDROID_IDE_ADVERTISEMENT)
1644+
1645+ print("config_status finished")
1646diff --git a/python/mozbuild/mozbuild/configure/__init__.py b/python/mozbuild/mozbuild/configure/__init__.py
1647index d03615707..13d623d4f 100644
1648--- a/python/mozbuild/mozbuild/configure/__init__.py
1649+++ b/python/mozbuild/mozbuild/configure/__init__.py
1650@@ -2,9 +2,9 @@
1651 # License, v. 2.0. If a copy of the MPL was not distributed with this
1652 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
1653
1654-from __future__ import absolute_import, print_function, unicode_literals
1655
1656-import __builtin__
1657+
1658+import builtins
1659 import inspect
1660 import logging
1661 import os
1662@@ -38,6 +38,8 @@ from mozbuild.util import (
1663
1664 import mozpack.path as mozpath
1665
1666+import traceback
1667+
1668
1669 class ConfigureError(Exception):
1670 pass
1671@@ -69,7 +71,7 @@ class SandboxDependsFunction(object):
1672 def __getattr__(self, key):
1673 return self._getattr(key).sandboxed
1674
1675- def __nonzero__(self):
1676+ def __bool__(self):
1677 raise ConfigureError(
1678 'Cannot do boolean operations on @depends functions.')
1679
1680@@ -96,6 +98,7 @@ class DependsFunction(object):
1681 sandbox._value_for(self)
1682 elif not sandbox._help:
1683 sandbox._execution_queue.append((sandbox._value_for, (self,)))
1684+ sandbox.tasks_debug_out("DependsFunction.__init %s" % func.__name__)
1685
1686 @property
1687 def name(self):
1688@@ -206,6 +209,15 @@ class CombinedDependsFunction(DependsFunction):
1689 def __ne__(self, other):
1690 return not self == other
1691
1692+ def __hash__(self):
1693+ # This was one was taken from [1] initially. Should not have done that:
1694+ # it causes explosion of ConfigureSandbox._execution_queue with 100%
1695+ # CPU load and eating all avaliable memory...
1696+ #
1697+ # [1] https://code.foxkit.us/adelie/packages/blob/f2b5773da19ab397fbe64fd32dacc383cfe4cd77/user/mozjs/python3.patch#L8068
1698+ return hash((self._name, tuple(self.dependencies)))
1699+
1700+
1701 class SandboxedGlobal(dict):
1702 '''Identifiable dict type for use as function global'''
1703
1704@@ -253,11 +265,12 @@ class ConfigureSandbox(dict):
1705 # The default set of builtins. We expose unicode as str to make sandboxed
1706 # files more python3-ready.
1707 BUILTINS = ReadOnlyDict({
1708- b: getattr(__builtin__, b)
1709+ b: getattr(builtins, b)
1710 for b in ('None', 'False', 'True', 'int', 'bool', 'any', 'all', 'len',
1711 'list', 'tuple', 'set', 'dict', 'isinstance', 'getattr',
1712- 'hasattr', 'enumerate', 'range', 'zip')
1713- }, __import__=forbidden_import, str=unicode)
1714+ 'hasattr', 'enumerate', 'range', 'zip', '__build_class__',
1715+ 'bytes', 'exec')
1716+ }, __import__=forbidden_import, str=str)
1717
1718 # Expose a limited set of functions from os.path
1719 OS = ReadOnlyNamespace(path=ReadOnlyNamespace(**{
1720@@ -294,6 +307,11 @@ class ConfigureSandbox(dict):
1721 # Queue of functions to execute, with their arguments
1722 self._execution_queue = []
1723
1724+ # For debugging: Show number of tasks started in run() / added elsewhere
1725+ # and some additional info
1726+ self.task_debug = False # set True to enable
1727+ self.tasks_started = 0
1728+
1729 # Store the `when`s associated to some options.
1730 self._conditions = {}
1731
1732@@ -331,7 +349,7 @@ class ConfigureSandbox(dict):
1733 return method
1734 def wrapped(*args, **kwargs):
1735 out_args = [
1736- arg.decode(encoding) if isinstance(arg, str) else arg
1737+ arg.decode(encoding) if isinstance(arg, bytes) else arg
1738 for arg in args
1739 ]
1740 return method(*out_args, **kwargs)
1741@@ -360,6 +378,14 @@ class ConfigureSandbox(dict):
1742 handler.setFormatter(formatter)
1743 logger.addHandler(handler)
1744
1745+ def tasks_debug_out(self, text):
1746+ if self.task_debug:
1747+ print("%s / queued %i / done %i" %(text, len(self._execution_queue), self.tasks_started))
1748+ #if len(self._execution_queue) > 5000:
1749+ # traceback.print_stack(file=sys.stdout)
1750+ #if len(self._execution_queue) > 5010:
1751+ # raise Exception("Too many tasks")
1752+
1753 def include_file(self, path):
1754 '''Include one file in the sandbox. Users of this class probably want
1755 to use `run` instead.
1756@@ -380,6 +406,9 @@ class ConfigureSandbox(dict):
1757 if path in self._all_paths:
1758 raise ConfigureError(
1759 'Cannot include `%s` because it was included already.' % path)
1760+
1761+ if self.task_debug:
1762+ print("include_file", path)
1763 self._paths.append(path)
1764 self._all_paths.add(path)
1765
1766@@ -398,7 +427,7 @@ class ConfigureSandbox(dict):
1767 if path:
1768 self.include_file(path)
1769
1770- for option in self._options.itervalues():
1771+ for option in self._options.values():
1772 # All options must be referenced by some @depends function
1773 if option not in self._seen:
1774 raise ConfigureError(
1775@@ -425,6 +454,8 @@ class ConfigureSandbox(dict):
1776
1777 # Run the execution queue
1778 for func, args in self._execution_queue:
1779+ self.tasks_started += 1
1780+ self.tasks_debug_out("ConfigureSandbox.run(%s)" % func.__name__)
1781 func(*args)
1782
1783 if self._help:
1784@@ -504,7 +535,7 @@ class ConfigureSandbox(dict):
1785 value = PositiveOptionValue()
1786 elif value is False or value == ():
1787 value = NegativeOptionValue()
1788- elif isinstance(value, types.StringTypes):
1789+ elif isinstance(value, (str,)):
1790 value = PositiveOptionValue((value,))
1791 elif isinstance(value, tuple):
1792 value = PositiveOptionValue(value)
1793@@ -544,7 +575,7 @@ class ConfigureSandbox(dict):
1794 return value
1795
1796 def _dependency(self, arg, callee_name, arg_name=None):
1797- if isinstance(arg, types.StringTypes):
1798+ if isinstance(arg, (str,)):
1799 prefix, name, values = Option.split_option(arg)
1800 if values != ():
1801 raise ConfigureError("Option must not contain an '='")
1802@@ -608,7 +639,7 @@ class ConfigureSandbox(dict):
1803 '''
1804 when = self._normalize_when(kwargs.get('when'), 'option')
1805 args = [self._resolve(arg) for arg in args]
1806- kwargs = {k: self._resolve(v) for k, v in kwargs.iteritems()
1807+ kwargs = {k: self._resolve(v) for k, v in kwargs.items()
1808 if k != 'when'}
1809 option = Option(*args, **kwargs)
1810 if when:
1811@@ -689,7 +720,7 @@ class ConfigureSandbox(dict):
1812 with self.only_when_impl(when):
1813 what = self._resolve(what)
1814 if what:
1815- if not isinstance(what, types.StringTypes):
1816+ if not isinstance(what, (str,)):
1817 raise TypeError("Unexpected type: '%s'" % type(what).__name__)
1818 self.include_file(what)
1819
1820@@ -707,7 +738,7 @@ class ConfigureSandbox(dict):
1821 (k[:-len('_impl')], getattr(self, k))
1822 for k in dir(self) if k.endswith('_impl') and k != 'template_impl'
1823 )
1824- glob.update((k, v) for k, v in self.iteritems() if k not in glob)
1825+ glob.update((k, v) for k, v in self.items() if k not in glob)
1826
1827 # Any function argument to the template must be prepared to be sandboxed.
1828 # If the template itself returns a function (in which case, it's very
1829@@ -731,7 +762,7 @@ class ConfigureSandbox(dict):
1830 def wrapper(*args, **kwargs):
1831 args = [maybe_prepare_function(arg) for arg in args]
1832 kwargs = {k: maybe_prepare_function(v)
1833- for k, v in kwargs.iteritems()}
1834+ for k, v in kwargs.items()}
1835 ret = template(*args, **kwargs)
1836 if isfunction(ret):
1837 # We can't expect the sandboxed code to think about all the
1838@@ -766,7 +797,7 @@ class ConfigureSandbox(dict):
1839 for value, required in (
1840 (_import, True), (_from, False), (_as, False)):
1841
1842- if not isinstance(value, types.StringTypes) and (
1843+ if not isinstance(value, (str,)) and (
1844 required or value is not None):
1845 raise TypeError("Unexpected type: '%s'" % type(value).__name__)
1846 if value is not None and not self.RE_MODULE.match(value):
1847@@ -807,7 +838,7 @@ class ConfigureSandbox(dict):
1848 # Special case for the open() builtin, because otherwise, using it
1849 # fails with "IOError: file() constructor not accessible in
1850 # restricted mode"
1851- if what == '__builtin__.open':
1852+ if what == 'builtins.open':
1853 return lambda *args, **kwargs: open(*args, **kwargs)
1854 # Until this proves to be a performance problem, just construct an
1855 # import statement and execute it.
1856@@ -829,7 +860,7 @@ class ConfigureSandbox(dict):
1857 name = self._resolve(name, need_help_dependency=False)
1858 if name is None:
1859 return
1860- if not isinstance(name, types.StringTypes):
1861+ if not isinstance(name, (str,)):
1862 raise TypeError("Unexpected type: '%s'" % type(name).__name__)
1863 if name in data:
1864 raise ConfigureError(
1865@@ -850,6 +881,7 @@ class ConfigureSandbox(dict):
1866
1867 self._execution_queue.append((
1868 self._resolve_and_set, (self._config, name, value, when)))
1869+ self.tasks_debug_out("ConfigureSandbox.set_config_impl / %s(%s" % (name, value))
1870
1871 def set_define_impl(self, name, value, when=None):
1872 '''Implementation of set_define().
1873@@ -864,6 +896,7 @@ class ConfigureSandbox(dict):
1874 defines = self._config.setdefault('DEFINES', {})
1875 self._execution_queue.append((
1876 self._resolve_and_set, (defines, name, value, when)))
1877+ self.tasks_debug_out("ConfigureSandbox.set_define_impl / %s(%s)" % (name, value))
1878
1879 def imply_option_impl(self, option, value, reason=None, when=None):
1880 '''Implementation of imply_option().
1881@@ -922,7 +955,7 @@ class ConfigureSandbox(dict):
1882 if isinstance(possible_reasons[0], Option):
1883 reason = possible_reasons[0]
1884 if not reason and (isinstance(value, (bool, tuple)) or
1885- isinstance(value, types.StringTypes)):
1886+ isinstance(value, (str,))):
1887 # A reason can be provided automatically when imply_option
1888 # is called with an immediate value.
1889 _, filename, line, _, _, _ = inspect.stack()[1]
1890@@ -955,10 +988,10 @@ class ConfigureSandbox(dict):
1891 if not inspect.isfunction(func):
1892 raise TypeError("Unexpected type: '%s'" % type(func).__name__)
1893 if func in self._prepared_functions:
1894- return func, func.func_globals
1895+ return func, func.__globals__
1896
1897 glob = SandboxedGlobal(
1898- (k, v) for k, v in func.func_globals.iteritems()
1899+ (k, v) for k, v in func.__globals__.items()
1900 if (inspect.isfunction(v) and v not in self._templates) or (
1901 inspect.isclass(v) and issubclass(v, Exception))
1902 )
1903@@ -979,20 +1012,20 @@ class ConfigureSandbox(dict):
1904 # Note this is not entirely bullet proof (if the value is e.g. a list,
1905 # the list contents could have changed), but covers the bases.
1906 closure = None
1907- if func.func_closure:
1908+ if func.__closure__:
1909 def makecell(content):
1910 def f():
1911 content
1912- return f.func_closure[0]
1913+ return f.__closure__[0]
1914
1915 closure = tuple(makecell(cell.cell_contents)
1916- for cell in func.func_closure)
1917+ for cell in func.__closure__)
1918
1919 new_func = self.wraps(func)(types.FunctionType(
1920- func.func_code,
1921+ func.__code__,
1922 glob,
1923 func.__name__,
1924- func.func_defaults,
1925+ func.__defaults__,
1926 closure
1927 ))
1928 @self.wraps(new_func)
1929diff --git a/python/mozbuild/mozbuild/configure/check_debug_ranges.py b/python/mozbuild/mozbuild/configure/check_debug_ranges.py
1930index c0caa9cc5..a3e1f37e1 100644
1931--- a/python/mozbuild/mozbuild/configure/check_debug_ranges.py
1932+++ b/python/mozbuild/mozbuild/configure/check_debug_ranges.py
1933@@ -6,7 +6,7 @@
1934 # to a given compilation unit. This is used as a helper to find a bug in some
1935 # versions of GNU ld.
1936
1937-from __future__ import absolute_import
1938+
1939
1940 import subprocess
1941 import sys
1942@@ -45,6 +45,8 @@ def get_range_length(range, debug_ranges):
1943 def main(bin, compilation_unit):
1944 p = subprocess.Popen(['objdump', '-W', bin], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
1945 (out, err) = p.communicate()
1946+ if isinstance(out, bytes):
1947+ out = out.decode('utf-8')
1948 sections = re.split('\n(Contents of the|The section) ', out)
1949 debug_info = [s for s in sections if s.startswith('.debug_info')]
1950 debug_ranges = [s for s in sections if s.startswith('.debug_ranges')]
1951@@ -59,4 +61,4 @@ def main(bin, compilation_unit):
1952
1953
1954 if __name__ == '__main__':
1955- print(main(*sys.argv[1:]))
1956+ print((main(*sys.argv[1:])))
1957diff --git a/python/mozbuild/mozbuild/configure/options.py b/python/mozbuild/mozbuild/configure/options.py
1958index 53ae2ae6d..4d80cad86 100644
1959--- a/python/mozbuild/mozbuild/configure/options.py
1960+++ b/python/mozbuild/mozbuild/configure/options.py
1961@@ -2,7 +2,7 @@
1962 # License, v. 2.0. If a copy of the MPL was not distributed with this
1963 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
1964
1965-from __future__ import absolute_import, print_function, unicode_literals
1966+
1967
1968 import os
1969 import sys
1970@@ -12,7 +12,7 @@ from collections import OrderedDict
1971
1972 def istupleofstrings(obj):
1973 return isinstance(obj, tuple) and len(obj) and all(
1974- isinstance(o, types.StringTypes) for o in obj)
1975+ isinstance(o, (str,)) for o in obj)
1976
1977
1978 class OptionValue(tuple):
1979@@ -88,7 +88,7 @@ class PositiveOptionValue(OptionValue):
1980 in the form of a tuple for when values are given to the option (in the form
1981 --option=value[,value2...].
1982 '''
1983- def __nonzero__(self):
1984+ def __bool__(self):
1985 return True
1986
1987
1988@@ -113,7 +113,7 @@ class ConflictingOptionError(InvalidOptionError):
1989 if format_data:
1990 message = message.format(**format_data)
1991 super(ConflictingOptionError, self).__init__(message)
1992- for k, v in format_data.iteritems():
1993+ for k, v in format_data.items():
1994 setattr(self, k, v)
1995
1996
1997@@ -149,7 +149,7 @@ class Option(object):
1998 'At least an option name or an environment variable name must '
1999 'be given')
2000 if name:
2001- if not isinstance(name, types.StringTypes):
2002+ if not isinstance(name, (str,)):
2003 raise InvalidOptionError('Option must be a string')
2004 if not name.startswith('--'):
2005 raise InvalidOptionError('Option must start with `--`')
2006@@ -158,7 +158,7 @@ class Option(object):
2007 if not name.islower():
2008 raise InvalidOptionError('Option must be all lowercase')
2009 if env:
2010- if not isinstance(env, types.StringTypes):
2011+ if not isinstance(env, (str,)):
2012 raise InvalidOptionError(
2013 'Environment variable name must be a string')
2014 if not env.isupper():
2015@@ -168,8 +168,8 @@ class Option(object):
2016 isinstance(nargs, int) and nargs >= 0):
2017 raise InvalidOptionError(
2018 "nargs must be a positive integer, '?', '*' or '+'")
2019- if (not isinstance(default, types.StringTypes) and
2020- not isinstance(default, (bool, types.NoneType)) and
2021+ if (not isinstance(default, (str,)) and
2022+ not isinstance(default, (bool, type(None))) and
2023 not istupleofstrings(default)):
2024 raise InvalidOptionError(
2025 'default must be a bool, a string or a tuple of strings')
2026@@ -241,7 +241,7 @@ class Option(object):
2027 ', '.join("'%s'" % c for c in choices))
2028 elif has_choices:
2029 maxargs = self.maxargs
2030- if len(choices) < maxargs and maxargs != sys.maxint:
2031+ if len(choices) < maxargs and maxargs != sys.maxsize:
2032 raise InvalidOptionError('Not enough `choices` for `nargs`')
2033 self.choices = choices
2034 self.help = help
2035@@ -255,7 +255,7 @@ class Option(object):
2036 where prefix is one of 'with', 'without', 'enable' or 'disable'.
2037 The '=values' part is optional. Values are separated with commas.
2038 '''
2039- if not isinstance(option, types.StringTypes):
2040+ if not isinstance(option, (str,)):
2041 raise InvalidOptionError('Option must be a string')
2042
2043 elements = option.split('=', 1)
2044@@ -308,7 +308,7 @@ class Option(object):
2045 def maxargs(self):
2046 if isinstance(self.nargs, int):
2047 return self.nargs
2048- return 1 if self.nargs == '?' else sys.maxint
2049+ return 1 if self.nargs == '?' else sys.maxsize
2050
2051 def _validate_nargs(self, num):
2052 minargs, maxargs = self.minargs, self.maxargs
2053@@ -499,5 +499,5 @@ class CommandLineHelper(object):
2054
2055 def __iter__(self):
2056 for d in (self._args, self._extra_args):
2057- for arg, pos in d.itervalues():
2058+ for arg, pos in d.values():
2059 yield arg
2060diff --git a/python/mozbuild/mozbuild/configure/util.py b/python/mozbuild/mozbuild/configure/util.py
2061index 9d8b2eb0e..a12986e48 100644
2062--- a/python/mozbuild/mozbuild/configure/util.py
2063+++ b/python/mozbuild/mozbuild/configure/util.py
2064@@ -77,15 +77,7 @@ class ConfigureOutputHandler(logging.Handler):
2065 # Python has this feature where it sets the encoding of pipes to
2066 # ascii, which blatantly fails when trying to print out non-ascii.
2067 def fix_encoding(fh):
2068- try:
2069- isatty = fh.isatty()
2070- except AttributeError:
2071- isatty = True
2072-
2073- if not isatty:
2074- encoding = getpreferredencoding()
2075- if encoding:
2076- return codecs.getwriter(encoding)(fh)
2077+ # no magic on oe / python3
2078 return fh
2079
2080 self._stdout = fix_encoding(stdout)
2081@@ -200,7 +192,7 @@ class LineIO(object):
2082 self._errors = errors
2083
2084 def write(self, buf):
2085- if self._encoding and isinstance(buf, str):
2086+ if self._encoding and isinstance(buf, bytes):
2087 buf = buf.decode(self._encoding, self._errors)
2088 lines = buf.splitlines()
2089 if not lines:
2090diff --git a/python/mozbuild/mozbuild/controller/building.py b/python/mozbuild/mozbuild/controller/building.py
2091index d5af532f7..e9810fe58 100644
2092--- a/python/mozbuild/mozbuild/controller/building.py
2093+++ b/python/mozbuild/mozbuild/controller/building.py
2094@@ -2,7 +2,7 @@
2095 # License, v. 2.0. If a copy of the MPL was not distributed with this
2096 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
2097
2098-from __future__ import absolute_import, unicode_literals
2099+
2100
2101 import errno
2102 import getpass
2103@@ -146,7 +146,7 @@ class TierStatus(object):
2104 """
2105 o = []
2106
2107- for tier, state in self.tiers.items():
2108+ for tier, state in list(self.tiers.items()):
2109 t_entry = dict(
2110 name=tier,
2111 start=state['begin_time'],
2112@@ -574,7 +574,7 @@ class BuildProgressFooter(Footer):
2113
2114 def __init__(self, terminal, monitor):
2115 Footer.__init__(self, terminal)
2116- self.tiers = monitor.tiers.tier_status.viewitems()
2117+ self.tiers = monitor.tiers.tier_status.items()
2118
2119 def draw(self):
2120 """Draws this footer in the terminal."""
2121@@ -911,8 +911,8 @@ class CCacheStats(object):
2122
2123 return '\n'.join(lines)
2124
2125- def __nonzero__(self):
2126- relative_values = [v for k, v in self._values.items()
2127+ def __bool__(self):
2128+ relative_values = [v for k, v in list(self._values.items())
2129 if k not in self.ABSOLUTE_KEYS]
2130 return (all(v >= 0 for v in relative_values) and
2131 any(v > 0 for v in relative_values))
2132@@ -1156,7 +1156,7 @@ class BuildDriver(MozbuildObject):
2133
2134 high_finder, finder_percent = monitor.have_high_finder_usage()
2135 if high_finder:
2136- print(FINDER_SLOW_MESSAGE % finder_percent)
2137+ print((FINDER_SLOW_MESSAGE % finder_percent))
2138
2139 ccache_end = monitor.ccache_stats()
2140
2141@@ -1276,8 +1276,8 @@ class BuildDriver(MozbuildObject):
2142 """Install test files."""
2143
2144 if self.is_clobber_needed():
2145- print(INSTALL_TESTS_CLOBBER.format(
2146- clobber_file=os.path.join(self.topobjdir, 'CLOBBER')))
2147+ print((INSTALL_TESTS_CLOBBER.format(
2148+ clobber_file=os.path.join(self.topobjdir, 'CLOBBER'))))
2149 sys.exit(1)
2150
2151 if not test_objs:
2152diff --git a/python/mozbuild/mozbuild/frontend/context.py b/python/mozbuild/mozbuild/frontend/context.py
2153index fbdbefc1d..1aef6a65a 100644
2154--- a/python/mozbuild/mozbuild/frontend/context.py
2155+++ b/python/mozbuild/mozbuild/frontend/context.py
2156@@ -14,7 +14,7 @@ If you are looking for the absolute authority on what moz.build files can
2157 contain, you've come to the right place.
2158 """
2159
2160-from __future__ import absolute_import, unicode_literals
2161+
2162
2163 import os
2164
2165@@ -237,15 +237,15 @@ class Context(KeyedDefaultDict):
2166 This function is transactional: if setitem fails for one of the values,
2167 the context is not updated at all."""
2168 if isinstance(iterable, dict):
2169- iterable = iterable.items()
2170+ iterable = list(iterable.items())
2171
2172 update = {}
2173- for key, value in itertools.chain(iterable, kwargs.items()):
2174+ for key, value in itertools.chain(iterable, list(kwargs.items())):
2175 stored_type = self._validate(key, value)
2176 # Don't create an instance of stored_type if coercion is needed,
2177 # until all values are validated.
2178 update[key] = (value, stored_type)
2179- for key, (value, stored_type) in update.items():
2180+ for key, (value, stored_type) in list(update.items()):
2181 if not isinstance(value, stored_type):
2182 update[key] = stored_type(value)
2183 else:
2184@@ -311,7 +311,7 @@ class BaseCompileFlags(ContextDerivedValue, dict):
2185 # a template were set and which were provided as defaults.
2186 template_name = getattr(context, 'template', None)
2187 if template_name in (None, 'Gyp'):
2188- dict.__init__(self, ((k, v if v is None else TypedList(unicode)(v))
2189+ dict.__init__(self, ((k, v if v is None else TypedList(str)(v))
2190 for k, v, _ in self.flag_variables))
2191 else:
2192 dict.__init__(self)
2193@@ -520,13 +520,13 @@ class CompileFlags(BaseCompileFlags):
2194 if key in self and self[key] is None:
2195 raise ValueError('`%s` may not be set in COMPILE_FLAGS from moz.build, this '
2196 'value is resolved from the emitter.' % key)
2197- if not (isinstance(value, list) and all(isinstance(v, basestring) for v in value)):
2198+ if not (isinstance(value, list) and all(isinstance(v, str) for v in value)):
2199 raise ValueError('A list of strings must be provided as a value for a '
2200 'compile flags category.')
2201 dict.__setitem__(self, key, value)
2202
2203
2204-class FinalTargetValue(ContextDerivedValue, unicode):
2205+class FinalTargetValue(ContextDerivedValue, str):
2206 def __new__(cls, context, value=""):
2207 if not value:
2208 value = 'dist/'
2209@@ -536,7 +536,7 @@ class FinalTargetValue(ContextDerivedValue, unicode):
2210 value += 'bin'
2211 if context['DIST_SUBDIR']:
2212 value += '/' + context['DIST_SUBDIR']
2213- return unicode.__new__(cls, value)
2214+ return str.__new__(cls, value)
2215
2216
2217 def Enum(*values):
2218@@ -584,7 +584,7 @@ class PathMeta(type):
2219 cls = SourcePath
2220 return super(PathMeta, cls).__call__(context, value)
2221
2222-class Path(ContextDerivedValue, unicode):
2223+class Path(ContextDerivedValue, str, metaclass=PathMeta):
2224 """Stores and resolves a source path relative to a given context
2225
2226 This class is used as a backing type for some of the sandbox variables.
2227@@ -595,7 +595,6 @@ class Path(ContextDerivedValue, unicode):
2228 - '!objdir/relative/paths'
2229 - '%/filesystem/absolute/paths'
2230 """
2231- __metaclass__ = PathMeta
2232
2233 def __new__(cls, context, value=None):
2234 return super(Path, cls).__new__(cls, value)
2235@@ -612,10 +611,14 @@ class Path(ContextDerivedValue, unicode):
2236 """
2237 return Path(self.context, mozpath.join(self, *p))
2238
2239+ @staticmethod
2240+ def cmp(a, b):
2241+ return (a > b) - (a < b)
2242+
2243 def __cmp__(self, other):
2244 if isinstance(other, Path) and self.srcdir != other.srcdir:
2245- return cmp(self.full_path, other.full_path)
2246- return cmp(unicode(self), other)
2247+ return self.cmp(self.full_path, other.full_path)
2248+ return self.cmp(str(self), other)
2249
2250 # __cmp__ is not enough because unicode has __eq__, __ne__, etc. defined
2251 # and __cmp__ is only used for those when they don't exist.
2252@@ -773,7 +776,7 @@ def ContextDerivedTypedRecord(*fields):
2253 __slots__ = tuple([name for name, _ in fields])
2254
2255 def __init__(self, context):
2256- for fname, ftype in self._fields.items():
2257+ for fname, ftype in list(self._fields.items()):
2258 if issubclass(ftype, ContextDerivedValue):
2259 setattr(self, fname, self._fields[fname](context))
2260 else:
2261@@ -909,8 +912,8 @@ def TypedListWithAction(typ, action):
2262 return _TypedListWithAction
2263
2264 WebPlatformTestManifest = TypedNamedTuple("WebPlatformTestManifest",
2265- [("manifest_path", unicode),
2266- ("test_root", unicode)])
2267+ [("manifest_path", str),
2268+ ("test_root", str)])
2269 ManifestparserManifestList = OrderedPathListWithAction(read_manifestparser_manifest)
2270 ReftestManifestList = OrderedPathListWithAction(read_reftest_manifest)
2271 WptManifestList = TypedListWithAction(WebPlatformTestManifest, read_wpt_manifest)
2272@@ -918,18 +921,18 @@ WptManifestList = TypedListWithAction(WebPlatformTestManifest, read_wpt_manifest
2273 OrderedSourceList = ContextDerivedTypedList(SourcePath, StrictOrderingOnAppendList)
2274 OrderedTestFlavorList = TypedList(Enum(*all_test_flavors()),
2275 StrictOrderingOnAppendList)
2276-OrderedStringList = TypedList(unicode, StrictOrderingOnAppendList)
2277+OrderedStringList = TypedList(str, StrictOrderingOnAppendList)
2278 DependentTestsEntry = ContextDerivedTypedRecord(('files', OrderedSourceList),
2279 ('tags', OrderedStringList),
2280 ('flavors', OrderedTestFlavorList))
2281 BugzillaComponent = TypedNamedTuple('BugzillaComponent',
2282- [('product', unicode), ('component', unicode)])
2283+ [('product', str), ('component', str)])
2284 SchedulingComponents = ContextDerivedTypedRecord(
2285- ('inclusive', TypedList(unicode, StrictOrderingOnAppendList)),
2286- ('exclusive', TypedList(unicode, StrictOrderingOnAppendList)))
2287+ ('inclusive', TypedList(str, StrictOrderingOnAppendList)),
2288+ ('exclusive', TypedList(str, StrictOrderingOnAppendList)))
2289
2290 GeneratedFilesList = StrictOrderingOnAppendListWithFlagsFactory({
2291- 'script': unicode,
2292+ 'script': str,
2293 'inputs': list,
2294 'flags': list, })
2295
2296@@ -1096,7 +1099,7 @@ class Files(SubContext):
2297 self.test_tags |= other.test_tags
2298 self.test_flavors |= other.test_flavors
2299
2300- for k, v in other.items():
2301+ for k, v in list(other.items()):
2302 if k == 'IMPACTED_TESTS':
2303 self.test_files |= set(mozpath.relpath(e.full_path, e.context.config.topsrcdir)
2304 for e in v.files)
2305@@ -1154,7 +1157,7 @@ class Files(SubContext):
2306
2307 bug_components = Counter()
2308
2309- for f in files.values():
2310+ for f in list(files.values()):
2311 bug_component = f.get('BUG_COMPONENT')
2312 if bug_component:
2313 bug_components[bug_component] += 1
2314@@ -1232,7 +1235,7 @@ VARIABLES = {
2315 RustLibrary template instead.
2316 """),
2317
2318- 'RUST_LIBRARY_TARGET_DIR': (unicode, unicode,
2319+ 'RUST_LIBRARY_TARGET_DIR': (str, str,
2320 """Where CARGO_TARGET_DIR should point when compiling this library. If
2321 not set, it defaults to the current objdir. It should be a relative path
2322 to the current objdir; absolute paths should not be used.
2323@@ -1248,7 +1251,7 @@ VARIABLES = {
2324 HostRustLibrary template instead.
2325 """),
2326
2327- 'RUST_TEST': (unicode, unicode,
2328+ 'RUST_TEST': (str, str,
2329 """Name of a Rust test to build and run via `cargo test`.
2330
2331 This variable should not be used directly; you should be using the
2332@@ -1487,7 +1490,7 @@ VARIABLES = {
2333 """Like ``OBJDIR_FILES``, with preprocessing. Use sparingly.
2334 """),
2335
2336- 'FINAL_LIBRARY': (unicode, unicode,
2337+ 'FINAL_LIBRARY': (str, str,
2338 """Library in which the objects of the current directory will be linked.
2339
2340 This variable contains the name of a library, defined elsewhere with
2341@@ -1528,7 +1531,7 @@ VARIABLES = {
2342 with the host compiler.
2343 """),
2344
2345- 'HOST_LIBRARY_NAME': (unicode, unicode,
2346+ 'HOST_LIBRARY_NAME': (str, str,
2347 """Name of target library generated when cross compiling.
2348 """),
2349
2350@@ -1546,7 +1549,7 @@ VARIABLES = {
2351 libraries that link into this library via FINAL_LIBRARY.
2352 """),
2353
2354- 'LIBRARY_NAME': (unicode, unicode,
2355+ 'LIBRARY_NAME': (str, str,
2356 """The code name of the library generated for a directory.
2357
2358 By default STATIC_LIBRARY_NAME and SHARED_LIBRARY_NAME take this name.
2359@@ -1558,7 +1561,7 @@ VARIABLES = {
2360 ``example/components/xpcomsample.lib`` on Windows.
2361 """),
2362
2363- 'SHARED_LIBRARY_NAME': (unicode, unicode,
2364+ 'SHARED_LIBRARY_NAME': (str, str,
2365 """The name of the static library generated for a directory, if it needs to
2366 differ from the library code name.
2367
2368@@ -1572,7 +1575,7 @@ VARIABLES = {
2369 Implies FORCE_SHARED_LIB.
2370 """),
2371
2372- 'STATIC_LIBRARY_NAME': (unicode, unicode,
2373+ 'STATIC_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@@ -1604,31 +1607,31 @@ VARIABLES = {
2378
2379 This variable contains a list of system libaries to link against.
2380 """),
2381- 'RCFILE': (unicode, unicode,
2382+ 'RCFILE': (str, str,
2383 """The program .rc file.
2384
2385 This variable can only be used on Windows.
2386 """),
2387
2388- 'RESFILE': (unicode, unicode,
2389+ 'RESFILE': (str, str,
2390 """The program .res file.
2391
2392 This variable can only be used on Windows.
2393 """),
2394
2395- 'RCINCLUDE': (unicode, unicode,
2396+ 'RCINCLUDE': (str, str,
2397 """The resource script file to be included in the default .res file.
2398
2399 This variable can only be used on Windows.
2400 """),
2401
2402- 'DEFFILE': (unicode, unicode,
2403+ 'DEFFILE': (str, str,
2404 """The program .def (module definition) file.
2405
2406 This variable can only be used on Windows.
2407 """),
2408
2409- 'SYMBOLS_FILE': (Path, unicode,
2410+ 'SYMBOLS_FILE': (Path, str,
2411 """A file containing a list of symbols to export from a shared library.
2412
2413 The given file contains a list of symbols to be exported, and is
2414@@ -1649,7 +1652,7 @@ VARIABLES = {
2415 ``BIN_SUFFIX``, the name will remain unchanged.
2416 """),
2417
2418- 'SONAME': (unicode, unicode,
2419+ 'SONAME': (str, str,
2420 """The soname of the shared object currently being linked
2421
2422 soname is the "logical name" of a shared object, often used to provide
2423@@ -1719,7 +1722,7 @@ VARIABLES = {
2424 ``GENERATED_FILES``.
2425 """),
2426
2427- 'PROGRAM' : (unicode, unicode,
2428+ 'PROGRAM' : (str, str,
2429 """Compiled executable name.
2430
2431 If the configuration token ``BIN_SUFFIX`` is set, its value will be
2432@@ -1727,7 +1730,7 @@ VARIABLES = {
2433 ``BIN_SUFFIX``, ``PROGRAM`` will remain unchanged.
2434 """),
2435
2436- 'HOST_PROGRAM' : (unicode, unicode,
2437+ 'HOST_PROGRAM' : (str, str,
2438 """Compiled host executable name.
2439
2440 If the configuration token ``HOST_BIN_SUFFIX`` is set, its value will be
2441@@ -1765,7 +1768,7 @@ VARIABLES = {
2442 files.
2443 """),
2444
2445- 'XPIDL_MODULE': (unicode, unicode,
2446+ 'XPIDL_MODULE': (str, str,
2447 """XPCOM Interface Definition Module Name.
2448
2449 This is the name of the ``.xpt`` file that is created by linking
2450@@ -1924,14 +1927,14 @@ VARIABLES = {
2451
2452
2453 # The following variables are used to control the target of installed files.
2454- 'XPI_NAME': (unicode, unicode,
2455+ 'XPI_NAME': (str, str,
2456 """The name of an extension XPI to generate.
2457
2458 When this variable is present, the results of this directory will end up
2459 being packaged into an extension instead of the main dist/bin results.
2460 """),
2461
2462- 'DIST_SUBDIR': (unicode, unicode,
2463+ 'DIST_SUBDIR': (str, str,
2464 """The name of an alternate directory to install files to.
2465
2466 When this variable is present, the results of this directory will end up
2467@@ -1939,7 +1942,7 @@ VARIABLES = {
2468 otherwise be placed.
2469 """),
2470
2471- 'FINAL_TARGET': (FinalTargetValue, unicode,
2472+ 'FINAL_TARGET': (FinalTargetValue, str,
2473 """The name of the directory to install targets to.
2474
2475 The directory is relative to the top of the object directory. The
2476@@ -1970,7 +1973,7 @@ VARIABLES = {
2477
2478 'GYP_DIRS': (StrictOrderingOnAppendListWithFlagsFactory({
2479 'variables': dict,
2480- 'input': unicode,
2481+ 'input': str,
2482 'sandbox_vars': dict,
2483 'no_chromium': bool,
2484 'no_unified': bool,
2485@@ -2194,7 +2197,7 @@ VARIABLES = {
2486 }
2487
2488 # Sanity check: we don't want any variable above to have a list as storage type.
2489-for name, (storage_type, input_types, docs) in VARIABLES.items():
2490+for name, (storage_type, input_types, docs) in list(VARIABLES.items()):
2491 if storage_type == list:
2492 raise RuntimeError('%s has a "list" storage type. Use "List" instead.'
2493 % name)
2494diff --git a/python/mozbuild/mozbuild/frontend/data.py b/python/mozbuild/mozbuild/frontend/data.py
2495index 442fc9e0a..837453a9f 100644
2496--- a/python/mozbuild/mozbuild/frontend/data.py
2497+++ b/python/mozbuild/mozbuild/frontend/data.py
2498@@ -15,7 +15,7 @@ contains the code for converting executed mozbuild files into these data
2499 structures.
2500 """
2501
2502-from __future__ import absolute_import, unicode_literals
2503+
2504
2505 from mozbuild.util import StrictOrderingOnAppendList
2506 from mozpack.chrome.manifest import ManifestEntry
2507@@ -182,7 +182,7 @@ class ComputedFlags(ContextDerived):
2508 if value:
2509 for dest_var in dest_vars:
2510 flags[dest_var].extend(value)
2511- return flags.items()
2512+ return list(flags.items())
2513
2514 class XPIDLFile(ContextDerived):
2515 """Describes an XPIDL file to be compiled."""
2516@@ -213,7 +213,7 @@ class BaseDefines(ContextDerived):
2517 self.defines = defines
2518
2519 def get_defines(self):
2520- for define, value in self.defines.iteritems():
2521+ for define, value in self.defines.items():
2522 if value is True:
2523 yield('-D%s' % define)
2524 elif value is False:
2525@@ -494,7 +494,7 @@ class SimpleProgram(BaseProgram):
2526 KIND = 'target'
2527
2528 def source_files(self):
2529- for srcs in self.sources.values():
2530+ for srcs in list(self.sources.values()):
2531 for f in srcs:
2532 if mozpath.basename(mozpath.splitext(f)[0]) == mozpath.splitext(self.program)[0]:
2533 return [f]
2534diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py
2535index 642b381c0..c28344a75 100644
2536--- a/python/mozbuild/mozbuild/frontend/emitter.py
2537+++ b/python/mozbuild/mozbuild/frontend/emitter.py
2538@@ -2,7 +2,7 @@
2539 # License, v. 2.0. If a copy of the MPL was not distributed with this
2540 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
2541
2542-from __future__ import absolute_import, unicode_literals
2543+
2544
2545 import itertools
2546 import logging
2547@@ -116,8 +116,8 @@ class TreeMetadataEmitter(LoggingMixin):
2548 # arguments. This gross hack works around the problem until we
2549 # rid ourselves of 2.6.
2550 self.info = {}
2551- for k, v in mozinfo.info.items():
2552- if isinstance(k, unicode):
2553+ for k, v in list(mozinfo.info.items()):
2554+ if isinstance(k, str):
2555 k = k.encode('ascii')
2556 self.info[k] = v
2557
2558@@ -234,7 +234,7 @@ class TreeMetadataEmitter(LoggingMixin):
2559
2560
2561 # Next do FINAL_LIBRARY linkage.
2562- for lib in (l for libs in self._libs.values() for l in libs):
2563+ for lib in (l for libs in list(self._libs.values()) for l in libs):
2564 if not isinstance(lib, (StaticLibrary, RustLibrary)) or not lib.link_into:
2565 continue
2566 if lib.link_into not in self._libs:
2567@@ -294,13 +294,13 @@ class TreeMetadataEmitter(LoggingMixin):
2568 lib.link_into == outerlib.basename):
2569 propagate_defines(lib, defines)
2570
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 isinstance(lib, Library):
2574 propagate_defines(lib, lib.lib_defines)
2575 yield lib
2576
2577
2578- for lib in (l for libs in self._libs.values() for l in libs):
2579+ for lib in (l for libs in list(self._libs.values()) for l in libs):
2580 lib_defines = list(lib.lib_defines.get_defines())
2581 if lib_defines:
2582 objdir_flags = self._compile_flags[lib.objdir]
2583@@ -310,13 +310,13 @@ class TreeMetadataEmitter(LoggingMixin):
2584 if objdir_flags:
2585 objdir_flags.resolve_flags('LIBRARY_DEFINES', lib_defines)
2586
2587- for flags_obj in self._compile_flags.values():
2588+ for flags_obj in list(self._compile_flags.values()):
2589 yield flags_obj
2590
2591- for flags_obj in self._compile_as_flags.values():
2592+ for flags_obj in list(self._compile_as_flags.values()):
2593 yield flags_obj
2594
2595- for obj in self._binaries.values():
2596+ for obj in list(self._binaries.values()):
2597 yield obj
2598
2599
2600@@ -409,7 +409,7 @@ class TreeMetadataEmitter(LoggingMixin):
2601 libs[key] = l
2602 if key not in libs:
2603 libs[key] = l
2604- candidates = libs.values()
2605+ candidates = list(libs.values())
2606 if force_static and not candidates:
2607 if dir:
2608 raise SandboxValidationError(
2609@@ -473,9 +473,9 @@ class TreeMetadataEmitter(LoggingMixin):
2610
2611 def _verify_deps(self, context, crate_dir, crate_name, dependencies, description='Dependency'):
2612 """Verify that a crate's dependencies all specify local paths."""
2613- for dep_crate_name, values in dependencies.iteritems():
2614+ for dep_crate_name, values in dependencies.items():
2615 # A simple version number.
2616- if isinstance(values, (str, unicode)):
2617+ if isinstance(values, str):
2618 raise SandboxValidationError(
2619 '%s %s of crate %s does not list a path' % (description, dep_crate_name, crate_name),
2620 context)
2621@@ -529,7 +529,7 @@ class TreeMetadataEmitter(LoggingMixin):
2622
2623 cargo_target_dir = context.get('RUST_LIBRARY_TARGET_DIR', '.')
2624
2625- dependencies = set(config.get('dependencies', {}).iterkeys())
2626+ dependencies = set(config.get('dependencies', {}).keys())
2627
2628 features = context.get(cls.FEATURES_VAR, [])
2629 unique_features = set(features)
2630@@ -863,7 +863,7 @@ class TreeMetadataEmitter(LoggingMixin):
2631 assert not gen_sources['UNIFIED_SOURCES']
2632
2633 no_pgo = context.get('NO_PGO')
2634- no_pgo_sources = [f for f, flags in all_flags.iteritems()
2635+ no_pgo_sources = [f for f, flags in all_flags.items()
2636 if flags.no_pgo]
2637 if no_pgo:
2638 if no_pgo_sources:
2639@@ -890,7 +890,7 @@ class TreeMetadataEmitter(LoggingMixin):
2640
2641 # The inverse of the above, mapping suffixes to their canonical suffix.
2642 canonicalized_suffix_map = {}
2643- for suffix, alternatives in suffix_map.iteritems():
2644+ for suffix, alternatives in suffix_map.items():
2645 alternatives.add(suffix)
2646 for a in alternatives:
2647 canonicalized_suffix_map[a] = suffix
2648@@ -914,7 +914,7 @@ class TreeMetadataEmitter(LoggingMixin):
2649 # Source files to track for linkables associated with this context.
2650 ctxt_sources = defaultdict(lambda: defaultdict(list))
2651
2652- for variable, (klass, gen_klass, suffixes) in varmap.items():
2653+ for variable, (klass, gen_klass, suffixes) in list(varmap.items()):
2654 allowed_suffixes = set().union(*[suffix_map[s] for s in suffixes])
2655
2656 # First ensure that we haven't been given filetypes that we don't
2657@@ -941,20 +941,20 @@ class TreeMetadataEmitter(LoggingMixin):
2658 obj = cls(*arglist)
2659 srcs = obj.files
2660 if isinstance(obj, UnifiedSources) and obj.have_unified_mapping:
2661- srcs = dict(obj.unified_source_mapping).keys()
2662+ srcs = list(dict(obj.unified_source_mapping).keys())
2663 ctxt_sources[variable][canonical_suffix] += sorted(srcs)
2664 yield obj
2665
2666 if ctxt_sources:
2667 for linkable in linkables:
2668 for target_var in ('SOURCES', 'UNIFIED_SOURCES'):
2669- for suffix, srcs in ctxt_sources[target_var].items():
2670+ for suffix, srcs in list(ctxt_sources[target_var].items()):
2671 linkable.sources[suffix] += srcs
2672 for host_linkable in host_linkables:
2673- for suffix, srcs in ctxt_sources['HOST_SOURCES'].items():
2674+ for suffix, srcs in list(ctxt_sources['HOST_SOURCES'].items()):
2675 host_linkable.sources[suffix] += srcs
2676
2677- for f, flags in all_flags.iteritems():
2678+ for f, flags in all_flags.items():
2679 if flags.flags:
2680 ext = mozpath.splitext(f)[1]
2681 yield PerSourceFlag(context, f, flags.flags)
2682@@ -1143,7 +1143,7 @@ class TreeMetadataEmitter(LoggingMixin):
2683 for obj in self._handle_linkables(context, passthru, generated_files):
2684 yield obj
2685
2686- generated_files.update(['%s%s' % (k, self.config.substs.get('BIN_SUFFIX', '')) for k in self._binaries.keys()])
2687+ generated_files.update(['%s%s' % (k, self.config.substs.get('BIN_SUFFIX', '')) for k in list(self._binaries.keys())])
2688
2689 components = []
2690 for var, cls in (
2691@@ -1277,7 +1277,7 @@ class TreeMetadataEmitter(LoggingMixin):
2692 for obj in self._process_jar_manifests(context):
2693 yield obj
2694
2695- for name, jar in context.get('JAVA_JAR_TARGETS', {}).items():
2696+ for name, jar in list(context.get('JAVA_JAR_TARGETS', {}).items()):
2697 yield ContextWrapped(context, jar)
2698
2699 computed_as_flags.resolve_flags('MOZBUILD',
2700@@ -1346,7 +1346,7 @@ class TreeMetadataEmitter(LoggingMixin):
2701 script = mozpath.join(mozpath.dirname(mozpath.dirname(__file__)),
2702 'action', 'process_define_files.py')
2703 yield GeneratedFile(context, script, 'process_define_file',
2704- unicode(path),
2705+ str(path),
2706 [Path(context, path + '.in')])
2707
2708 generated_files = context.get('GENERATED_FILES') or []
2709@@ -1393,7 +1393,7 @@ class TreeMetadataEmitter(LoggingMixin):
2710 flags.flags, localized=localized)
2711
2712 def _process_test_manifests(self, context):
2713- for prefix, info in TEST_MANIFESTS.items():
2714+ for prefix, info in list(TEST_MANIFESTS.items()):
2715 for path, manifest in context.get('%s_MANIFESTS' % prefix, []):
2716 for obj in self._process_test_manifest(context, info, path, manifest):
2717 yield obj
2718@@ -1479,7 +1479,7 @@ class TreeMetadataEmitter(LoggingMixin):
2719
2720 process_support_files(test)
2721
2722- for path, m_defaults in mpmanifest.manifest_defaults.items():
2723+ for path, m_defaults in list(mpmanifest.manifest_defaults.items()):
2724 process_support_files(m_defaults)
2725
2726 # We also copy manifests into the output directory,
2727diff --git a/python/mozbuild/mozbuild/frontend/reader.py b/python/mozbuild/mozbuild/frontend/reader.py
2728index c1efc1c3d..0cdf8b8db 100644
2729--- a/python/mozbuild/mozbuild/frontend/reader.py
2730+++ b/python/mozbuild/mozbuild/frontend/reader.py
2731@@ -16,7 +16,7 @@ The BuildReader contains basic logic for traversing a tree of mozbuild files.
2732 It does this by examining specific variables populated during execution.
2733 """
2734
2735-from __future__ import absolute_import, print_function, unicode_literals
2736+
2737
2738 import ast
2739 import inspect
2740@@ -81,12 +81,13 @@ from .context import (
2741
2742 from mozbuild.base import ExecutionSummary
2743 from concurrent.futures.process import ProcessPoolExecutor
2744+from functools import reduce
2745
2746
2747
2748 if sys.version_info.major == 2:
2749- text_type = unicode
2750- type_type = types.TypeType
2751+ text_type = str
2752+ type_type = type
2753 else:
2754 text_type = str
2755 type_type = type
2756@@ -127,7 +128,7 @@ class EmptyConfig(object):
2757
2758 self.substs = self.PopulateOnGetDict(EmptyValue, substs or self.default_substs)
2759 udict = {}
2760- for k, v in self.substs.items():
2761+ for k, v in list(self.substs.items()):
2762 if isinstance(v, str):
2763 udict[k.decode('utf-8')] = v.decode('utf-8')
2764 else:
2765@@ -311,7 +312,7 @@ class MozbuildSandbox(Sandbox):
2766 raise Exception('`template` is a function decorator. You must '
2767 'use it as `@template` preceding a function declaration.')
2768
2769- name = func.func_name
2770+ name = func.__name__
2771
2772 if name in self.templates:
2773 raise KeyError(
2774@@ -390,7 +391,7 @@ class MozbuildSandbox(Sandbox):
2775 klass = self._context.__class__
2776 self._context.__class__ = TemplateContext
2777 # The sandbox will do all the necessary checks for these merges.
2778- for key, value in context.items():
2779+ for key, value in list(context.items()):
2780 if isinstance(value, dict):
2781 self[key].update(value)
2782 elif isinstance(value, (list, HierarchicalStringList)):
2783@@ -407,12 +408,14 @@ class MozbuildSandbox(Sandbox):
2784
2785 class TemplateFunction(object):
2786 def __init__(self, func, sandbox):
2787- self.path = func.func_code.co_filename
2788- self.name = func.func_name
2789+ self.path = func.__code__.co_filename
2790+ self.name = func.__name__
2791
2792- code = func.func_code
2793+ code = func.__code__
2794 firstlineno = code.co_firstlineno
2795 lines = sandbox._current_source.splitlines(True)
2796+ if len(lines) and isinstance(lines[0], bytes):
2797+ lines = [l.decode('utf-8') for l in lines]
2798 lines = inspect.getblock(lines[firstlineno - 1:])
2799
2800 # The code lines we get out of inspect.getsourcelines look like
2801@@ -430,7 +433,7 @@ class TemplateFunction(object):
2802 # actually never calls __getitem__ and __setitem__, so we need to
2803 # modify the AST so that accesses to globals are properly directed
2804 # to a dict.
2805- self._global_name = b'_data' # AST wants str for this, not unicode
2806+ self._global_name = '_data'
2807 # In case '_data' is a name used for a variable in the function code,
2808 # prepend more underscores until we find an unused name.
2809 while (self._global_name in code.co_names or
2810@@ -449,8 +452,8 @@ class TemplateFunction(object):
2811 compile(func_ast, self.path, 'exec'),
2812 glob,
2813 self.name,
2814- func.func_defaults,
2815- func.func_closure,
2816+ func.__defaults__,
2817+ func.__closure__,
2818 )
2819 func()
2820
2821@@ -464,11 +467,11 @@ class TemplateFunction(object):
2822 '__builtins__': sandbox._builtins
2823 }
2824 func = types.FunctionType(
2825- self._func.func_code,
2826+ self._func.__code__,
2827 glob,
2828 self.name,
2829- self._func.func_defaults,
2830- self._func.func_closure
2831+ self._func.__defaults__,
2832+ self._func.__closure__
2833 )
2834 sandbox.exec_function(func, args, kwargs, self.path,
2835 becomes_current_path=False)
2836@@ -484,7 +487,7 @@ class TemplateFunction(object):
2837 def visit_Str(self, node):
2838 # String nodes we got from the AST parser are str, but we want
2839 # unicode literals everywhere, so transform them.
2840- node.s = unicode(node.s)
2841+ node.s = str(node.s)
2842 return node
2843
2844 def visit_Name(self, node):
2845@@ -617,7 +620,7 @@ class BuildReaderError(Exception):
2846
2847 for l in traceback.format_exception(type(self.other), self.other,
2848 self.trace):
2849- s.write(unicode(l))
2850+ s.write(str(l))
2851
2852 return s.getvalue()
2853
2854@@ -767,7 +770,7 @@ class BuildReaderError(Exception):
2855 s.write(' %s\n' % inner.args[2])
2856 s.write('\n')
2857 close_matches = difflib.get_close_matches(inner.args[2],
2858- VARIABLES.keys(), 2)
2859+ list(VARIABLES.keys()), 2)
2860 if close_matches:
2861 s.write('Maybe you meant %s?\n' % ' or '.join(close_matches))
2862 s.write('\n')
2863@@ -1152,7 +1155,7 @@ class BuildReader(object):
2864 context)
2865 non_unified_sources.add(source)
2866 action_overrides = {}
2867- for action, script in gyp_dir.action_overrides.iteritems():
2868+ for action, script in gyp_dir.action_overrides.items():
2869 action_overrides[action] = SourcePath(context, script)
2870
2871 gyp_processor = GypProcessor(context.config,
2872@@ -1188,7 +1191,7 @@ class BuildReader(object):
2873
2874 recurse_info[d][key] = dict(sandbox.metadata[key])
2875
2876- for path, child_metadata in recurse_info.items():
2877+ for path, child_metadata in list(recurse_info.items()):
2878 child_path = path.join('moz.build').full_path
2879
2880 # Ensure we don't break out of the topsrcdir. We don't do realpath
2881@@ -1279,7 +1282,7 @@ class BuildReader(object):
2882 # There is room to improve this code (and the code in
2883 # _find_relevant_mozbuilds) to better handle multiple files in the same
2884 # directory. Bug 1136966 tracks.
2885- for path, mbpaths in relevants.items():
2886+ for path, mbpaths in list(relevants.items()):
2887 path_mozbuilds[path] = [mozpath.join(topsrcdir, p) for p in mbpaths]
2888
2889 for i, mbpath in enumerate(mbpaths[0:-1]):
2890@@ -1316,7 +1319,7 @@ class BuildReader(object):
2891 all_contexts.append(context)
2892
2893 result = {}
2894- for path, paths in path_mozbuilds.items():
2895+ for path, paths in list(path_mozbuilds.items()):
2896 result[path] = reduce(lambda x, y: x + y, (contexts[p] for p in paths), [])
2897
2898 return result, all_contexts
2899@@ -1356,7 +1359,7 @@ class BuildReader(object):
2900
2901 r = {}
2902
2903- for path, ctxs in paths.items():
2904+ for path, ctxs in list(paths.items()):
2905 # Should be normalized by read_relevant_mozbuilds.
2906 assert '\\' not in path
2907
2908diff --git a/python/mozbuild/mozbuild/frontend/sandbox.py b/python/mozbuild/mozbuild/frontend/sandbox.py
2909index b2090802e..6d94291ea 100644
2910--- a/python/mozbuild/mozbuild/frontend/sandbox.py
2911+++ b/python/mozbuild/mozbuild/frontend/sandbox.py
2912@@ -17,7 +17,7 @@ KeyError are machine parseable. This machine-friendly data is used to present
2913 user-friendly error messages in the case of errors.
2914 """
2915
2916-from __future__ import absolute_import, unicode_literals
2917+
2918
2919 import os
2920 import sys
2921@@ -112,6 +112,7 @@ class Sandbox(dict):
2922 'int': int,
2923 'set': set,
2924 'tuple': tuple,
2925+ 'str': str,
2926 })
2927
2928 def __init__(self, context, finder=default_finder):
2929diff --git a/python/mozbuild/mozbuild/jar.py b/python/mozbuild/mozbuild/jar.py
2930index 47a2eff63..96aea63ce 100644
2931--- a/python/mozbuild/mozbuild/jar.py
2932+++ b/python/mozbuild/mozbuild/jar.py
2933@@ -8,7 +8,7 @@ processing jar.mn files.
2934 See the documentation for jar.mn on MDC for further details on the format.
2935 '''
2936
2937-from __future__ import absolute_import
2938+
2939
2940 import sys
2941 import os
2942@@ -17,7 +17,7 @@ import re
2943 import logging
2944 from time import localtime
2945 from MozZipFile import ZipFile
2946-from cStringIO import StringIO
2947+from io import StringIO
2948 from collections import defaultdict
2949
2950 from mozbuild.preprocessor import Preprocessor
2951@@ -302,9 +302,9 @@ class JarMaker(object):
2952 '''updateManifest replaces the % in the chrome registration entries
2953 with the given chrome base path, and updates the given manifest file.
2954 '''
2955- myregister = dict.fromkeys(map(lambda s: s.replace('%',
2956- chromebasepath), register))
2957- addEntriesToListFile(manifestPath, myregister.iterkeys())
2958+ myregister = dict.fromkeys([s.replace('%',
2959+ chromebasepath) for s in register])
2960+ addEntriesToListFile(manifestPath, iter(myregister.keys()))
2961
2962 def makeJar(self, infile, jardir):
2963 '''makeJar is the main entry point to JarMaker.
2964@@ -322,7 +322,7 @@ class JarMaker(object):
2965 elif self.relativesrcdir:
2966 self.localedirs = \
2967 self.generateLocaleDirs(self.relativesrcdir)
2968- if isinstance(infile, basestring):
2969+ if isinstance(infile, str):
2970 logging.info('processing ' + infile)
2971 self.sourcedirs.append(_normpath(os.path.dirname(infile)))
2972 pp = self.pp.clone()
2973diff --git a/python/mozbuild/mozbuild/makeutil.py b/python/mozbuild/mozbuild/makeutil.py
2974index fcd45bed2..f77c5d2c3 100644
2975--- a/python/mozbuild/mozbuild/makeutil.py
2976+++ b/python/mozbuild/mozbuild/makeutil.py
2977@@ -2,11 +2,10 @@
2978 # License, v. 2.0. If a copy of the MPL was not distributed with this
2979 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
2980
2981-from __future__ import absolute_import
2982+
2983
2984 import os
2985 import re
2986-from types import StringTypes
2987 from collections import Iterable
2988
2989
2990@@ -66,7 +65,7 @@ class _SimpleOrderedSet(object):
2991 self._list = []
2992 self._set = set()
2993
2994- def __nonzero__(self):
2995+ def __bool__(self):
2996 return bool(self._set)
2997
2998 def __iter__(self):
2999@@ -103,19 +102,19 @@ class Rule(object):
3000
3001 def add_targets(self, targets):
3002 '''Add additional targets to the rule.'''
3003- assert isinstance(targets, Iterable) and not isinstance(targets, StringTypes)
3004+ assert isinstance(targets, Iterable) and not isinstance(targets, str)
3005 self._targets.update(targets)
3006 return self
3007
3008 def add_dependencies(self, deps):
3009 '''Add dependencies to the rule.'''
3010- assert isinstance(deps, Iterable) and not isinstance(deps, StringTypes)
3011+ assert isinstance(deps, Iterable) and not isinstance(deps, str)
3012 self._dependencies.update(deps)
3013 return self
3014
3015 def add_commands(self, commands):
3016 '''Add commands to the rule.'''
3017- assert isinstance(commands, Iterable) and not isinstance(commands, StringTypes)
3018+ assert isinstance(commands, Iterable) and not isinstance(commands, str)
3019 self._commands.extend(commands)
3020 return self
3021
3022@@ -139,13 +138,16 @@ class Rule(object):
3023 '''
3024 if not self._targets:
3025 return
3026- fh.write('%s:' % ' '.join(self._targets))
3027+ wstring = '%s:' % ' '.join(self._targets)
3028 if self._dependencies:
3029- fh.write(' %s' % ' '.join(self.dependencies()))
3030- fh.write('\n')
3031+ wstring += ' %s' % ' '.join(self.dependencies())
3032+ wstring += '\n'
3033 for cmd in self._commands:
3034- fh.write('\t%s\n' % cmd)
3035-
3036+ wstring += '\t%s\n' % cmd
3037+ try:
3038+ fh.write(wstring.encode('utf-8'))
3039+ except TypeError:
3040+ fh.write(wstring)
3041
3042 # colon followed by anything except a slash (Windows path detection)
3043 _depfilesplitter = re.compile(r':(?![\\/])')
3044diff --git a/python/mozbuild/mozbuild/mozinfo.py b/python/mozbuild/mozbuild/mozinfo.py
3045index 7e7ad1b2a..f03f20ba3 100755
3046--- a/python/mozbuild/mozbuild/mozinfo.py
3047+++ b/python/mozbuild/mozbuild/mozinfo.py
3048@@ -5,7 +5,7 @@
3049 # This module produces a JSON file that provides basic build info and
3050 # configuration metadata.
3051
3052-from __future__ import absolute_import
3053+
3054
3055 import os
3056 import re
3057@@ -33,7 +33,7 @@ def build_dict(config, env=os.environ):
3058 d['mozconfig'] = config.mozconfig
3059
3060 # os
3061- o = substs["OS_TARGET"]
3062+ o = str(substs["OS_TARGET"])
3063 known_os = {"Linux": "linux",
3064 "WINNT": "win",
3065 "Darwin": "mac",
3066@@ -148,7 +148,7 @@ def write_mozinfo(file, config, env=os.environ):
3067 and what keys are produced.
3068 """
3069 build_conf = build_dict(config, env)
3070- if isinstance(file, basestring):
3071- file = open(file, 'wb')
3072+ if isinstance(file, str):
3073+ file = open(file, 'w')
3074
3075 json.dump(build_conf, file, sort_keys=True, indent=4)
3076diff --git a/python/mozbuild/mozbuild/preprocessor.py b/python/mozbuild/mozbuild/preprocessor.py
3077index 6780b8b72..19e59884e 100644
3078--- a/python/mozbuild/mozbuild/preprocessor.py
3079+++ b/python/mozbuild/mozbuild/preprocessor.py
3080@@ -27,7 +27,8 @@ import os
3081 import re
3082 from optparse import OptionParser
3083 import errno
3084-from makeutil import Makefile
3085+from .makeutil import Makefile
3086+from functools import reduce
3087
3088 # hack around win32 mangling our line endings
3089 # http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65443
3090@@ -230,7 +231,7 @@ class Expression:
3091 def __repr__(self):
3092 return self.value.__repr__()
3093
3094- class ParseError(StandardError):
3095+ class ParseError(Exception):
3096 """
3097 Error raised when parsing fails.
3098 It has two members, offset and content, which give the offset of the
3099@@ -278,7 +279,7 @@ class Preprocessor:
3100 self.context = Context()
3101 for k,v in {'FILE': '',
3102 'LINE': 0,
3103- 'DIRECTORY': os.path.abspath('.')}.iteritems():
3104+ 'DIRECTORY': os.path.abspath('.')}.items():
3105 self.context[k] = v
3106 self.actionLevel = 0
3107 self.disableLevel = 0
3108@@ -292,21 +293,21 @@ class Preprocessor:
3109 self.cmds = {}
3110 for cmd, level in {'define': 0,
3111 'undef': 0,
3112- 'if': sys.maxint,
3113- 'ifdef': sys.maxint,
3114- 'ifndef': sys.maxint,
3115+ 'if': sys.maxsize,
3116+ 'ifdef': sys.maxsize,
3117+ 'ifndef': sys.maxsize,
3118 'else': 1,
3119 'elif': 1,
3120 'elifdef': 1,
3121 'elifndef': 1,
3122- 'endif': sys.maxint,
3123+ 'endif': sys.maxsize,
3124 'expand': 0,
3125 'literal': 0,
3126 'filter': 0,
3127 'unfilter': 0,
3128 'include': 0,
3129 'includesubst': 0,
3130- 'error': 0}.iteritems():
3131+ 'error': 0}.items():
3132 self.cmds[cmd] = (level, getattr(self, 'do_' + cmd))
3133 self.out = sys.stdout
3134 self.setMarker(marker)
3135@@ -434,7 +435,7 @@ class Preprocessor:
3136 filteredLine = self.applyFilters(aLine)
3137 if filteredLine != aLine:
3138 self.actionLevel = 2
3139- self.out.write(filteredLine)
3140+ self.out.write(filteredLine.encode('utf-8'))
3141
3142 def handleCommandLine(self, args, defaultToStdin = False):
3143 """
3144@@ -468,7 +469,7 @@ class Preprocessor:
3145 raise Preprocessor.Error(self, "--depend doesn't work with stdout",
3146 None)
3147 try:
3148- from makeutil import Makefile
3149+ from .makeutil import Makefile
3150 except:
3151 raise Preprocessor.Error(self, "--depend requires the "
3152 "mozbuild.makeutil module", None)
3153@@ -683,7 +684,7 @@ class Preprocessor:
3154 current = dict(self.filters)
3155 for f in filters:
3156 current[f] = getattr(self, 'filter_' + f)
3157- filterNames = current.keys()
3158+ filterNames = list(current.keys())
3159 filterNames.sort()
3160 self.filters = [(fn, current[fn]) for fn in filterNames]
3161 return
3162@@ -693,7 +694,7 @@ class Preprocessor:
3163 for f in filters:
3164 if f in current:
3165 del current[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@@ -738,7 +739,7 @@ class Preprocessor:
3172 args can either be a file name, or a file-like object.
3173 Files should be opened, and will be closed after processing.
3174 """
3175- isName = type(args) == str or type(args) == unicode
3176+ isName = type(args) == str or type(args) == str
3177 oldCheckLineNumbers = self.checkLineNumbers
3178 self.checkLineNumbers = False
3179 if isName:
3180diff --git a/python/mozbuild/mozbuild/shellutil.py b/python/mozbuild/mozbuild/shellutil.py
3181index 185a970ee..c0c15f8f2 100644
3182--- a/python/mozbuild/mozbuild/shellutil.py
3183+++ b/python/mozbuild/mozbuild/shellutil.py
3184@@ -15,7 +15,7 @@ def _tokens2re(**tokens):
3185 # which matches the pattern and captures it in a named match group.
3186 # The group names and patterns are given as arguments.
3187 all_tokens = '|'.join('(?P<%s>%s)' % (name, value)
3188- for name, value in tokens.iteritems())
3189+ for name, value in tokens.items())
3190 nonescaped = r'(?<!\\)(?:%s)' % all_tokens
3191
3192 # The final pattern matches either the above pattern, or an escaped
3193@@ -96,7 +96,7 @@ class _ClineSplitter(object):
3194 self.cline = self.cline[m.end():]
3195
3196 match = {name: value
3197- for name, value in m.groupdict().items() if value}
3198+ for name, value in list(m.groupdict().items()) if value}
3199 if 'quote' in match:
3200 # " or ' start a quoted string
3201 if match['quote'] == '"':
3202@@ -144,7 +144,7 @@ class _ClineSplitter(object):
3203 self._push(self.cline[:m.start()])
3204 self.cline = self.cline[m.end():]
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 # a double quote ends the quoted string, so go back to
3210 # unquoted parsing
3211diff --git a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py
3212index a05059f8a..355a96165 100644
3213--- a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py
3214+++ b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py
3215@@ -2,9 +2,9 @@
3216 # License, v. 2.0. If a copy of the MPL was not distributed with this
3217 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
3218
3219-from __future__ import unicode_literals
3220
3221-import cPickle as pickle
3222+
3223+import pickle as pickle
3224 import json
3225 import os
3226 import unittest
3227@@ -333,7 +333,7 @@ class TestRecursiveMakeBackend(BackendTester):
3228 ],
3229 }
3230
3231- for var, val in expected.items():
3232+ for var, val in list(expected.items()):
3233 # print("test_variable_passthru[%s]" % (var))
3234 found = [str for str in lines if str.startswith(var)]
3235 self.assertEqual(found, val)
3236@@ -372,7 +372,7 @@ class TestRecursiveMakeBackend(BackendTester):
3237 ],
3238 }
3239
3240- for var, val in expected.items():
3241+ for var, val in list(expected.items()):
3242 found = [str for str in lines if str.startswith(var)]
3243 self.assertEqual(found, val)
3244
3245@@ -563,7 +563,7 @@ class TestRecursiveMakeBackend(BackendTester):
3246
3247 # This is not the most robust test in the world, but it gets the job
3248 # done.
3249- entries = [e for e in m._dests.keys() if '**' in e]
3250+ entries = [e for e in list(m._dests.keys()) if '**' in e]
3251 self.assertEqual(len(entries), 1)
3252 self.assertIn('support/**', entries[0])
3253
3254@@ -590,11 +590,11 @@ class TestRecursiveMakeBackend(BackendTester):
3255 set(['child/test_sub.js',
3256 'child/data/**',
3257 'child/another-file.sjs']))
3258- for key in test_installs.keys():
3259+ for key in list(test_installs.keys()):
3260 self.assertIn(key, test_installs)
3261
3262 synthesized_manifest = InstallManifest()
3263- for item, installs in test_installs.items():
3264+ for item, installs in list(test_installs.items()):
3265 for install_info in installs:
3266 if len(install_info) == 3:
3267 synthesized_manifest.add_pattern_link(*install_info)
3268@@ -602,7 +602,7 @@ class TestRecursiveMakeBackend(BackendTester):
3269 synthesized_manifest.add_link(*install_info)
3270
3271 self.assertEqual(len(synthesized_manifest), 3)
3272- for item, info in synthesized_manifest._dests.items():
3273+ for item, info in list(synthesized_manifest._dests.items()):
3274 self.assertIn(item, m)
3275 self.assertEqual(info, m._dests[item])
3276
3277@@ -864,7 +864,7 @@ class TestRecursiveMakeBackend(BackendTester):
3278 expected[mozpath.join(env.topobjdir, 'final-target')] = [
3279 'FINAL_TARGET = $(DEPTH)/random-final-target'
3280 ]
3281- for key, expected_rules in expected.iteritems():
3282+ for key, expected_rules in expected.items():
3283 backend_path = mozpath.join(key, 'backend.mk')
3284 lines = [l.strip() for l in open(backend_path, 'rt').readlines()[2:]]
3285 found = [str for str in lines if
3286diff --git a/python/mozbuild/mozbuild/test/configure/common.py b/python/mozbuild/mozbuild/test/configure/common.py
3287index 150c6e393..5e2c2afaa 100644
3288--- a/python/mozbuild/mozbuild/test/configure/common.py
3289+++ b/python/mozbuild/mozbuild/test/configure/common.py
3290@@ -2,7 +2,7 @@
3291 # License, v. 2.0. If a copy of the MPL was not distributed with this
3292 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
3293
3294-from __future__ import absolute_import, print_function, unicode_literals
3295+
3296
3297 import copy
3298 import errno
3299@@ -16,7 +16,7 @@ from mozbuild.configure import ConfigureSandbox
3300 from mozbuild.util import ReadOnlyNamespace
3301 from mozpack import path as mozpath
3302
3303-from StringIO import StringIO
3304+from io import StringIO
3305 from which import WhichError
3306
3307 from buildconfig import (
3308@@ -77,10 +77,10 @@ class ConfigureTestSandbox(ConfigureSandbox):
3309 self._search_path = environ.get('PATH', '').split(os.pathsep)
3310
3311 self._subprocess_paths = {
3312- mozpath.abspath(k): v for k, v in paths.iteritems() if v
3313+ mozpath.abspath(k): v for k, v in paths.items() if v
3314 }
3315
3316- paths = paths.keys()
3317+ paths = list(paths.keys())
3318
3319 environ = dict(environ)
3320 if 'CONFIG_SHELL' not in environ:
3321diff --git a/python/mozbuild/mozbuild/test/configure/lint.py b/python/mozbuild/mozbuild/test/configure/lint.py
3322index 98f5f4fe7..a549b4bcf 100644
3323--- a/python/mozbuild/mozbuild/test/configure/lint.py
3324+++ b/python/mozbuild/mozbuild/test/configure/lint.py
3325@@ -2,11 +2,11 @@
3326 # License, v. 2.0. If a copy of the MPL was not distributed with this
3327 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
3328
3329-from __future__ import absolute_import, print_function, unicode_literals
3330+
3331
3332 import os
3333 import unittest
3334-from StringIO import StringIO
3335+from io import StringIO
3336 from mozunit import main
3337 from buildconfig import (
3338 topobjdir,
3339@@ -40,9 +40,7 @@ class LintMeta(type):
3340 return type.__new__(mcs, name, bases, attrs)
3341
3342
3343-class Lint(unittest.TestCase):
3344- __metaclass__ = LintMeta
3345-
3346+class Lint(unittest.TestCase, metaclass=LintMeta):
3347 def setUp(self):
3348 self._curdir = os.getcwd()
3349 os.chdir(topobjdir)
3350diff --git a/python/mozbuild/mozbuild/test/configure/test_checks_configure.py b/python/mozbuild/mozbuild/test/configure/test_checks_configure.py
3351index c60000bb2..07091c077 100644
3352--- a/python/mozbuild/mozbuild/test/configure/test_checks_configure.py
3353+++ b/python/mozbuild/mozbuild/test/configure/test_checks_configure.py
3354@@ -2,9 +2,9 @@
3355 # License, v. 2.0. If a copy of the MPL was not distributed with this
3356 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
3357
3358-from __future__ import absolute_import, print_function, unicode_literals
3359
3360-from StringIO import StringIO
3361+
3362+from io import StringIO
3363 import os
3364 import sys
3365 import textwrap
3366@@ -447,7 +447,7 @@ class TestChecksConfigure(unittest.TestCase):
3367 checking for a... %s
3368 ''' % self.OTHER_A))
3369
3370- dirs = map(mozpath.dirname, (self.OTHER_A, self.KNOWN_A))
3371+ dirs = list(map(mozpath.dirname, (self.OTHER_A, self.KNOWN_A)))
3372 config, out, status = self.get_result(textwrap.dedent('''\
3373 check_prog("A", ("known-a",), paths=["%s"])
3374 ''' % os.pathsep.join(dirs)))
3375@@ -457,7 +457,7 @@ class TestChecksConfigure(unittest.TestCase):
3376 checking for a... %s
3377 ''' % self.OTHER_A))
3378
3379- dirs = map(mozpath.dirname, (self.KNOWN_A, self.KNOWN_B))
3380+ dirs = list(map(mozpath.dirname, (self.KNOWN_A, self.KNOWN_B)))
3381 config, out, status = self.get_result(textwrap.dedent('''\
3382 check_prog("A", ("known-a",), paths=["%s", "%s"])
3383 ''' % (os.pathsep.join(dirs), self.OTHER_A)))
3384diff --git a/python/mozbuild/mozbuild/test/configure/test_compile_checks.py b/python/mozbuild/mozbuild/test/configure/test_compile_checks.py
3385index b5be3bf2e..282000bb2 100644
3386--- a/python/mozbuild/mozbuild/test/configure/test_compile_checks.py
3387+++ b/python/mozbuild/mozbuild/test/configure/test_compile_checks.py
3388@@ -2,14 +2,14 @@
3389 # License, v. 2.0. If a copy of the MPL was not distributed with this
3390 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
3391
3392-from __future__ import absolute_import, print_function, unicode_literals
3393+
3394
3395 import os
3396 import textwrap
3397 import unittest
3398 import mozpack.path as mozpath
3399
3400-from StringIO import StringIO
3401+from io import StringIO
3402
3403 from buildconfig import topsrcdir
3404 from common import ConfigureTestSandbox
3405diff --git a/python/mozbuild/mozbuild/test/configure/test_configure.py b/python/mozbuild/mozbuild/test/configure/test_configure.py
3406index f37e2701f..eb0ca84fb 100644
3407--- a/python/mozbuild/mozbuild/test/configure/test_configure.py
3408+++ b/python/mozbuild/mozbuild/test/configure/test_configure.py
3409@@ -2,9 +2,9 @@
3410 # License, v. 2.0. If a copy of the MPL was not distributed with this
3411 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
3412
3413-from __future__ import absolute_import, print_function, unicode_literals
3414
3415-from StringIO import StringIO
3416+
3417+from io import StringIO
3418 import os
3419 import sys
3420 import textwrap
3421@@ -43,7 +43,7 @@ class TestConfigure(unittest.TestCase):
3422
3423 if '--help' in options:
3424 return out.getvalue(), config
3425- self.assertEquals('', out.getvalue())
3426+ self.assertEqual('', out.getvalue())
3427 return config
3428
3429 def moz_configure(self, source):
3430@@ -55,7 +55,7 @@ class TestConfigure(unittest.TestCase):
3431 def test_defaults(self):
3432 config = self.get_config()
3433 self.maxDiff = None
3434- self.assertEquals({
3435+ self.assertEqual({
3436 'CHOICES': NegativeOptionValue(),
3437 'DEFAULTED': PositiveOptionValue(('not-simple',)),
3438 'IS_GCC': NegativeOptionValue(),
3439@@ -71,9 +71,9 @@ class TestConfigure(unittest.TestCase):
3440 def test_help(self):
3441 help, config = self.get_config(['--help'], prog='configure')
3442
3443- self.assertEquals({}, config)
3444+ self.assertEqual({}, config)
3445 self.maxDiff = None
3446- self.assertEquals(
3447+ self.assertEqual(
3448 'Usage: configure [options]\n'
3449 '\n'
3450 'Options: [defaults in brackets after descriptions]\n'
3451@@ -109,7 +109,7 @@ class TestConfigure(unittest.TestCase):
3452 ):
3453 self.assertNotIn('ENABLED_SIMPLE', config)
3454 self.assertIn('SIMPLE', config)
3455- self.assertEquals(NegativeOptionValue(), config['SIMPLE'])
3456+ self.assertEqual(NegativeOptionValue(), config['SIMPLE'])
3457
3458 for config in (
3459 self.get_config(['--enable-simple']),
3460@@ -117,7 +117,7 @@ class TestConfigure(unittest.TestCase):
3461 ):
3462 self.assertIn('ENABLED_SIMPLE', config)
3463 self.assertIn('SIMPLE', config)
3464- self.assertEquals(PositiveOptionValue(), config['SIMPLE'])
3465+ self.assertEqual(PositiveOptionValue(), config['SIMPLE'])
3466 self.assertIs(config['SIMPLE'], config['ENABLED_SIMPLE'])
3467
3468 # --enable-simple doesn't take values.
3469@@ -135,7 +135,7 @@ class TestConfigure(unittest.TestCase):
3470 env={'MOZ_WITH_ENV': '1'}),
3471 ):
3472 self.assertIn('WITH_ENV', config)
3473- self.assertEquals(NegativeOptionValue(), config['WITH_ENV'])
3474+ self.assertEqual(NegativeOptionValue(), config['WITH_ENV'])
3475
3476 for config in (
3477 self.get_config(['--enable-with-env']),
3478@@ -145,7 +145,7 @@ class TestConfigure(unittest.TestCase):
3479 env={'MOZ_WITH_ENV': ''}),
3480 ):
3481 self.assertIn('WITH_ENV', config)
3482- self.assertEquals(PositiveOptionValue(), config['WITH_ENV'])
3483+ self.assertEqual(PositiveOptionValue(), config['WITH_ENV'])
3484
3485 with self.assertRaises(InvalidOptionError):
3486 self.get_config(['--enable-with-env=value'])
3487@@ -160,23 +160,23 @@ class TestConfigure(unittest.TestCase):
3488 self.get_config(['--enable-values', '--disable-values']),
3489 ):
3490 self.assertIn(name, config)
3491- self.assertEquals(NegativeOptionValue(), config[name])
3492+ self.assertEqual(NegativeOptionValue(), config[name])
3493
3494 for config in (
3495 self.get_config(['--enable-values']),
3496 self.get_config(['--disable-values', '--enable-values']),
3497 ):
3498 self.assertIn(name, config)
3499- self.assertEquals(PositiveOptionValue(), config[name])
3500+ self.assertEqual(PositiveOptionValue(), config[name])
3501
3502 config = self.get_config(['--enable-values=foo'])
3503 self.assertIn(name, config)
3504- self.assertEquals(PositiveOptionValue(('foo',)), config[name])
3505+ self.assertEqual(PositiveOptionValue(('foo',)), config[name])
3506
3507 config = self.get_config(['--enable-values=foo,bar'])
3508 self.assertIn(name, config)
3509 self.assertTrue(config[name])
3510- self.assertEquals(PositiveOptionValue(('foo', 'bar')), config[name])
3511+ self.assertEqual(PositiveOptionValue(('foo', 'bar')), config[name])
3512
3513 def test_values2(self):
3514 self.test_values('VALUES2')
3515@@ -187,12 +187,12 @@ class TestConfigure(unittest.TestCase):
3516 def test_returned_default(self):
3517 config = self.get_config(['--enable-simple'])
3518 self.assertIn('DEFAULTED', config)
3519- self.assertEquals(
3520+ self.assertEqual(
3521 PositiveOptionValue(('simple',)), config['DEFAULTED'])
3522
3523 config = self.get_config(['--disable-simple'])
3524 self.assertIn('DEFAULTED', config)
3525- self.assertEquals(
3526+ self.assertEqual(
3527 PositiveOptionValue(('not-simple',)), config['DEFAULTED'])
3528
3529 def test_returned_choices(self):
3530@@ -200,13 +200,13 @@ class TestConfigure(unittest.TestCase):
3531 config = self.get_config(
3532 ['--enable-values=alpha', '--returned-choices=%s' % val])
3533 self.assertIn('CHOICES', config)
3534- self.assertEquals(PositiveOptionValue((val,)), config['CHOICES'])
3535+ self.assertEqual(PositiveOptionValue((val,)), config['CHOICES'])
3536
3537 for val in ('0', '1', '2'):
3538 config = self.get_config(
3539 ['--enable-values=numeric', '--returned-choices=%s' % val])
3540 self.assertIn('CHOICES', config)
3541- self.assertEquals(PositiveOptionValue((val,)), config['CHOICES'])
3542+ self.assertEqual(PositiveOptionValue((val,)), config['CHOICES'])
3543
3544 with self.assertRaises(InvalidOptionError):
3545 self.get_config(['--enable-values=numeric',
3546@@ -218,12 +218,12 @@ class TestConfigure(unittest.TestCase):
3547 def test_included(self):
3548 config = self.get_config(env={'CC': 'gcc'})
3549 self.assertIn('IS_GCC', config)
3550- self.assertEquals(config['IS_GCC'], True)
3551+ self.assertEqual(config['IS_GCC'], True)
3552
3553 config = self.get_config(
3554 ['--enable-include=extra.configure', '--extra'])
3555 self.assertIn('EXTRA', config)
3556- self.assertEquals(PositiveOptionValue(), config['EXTRA'])
3557+ self.assertEqual(PositiveOptionValue(), config['EXTRA'])
3558
3559 with self.assertRaises(InvalidOptionError):
3560 self.get_config(['--extra'])
3561@@ -231,7 +231,7 @@ class TestConfigure(unittest.TestCase):
3562 def test_template(self):
3563 config = self.get_config(env={'CC': 'gcc'})
3564 self.assertIn('CFLAGS', config)
3565- self.assertEquals(config['CFLAGS'], ['-Werror=foobar'])
3566+ self.assertEqual(config['CFLAGS'], ['-Werror=foobar'])
3567
3568 config = self.get_config(env={'CC': 'clang'})
3569 self.assertNotIn('CFLAGS', config)
3570@@ -288,7 +288,7 @@ class TestConfigure(unittest.TestCase):
3571 sandbox
3572 )
3573
3574- import __builtin__
3575+ import builtins
3576 self.assertIs(sandbox['foo'](), __builtin__)
3577
3578 exec_(textwrap.dedent('''
3579@@ -300,7 +300,7 @@ class TestConfigure(unittest.TestCase):
3580 )
3581
3582 f = sandbox['foo']()
3583- self.assertEquals(f.name, os.devnull)
3584+ self.assertEqual(f.name, os.devnull)
3585 f.close()
3586
3587 # This unlocks the sandbox
3588@@ -336,8 +336,8 @@ class TestConfigure(unittest.TestCase):
3589 self.assertIs(sandbox['foo'](), sandbox)
3590
3591 # Nothing leaked from the function being executed
3592- self.assertEquals(sandbox.keys(), ['__builtins__', 'foo'])
3593- self.assertEquals(sandbox['__builtins__'], ConfigureSandbox.BUILTINS)
3594+ self.assertEqual(list(sandbox.keys()), ['__builtins__', 'foo'])
3595+ self.assertEqual(sandbox['__builtins__'], ConfigureSandbox.BUILTINS)
3596
3597 exec_(textwrap.dedent('''
3598 @template
3599@@ -354,7 +354,7 @@ class TestConfigure(unittest.TestCase):
3600 with self.assertRaises(NameError) as e:
3601 sandbox._depends[sandbox['bar']].result()
3602
3603- self.assertEquals(e.exception.message,
3604+ self.assertEqual(e.exception.message,
3605 "global name 'sys' is not defined")
3606
3607 def test_apply_imports(self):
3608@@ -380,28 +380,28 @@ class TestConfigure(unittest.TestCase):
3609 sandbox
3610 )
3611
3612- self.assertEquals(len(imports), 1)
3613+ self.assertEqual(len(imports), 1)
3614
3615 def test_os_path(self):
3616 config = self.get_config(['--with-imports=%s' % __file__])
3617 self.assertIn('HAS_ABSPATH', config)
3618- self.assertEquals(config['HAS_ABSPATH'], True)
3619+ self.assertEqual(config['HAS_ABSPATH'], True)
3620 self.assertIn('HAS_GETATIME', config)
3621- self.assertEquals(config['HAS_GETATIME'], True)
3622+ self.assertEqual(config['HAS_GETATIME'], True)
3623 self.assertIn('HAS_GETATIME2', config)
3624- self.assertEquals(config['HAS_GETATIME2'], False)
3625+ self.assertEqual(config['HAS_GETATIME2'], False)
3626
3627 def test_template_call(self):
3628 config = self.get_config(env={'CC': 'gcc'})
3629 self.assertIn('TEMPLATE_VALUE', config)
3630- self.assertEquals(config['TEMPLATE_VALUE'], 42)
3631+ self.assertEqual(config['TEMPLATE_VALUE'], 42)
3632 self.assertIn('TEMPLATE_VALUE_2', config)
3633- self.assertEquals(config['TEMPLATE_VALUE_2'], 21)
3634+ self.assertEqual(config['TEMPLATE_VALUE_2'], 21)
3635
3636 def test_template_imports(self):
3637 config = self.get_config(['--enable-imports-in-template'])
3638 self.assertIn('PLATFORM', config)
3639- self.assertEquals(config['PLATFORM'], sys.platform)
3640+ self.assertEqual(config['PLATFORM'], sys.platform)
3641
3642 def test_decorators(self):
3643 config = {}
3644@@ -419,27 +419,27 @@ class TestConfigure(unittest.TestCase):
3645 return self.get_config(*args, configure='set_config.configure')
3646
3647 help, config = get_config(['--help'])
3648- self.assertEquals(config, {})
3649+ self.assertEqual(config, {})
3650
3651 config = get_config(['--set-foo'])
3652 self.assertIn('FOO', config)
3653- self.assertEquals(config['FOO'], True)
3654+ self.assertEqual(config['FOO'], True)
3655
3656 config = get_config(['--set-bar'])
3657 self.assertNotIn('FOO', config)
3658 self.assertIn('BAR', config)
3659- self.assertEquals(config['BAR'], True)
3660+ self.assertEqual(config['BAR'], True)
3661
3662 config = get_config(['--set-value=qux'])
3663 self.assertIn('VALUE', config)
3664- self.assertEquals(config['VALUE'], 'qux')
3665+ self.assertEqual(config['VALUE'], 'qux')
3666
3667 config = get_config(['--set-name=hoge'])
3668 self.assertIn('hoge', config)
3669- self.assertEquals(config['hoge'], True)
3670+ self.assertEqual(config['hoge'], True)
3671
3672 config = get_config([])
3673- self.assertEquals(config, {'BAR': False})
3674+ self.assertEqual(config, {'BAR': False})
3675
3676 with self.assertRaises(ConfigureError):
3677 # Both --set-foo and --set-name=FOO are going to try to
3678@@ -454,11 +454,11 @@ class TestConfigure(unittest.TestCase):
3679 set_config('QUX', 'qux', when='--with-qux')
3680 '''):
3681 config = self.get_config()
3682- self.assertEquals(config, {
3683+ self.assertEqual(config, {
3684 'FOO': 'foo',
3685 })
3686 config = self.get_config(['--with-qux'])
3687- self.assertEquals(config, {
3688+ self.assertEqual(config, {
3689 'FOO': 'foo',
3690 'QUX': 'qux',
3691 })
3692@@ -468,27 +468,27 @@ class TestConfigure(unittest.TestCase):
3693 return self.get_config(*args, configure='set_define.configure')
3694
3695 help, config = get_config(['--help'])
3696- self.assertEquals(config, {'DEFINES': {}})
3697+ self.assertEqual(config, {'DEFINES': {}})
3698
3699 config = get_config(['--set-foo'])
3700 self.assertIn('FOO', config['DEFINES'])
3701- self.assertEquals(config['DEFINES']['FOO'], True)
3702+ self.assertEqual(config['DEFINES']['FOO'], True)
3703
3704 config = get_config(['--set-bar'])
3705 self.assertNotIn('FOO', config['DEFINES'])
3706 self.assertIn('BAR', config['DEFINES'])
3707- self.assertEquals(config['DEFINES']['BAR'], True)
3708+ self.assertEqual(config['DEFINES']['BAR'], True)
3709
3710 config = get_config(['--set-value=qux'])
3711 self.assertIn('VALUE', config['DEFINES'])
3712- self.assertEquals(config['DEFINES']['VALUE'], 'qux')
3713+ self.assertEqual(config['DEFINES']['VALUE'], 'qux')
3714
3715 config = get_config(['--set-name=hoge'])
3716 self.assertIn('hoge', config['DEFINES'])
3717- self.assertEquals(config['DEFINES']['hoge'], True)
3718+ self.assertEqual(config['DEFINES']['hoge'], True)
3719
3720 config = get_config([])
3721- self.assertEquals(config['DEFINES'], {'BAR': False})
3722+ self.assertEqual(config['DEFINES'], {'BAR': False})
3723
3724 with self.assertRaises(ConfigureError):
3725 # Both --set-foo and --set-name=FOO are going to try to
3726@@ -503,11 +503,11 @@ class TestConfigure(unittest.TestCase):
3727 set_define('QUX', 'qux', when='--with-qux')
3728 '''):
3729 config = self.get_config()
3730- self.assertEquals(config['DEFINES'], {
3731+ self.assertEqual(config['DEFINES'], {
3732 'FOO': 'foo',
3733 })
3734 config = self.get_config(['--with-qux'])
3735- self.assertEquals(config['DEFINES'], {
3736+ self.assertEqual(config['DEFINES'], {
3737 'FOO': 'foo',
3738 'QUX': 'qux',
3739 })
3740@@ -518,19 +518,19 @@ class TestConfigure(unittest.TestCase):
3741 *args, configure='imply_option/simple.configure')
3742
3743 help, config = get_config(['--help'])
3744- self.assertEquals(config, {})
3745+ self.assertEqual(config, {})
3746
3747 config = get_config([])
3748- self.assertEquals(config, {})
3749+ self.assertEqual(config, {})
3750
3751 config = get_config(['--enable-foo'])
3752 self.assertIn('BAR', config)
3753- self.assertEquals(config['BAR'], PositiveOptionValue())
3754+ self.assertEqual(config['BAR'], PositiveOptionValue())
3755
3756 with self.assertRaises(InvalidOptionError) as e:
3757 get_config(['--enable-foo', '--disable-bar'])
3758
3759- self.assertEquals(
3760+ self.assertEqual(
3761 e.exception.message,
3762 "'--enable-bar' implied by '--enable-foo' conflicts with "
3763 "'--disable-bar' from the command-line")
3764@@ -541,31 +541,31 @@ class TestConfigure(unittest.TestCase):
3765 *args, configure='imply_option/negative.configure')
3766
3767 help, config = get_config(['--help'])
3768- self.assertEquals(config, {})
3769+ self.assertEqual(config, {})
3770
3771 config = get_config([])
3772- self.assertEquals(config, {})
3773+ self.assertEqual(config, {})
3774
3775 config = get_config(['--enable-foo'])
3776 self.assertIn('BAR', config)
3777- self.assertEquals(config['BAR'], NegativeOptionValue())
3778+ self.assertEqual(config['BAR'], NegativeOptionValue())
3779
3780 with self.assertRaises(InvalidOptionError) as e:
3781 get_config(['--enable-foo', '--enable-bar'])
3782
3783- self.assertEquals(
3784+ self.assertEqual(
3785 e.exception.message,
3786 "'--disable-bar' implied by '--enable-foo' conflicts with "
3787 "'--enable-bar' from the command-line")
3788
3789 config = get_config(['--disable-hoge'])
3790 self.assertIn('BAR', config)
3791- self.assertEquals(config['BAR'], NegativeOptionValue())
3792+ self.assertEqual(config['BAR'], NegativeOptionValue())
3793
3794 with self.assertRaises(InvalidOptionError) as e:
3795 get_config(['--disable-hoge', '--enable-bar'])
3796
3797- self.assertEquals(
3798+ self.assertEqual(
3799 e.exception.message,
3800 "'--disable-bar' implied by '--disable-hoge' conflicts with "
3801 "'--enable-bar' from the command-line")
3802@@ -576,23 +576,23 @@ class TestConfigure(unittest.TestCase):
3803 *args, configure='imply_option/values.configure')
3804
3805 help, config = get_config(['--help'])
3806- self.assertEquals(config, {})
3807+ self.assertEqual(config, {})
3808
3809 config = get_config([])
3810- self.assertEquals(config, {})
3811+ self.assertEqual(config, {})
3812
3813 config = get_config(['--enable-foo=a'])
3814 self.assertIn('BAR', config)
3815- self.assertEquals(config['BAR'], PositiveOptionValue(('a',)))
3816+ self.assertEqual(config['BAR'], PositiveOptionValue(('a',)))
3817
3818 config = get_config(['--enable-foo=a,b'])
3819 self.assertIn('BAR', config)
3820- self.assertEquals(config['BAR'], PositiveOptionValue(('a','b')))
3821+ self.assertEqual(config['BAR'], PositiveOptionValue(('a','b')))
3822
3823 with self.assertRaises(InvalidOptionError) as e:
3824 get_config(['--enable-foo=a,b', '--disable-bar'])
3825
3826- self.assertEquals(
3827+ self.assertEqual(
3828 e.exception.message,
3829 "'--enable-bar=a,b' implied by '--enable-foo' conflicts with "
3830 "'--disable-bar' from the command-line")
3831@@ -603,15 +603,15 @@ class TestConfigure(unittest.TestCase):
3832 *args, configure='imply_option/infer.configure')
3833
3834 help, config = get_config(['--help'])
3835- self.assertEquals(config, {})
3836+ self.assertEqual(config, {})
3837
3838 config = get_config([])
3839- self.assertEquals(config, {})
3840+ self.assertEqual(config, {})
3841
3842 with self.assertRaises(InvalidOptionError) as e:
3843 get_config(['--enable-foo', '--disable-bar'])
3844
3845- self.assertEquals(
3846+ self.assertEqual(
3847 e.exception.message,
3848 "'--enable-bar' implied by '--enable-foo' conflicts with "
3849 "'--disable-bar' from the command-line")
3850@@ -619,7 +619,7 @@ class TestConfigure(unittest.TestCase):
3851 with self.assertRaises(ConfigureError) as e:
3852 self.get_config([], configure='imply_option/infer_ko.configure')
3853
3854- self.assertEquals(
3855+ self.assertEqual(
3856 e.exception.message,
3857 "Cannot infer what implies '--enable-bar'. Please add a `reason` "
3858 "to the `imply_option` call.")
3859@@ -630,25 +630,25 @@ class TestConfigure(unittest.TestCase):
3860 *args, configure='imply_option/imm.configure')
3861
3862 help, config = get_config(['--help'])
3863- self.assertEquals(config, {})
3864+ self.assertEqual(config, {})
3865
3866 config = get_config([])
3867- self.assertEquals(config, {})
3868+ self.assertEqual(config, {})
3869
3870 config_path = mozpath.abspath(
3871 mozpath.join(test_data_path, 'imply_option', 'imm.configure'))
3872
3873- with self.assertRaisesRegexp(InvalidOptionError,
3874+ with self.assertRaisesRegex(InvalidOptionError,
3875 "--enable-foo' implied by 'imply_option at %s:7' conflicts with "
3876 "'--disable-foo' from the command-line" % config_path):
3877 get_config(['--disable-foo'])
3878
3879- with self.assertRaisesRegexp(InvalidOptionError,
3880+ with self.assertRaisesRegex(InvalidOptionError,
3881 "--enable-bar=foo,bar' implied by 'imply_option at %s:16' conflicts"
3882 " with '--enable-bar=a,b,c' from the command-line" % config_path):
3883 get_config(['--enable-bar=a,b,c'])
3884
3885- with self.assertRaisesRegexp(InvalidOptionError,
3886+ with self.assertRaisesRegex(InvalidOptionError,
3887 "--enable-baz=BAZ' implied by 'imply_option at %s:25' conflicts"
3888 " with '--enable-baz=QUUX' from the command-line" % config_path):
3889 get_config(['--enable-baz=QUUX'])
3890@@ -660,7 +660,7 @@ class TestConfigure(unittest.TestCase):
3891 '''):
3892 self.get_config()
3893
3894- self.assertEquals(e.exception.message,
3895+ self.assertEqual(e.exception.message,
3896 "`--with-foo`, emitted from `%s` line 2, is unknown."
3897 % mozpath.join(test_data_path, 'moz.configure'))
3898
3899@@ -675,7 +675,7 @@ class TestConfigure(unittest.TestCase):
3900 '''):
3901 self.get_config()
3902
3903- self.assertEquals(e.exception.message,
3904+ self.assertEqual(e.exception.message,
3905 "Unexpected type: 'int'")
3906
3907 def test_imply_option_when(self):
3908@@ -686,12 +686,12 @@ class TestConfigure(unittest.TestCase):
3909 set_config('QUX', depends('--with-qux')(lambda x: x))
3910 '''):
3911 config = self.get_config()
3912- self.assertEquals(config, {
3913+ self.assertEqual(config, {
3914 'QUX': NegativeOptionValue(),
3915 })
3916
3917 config = self.get_config(['--with-foo'])
3918- self.assertEquals(config, {
3919+ self.assertEqual(config, {
3920 'QUX': PositiveOptionValue(),
3921 })
3922
3923@@ -700,7 +700,7 @@ class TestConfigure(unittest.TestCase):
3924 with self.moz_configure('option("--with-foo", help="foo")'):
3925 self.get_config()
3926
3927- self.assertEquals(
3928+ self.assertEqual(
3929 e.exception.message,
3930 'Option `--with-foo` is not handled ; reference it with a @depends'
3931 )
3932@@ -712,7 +712,7 @@ class TestConfigure(unittest.TestCase):
3933 '''):
3934 self.get_config()
3935
3936- self.assertEquals(
3937+ self.assertEqual(
3938 e.exception.message,
3939 'Option `--with-foo` already defined'
3940 )
3941@@ -724,7 +724,7 @@ class TestConfigure(unittest.TestCase):
3942 '''):
3943 self.get_config()
3944
3945- self.assertEquals(
3946+ self.assertEqual(
3947 e.exception.message,
3948 'Option `MOZ_FOO` already defined'
3949 )
3950@@ -736,7 +736,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@@ -748,7 +748,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@@ -760,7 +760,7 @@ class TestConfigure(unittest.TestCase):
3969 '''):
3970 self.get_config()
3971
3972- self.assertEquals(
3973+ self.assertEqual(
3974 e.exception.message,
3975 'Option `--with-foo` already defined'
3976 )
3977@@ -776,18 +776,18 @@ class TestConfigure(unittest.TestCase):
3978 set_config('QUX', depends('--with-qux', when='--with-foo')(lambda x: x))
3979 '''):
3980 config = self.get_config()
3981- self.assertEquals(config, {
3982+ self.assertEqual(config, {
3983 'FOO': NegativeOptionValue(),
3984 })
3985
3986 config = self.get_config(['--with-foo'])
3987- self.assertEquals(config, {
3988+ self.assertEqual(config, {
3989 'FOO': PositiveOptionValue(),
3990 'QUX': NegativeOptionValue(),
3991 })
3992
3993 config = self.get_config(['--with-foo', '--with-qux'])
3994- self.assertEquals(config, {
3995+ self.assertEqual(config, {
3996 'FOO': PositiveOptionValue(),
3997 'QUX': PositiveOptionValue(),
3998 })
3999@@ -795,7 +795,7 @@ class TestConfigure(unittest.TestCase):
4000 with self.assertRaises(InvalidOptionError) as e:
4001 self.get_config(['--with-bar'])
4002
4003- self.assertEquals(
4004+ self.assertEqual(
4005 e.exception.message,
4006 '--with-bar is not available in this configuration'
4007 )
4008@@ -803,7 +803,7 @@ class TestConfigure(unittest.TestCase):
4009 with self.assertRaises(InvalidOptionError) as e:
4010 self.get_config(['--with-qux'])
4011
4012- self.assertEquals(
4013+ self.assertEqual(
4014 e.exception.message,
4015 '--with-qux is not available in this configuration'
4016 )
4017@@ -811,18 +811,18 @@ class TestConfigure(unittest.TestCase):
4018 with self.assertRaises(InvalidOptionError) as e:
4019 self.get_config(['QUX=1'])
4020
4021- self.assertEquals(
4022+ self.assertEqual(
4023 e.exception.message,
4024 'QUX is not available in this configuration'
4025 )
4026
4027 config = self.get_config(env={'QUX': '1'})
4028- self.assertEquals(config, {
4029+ self.assertEqual(config, {
4030 'FOO': NegativeOptionValue(),
4031 })
4032
4033 help, config = self.get_config(['--help'])
4034- self.assertEquals(help, textwrap.dedent('''\
4035+ self.assertEqual(help, textwrap.dedent('''\
4036 Usage: configure [options]
4037
4038 Options: [defaults in brackets after descriptions]
4039@@ -833,7 +833,7 @@ class TestConfigure(unittest.TestCase):
4040 '''))
4041
4042 help, config = self.get_config(['--help', '--with-foo'])
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@@ -851,7 +851,7 @@ class TestConfigure(unittest.TestCase):
4049 with self.assertRaises(ConfigureError) as e:
4050 self.get_config()
4051
4052- self.assertEquals(e.exception.message,
4053+ self.assertEqual(e.exception.message,
4054 '@depends function needs the same `when` as '
4055 'options it depends on')
4056
4057@@ -868,7 +868,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@@ -896,7 +896,7 @@ class TestConfigure(unittest.TestCase):
4067 with self.moz_configure('include("../foo.configure")'):
4068 self.get_config()
4069
4070- self.assertEquals(
4071+ self.assertEqual(
4072 e.exception.message,
4073 'Cannot include `%s` because it is not in a subdirectory of `%s`'
4074 % (mozpath.normpath(mozpath.join(test_data_path, '..',
4075@@ -911,7 +911,7 @@ class TestConfigure(unittest.TestCase):
4076 '''):
4077 self.get_config()
4078
4079- self.assertEquals(
4080+ self.assertEqual(
4081 e.exception.message,
4082 'Cannot include `%s` because it was included already.'
4083 % mozpath.normpath(mozpath.join(test_data_path,
4084@@ -924,7 +924,7 @@ class TestConfigure(unittest.TestCase):
4085 '''):
4086 self.get_config()
4087
4088- self.assertEquals(e.exception.message, "Unexpected type: 'int'")
4089+ self.assertEqual(e.exception.message, "Unexpected type: 'int'")
4090
4091 def test_include_when(self):
4092 with MockedOpen({
4093@@ -967,26 +967,26 @@ class TestConfigure(unittest.TestCase):
4094 '''),
4095 }):
4096 config = self.get_config()
4097- self.assertEquals(config, {})
4098+ self.assertEqual(config, {})
4099
4100 config = self.get_config(['--with-foo'])
4101- self.assertEquals(config, {})
4102+ self.assertEqual(config, {})
4103
4104 config = self.get_config(['--with-bar'])
4105- self.assertEquals(config, {
4106+ self.assertEqual(config, {
4107 'BAR': 'bar',
4108 })
4109
4110 with self.assertRaises(InvalidOptionError) as e:
4111 self.get_config(['--with-qux'])
4112
4113- self.assertEquals(
4114+ self.assertEqual(
4115 e.exception.message,
4116 '--with-qux is not available in this configuration'
4117 )
4118
4119 config = self.get_config(['--with-foo', '--with-foo-really'])
4120- self.assertEquals(config, {
4121+ self.assertEqual(config, {
4122 'FOO': 'foo',
4123 'FOO2': True,
4124 })
4125@@ -998,7 +998,7 @@ class TestConfigure(unittest.TestCase):
4126 '''):
4127 self.get_config()
4128
4129- self.assertEquals(e.exception.message, 'Cannot reassign builtins')
4130+ self.assertEqual(e.exception.message, 'Cannot reassign builtins')
4131
4132 with self.assertRaises(KeyError) as e:
4133 with self.moz_configure('''
4134@@ -1006,7 +1006,7 @@ class TestConfigure(unittest.TestCase):
4135 '''):
4136 self.get_config()
4137
4138- self.assertEquals(e.exception.message,
4139+ self.assertEqual(e.exception.message,
4140 'Cannot assign `foo` because it is neither a '
4141 '@depends nor a @template')
4142
4143@@ -1019,7 +1019,7 @@ class TestConfigure(unittest.TestCase):
4144 '''):
4145 self.get_config()
4146
4147- self.assertEquals(e.exception.message,
4148+ self.assertEqual(e.exception.message,
4149 "@depends needs at least one argument")
4150
4151 with self.assertRaises(ConfigureError) as e:
4152@@ -1030,7 +1030,7 @@ class TestConfigure(unittest.TestCase):
4153 '''):
4154 self.get_config()
4155
4156- self.assertEquals(e.exception.message,
4157+ self.assertEqual(e.exception.message,
4158 "'--with-foo' is not a known option. Maybe it's "
4159 "declared too late?")
4160
4161@@ -1042,7 +1042,7 @@ class TestConfigure(unittest.TestCase):
4162 '''):
4163 self.get_config()
4164
4165- self.assertEquals(e.exception.message,
4166+ self.assertEqual(e.exception.message,
4167 "Option must not contain an '='")
4168
4169 with self.assertRaises(TypeError) as e:
4170@@ -1053,7 +1053,7 @@ class TestConfigure(unittest.TestCase):
4171 '''):
4172 self.get_config()
4173
4174- self.assertEquals(e.exception.message,
4175+ self.assertEqual(e.exception.message,
4176 "Cannot use object of type 'int' as argument "
4177 "to @depends")
4178
4179@@ -1065,7 +1065,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 decorate generator functions with @depends")
4186
4187 with self.assertRaises(TypeError) as e:
4188@@ -1074,7 +1074,7 @@ class TestConfigure(unittest.TestCase):
4189 '''):
4190 self.get_config()
4191
4192- self.assertEquals(e.exception.message,
4193+ self.assertEqual(e.exception.message,
4194 "Unexpected type: 'int'")
4195
4196 with self.assertRaises(ConfigureError) as e:
4197@@ -1088,7 +1088,7 @@ class TestConfigure(unittest.TestCase):
4198 '''):
4199 self.get_config()
4200
4201- self.assertEquals(e.exception.message,
4202+ self.assertEqual(e.exception.message,
4203 "The `foo` function may not be called")
4204
4205 with self.assertRaises(TypeError) as e:
4206@@ -1099,7 +1099,7 @@ class TestConfigure(unittest.TestCase):
4207 '''):
4208 self.get_config()
4209
4210- self.assertEquals(e.exception.message,
4211+ self.assertEqual(e.exception.message,
4212 "depends_impl() got an unexpected keyword argument 'foo'")
4213
4214 def test_depends_when(self):
4215@@ -1124,12 +1124,12 @@ class TestConfigure(unittest.TestCase):
4216 set_config('QUX', qux)
4217 '''):
4218 config = self.get_config()
4219- self.assertEquals(config, {
4220+ self.assertEqual(config, {
4221 'FOO': 'foo',
4222 })
4223
4224 config = self.get_config(['--with-qux'])
4225- self.assertEquals(config, {
4226+ self.assertEqual(config, {
4227 'FOO': 'foo',
4228 'QUX': 'qux',
4229 })
4230@@ -1144,7 +1144,7 @@ class TestConfigure(unittest.TestCase):
4231 '''):
4232 self.get_config()
4233
4234- self.assertEquals(e.exception.message,
4235+ self.assertEqual(e.exception.message,
4236 '@imports must appear after @template')
4237
4238 with self.assertRaises(ConfigureError) as e:
4239@@ -1157,7 +1157,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 @depends')
4246
4247 for import_ in (
4248@@ -1174,7 +1174,7 @@ class TestConfigure(unittest.TestCase):
4249 ''' % import_):
4250 self.get_config()
4251
4252- self.assertEquals(e.exception.message, "Unexpected type: 'int'")
4253+ self.assertEqual(e.exception.message, "Unexpected type: 'int'")
4254
4255 with self.assertRaises(TypeError) as e:
4256 with self.moz_configure('''
4257@@ -1185,7 +1185,7 @@ class TestConfigure(unittest.TestCase):
4258 '''):
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(ValueError) as e:
4265 with self.moz_configure('''
4266@@ -1195,7 +1195,7 @@ class TestConfigure(unittest.TestCase):
4267 '''):
4268 self.get_config()
4269
4270- self.assertEquals(e.exception.message,
4271+ self.assertEqual(e.exception.message,
4272 "Invalid argument to @imports: 'os*'")
4273
4274 def test_only_when(self):
4275@@ -1250,7 +1250,7 @@ class TestConfigure(unittest.TestCase):
4276 with self.assertRaises(InvalidOptionError) as e:
4277 self.get_config(['--foo'])
4278
4279- self.assertEquals(e.exception.message,
4280+ self.assertEqual(e.exception.message,
4281 '--foo is not available in this configuration')
4282
4283 # Cannot depend on an option defined in a only_when block, because we
4284@@ -1261,7 +1261,7 @@ class TestConfigure(unittest.TestCase):
4285 with self.assertRaises(ConfigureError) as e:
4286 self.get_config()
4287
4288- self.assertEquals(e.exception.message,
4289+ self.assertEqual(e.exception.message,
4290 '@depends function needs the same `when` as '
4291 'options it depends on')
4292
4293@@ -1278,7 +1278,7 @@ class TestConfigure(unittest.TestCase):
4294 with self.assertRaises(InvalidOptionError) as e:
4295 self.get_config()
4296
4297- self.assertEquals(e.exception.message,
4298+ self.assertEqual(e.exception.message,
4299 '--foo is not available in this configuration')
4300
4301 # And similarly doesn't fail when the condition is true.
4302diff --git a/python/mozbuild/mozbuild/test/configure/test_lint.py b/python/mozbuild/mozbuild/test/configure/test_lint.py
4303index 6d8d4c49f..6ad897839 100644
4304--- a/python/mozbuild/mozbuild/test/configure/test_lint.py
4305+++ b/python/mozbuild/mozbuild/test/configure/test_lint.py
4306@@ -2,9 +2,9 @@
4307 # License, v. 2.0. If a copy of the MPL was not distributed with this
4308 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4309
4310-from __future__ import absolute_import, print_function, unicode_literals
4311
4312-from StringIO import StringIO
4313+
4314+from io import StringIO
4315 import os
4316 import textwrap
4317 import unittest
4318@@ -62,7 +62,7 @@ class TestLint(unittest.TestCase):
4319 '''):
4320 self.lint_test()
4321
4322- self.assertEquals(e.exception.message,
4323+ self.assertEqual(e.exception.message,
4324 "`bar` depends on '--help' and `foo`. "
4325 "`foo` must depend on '--help'")
4326
4327@@ -85,7 +85,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@@ -111,7 +111,7 @@ class TestLint(unittest.TestCase):
4337 '''):
4338 self.lint_test()
4339
4340- self.assertEquals(e.exception.message,
4341+ self.assertEqual(e.exception.message,
4342 "Missing @depends for `foo`: '--help'")
4343
4344 with self.assertRaises(ConfigureError) as e:
4345@@ -130,7 +130,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@@ -145,7 +145,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 # This would have failed with "Missing @depends for `foo`: '--help'"
4363@@ -178,7 +178,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 # There is a default restricted `os` module when there is no explicit
4372@@ -205,7 +205,7 @@ class TestLint(unittest.TestCase):
4373 '''):
4374 self.lint_test()
4375
4376- self.assertEquals(e.exception.message,
4377+ self.assertEqual(e.exception.message,
4378 "%s:3: The dependency on `--foo` is unused."
4379 % mozpath.join(test_data_path, 'moz.configure'))
4380
4381@@ -222,7 +222,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:5: The dependency on `bar` is unused."
4388 % mozpath.join(test_data_path, 'moz.configure'))
4389
4390@@ -236,7 +236,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:2: The dependency on `<lambda>` is unused."
4397 % mozpath.join(test_data_path, 'moz.configure'))
4398
4399@@ -257,7 +257,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:9: The dependency on `qux` is unused."
4406 % mozpath.join(test_data_path, 'moz.configure'))
4407
4408diff --git a/python/mozbuild/mozbuild/test/configure/test_moz_configure.py b/python/mozbuild/mozbuild/test/configure/test_moz_configure.py
4409index b3342e268..7a26e9e09 100644
4410--- a/python/mozbuild/mozbuild/test/configure/test_moz_configure.py
4411+++ b/python/mozbuild/mozbuild/test/configure/test_moz_configure.py
4412@@ -2,7 +2,7 @@
4413 # License, v. 2.0. If a copy of the MPL was not distributed with this
4414 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4415
4416-from __future__ import absolute_import, print_function, unicode_literals
4417+
4418
4419 from mozunit import main
4420 from mozpack import path as mozpath
4421@@ -27,10 +27,10 @@ class TestMozConfigure(BaseConfigureTest):
4422 shell = mozpath.abspath('/bin/sh')
4423 return result.replace('CONFIG_SHELL=%s ' % shell, '')
4424
4425- self.assertEquals('--enable-application=browser',
4426+ self.assertEqual('--enable-application=browser',
4427 get_value_for(['--enable-application=browser']))
4428
4429- self.assertEquals('--enable-application=browser '
4430+ self.assertEqual('--enable-application=browser '
4431 'MOZ_VTUNE=1',
4432 get_value_for(['--enable-application=browser',
4433 'MOZ_VTUNE=1']))
4434@@ -39,25 +39,25 @@ class TestMozConfigure(BaseConfigureTest):
4435 environ={'MOZ_VTUNE': '1'},
4436 mozconfig='ac_add_options --enable-project=js')
4437
4438- self.assertEquals('--enable-project=js MOZ_VTUNE=1',
4439+ self.assertEqual('--enable-project=js MOZ_VTUNE=1',
4440 value)
4441
4442 # --disable-js-shell is the default, so it's filtered out.
4443- self.assertEquals('--enable-application=browser',
4444+ self.assertEqual('--enable-application=browser',
4445 get_value_for(['--enable-application=browser',
4446 '--disable-js-shell']))
4447
4448 # Normally, --without-foo would be filtered out because that's the
4449 # default, but since it is a (fake) old-configure option, it always
4450 # appears.
4451- self.assertEquals('--enable-application=browser --without-foo',
4452+ self.assertEqual('--enable-application=browser --without-foo',
4453 get_value_for(['--enable-application=browser',
4454 '--without-foo']))
4455- self.assertEquals('--enable-application=browser --with-foo',
4456+ self.assertEqual('--enable-application=browser --with-foo',
4457 get_value_for(['--enable-application=browser',
4458 '--with-foo']))
4459
4460- self.assertEquals("--enable-application=browser '--with-foo=foo bar'",
4461+ self.assertEqual("--enable-application=browser '--with-foo=foo bar'",
4462 get_value_for(['--enable-application=browser',
4463 '--with-foo=foo bar']))
4464
4465@@ -69,7 +69,7 @@ class TestMozConfigure(BaseConfigureTest):
4466 self.version = version
4467
4468 def __call__(self, stdin, args):
4469- this.assertEquals(args, ('-version',))
4470+ this.assertEqual(args, ('-version',))
4471 return 0, self.version, ''
4472
4473 def check_nsis_version(version):
4474@@ -84,13 +84,13 @@ class TestMozConfigure(BaseConfigureTest):
4475 with self.assertRaises(SystemExit) as e:
4476 check_nsis_version('v3.0a2')
4477
4478- self.assertEquals(check_nsis_version('v3.0b1'), '3.0b1')
4479- self.assertEquals(check_nsis_version('v3.0b2'), '3.0b2')
4480- self.assertEquals(check_nsis_version('v3.0rc1'), '3.0rc1')
4481- self.assertEquals(check_nsis_version('v3.0'), '3.0')
4482- self.assertEquals(check_nsis_version('v3.0-2'), '3.0')
4483- self.assertEquals(check_nsis_version('v3.0.1'), '3.0')
4484- self.assertEquals(check_nsis_version('v3.1'), '3.1')
4485+ self.assertEqual(check_nsis_version('v3.0b1'), '3.0b1')
4486+ self.assertEqual(check_nsis_version('v3.0b2'), '3.0b2')
4487+ self.assertEqual(check_nsis_version('v3.0rc1'), '3.0rc1')
4488+ self.assertEqual(check_nsis_version('v3.0'), '3.0')
4489+ self.assertEqual(check_nsis_version('v3.0-2'), '3.0')
4490+ self.assertEqual(check_nsis_version('v3.0.1'), '3.0')
4491+ self.assertEqual(check_nsis_version('v3.1'), '3.1')
4492
4493
4494 if __name__ == '__main__':
4495diff --git a/python/mozbuild/mozbuild/test/configure/test_options.py b/python/mozbuild/mozbuild/test/configure/test_options.py
4496index 9defccb2c..330ce3b1f 100644
4497--- a/python/mozbuild/mozbuild/test/configure/test_options.py
4498+++ b/python/mozbuild/mozbuild/test/configure/test_options.py
4499@@ -2,7 +2,7 @@
4500 # License, v. 2.0. If a copy of the MPL was not distributed with this
4501 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4502
4503-from __future__ import absolute_import, print_function, unicode_literals
4504+
4505
4506 import unittest
4507
4508@@ -28,139 +28,139 @@ class Option(Option):
4509 class TestOption(unittest.TestCase):
4510 def test_option(self):
4511 option = Option('--option')
4512- self.assertEquals(option.prefix, '')
4513- self.assertEquals(option.name, 'option')
4514- self.assertEquals(option.env, None)
4515+ self.assertEqual(option.prefix, '')
4516+ self.assertEqual(option.name, 'option')
4517+ self.assertEqual(option.env, None)
4518 self.assertFalse(option.default)
4519
4520 option = Option('--enable-option')
4521- self.assertEquals(option.prefix, 'enable')
4522- self.assertEquals(option.name, 'option')
4523- self.assertEquals(option.env, None)
4524+ self.assertEqual(option.prefix, 'enable')
4525+ self.assertEqual(option.name, 'option')
4526+ self.assertEqual(option.env, None)
4527 self.assertFalse(option.default)
4528
4529 option = Option('--disable-option')
4530- self.assertEquals(option.prefix, 'disable')
4531- self.assertEquals(option.name, 'option')
4532- self.assertEquals(option.env, None)
4533+ self.assertEqual(option.prefix, 'disable')
4534+ self.assertEqual(option.name, 'option')
4535+ self.assertEqual(option.env, None)
4536 self.assertTrue(option.default)
4537
4538 option = Option('--with-option')
4539- self.assertEquals(option.prefix, 'with')
4540- self.assertEquals(option.name, 'option')
4541- self.assertEquals(option.env, None)
4542+ self.assertEqual(option.prefix, 'with')
4543+ self.assertEqual(option.name, 'option')
4544+ self.assertEqual(option.env, None)
4545 self.assertFalse(option.default)
4546
4547 option = Option('--without-option')
4548- self.assertEquals(option.prefix, 'without')
4549- self.assertEquals(option.name, 'option')
4550- self.assertEquals(option.env, None)
4551+ self.assertEqual(option.prefix, 'without')
4552+ self.assertEqual(option.name, 'option')
4553+ self.assertEqual(option.env, None)
4554 self.assertTrue(option.default)
4555
4556 option = Option('--without-option-foo', env='MOZ_OPTION')
4557- self.assertEquals(option.env, 'MOZ_OPTION')
4558+ self.assertEqual(option.env, 'MOZ_OPTION')
4559
4560 option = Option(env='MOZ_OPTION')
4561- self.assertEquals(option.prefix, '')
4562- self.assertEquals(option.name, None)
4563- self.assertEquals(option.env, 'MOZ_OPTION')
4564+ self.assertEqual(option.prefix, '')
4565+ self.assertEqual(option.name, None)
4566+ self.assertEqual(option.env, 'MOZ_OPTION')
4567 self.assertFalse(option.default)
4568
4569 with self.assertRaises(InvalidOptionError) as e:
4570 Option('--option', nargs=0, default=('a',))
4571- self.assertEquals(e.exception.message,
4572+ self.assertEqual(e.exception.message,
4573 "The given `default` doesn't satisfy `nargs`")
4574
4575 with self.assertRaises(InvalidOptionError) as e:
4576 Option('--option', nargs=1, default=())
4577- self.assertEquals(
4578+ self.assertEqual(
4579 e.exception.message,
4580 'default must be a bool, a string or a tuple of strings')
4581
4582 with self.assertRaises(InvalidOptionError) as e:
4583 Option('--option', nargs=1, default=True)
4584- self.assertEquals(e.exception.message,
4585+ self.assertEqual(e.exception.message,
4586 "The given `default` doesn't satisfy `nargs`")
4587
4588 with self.assertRaises(InvalidOptionError) as e:
4589 Option('--option', nargs=1, default=('a', 'b'))
4590- self.assertEquals(e.exception.message,
4591+ self.assertEqual(e.exception.message,
4592 "The given `default` doesn't satisfy `nargs`")
4593
4594 with self.assertRaises(InvalidOptionError) as e:
4595 Option('--option', nargs=2, default=())
4596- self.assertEquals(
4597+ self.assertEqual(
4598 e.exception.message,
4599 'default must be a bool, a string or a tuple of strings')
4600
4601 with self.assertRaises(InvalidOptionError) as e:
4602 Option('--option', nargs=2, default=True)
4603- self.assertEquals(e.exception.message,
4604+ self.assertEqual(e.exception.message,
4605 "The given `default` doesn't satisfy `nargs`")
4606
4607 with self.assertRaises(InvalidOptionError) as e:
4608 Option('--option', nargs=2, default=('a',))
4609- self.assertEquals(e.exception.message,
4610+ self.assertEqual(e.exception.message,
4611 "The given `default` doesn't satisfy `nargs`")
4612
4613 with self.assertRaises(InvalidOptionError) as e:
4614 Option('--option', nargs='?', default=('a', 'b'))
4615- self.assertEquals(e.exception.message,
4616+ self.assertEqual(e.exception.message,
4617 "The given `default` doesn't satisfy `nargs`")
4618
4619 with self.assertRaises(InvalidOptionError) as e:
4620 Option('--option', nargs='+', default=())
4621- self.assertEquals(
4622+ self.assertEqual(
4623 e.exception.message,
4624 'default must be a bool, a string or a tuple of strings')
4625
4626 with self.assertRaises(InvalidOptionError) as e:
4627 Option('--option', nargs='+', default=True)
4628- self.assertEquals(e.exception.message,
4629+ self.assertEqual(e.exception.message,
4630 "The given `default` doesn't satisfy `nargs`")
4631
4632 # --disable options with a nargs value that requires at least one
4633 # argument need to be given a default.
4634 with self.assertRaises(InvalidOptionError) as e:
4635 Option('--disable-option', nargs=1)
4636- self.assertEquals(e.exception.message,
4637+ self.assertEqual(e.exception.message,
4638 "The given `default` doesn't satisfy `nargs`")
4639
4640 with self.assertRaises(InvalidOptionError) as e:
4641 Option('--disable-option', nargs='+')
4642- self.assertEquals(e.exception.message,
4643+ self.assertEqual(e.exception.message,
4644 "The given `default` doesn't satisfy `nargs`")
4645
4646 # Test nargs inference from default value
4647 option = Option('--with-foo', default=True)
4648- self.assertEquals(option.nargs, 0)
4649+ self.assertEqual(option.nargs, 0)
4650
4651 option = Option('--with-foo', default=False)
4652- self.assertEquals(option.nargs, 0)
4653+ self.assertEqual(option.nargs, 0)
4654
4655 option = Option('--with-foo', default='a')
4656- self.assertEquals(option.nargs, '?')
4657+ self.assertEqual(option.nargs, '?')
4658
4659 option = Option('--with-foo', default=('a',))
4660- self.assertEquals(option.nargs, '?')
4661+ self.assertEqual(option.nargs, '?')
4662
4663 option = Option('--with-foo', default=('a', 'b'))
4664- self.assertEquals(option.nargs, '*')
4665+ self.assertEqual(option.nargs, '*')
4666
4667 option = Option(env='FOO', default=True)
4668- self.assertEquals(option.nargs, 0)
4669+ self.assertEqual(option.nargs, 0)
4670
4671 option = Option(env='FOO', default=False)
4672- self.assertEquals(option.nargs, 0)
4673+ self.assertEqual(option.nargs, 0)
4674
4675 option = Option(env='FOO', default='a')
4676- self.assertEquals(option.nargs, '?')
4677+ self.assertEqual(option.nargs, '?')
4678
4679 option = Option(env='FOO', default=('a',))
4680- self.assertEquals(option.nargs, '?')
4681+ self.assertEqual(option.nargs, '?')
4682
4683 option = Option(env='FOO', default=('a', 'b'))
4684- self.assertEquals(option.nargs, '*')
4685+ self.assertEqual(option.nargs, '*')
4686
4687 def test_option_option(self):
4688 for option in (
4689@@ -170,70 +170,70 @@ class TestOption(unittest.TestCase):
4690 '--with-option',
4691 '--without-option',
4692 ):
4693- self.assertEquals(Option(option).option, option)
4694- self.assertEquals(Option(option, env='FOO').option, option)
4695+ self.assertEqual(Option(option).option, option)
4696+ self.assertEqual(Option(option, env='FOO').option, option)
4697
4698 opt = Option(option, default=False)
4699- self.assertEquals(opt.option,
4700+ self.assertEqual(opt.option,
4701 option.replace('-disable-', '-enable-')
4702 .replace('-without-', '-with-'))
4703
4704 opt = Option(option, default=True)
4705- self.assertEquals(opt.option,
4706+ self.assertEqual(opt.option,
4707 option.replace('-enable-', '-disable-')
4708 .replace('-with-', '-without-'))
4709
4710- self.assertEquals(Option(env='FOO').option, 'FOO')
4711+ self.assertEqual(Option(env='FOO').option, 'FOO')
4712
4713 def test_option_choices(self):
4714 with self.assertRaises(InvalidOptionError) as e:
4715 Option('--option', nargs=3, choices=('a', 'b'))
4716- self.assertEquals(e.exception.message,
4717+ self.assertEqual(e.exception.message,
4718 'Not enough `choices` for `nargs`')
4719
4720 with self.assertRaises(InvalidOptionError) as e:
4721 Option('--without-option', nargs=1, choices=('a', 'b'))
4722- self.assertEquals(e.exception.message,
4723+ self.assertEqual(e.exception.message,
4724 'A `default` must be given along with `choices`')
4725
4726 with self.assertRaises(InvalidOptionError) as e:
4727 Option('--without-option', nargs='+', choices=('a', 'b'))
4728- self.assertEquals(e.exception.message,
4729+ self.assertEqual(e.exception.message,
4730 'A `default` must be given along with `choices`')
4731
4732 with self.assertRaises(InvalidOptionError) as e:
4733 Option('--without-option', default='c', choices=('a', 'b'))
4734- self.assertEquals(e.exception.message,
4735+ self.assertEqual(e.exception.message,
4736 "The `default` value must be one of 'a', 'b'")
4737
4738 with self.assertRaises(InvalidOptionError) as e:
4739 Option('--without-option', default=('a', 'c',), choices=('a', 'b'))
4740- self.assertEquals(e.exception.message,
4741+ self.assertEqual(e.exception.message,
4742 "The `default` value must be one of 'a', 'b'")
4743
4744 with self.assertRaises(InvalidOptionError) as e:
4745 Option('--without-option', default=('c',), choices=('a', 'b'))
4746- self.assertEquals(e.exception.message,
4747+ self.assertEqual(e.exception.message,
4748 "The `default` value must be one of 'a', 'b'")
4749
4750 option = Option('--with-option', nargs='+', choices=('a', 'b'))
4751 with self.assertRaises(InvalidOptionError) as e:
4752 option.get_value('--with-option=c')
4753- self.assertEquals(e.exception.message, "'c' is not one of 'a', 'b'")
4754+ self.assertEqual(e.exception.message, "'c' is not one of 'a', 'b'")
4755
4756 value = option.get_value('--with-option=b,a')
4757 self.assertTrue(value)
4758- self.assertEquals(PositiveOptionValue(('b', 'a')), value)
4759+ self.assertEqual(PositiveOptionValue(('b', 'a')), value)
4760
4761 option = Option('--without-option', nargs='*', default='a',
4762 choices=('a', 'b'))
4763 with self.assertRaises(InvalidOptionError) as e:
4764 option.get_value('--with-option=c')
4765- self.assertEquals(e.exception.message, "'c' is not one of 'a', 'b'")
4766+ self.assertEqual(e.exception.message, "'c' is not one of 'a', 'b'")
4767
4768 value = option.get_value('--with-option=b,a')
4769 self.assertTrue(value)
4770- self.assertEquals(PositiveOptionValue(('b', 'a')), value)
4771+ self.assertEqual(PositiveOptionValue(('b', 'a')), value)
4772
4773 # Test nargs inference from choices
4774 option = Option('--with-option', choices=('a', 'b'))
4775@@ -244,37 +244,37 @@ class TestOption(unittest.TestCase):
4776 choices=('a', 'b', 'c', 'd'))
4777
4778 value = option.get_value('--with-option=+d')
4779- self.assertEquals(PositiveOptionValue(('b', 'c', 'd')), value)
4780+ self.assertEqual(PositiveOptionValue(('b', 'c', 'd')), value)
4781
4782 value = option.get_value('--with-option=-b')
4783- self.assertEquals(PositiveOptionValue(('c',)), value)
4784+ self.assertEqual(PositiveOptionValue(('c',)), value)
4785
4786 value = option.get_value('--with-option=-b,+d')
4787- self.assertEquals(PositiveOptionValue(('c','d')), value)
4788+ self.assertEqual(PositiveOptionValue(('c','d')), value)
4789
4790 # Adding something that is in the default is fine
4791 value = option.get_value('--with-option=+b')
4792- self.assertEquals(PositiveOptionValue(('b', 'c')), value)
4793+ self.assertEqual(PositiveOptionValue(('b', 'c')), value)
4794
4795 # Removing something that is not in the default is fine, as long as it
4796 # is one of the choices
4797 value = option.get_value('--with-option=-a')
4798- self.assertEquals(PositiveOptionValue(('b', 'c')), value)
4799+ self.assertEqual(PositiveOptionValue(('b', 'c')), value)
4800
4801 with self.assertRaises(InvalidOptionError) as e:
4802 option.get_value('--with-option=-e')
4803- self.assertEquals(e.exception.message,
4804+ self.assertEqual(e.exception.message,
4805 "'e' is not one of 'a', 'b', 'c', 'd'")
4806
4807 # Other "not a choice" errors.
4808 with self.assertRaises(InvalidOptionError) as e:
4809 option.get_value('--with-option=+e')
4810- self.assertEquals(e.exception.message,
4811+ self.assertEqual(e.exception.message,
4812 "'e' is not one of 'a', 'b', 'c', 'd'")
4813
4814 with self.assertRaises(InvalidOptionError) as e:
4815 option.get_value('--with-option=e')
4816- self.assertEquals(e.exception.message,
4817+ self.assertEqual(e.exception.message,
4818 "'e' is not one of 'a', 'b', 'c', 'd'")
4819
4820 def test_option_value_compare(self):
4821@@ -294,7 +294,7 @@ class TestOption(unittest.TestCase):
4822
4823 # For usability reasons, we raise TypeError when attempting to compare
4824 # against a non-tuple.
4825- with self.assertRaisesRegexp(TypeError, 'cannot compare a'):
4826+ with self.assertRaisesRegex(TypeError, 'cannot compare a'):
4827 val == 'foo'
4828
4829 # But we allow empty option values to compare otherwise we can't
4830@@ -313,36 +313,36 @@ class TestOption(unittest.TestCase):
4831
4832 def test_option_value_format(self):
4833 val = PositiveOptionValue()
4834- self.assertEquals('--with-value', val.format('--with-value'))
4835- self.assertEquals('--with-value', val.format('--without-value'))
4836- self.assertEquals('--enable-value', val.format('--enable-value'))
4837- self.assertEquals('--enable-value', val.format('--disable-value'))
4838- self.assertEquals('--value', val.format('--value'))
4839- self.assertEquals('VALUE=1', val.format('VALUE'))
4840+ self.assertEqual('--with-value', val.format('--with-value'))
4841+ self.assertEqual('--with-value', val.format('--without-value'))
4842+ self.assertEqual('--enable-value', val.format('--enable-value'))
4843+ self.assertEqual('--enable-value', val.format('--disable-value'))
4844+ self.assertEqual('--value', val.format('--value'))
4845+ self.assertEqual('VALUE=1', val.format('VALUE'))
4846
4847 val = PositiveOptionValue(('a',))
4848- self.assertEquals('--with-value=a', val.format('--with-value'))
4849- self.assertEquals('--with-value=a', val.format('--without-value'))
4850- self.assertEquals('--enable-value=a', val.format('--enable-value'))
4851- self.assertEquals('--enable-value=a', val.format('--disable-value'))
4852- self.assertEquals('--value=a', val.format('--value'))
4853- self.assertEquals('VALUE=a', val.format('VALUE'))
4854+ self.assertEqual('--with-value=a', val.format('--with-value'))
4855+ self.assertEqual('--with-value=a', val.format('--without-value'))
4856+ self.assertEqual('--enable-value=a', val.format('--enable-value'))
4857+ self.assertEqual('--enable-value=a', val.format('--disable-value'))
4858+ self.assertEqual('--value=a', val.format('--value'))
4859+ self.assertEqual('VALUE=a', val.format('VALUE'))
4860
4861 val = PositiveOptionValue(('a', 'b'))
4862- self.assertEquals('--with-value=a,b', val.format('--with-value'))
4863- self.assertEquals('--with-value=a,b', val.format('--without-value'))
4864- self.assertEquals('--enable-value=a,b', val.format('--enable-value'))
4865- self.assertEquals('--enable-value=a,b', val.format('--disable-value'))
4866- self.assertEquals('--value=a,b', val.format('--value'))
4867- self.assertEquals('VALUE=a,b', val.format('VALUE'))
4868+ self.assertEqual('--with-value=a,b', val.format('--with-value'))
4869+ self.assertEqual('--with-value=a,b', val.format('--without-value'))
4870+ self.assertEqual('--enable-value=a,b', val.format('--enable-value'))
4871+ self.assertEqual('--enable-value=a,b', val.format('--disable-value'))
4872+ self.assertEqual('--value=a,b', val.format('--value'))
4873+ self.assertEqual('VALUE=a,b', val.format('VALUE'))
4874
4875 val = NegativeOptionValue()
4876- self.assertEquals('--without-value', val.format('--with-value'))
4877- self.assertEquals('--without-value', val.format('--without-value'))
4878- self.assertEquals('--disable-value', val.format('--enable-value'))
4879- self.assertEquals('--disable-value', val.format('--disable-value'))
4880- self.assertEquals('', val.format('--value'))
4881- self.assertEquals('VALUE=', val.format('VALUE'))
4882+ self.assertEqual('--without-value', val.format('--with-value'))
4883+ self.assertEqual('--without-value', val.format('--without-value'))
4884+ self.assertEqual('--disable-value', val.format('--enable-value'))
4885+ self.assertEqual('--disable-value', val.format('--disable-value'))
4886+ self.assertEqual('', val.format('--value'))
4887+ self.assertEqual('VALUE=', val.format('VALUE'))
4888
4889 def test_option_value(self, name='option', nargs=0, default=None):
4890 disabled = name.startswith(('disable-', 'without-'))
4891@@ -359,28 +359,28 @@ class TestOption(unittest.TestCase):
4892
4893 if nargs in (0, '?', '*') or disabled:
4894 value = option.get_value('--%s' % name, 'option')
4895- self.assertEquals(value, posOptionValue())
4896- self.assertEquals(value.origin, 'option')
4897+ self.assertEqual(value, posOptionValue())
4898+ self.assertEqual(value.origin, 'option')
4899 else:
4900 with self.assertRaises(InvalidOptionError) as e:
4901 option.get_value('--%s' % name)
4902 if nargs == 1:
4903- self.assertEquals(e.exception.message,
4904+ self.assertEqual(e.exception.message,
4905 '--%s takes 1 value' % name)
4906 elif nargs == '+':
4907- self.assertEquals(e.exception.message,
4908+ self.assertEqual(e.exception.message,
4909 '--%s takes 1 or more values' % name)
4910 else:
4911- self.assertEquals(e.exception.message,
4912+ self.assertEqual(e.exception.message,
4913 '--%s takes 2 values' % name)
4914
4915 value = option.get_value('')
4916- self.assertEquals(value, defaultValue)
4917- self.assertEquals(value.origin, 'default')
4918+ self.assertEqual(value, defaultValue)
4919+ self.assertEqual(value.origin, 'default')
4920
4921 value = option.get_value(None)
4922- self.assertEquals(value, defaultValue)
4923- self.assertEquals(value.origin, 'default')
4924+ self.assertEqual(value, defaultValue)
4925+ self.assertEqual(value.origin, 'default')
4926
4927 with self.assertRaises(AssertionError):
4928 value = option.get_value('MOZ_OPTION=', 'environment')
4929@@ -393,47 +393,47 @@ class TestOption(unittest.TestCase):
4930
4931 if nargs in (1, '?', '*', '+') and not disabled:
4932 value = option.get_value('--%s=' % name, 'option')
4933- self.assertEquals(value, PositiveOptionValue(('',)))
4934- self.assertEquals(value.origin, 'option')
4935+ self.assertEqual(value, PositiveOptionValue(('',)))
4936+ self.assertEqual(value.origin, 'option')
4937 else:
4938 with self.assertRaises(InvalidOptionError) as e:
4939 option.get_value('--%s=' % name)
4940 if disabled:
4941- self.assertEquals(e.exception.message,
4942+ self.assertEqual(e.exception.message,
4943 'Cannot pass a value to --%s' % name)
4944 else:
4945- self.assertEquals(e.exception.message,
4946+ self.assertEqual(e.exception.message,
4947 '--%s takes %d values' % (name, nargs))
4948
4949 if nargs in (1, '?', '*', '+') and not disabled:
4950 value = option.get_value('--%s=foo' % name, 'option')
4951- self.assertEquals(value, PositiveOptionValue(('foo',)))
4952- self.assertEquals(value.origin, 'option')
4953+ self.assertEqual(value, PositiveOptionValue(('foo',)))
4954+ self.assertEqual(value.origin, 'option')
4955 else:
4956 with self.assertRaises(InvalidOptionError) as e:
4957 option.get_value('--%s=foo' % name)
4958 if disabled:
4959- self.assertEquals(e.exception.message,
4960+ self.assertEqual(e.exception.message,
4961 'Cannot pass a value to --%s' % name)
4962 else:
4963- self.assertEquals(e.exception.message,
4964+ self.assertEqual(e.exception.message,
4965 '--%s takes %d values' % (name, nargs))
4966
4967 if nargs in (2, '*', '+') and not disabled:
4968 value = option.get_value('--%s=foo,bar' % name, 'option')
4969- self.assertEquals(value, PositiveOptionValue(('foo', 'bar')))
4970- self.assertEquals(value.origin, 'option')
4971+ self.assertEqual(value, PositiveOptionValue(('foo', 'bar')))
4972+ self.assertEqual(value.origin, 'option')
4973 else:
4974 with self.assertRaises(InvalidOptionError) as e:
4975 option.get_value('--%s=foo,bar' % name, 'option')
4976 if disabled:
4977- self.assertEquals(e.exception.message,
4978+ self.assertEqual(e.exception.message,
4979 'Cannot pass a value to --%s' % name)
4980 elif nargs == '?':
4981- self.assertEquals(e.exception.message,
4982+ self.assertEqual(e.exception.message,
4983 '--%s takes 0 or 1 values' % name)
4984 else:
4985- self.assertEquals(e.exception.message,
4986+ self.assertEqual(e.exception.message,
4987 '--%s takes %d value%s'
4988 % (name, nargs, 's' if nargs != 1 else ''))
4989
4990@@ -441,59 +441,59 @@ class TestOption(unittest.TestCase):
4991 default=default)
4992 if nargs in (0, '?', '*') or disabled:
4993 value = option.get_value('--%s' % name, 'option')
4994- self.assertEquals(value, posOptionValue())
4995- self.assertEquals(value.origin, 'option')
4996+ self.assertEqual(value, posOptionValue())
4997+ self.assertEqual(value.origin, 'option')
4998 else:
4999 with self.assertRaises(InvalidOptionError) as e:
5000 option.get_value('--%s' % name)
5001 if disabled:
5002- self.assertEquals(e.exception.message,
5003+ self.assertEqual(e.exception.message,
5004 'Cannot pass a value to --%s' % name)
5005 elif nargs == '+':
5006- self.assertEquals(e.exception.message,
5007+ self.assertEqual(e.exception.message,
5008 '--%s takes 1 or more values' % name)
5009 else:
5010- self.assertEquals(e.exception.message,
5011+ self.assertEqual(e.exception.message,
5012 '--%s takes %d value%s'
5013 % (name, nargs, 's' if nargs != 1 else ''))
5014
5015 value = option.get_value('')
5016- self.assertEquals(value, defaultValue)
5017- self.assertEquals(value.origin, 'default')
5018+ self.assertEqual(value, defaultValue)
5019+ self.assertEqual(value.origin, 'default')
5020
5021 value = option.get_value(None)
5022- self.assertEquals(value, defaultValue)
5023- self.assertEquals(value.origin, 'default')
5024+ self.assertEqual(value, defaultValue)
5025+ self.assertEqual(value.origin, 'default')
5026
5027 value = option.get_value('MOZ_OPTION=', 'environment')
5028- self.assertEquals(value, NegativeOptionValue())
5029- self.assertEquals(value.origin, 'environment')
5030+ self.assertEqual(value, NegativeOptionValue())
5031+ self.assertEqual(value.origin, 'environment')
5032
5033 if nargs in (0, '?', '*'):
5034 value = option.get_value('MOZ_OPTION=1', 'environment')
5035- self.assertEquals(value, PositiveOptionValue())
5036- self.assertEquals(value.origin, 'environment')
5037+ self.assertEqual(value, PositiveOptionValue())
5038+ self.assertEqual(value.origin, 'environment')
5039 elif nargs in (1, '+'):
5040 value = option.get_value('MOZ_OPTION=1', 'environment')
5041- self.assertEquals(value, PositiveOptionValue(('1',)))
5042- self.assertEquals(value.origin, 'environment')
5043+ self.assertEqual(value, PositiveOptionValue(('1',)))
5044+ self.assertEqual(value.origin, 'environment')
5045 else:
5046 with self.assertRaises(InvalidOptionError) as e:
5047 option.get_value('MOZ_OPTION=1', 'environment')
5048- self.assertEquals(e.exception.message, 'MOZ_OPTION takes 2 values')
5049+ self.assertEqual(e.exception.message, 'MOZ_OPTION takes 2 values')
5050
5051 if nargs in (1, '?', '*', '+') and not disabled:
5052 value = option.get_value('--%s=' % name, 'option')
5053- self.assertEquals(value, PositiveOptionValue(('',)))
5054- self.assertEquals(value.origin, 'option')
5055+ self.assertEqual(value, PositiveOptionValue(('',)))
5056+ self.assertEqual(value.origin, 'option')
5057 else:
5058 with self.assertRaises(InvalidOptionError) as e:
5059 option.get_value('--%s=' % name, 'option')
5060 if disabled:
5061- self.assertEquals(e.exception.message,
5062+ self.assertEqual(e.exception.message,
5063 'Cannot pass a value to --%s' % name)
5064 else:
5065- self.assertEquals(e.exception.message,
5066+ self.assertEqual(e.exception.message,
5067 '--%s takes %d values' % (name, nargs))
5068
5069 with self.assertRaises(AssertionError):
5070@@ -501,26 +501,26 @@ class TestOption(unittest.TestCase):
5071
5072 if nargs in (1, '?', '*', '+'):
5073 value = option.get_value('MOZ_OPTION=foo', 'environment')
5074- self.assertEquals(value, PositiveOptionValue(('foo',)))
5075- self.assertEquals(value.origin, 'environment')
5076+ self.assertEqual(value, PositiveOptionValue(('foo',)))
5077+ self.assertEqual(value.origin, 'environment')
5078 else:
5079 with self.assertRaises(InvalidOptionError) as e:
5080 option.get_value('MOZ_OPTION=foo', 'environment')
5081- self.assertEquals(e.exception.message,
5082+ self.assertEqual(e.exception.message,
5083 'MOZ_OPTION takes %d values' % nargs)
5084
5085 if nargs in (2, '*', '+'):
5086 value = option.get_value('MOZ_OPTION=foo,bar', 'environment')
5087- self.assertEquals(value, PositiveOptionValue(('foo', 'bar')))
5088- self.assertEquals(value.origin, 'environment')
5089+ self.assertEqual(value, PositiveOptionValue(('foo', 'bar')))
5090+ self.assertEqual(value.origin, 'environment')
5091 else:
5092 with self.assertRaises(InvalidOptionError) as e:
5093 option.get_value('MOZ_OPTION=foo,bar', 'environment')
5094 if nargs == '?':
5095- self.assertEquals(e.exception.message,
5096+ self.assertEqual(e.exception.message,
5097 'MOZ_OPTION takes 0 or 1 values')
5098 else:
5099- self.assertEquals(e.exception.message,
5100+ self.assertEqual(e.exception.message,
5101 'MOZ_OPTION takes %d value%s'
5102 % (nargs, 's' if nargs != 1 else ''))
5103
5104@@ -532,26 +532,26 @@ class TestOption(unittest.TestCase):
5105 env_option.get_value('--%s' % name)
5106
5107 value = env_option.get_value('')
5108- self.assertEquals(value, defaultValue)
5109- self.assertEquals(value.origin, 'default')
5110+ self.assertEqual(value, defaultValue)
5111+ self.assertEqual(value.origin, 'default')
5112
5113 value = env_option.get_value('MOZ_OPTION=', 'environment')
5114- self.assertEquals(value, negOptionValue())
5115- self.assertEquals(value.origin, 'environment')
5116+ self.assertEqual(value, negOptionValue())
5117+ self.assertEqual(value.origin, 'environment')
5118
5119 if nargs in (0, '?', '*'):
5120 value = env_option.get_value('MOZ_OPTION=1', 'environment')
5121- self.assertEquals(value, posOptionValue())
5122+ self.assertEqual(value, posOptionValue())
5123 self.assertTrue(value)
5124- self.assertEquals(value.origin, 'environment')
5125+ self.assertEqual(value.origin, 'environment')
5126 elif nargs in (1, '+'):
5127 value = env_option.get_value('MOZ_OPTION=1', 'environment')
5128- self.assertEquals(value, PositiveOptionValue(('1',)))
5129- self.assertEquals(value.origin, 'environment')
5130+ self.assertEqual(value, PositiveOptionValue(('1',)))
5131+ self.assertEqual(value.origin, 'environment')
5132 else:
5133 with self.assertRaises(InvalidOptionError) as e:
5134 env_option.get_value('MOZ_OPTION=1', 'environment')
5135- self.assertEquals(e.exception.message, 'MOZ_OPTION takes 2 values')
5136+ self.assertEqual(e.exception.message, 'MOZ_OPTION takes 2 values')
5137
5138 with self.assertRaises(AssertionError) as e:
5139 env_option.get_value('--%s' % name)
5140@@ -561,26 +561,26 @@ class TestOption(unittest.TestCase):
5141
5142 if nargs in (1, '?', '*', '+'):
5143 value = env_option.get_value('MOZ_OPTION=foo', 'environment')
5144- self.assertEquals(value, PositiveOptionValue(('foo',)))
5145- self.assertEquals(value.origin, 'environment')
5146+ self.assertEqual(value, PositiveOptionValue(('foo',)))
5147+ self.assertEqual(value.origin, 'environment')
5148 else:
5149 with self.assertRaises(InvalidOptionError) as e:
5150 env_option.get_value('MOZ_OPTION=foo', 'environment')
5151- self.assertEquals(e.exception.message,
5152+ self.assertEqual(e.exception.message,
5153 'MOZ_OPTION takes %d values' % nargs)
5154
5155 if nargs in (2, '*', '+'):
5156 value = env_option.get_value('MOZ_OPTION=foo,bar', 'environment')
5157- self.assertEquals(value, PositiveOptionValue(('foo', 'bar')))
5158- self.assertEquals(value.origin, 'environment')
5159+ self.assertEqual(value, PositiveOptionValue(('foo', 'bar')))
5160+ self.assertEqual(value.origin, 'environment')
5161 else:
5162 with self.assertRaises(InvalidOptionError) as e:
5163 env_option.get_value('MOZ_OPTION=foo,bar', 'environment')
5164 if nargs == '?':
5165- self.assertEquals(e.exception.message,
5166+ self.assertEqual(e.exception.message,
5167 'MOZ_OPTION takes 0 or 1 values')
5168 else:
5169- self.assertEquals(e.exception.message,
5170+ self.assertEqual(e.exception.message,
5171 'MOZ_OPTION takes %d value%s'
5172 % (nargs, 's' if nargs != 1 else ''))
5173
5174@@ -592,28 +592,28 @@ class TestOption(unittest.TestCase):
5175 default=default)
5176
5177 value = option.get_value('--%s-option' % disable, 'option')
5178- self.assertEquals(value, NegativeOptionValue())
5179- self.assertEquals(value.origin, 'option')
5180+ self.assertEqual(value, NegativeOptionValue())
5181+ self.assertEqual(value.origin, 'option')
5182
5183 option = self.test_option_value('%s-option' % disable, nargs=nargs,
5184 default=default)
5185
5186 if nargs in (0, '?', '*'):
5187 value = option.get_value('--%s-option' % enable, 'option')
5188- self.assertEquals(value, PositiveOptionValue())
5189- self.assertEquals(value.origin, 'option')
5190+ self.assertEqual(value, PositiveOptionValue())
5191+ self.assertEqual(value.origin, 'option')
5192 else:
5193 with self.assertRaises(InvalidOptionError) as e:
5194 option.get_value('--%s-option' % enable, 'option')
5195 if nargs == 1:
5196- self.assertEquals(e.exception.message,
5197+ self.assertEqual(e.exception.message,
5198 '--%s-option takes 1 value' % enable)
5199 elif nargs == '+':
5200- self.assertEquals(e.exception.message,
5201+ self.assertEqual(e.exception.message,
5202 '--%s-option takes 1 or more values'
5203 % enable)
5204 else:
5205- self.assertEquals(e.exception.message,
5206+ self.assertEqual(e.exception.message,
5207 '--%s-option takes 2 values' % enable)
5208
5209 def test_option_value_with(self):
5210@@ -622,12 +622,12 @@ class TestOption(unittest.TestCase):
5211 def test_option_value_invalid_nargs(self):
5212 with self.assertRaises(InvalidOptionError) as e:
5213 Option('--option', nargs='foo')
5214- self.assertEquals(e.exception.message,
5215+ self.assertEqual(e.exception.message,
5216 "nargs must be a positive integer, '?', '*' or '+'")
5217
5218 with self.assertRaises(InvalidOptionError) as e:
5219 Option('--option', nargs=-2)
5220- self.assertEquals(e.exception.message,
5221+ self.assertEqual(e.exception.message,
5222 "nargs must be a positive integer, '?', '*' or '+'")
5223
5224 def test_option_value_nargs_1(self):
5225@@ -638,7 +638,7 @@ class TestOption(unittest.TestCase):
5226 # A default is required
5227 with self.assertRaises(InvalidOptionError) as e:
5228 Option('--disable-option', nargs=1)
5229- self.assertEquals(e.exception.message,
5230+ self.assertEqual(e.exception.message,
5231 "The given `default` doesn't satisfy `nargs`")
5232
5233 def test_option_value_nargs_2(self):
5234@@ -649,7 +649,7 @@ class TestOption(unittest.TestCase):
5235 # A default is required
5236 with self.assertRaises(InvalidOptionError) as e:
5237 Option('--disable-option', nargs=2)
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_0_or_1(self):
5243@@ -676,7 +676,7 @@ class TestOption(unittest.TestCase):
5244 # A default is required
5245 with self.assertRaises(InvalidOptionError) as e:
5246 Option('--disable-option', nargs='+')
5247- self.assertEquals(e.exception.message,
5248+ self.assertEqual(e.exception.message,
5249 "The given `default` doesn't satisfy `nargs`")
5250
5251
5252@@ -684,21 +684,21 @@ class TestCommandLineHelper(unittest.TestCase):
5253 def test_basic(self):
5254 helper = CommandLineHelper({}, ['cmd', '--foo', '--bar'])
5255
5256- self.assertEquals(['--foo', '--bar'], list(helper))
5257+ self.assertEqual(['--foo', '--bar'], list(helper))
5258
5259 helper.add('--enable-qux')
5260
5261- self.assertEquals(['--foo', '--bar', '--enable-qux'], list(helper))
5262+ self.assertEqual(['--foo', '--bar', '--enable-qux'], list(helper))
5263
5264 value, option = helper.handle(Option('--bar'))
5265- self.assertEquals(['--foo', '--enable-qux'], list(helper))
5266- self.assertEquals(PositiveOptionValue(), value)
5267- self.assertEquals('--bar', option)
5268+ self.assertEqual(['--foo', '--enable-qux'], list(helper))
5269+ self.assertEqual(PositiveOptionValue(), value)
5270+ self.assertEqual('--bar', option)
5271
5272 value, option = helper.handle(Option('--baz'))
5273- self.assertEquals(['--foo', '--enable-qux'], list(helper))
5274- self.assertEquals(NegativeOptionValue(), value)
5275- self.assertEquals(None, option)
5276+ self.assertEqual(['--foo', '--enable-qux'], list(helper))
5277+ self.assertEqual(NegativeOptionValue(), value)
5278+ self.assertEqual(None, option)
5279
5280 with self.assertRaises(AssertionError):
5281 CommandLineHelper({}, ['--foo', '--bar'])
5282@@ -707,89 +707,89 @@ class TestCommandLineHelper(unittest.TestCase):
5283 foo = Option('--with-foo', nargs='*')
5284 helper = CommandLineHelper({}, ['cmd', '--with-foo=a,b'])
5285 value, option = helper.handle(foo)
5286- self.assertEquals(PositiveOptionValue(('a', 'b')), value)
5287- self.assertEquals('command-line', value.origin)
5288- self.assertEquals('--with-foo=a,b', option)
5289+ self.assertEqual(PositiveOptionValue(('a', 'b')), value)
5290+ self.assertEqual('command-line', value.origin)
5291+ self.assertEqual('--with-foo=a,b', option)
5292
5293 helper = CommandLineHelper({}, ['cmd', '--with-foo=a,b',
5294 '--without-foo'])
5295 value, option = helper.handle(foo)
5296- self.assertEquals(NegativeOptionValue(), value)
5297- self.assertEquals('command-line', value.origin)
5298- self.assertEquals('--without-foo', option)
5299+ self.assertEqual(NegativeOptionValue(), value)
5300+ self.assertEqual('command-line', value.origin)
5301+ self.assertEqual('--without-foo', option)
5302
5303 helper = CommandLineHelper({}, ['cmd', '--without-foo',
5304 '--with-foo=a,b'])
5305 value, option = helper.handle(foo)
5306- self.assertEquals(PositiveOptionValue(('a', 'b')), value)
5307- self.assertEquals('command-line', value.origin)
5308- self.assertEquals('--with-foo=a,b', option)
5309+ self.assertEqual(PositiveOptionValue(('a', 'b')), value)
5310+ self.assertEqual('command-line', value.origin)
5311+ self.assertEqual('--with-foo=a,b', option)
5312
5313 foo = Option('--with-foo', env='FOO', nargs='*')
5314 helper = CommandLineHelper({'FOO': ''}, ['cmd', '--with-foo=a,b'])
5315 value, option = helper.handle(foo)
5316- self.assertEquals(PositiveOptionValue(('a', 'b')), value)
5317- self.assertEquals('command-line', value.origin)
5318- self.assertEquals('--with-foo=a,b', option)
5319+ self.assertEqual(PositiveOptionValue(('a', 'b')), value)
5320+ self.assertEqual('command-line', value.origin)
5321+ self.assertEqual('--with-foo=a,b', option)
5322
5323 helper = CommandLineHelper({'FOO': 'a,b'}, ['cmd', '--without-foo'])
5324 value, option = helper.handle(foo)
5325- self.assertEquals(NegativeOptionValue(), value)
5326- self.assertEquals('command-line', value.origin)
5327- self.assertEquals('--without-foo', option)
5328+ self.assertEqual(NegativeOptionValue(), value)
5329+ self.assertEqual('command-line', value.origin)
5330+ self.assertEqual('--without-foo', option)
5331
5332 helper = CommandLineHelper({'FOO': ''}, ['cmd', '--with-bar=a,b'])
5333 value, option = helper.handle(foo)
5334- self.assertEquals(NegativeOptionValue(), value)
5335- self.assertEquals('environment', value.origin)
5336- self.assertEquals('FOO=', option)
5337+ self.assertEqual(NegativeOptionValue(), value)
5338+ self.assertEqual('environment', value.origin)
5339+ self.assertEqual('FOO=', option)
5340
5341 helper = CommandLineHelper({'FOO': 'a,b'}, ['cmd', '--without-bar'])
5342 value, option = helper.handle(foo)
5343- self.assertEquals(PositiveOptionValue(('a', 'b')), value)
5344- self.assertEquals('environment', value.origin)
5345- self.assertEquals('FOO=a,b', option)
5346+ self.assertEqual(PositiveOptionValue(('a', 'b')), value)
5347+ self.assertEqual('environment', value.origin)
5348+ self.assertEqual('FOO=a,b', option)
5349
5350 helper = CommandLineHelper({}, ['cmd', '--with-foo=a,b', 'FOO='])
5351 value, option = helper.handle(foo)
5352- self.assertEquals(NegativeOptionValue(), value)
5353- self.assertEquals('command-line', value.origin)
5354- self.assertEquals('FOO=', option)
5355+ self.assertEqual(NegativeOptionValue(), value)
5356+ self.assertEqual('command-line', value.origin)
5357+ self.assertEqual('FOO=', option)
5358
5359 helper = CommandLineHelper({}, ['cmd', '--without-foo', 'FOO=a,b'])
5360 value, option = helper.handle(foo)
5361- self.assertEquals(PositiveOptionValue(('a', 'b')), value)
5362- self.assertEquals('command-line', value.origin)
5363- self.assertEquals('FOO=a,b', option)
5364+ self.assertEqual(PositiveOptionValue(('a', 'b')), value)
5365+ self.assertEqual('command-line', value.origin)
5366+ self.assertEqual('FOO=a,b', option)
5367
5368 helper = CommandLineHelper({}, ['cmd', 'FOO=', '--with-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('--with-foo=a,b', option)
5373+ self.assertEqual(PositiveOptionValue(('a', 'b')), value)
5374+ self.assertEqual('command-line', value.origin)
5375+ self.assertEqual('--with-foo=a,b', option)
5376
5377 helper = CommandLineHelper({}, ['cmd', 'FOO=a,b', '--without-foo'])
5378 value, option = helper.handle(foo)
5379- self.assertEquals(NegativeOptionValue(), value)
5380- self.assertEquals('command-line', value.origin)
5381- self.assertEquals('--without-foo', option)
5382+ self.assertEqual(NegativeOptionValue(), value)
5383+ self.assertEqual('command-line', value.origin)
5384+ self.assertEqual('--without-foo', option)
5385
5386 def test_extra_args(self):
5387 foo = Option('--with-foo', env='FOO', nargs='*')
5388 helper = CommandLineHelper({}, ['cmd'])
5389 helper.add('FOO=a,b,c', 'other-origin')
5390 value, option = helper.handle(foo)
5391- self.assertEquals(PositiveOptionValue(('a', 'b', 'c')), value)
5392- self.assertEquals('other-origin', value.origin)
5393- self.assertEquals('FOO=a,b,c', option)
5394+ self.assertEqual(PositiveOptionValue(('a', 'b', 'c')), value)
5395+ self.assertEqual('other-origin', value.origin)
5396+ self.assertEqual('FOO=a,b,c', option)
5397
5398 helper = CommandLineHelper({}, ['cmd'])
5399 helper.add('FOO=a,b,c', 'other-origin')
5400 helper.add('--with-foo=a,b,c', 'other-origin')
5401 value, option = helper.handle(foo)
5402- self.assertEquals(PositiveOptionValue(('a', 'b', 'c')), value)
5403- self.assertEquals('other-origin', value.origin)
5404- self.assertEquals('--with-foo=a,b,c', option)
5405+ self.assertEqual(PositiveOptionValue(('a', 'b', 'c')), value)
5406+ self.assertEqual('other-origin', value.origin)
5407+ self.assertEqual('--with-foo=a,b,c', option)
5408
5409 # Adding conflicting options is not allowed.
5410 helper = CommandLineHelper({}, ['cmd'])
5411@@ -809,9 +809,9 @@ class TestCommandLineHelper(unittest.TestCase):
5412 # But adding the same is allowed.
5413 helper.add('FOO=a,b,c', 'other-origin')
5414 value, option = helper.handle(foo)
5415- self.assertEquals(PositiveOptionValue(('a', 'b', 'c')), value)
5416- self.assertEquals('other-origin', value.origin)
5417- self.assertEquals('FOO=a,b,c', option)
5418+ self.assertEqual(PositiveOptionValue(('a', 'b', 'c')), value)
5419+ self.assertEqual('other-origin', value.origin)
5420+ self.assertEqual('FOO=a,b,c', option)
5421
5422 # The same rule as above applies when using the option form vs. the
5423 # variable form. But we can't detect it when .add is called.
5424@@ -837,9 +837,9 @@ class TestCommandLineHelper(unittest.TestCase):
5425 helper.add('FOO=a,b,c', 'other-origin')
5426 helper.add('--with-foo=a,b,c', 'other-origin')
5427 value, option = helper.handle(foo)
5428- self.assertEquals(PositiveOptionValue(('a', 'b', 'c')), value)
5429- self.assertEquals('other-origin', value.origin)
5430- self.assertEquals('--with-foo=a,b,c', option)
5431+ self.assertEqual(PositiveOptionValue(('a', 'b', 'c')), value)
5432+ self.assertEqual('other-origin', value.origin)
5433+ self.assertEqual('--with-foo=a,b,c', option)
5434
5435 # Conflicts are also not allowed against what is in the
5436 # environment/on the command line.
5437@@ -869,19 +869,19 @@ class TestCommandLineHelper(unittest.TestCase):
5438 foo = Option('--foo',
5439 possible_origins=('command-line',))
5440 value, option = helper.handle(foo)
5441- self.assertEquals(PositiveOptionValue(), value)
5442- self.assertEquals('command-line', value.origin)
5443- self.assertEquals('--foo', option)
5444+ self.assertEqual(PositiveOptionValue(), value)
5445+ self.assertEqual('command-line', value.origin)
5446+ self.assertEqual('--foo', option)
5447
5448 bar = Option('--bar',
5449 possible_origins=('mozconfig',))
5450- with self.assertRaisesRegexp(InvalidOptionError,
5451+ with self.assertRaisesRegex(InvalidOptionError,
5452 "--bar can not be set by command-line. Values are accepted from: mozconfig"):
5453 helper.handle(bar)
5454
5455 baz = Option(env='BAZ',
5456 possible_origins=('implied',))
5457- with self.assertRaisesRegexp(InvalidOptionError,
5458+ with self.assertRaisesRegex(InvalidOptionError,
5459 "BAZ=1 can not be set by environment. Values are accepted from: implied"):
5460 helper.handle(baz)
5461
5462diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
5463index cb7ff709e..c339a32bf 100755
5464--- a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
5465+++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py
5466@@ -2,12 +2,12 @@
5467 # License, v. 2.0. If a copy of the MPL was not distributed with this
5468 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5469
5470-from __future__ import absolute_import, print_function, unicode_literals
5471+
5472
5473 import logging
5474 import os
5475
5476-from StringIO import StringIO
5477+from io import StringIO
5478
5479 from mozunit import main
5480
5481@@ -366,9 +366,9 @@ class BaseToolchainTest(BaseConfigureTest):
5482 compiler = sandbox._value_for(sandbox[var])
5483 # Add var on both ends to make it clear which of the
5484 # variables is failing the test when that happens.
5485- self.assertEquals((var, compiler), (var, result))
5486+ self.assertEqual((var, compiler), (var, result))
5487 except SystemExit:
5488- self.assertEquals((var, result),
5489+ self.assertEqual((var, result),
5490 (var, self.out.getvalue().strip()))
5491 return
5492
5493@@ -407,7 +407,7 @@ class BaseToolchainTest(BaseConfigureTest):
5494 'RUST_LIB_SUFFIX',
5495 'OBJ_SUFFIX',
5496 ):
5497- self.assertEquals('%s=%s' % (k, sandbox.get_config(k)),
5498+ self.assertEqual('%s=%s' % (k, sandbox.get_config(k)),
5499 '%s=%s' % (k, library_name_info[k]))
5500
5501
5502@@ -584,7 +584,7 @@ class LinuxToolchainTest(BaseToolchainTest):
5503 # We'll try gcc and clang, but since there is no gcc (gcc-x.y doesn't
5504 # count), find clang.
5505 paths = {
5506- k: v for k, v in self.PATHS.iteritems()
5507+ k: v for k, v in self.PATHS.items()
5508 if os.path.basename(k) not in ('gcc', 'g++')
5509 }
5510 self.do_toolchain_test(paths, {
5511@@ -619,7 +619,7 @@ class LinuxToolchainTest(BaseToolchainTest):
5512 # Even if there are gcc-x.y or clang-x.y compilers available, we
5513 # don't try them. This could be considered something to improve.
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++', 'clang', 'clang++')
5518 }
5519 self.do_toolchain_test(paths, {
5520@@ -800,7 +800,7 @@ class OSXToolchainTest(BaseToolchainTest):
5521 def test_not_gcc(self):
5522 # We won't pick GCC if it's the only thing available.
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 ('clang', 'clang++')
5527 }
5528 self.do_toolchain_test(paths, {
5529@@ -976,7 +976,7 @@ class WindowsToolchainTest(BaseToolchainTest):
5530 def test_clang_cl(self):
5531 # We'll pick clang-cl if msvc can't be found.
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) != 'cl'
5536 }
5537 self.do_toolchain_test(paths, {
5538@@ -987,7 +987,7 @@ class WindowsToolchainTest(BaseToolchainTest):
5539 def test_gcc(self):
5540 # We'll pick GCC if msvc and clang-cl 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) not in ('cl', 'clang-cl')
5545 }
5546 self.do_toolchain_test(paths, {
5547@@ -1006,7 +1006,7 @@ class WindowsToolchainTest(BaseToolchainTest):
5548 def test_clang(self):
5549 # We'll pick clang if nothing else is 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', 'gcc')
5554 }
5555 self.do_toolchain_test(paths, {
5556diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_helpers.py b/python/mozbuild/mozbuild/test/configure/test_toolchain_helpers.py
5557index 8ec33a8b7..ba046ed12 100644
5558--- a/python/mozbuild/mozbuild/test/configure/test_toolchain_helpers.py
5559+++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_helpers.py
5560@@ -2,7 +2,7 @@
5561 # License, v. 2.0. If a copy of the MPL was not distributed with this
5562 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5563
5564-from __future__ import absolute_import, print_function, unicode_literals
5565+
5566
5567 import copy
5568 import re
5569@@ -10,7 +10,7 @@ import types
5570 import unittest
5571
5572 from fnmatch import fnmatch
5573-from StringIO import StringIO
5574+from io import StringIO
5575 from textwrap import dedent
5576
5577 from mozunit import (
5578@@ -43,7 +43,7 @@ class CompilerPreprocessor(Preprocessor):
5579 # Hack around it enough that the configure tests work properly.
5580 context = self.context
5581 def normalize_numbers(value):
5582- if isinstance(value, types.StringTypes):
5583+ if isinstance(value, (str,)):
5584 if value[-1:] == 'L' and value[:-1].isdigit():
5585 value = int(value[:-1])
5586 return value
5587@@ -53,7 +53,7 @@ class CompilerPreprocessor(Preprocessor):
5588 return self.HAS_FEATURE.sub(r'\1\2', expr)
5589 self.context = self.Context(
5590 (normalize_has_feature(k), normalize_numbers(v))
5591- for k, v in context.iteritems()
5592+ for k, v in context.items()
5593 )
5594 try:
5595 return Preprocessor.do_if(self, normalize_has_feature(expression),
5596@@ -95,7 +95,7 @@ class TestCompilerPreprocessor(unittest.TestCase):
5597 input.name = 'foo'
5598 pp.do_include(input)
5599
5600- self.assertEquals(pp.out.getvalue(), '1 . 2 . c "D"')
5601+ self.assertEqual(pp.out.getvalue(), '1 . 2 . c "D"')
5602
5603 def test_condition(self):
5604 pp = CompilerPreprocessor({
5605@@ -125,7 +125,7 @@ class TestCompilerPreprocessor(unittest.TestCase):
5606 input.name = 'foo'
5607 pp.do_include(input)
5608
5609- self.assertEquals('IFDEF_A\nIF_A\nIF_B\nIF_NOT_C\n', pp.out.getvalue())
5610+ self.assertEqual('IFDEF_A\nIF_A\nIF_B\nIF_NOT_C\n', pp.out.getvalue())
5611
5612
5613 class FakeCompiler(dict):
5614@@ -164,9 +164,9 @@ class FakeCompiler(dict):
5615 '''
5616 def __init__(self, *definitions):
5617 for definition in definitions:
5618- if all(not isinstance(d, dict) for d in definition.itervalues()):
5619+ if all(not isinstance(d, dict) for d in definition.values()):
5620 definition = {None: definition}
5621- for key, value in definition.iteritems():
5622+ for key, value in definition.items():
5623 self.setdefault(key, {}).update(value)
5624
5625 def __call__(self, stdin, args):
5626@@ -178,14 +178,14 @@ class FakeCompiler(dict):
5627 pp = CompilerPreprocessor(self[None])
5628
5629 def apply_defn(defn):
5630- for k, v in defn.iteritems():
5631+ for k, v in defn.items():
5632 if v is False:
5633 if k in pp.context:
5634 del pp.context[k]
5635 else:
5636 pp.context[k] = v
5637
5638- for glob, defn in self.iteritems():
5639+ for glob, defn in self.items():
5640 if glob and not glob.startswith('-') and fnmatch(file, glob):
5641 apply_defn(defn)
5642
5643@@ -216,7 +216,7 @@ class TestFakeCompiler(unittest.TestCase):
5644 'A': '1',
5645 'B': '2',
5646 })
5647- self.assertEquals(compiler(None, ['-E', 'file']),
5648+ self.assertEqual(compiler(None, ['-E', 'file']),
5649 (0, '1 2 C', ''))
5650
5651 compiler = FakeCompiler({
5652@@ -238,25 +238,25 @@ class TestFakeCompiler(unittest.TestCase):
5653 'B': '42',
5654 },
5655 })
5656- self.assertEquals(compiler(None, ['-E', 'file']),
5657+ self.assertEqual(compiler(None, ['-E', 'file']),
5658 (0, '1 2 C', ''))
5659- self.assertEquals(compiler(None, ['-E', '-foo', 'file']),
5660+ self.assertEqual(compiler(None, ['-E', '-foo', 'file']),
5661 (0, '1 2 foo', ''))
5662- self.assertEquals(compiler(None, ['-E', '-bar', 'file']),
5663+ self.assertEqual(compiler(None, ['-E', '-bar', 'file']),
5664 (0, '1 bar bar', ''))
5665- self.assertEquals(compiler(None, ['-E', '-qux', 'file']),
5666+ self.assertEqual(compiler(None, ['-E', '-qux', 'file']),
5667 (0, '1 B C', ''))
5668- self.assertEquals(compiler(None, ['-E', '-foo', '-bar', 'file']),
5669+ self.assertEqual(compiler(None, ['-E', '-foo', '-bar', 'file']),
5670 (0, '1 bar bar', ''))
5671- self.assertEquals(compiler(None, ['-E', '-bar', '-foo', 'file']),
5672+ self.assertEqual(compiler(None, ['-E', '-bar', '-foo', 'file']),
5673 (0, '1 bar foo', ''))
5674- self.assertEquals(compiler(None, ['-E', '-bar', '-qux', 'file']),
5675+ self.assertEqual(compiler(None, ['-E', '-bar', '-qux', 'file']),
5676 (0, '1 B bar', ''))
5677- self.assertEquals(compiler(None, ['-E', '-qux', '-bar', 'file']),
5678+ self.assertEqual(compiler(None, ['-E', '-qux', '-bar', 'file']),
5679 (0, '1 bar bar', ''))
5680- self.assertEquals(compiler(None, ['-E', 'file.c']),
5681+ self.assertEqual(compiler(None, ['-E', 'file.c']),
5682 (0, '1 42 C', ''))
5683- self.assertEquals(compiler(None, ['-E', '-bar', 'file.c']),
5684+ self.assertEqual(compiler(None, ['-E', '-bar', 'file.c']),
5685 (0, '1 bar bar', ''))
5686
5687 def test_multiple_definitions(self):
5688@@ -267,7 +267,7 @@ class TestFakeCompiler(unittest.TestCase):
5689 'C': 3,
5690 })
5691
5692- self.assertEquals(compiler, {
5693+ self.assertEqual(compiler, {
5694 None: {
5695 'A': 1,
5696 'B': 2,
5697@@ -282,7 +282,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': 4,
5706@@ -302,7 +302,7 @@ class TestFakeCompiler(unittest.TestCase):
5707 },
5708 })
5709
5710- self.assertEquals(compiler, {
5711+ self.assertEqual(compiler, {
5712 None: {
5713 'A': 1,
5714 'B': 4,
5715@@ -330,7 +330,7 @@ class TestFakeCompiler(unittest.TestCase):
5716 },
5717 })
5718
5719- self.assertEquals(compiler, {
5720+ self.assertEqual(compiler, {
5721 None: {
5722 'A': 1,
5723 'B': 2,
5724@@ -370,7 +370,7 @@ class CompilerResult(ReadOnlyNamespace):
5725 def __add__(self, other):
5726 assert isinstance(other, dict)
5727 result = copy.deepcopy(self.__dict__)
5728- for k, v in other.iteritems():
5729+ for k, v in other.items():
5730 if k == 'flags':
5731 result.setdefault(k, []).extend(v)
5732 else:
5733@@ -381,7 +381,7 @@ class CompilerResult(ReadOnlyNamespace):
5734 class TestCompilerResult(unittest.TestCase):
5735 def test_compiler_result(self):
5736 result = CompilerResult()
5737- self.assertEquals(result.__dict__, {
5738+ self.assertEqual(result.__dict__, {
5739 'wrapper': [],
5740 'compiler': mozpath.abspath(''),
5741 'version': '',
5742@@ -397,7 +397,7 @@ class TestCompilerResult(unittest.TestCase):
5743 language='C',
5744 flags=['-std=gnu99'],
5745 )
5746- self.assertEquals(result.__dict__, {
5747+ self.assertEqual(result.__dict__, {
5748 'wrapper': [],
5749 'compiler': mozpath.abspath('/usr/bin/gcc'),
5750 'version': '4.2.1',
5751@@ -407,7 +407,7 @@ class TestCompilerResult(unittest.TestCase):
5752 })
5753
5754 result2 = result + {'flags': ['-m32']}
5755- self.assertEquals(result2.__dict__, {
5756+ self.assertEqual(result2.__dict__, {
5757 'wrapper': [],
5758 'compiler': mozpath.abspath('/usr/bin/gcc'),
5759 'version': '4.2.1',
5760@@ -416,14 +416,14 @@ class TestCompilerResult(unittest.TestCase):
5761 'flags': ['-std=gnu99', '-m32'],
5762 })
5763 # Original flags are untouched.
5764- self.assertEquals(result.flags, ['-std=gnu99'])
5765+ self.assertEqual(result.flags, ['-std=gnu99'])
5766
5767 result3 = result + {
5768 'compiler': '/usr/bin/gcc-4.7',
5769 'version': '4.7.3',
5770 'flags': ['-m32'],
5771 }
5772- self.assertEquals(result3.__dict__, {
5773+ self.assertEqual(result3.__dict__, {
5774 'wrapper': [],
5775 'compiler': mozpath.abspath('/usr/bin/gcc-4.7'),
5776 'version': '4.7.3',
5777diff --git a/python/mozbuild/mozbuild/test/configure/test_toolkit_moz_configure.py b/python/mozbuild/mozbuild/test/configure/test_toolkit_moz_configure.py
5778index ac35d745f..cdd8ece1b 100644
5779--- a/python/mozbuild/mozbuild/test/configure/test_toolkit_moz_configure.py
5780+++ b/python/mozbuild/mozbuild/test/configure/test_toolkit_moz_configure.py
5781@@ -2,7 +2,7 @@
5782 # License, v. 2.0. If a copy of the MPL was not distributed with this
5783 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5784
5785-from __future__ import absolute_import, print_function, unicode_literals
5786+
5787
5788 import os
5789
5790diff --git a/python/mozbuild/mozbuild/test/configure/test_util.py b/python/mozbuild/mozbuild/test/configure/test_util.py
5791index 9f9575fd0..c2db1a628 100644
5792--- a/python/mozbuild/mozbuild/test/configure/test_util.py
5793+++ b/python/mozbuild/mozbuild/test/configure/test_util.py
5794@@ -2,7 +2,7 @@
5795 # License, v. 2.0. If a copy of the MPL was not distributed with this
5796 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5797
5798-from __future__ import absolute_import, print_function, unicode_literals
5799+
5800
5801 import logging
5802 import os
5803@@ -11,7 +11,7 @@ import textwrap
5804 import unittest
5805 import sys
5806
5807-from StringIO import StringIO
5808+from io import StringIO
5809
5810 from mozunit import main
5811 from mozpack import path as mozpath
5812@@ -434,11 +434,11 @@ class TestLogSubprocessOutput(unittest.TestCase):
5813 except SystemExit as e:
5814 status = e.code
5815
5816- self.assertEquals(status, 0)
5817+ self.assertEqual(status, 0)
5818 quote_char = "'"
5819 if getpreferredencoding().lower() == 'utf-8':
5820 quote_char = '\u00B4'.encode('utf-8')
5821- self.assertEquals(out.getvalue().strip(), quote_char)
5822+ self.assertEqual(out.getvalue().strip(), quote_char)
5823
5824
5825 class TestVersion(unittest.TestCase):
5826diff --git a/python/mozbuild/mozbuild/testing.py b/python/mozbuild/mozbuild/testing.py
5827index 3229c3f77..82d250fab 100644
5828--- a/python/mozbuild/mozbuild/testing.py
5829+++ b/python/mozbuild/mozbuild/testing.py
5830@@ -2,9 +2,9 @@
5831 # License, v. 2.0. If a copy of the MPL was not distributed with this
5832 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5833
5834-from __future__ import absolute_import, unicode_literals
5835
5836-import cPickle as pickle
5837+
5838+import pickle as pickle
5839 import os
5840 import sys
5841
5842@@ -70,7 +70,7 @@ REFTEST_FLAVORS = ('crashtest', 'reftest')
5843 WEB_PLATFORM_TESTS_FLAVORS = ('web-platform-tests',)
5844
5845 def all_test_flavors():
5846- return ([v[0] for v in TEST_MANIFESTS.values()] +
5847+ return ([v[0] for v in list(TEST_MANIFESTS.values())] +
5848 list(REFTEST_FLAVORS) +
5849 list(WEB_PLATFORM_TESTS_FLAVORS))
5850
5851@@ -210,7 +210,7 @@ def install_test_files(topsrcdir, topobjdir, tests_root, test_objs):
5852 only a few tests need to be run.
5853 """
5854 flavor_info = {flavor: (root, prefix, install)
5855- for (flavor, root, prefix, install) in TEST_MANIFESTS.values()}
5856+ for (flavor, root, prefix, install) in list(TEST_MANIFESTS.values())}
5857 objdir_dest = mozpath.join(topobjdir, tests_root)
5858
5859 converter = SupportFilesConverter()
5860@@ -292,7 +292,7 @@ def read_wpt_manifest(context, paths):
5861 paths_file = os.path.join(context.config.topsrcdir, "testing",
5862 "web-platform", "tests", "tools", "localpaths.py")
5863 _globals = {"__file__": paths_file}
5864- execfile(paths_file, _globals)
5865+ exec(compile(open(paths_file, "rb").read(), paths_file, 'exec'), _globals)
5866 import manifest as wptmanifest
5867 finally:
5868 sys.path = old_path
5869diff --git a/python/mozbuild/mozbuild/util.py b/python/mozbuild/mozbuild/util.py
5870index 4ea227dc0..79cb15713 100644
5871--- a/python/mozbuild/mozbuild/util.py
5872+++ b/python/mozbuild/mozbuild/util.py
5873@@ -5,7 +5,7 @@
5874 # This file contains miscellaneous utility functions that don't belong anywhere
5875 # in particular.
5876
5877-from __future__ import absolute_import, unicode_literals, print_function
5878+
5879
5880 import argparse
5881 import collections
5882@@ -21,6 +21,9 @@ import stat
5883 import sys
5884 import time
5885 import types
5886+import pprint
5887+import six
5888+import subprocess
5889
5890 from collections import (
5891 defaultdict,
5892@@ -36,7 +39,7 @@ from io import (
5893 if sys.version_info[0] == 3:
5894 str_type = str
5895 else:
5896- str_type = basestring
5897+ str_type = str
5898
5899 if sys.platform == 'win32':
5900 _kernel32 = ctypes.windll.kernel32
5901@@ -78,7 +81,7 @@ def hash_file(path, hasher=None):
5902 return h.hexdigest()
5903
5904
5905-class EmptyValue(unicode):
5906+class EmptyValue(str):
5907 """A dummy type that behaves like an empty string and sequence.
5908
5909 This type exists in order to support
5910@@ -92,7 +95,7 @@ class EmptyValue(unicode):
5911 class ReadOnlyNamespace(object):
5912 """A class for objects with immutable attributes set at initialization."""
5913 def __init__(self, **kwargs):
5914- for k, v in kwargs.iteritems():
5915+ for k, v in kwargs.items():
5916 super(ReadOnlyNamespace, self).__setattr__(k, v)
5917
5918 def __delattr__(self, key):
5919@@ -224,7 +227,7 @@ class FileAvoidWrite(BytesIO):
5920 self.mode = mode
5921
5922 def write(self, buf):
5923- if isinstance(buf, unicode):
5924+ if isinstance(buf, str):
5925 buf = buf.encode('utf-8')
5926 BytesIO.write(self, buf)
5927
5928@@ -267,6 +270,10 @@ class FileAvoidWrite(BytesIO):
5929 if 'b' in self.mode:
5930 writemode += 'b'
5931 with open(self.name, writemode) as file:
5932+ if 'b' in self.mode and isinstance(buf, str):
5933+ buf = buf.encode('utf-8')
5934+ elif 'b' not in self.mode and isinstance(buf, bytes):
5935+ buf = buf.decode('utf-8')
5936 file.write(buf)
5937
5938 if self._capture_diff:
5939@@ -381,7 +388,7 @@ class ListMixin(object):
5940 def __add__(self, other):
5941 # Allow None and EmptyValue is a special case because it makes undefined
5942 # variable references in moz.build behave better.
5943- other = [] if isinstance(other, (types.NoneType, EmptyValue)) else other
5944+ other = [] if isinstance(other, (type(None), EmptyValue)) else other
5945 if not isinstance(other, list):
5946 raise ValueError('Only lists can be appended to lists.')
5947
5948@@ -390,7 +397,7 @@ class ListMixin(object):
5949 return new_list
5950
5951 def __iadd__(self, other):
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@@ -561,14 +568,14 @@ def FlagsFactory(flags):
5958 functions below.
5959 """
5960 assert isinstance(flags, dict)
5961- assert all(isinstance(v, type) for v in flags.values())
5962+ assert all(isinstance(v, type) for v in list(flags.values()))
5963
5964 class Flags(object):
5965- __slots__ = flags.keys()
5966+ __slots__ = list(flags.keys())
5967 _flags = flags
5968
5969 def update(self, **kwargs):
5970- for k, v in kwargs.iteritems():
5971+ for k, v in kwargs.items():
5972 setattr(self, k, v)
5973
5974 def __getattr__(self, name):
5975@@ -1006,8 +1013,6 @@ def TypedNamedTuple(name, fields):
5976 'got %s, expected %s' % (fname,
5977 type(value), ftype))
5978
5979- super(TypedTuple, self).__init__(*args, **kwargs)
5980-
5981 TypedTuple._fields = fields
5982
5983 return TypedTuple
5984@@ -1099,14 +1104,14 @@ def group_unified_files(files, unified_prefix, unified_suffix,
5985 # issue. So we do a little dance to filter it out ourselves.
5986 dummy_fill_value = ("dummy",)
5987 def filter_out_dummy(iterable):
5988- return itertools.ifilter(lambda x: x != dummy_fill_value,
5989+ return filter(lambda x: x != dummy_fill_value,
5990 iterable)
5991
5992 # From the itertools documentation, slightly modified:
5993 def grouper(n, iterable):
5994 "grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx"
5995 args = [iter(iterable)] * n
5996- return itertools.izip_longest(fillvalue=dummy_fill_value, *args)
5997+ return itertools.zip_longest(fillvalue=dummy_fill_value, *args)
5998
5999 for i, unified_group in enumerate(grouper(files_per_unified_file,
6000 files)):
6001@@ -1123,7 +1128,7 @@ def pair(iterable):
6002 [(1,2), (3,4), (5,6)]
6003 '''
6004 i = iter(iterable)
6005- return itertools.izip_longest(i, i)
6006+ return itertools.zip_longest(i, i)
6007
6008
6009 VARIABLES_RE = re.compile('\$\((\w+)\)')
6010@@ -1141,7 +1146,7 @@ def expand_variables(s, variables):
6011 value = variables.get(name)
6012 if not value:
6013 continue
6014- if not isinstance(value, types.StringTypes):
6015+ if not isinstance(value, (str,)):
6016 value = ' '.join(value)
6017 result += value
6018 return result
6019@@ -1168,7 +1173,7 @@ class EnumStringComparisonError(Exception):
6020 pass
6021
6022
6023-class EnumString(unicode):
6024+class EnumString(str):
6025 '''A string type that only can have a limited set of values, similarly to
6026 an Enum, and can only be compared against that set of values.
6027
6028@@ -1185,8 +1190,8 @@ class EnumString(unicode):
6029 def __eq__(self, other):
6030 if other not in self.POSSIBLE_VALUES:
6031 raise EnumStringComparisonError(
6032- 'Can only compare with %s'
6033- % ', '.join("'%s'" % v for v in self.POSSIBLE_VALUES))
6034+ '%s is not in %s'
6035+ % (other, ', '.join("'%s'" % v for v in self.POSSIBLE_VALUES)))
6036 return super(EnumString, self).__eq__(other)
6037
6038 def __ne__(self, other):
6039@@ -1204,14 +1209,14 @@ def _escape_char(c):
6040 # quoting could be done with either ' or ".
6041 if c == "'":
6042 return "\\'"
6043- return unicode(c.encode('unicode_escape'))
6044+ return str(c.encode('unicode_escape'))
6045
6046 # Mapping table between raw characters below \x80 and their escaped
6047 # counterpart, when they differ
6048 _INDENTED_REPR_TABLE = {
6049 c: e
6050 for c, e in map(lambda x: (x, _escape_char(x)),
6051- map(unichr, range(128)))
6052+ map(chr, range(128)))
6053 if c != e
6054 }
6055 # Regexp matching all characters to escape.
6056@@ -1219,7 +1224,33 @@ _INDENTED_REPR_RE = re.compile(
6057 '([' + ''.join(_INDENTED_REPR_TABLE.values()) + ']+)')
6058
6059
6060+# Stolen from gecko master [1]
6061+# [1] https://github.com/mozilla/gecko-dev/blob/4165a2e843c494bfb3e35d8a1fbf9c61209e3675/python/mozbuild/mozbuild/util.py#L1286
6062+
6063+# The default PrettyPrinter has some issues with UTF-8, so we need to override
6064+# some stuff here.
6065+class _PrettyPrinter(pprint.PrettyPrinter):
6066+ def format(self, object, context, maxlevels, level):
6067+ if not (isinstance(object, six.text_type) or
6068+ isinstance(object, six.binary_type)):
6069+ return super(_PrettyPrinter, self).format(
6070+ object, context, maxlevels, level)
6071+ # This is super hacky and weird, but the output of 'repr' actually
6072+ # varies based on the default I/O encoding of the process, which isn't
6073+ # necessarily utf-8. Instead we open a new shell and ask what the repr
6074+ # WOULD be assuming the default encoding is utf-8. If you can come up
6075+ # with a better way of doing this without simply re-implementing the
6076+ # logic of "repr", please replace this.
6077+ env = dict(os.environ)
6078+ env['PYTHONIOENCODING'] = 'utf-8'
6079+ ret = six.ensure_text(subprocess.check_output(
6080+ [sys.executable], input='print(repr(%s))' % repr(object),
6081+ universal_newlines=True, env=env, encoding='utf-8')).strip()
6082+ return (ret, True, False)
6083+
6084 def indented_repr(o, indent=4):
6085+ return _PrettyPrinter(indent=indent).pformat(o)
6086+
6087 '''Similar to repr(), but returns an indented representation of the object
6088
6089 One notable difference with repr is that the returned representation
6090@@ -1242,7 +1273,7 @@ def indented_repr(o, indent=4):
6091 elif isinstance(o, bytes):
6092 yield 'b'
6093 yield repr(o)
6094- elif isinstance(o, unicode):
6095+ elif isinstance(o, str):
6096 yield "'"
6097 # We want a readable string (non escaped unicode), but some
6098 # special characters need escaping (e.g. \n, \t, etc.)
6099@@ -1272,11 +1303,11 @@ def encode(obj, encoding='utf-8'):
6100 if isinstance(obj, dict):
6101 return {
6102 encode(k, encoding): encode(v, encoding)
6103- for k, v in obj.iteritems()
6104+ for k, v in obj.items()
6105 }
6106 if isinstance(obj, bytes):
6107 return obj
6108- if isinstance(obj, unicode):
6109+ if isinstance(obj, str):
6110 return obj.encode(encoding)
6111 if isinstance(obj, Iterable):
6112 return [encode(i, encoding) for i in obj]
6113diff --git a/python/mozbuild/mozbuild/virtualenv.py b/python/mozbuild/mozbuild/virtualenv.py
6114index 38d06d71d..c67c046f3 100644
6115--- a/python/mozbuild/mozbuild/virtualenv.py
6116+++ b/python/mozbuild/mozbuild/virtualenv.py
6117@@ -531,9 +531,9 @@ def verify_python_version(log_handle):
6118
6119 our = LooseVersion('%d.%d.%d' % (major, minor, micro))
6120
6121- if major != MINIMUM_PYTHON_MAJOR or our < MINIMUM_PYTHON_VERSION:
6122- log_handle.write('Python %s or greater (but not Python 3) is '
6123- 'required to build. ' % MINIMUM_PYTHON_VERSION)
6124+ if our < MINIMUM_PYTHON_VERSION:
6125+ log_handle.write('Python %s or greater is required to build. '
6126+ % MINIMUM_PYTHON_VERSION)
6127 log_handle.write('You are running Python %s.\n' % our)
6128
6129 if os.name in ('nt', 'ce'):
6130diff --git a/python/mozbuild/mozpack/chrome/manifest.py b/python/mozbuild/mozpack/chrome/manifest.py
6131index c91b99cf1..02eac0dbb 100644
6132--- a/python/mozbuild/mozpack/chrome/manifest.py
6133+++ b/python/mozbuild/mozpack/chrome/manifest.py
6134@@ -2,11 +2,11 @@
6135 # License, v. 2.0. If a copy of the MPL was not distributed with this
6136 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
6137
6138-from __future__ import absolute_import
6139+
6140
6141 import re
6142 import os
6143-from urlparse import urlparse
6144+from urllib.parse import urlparse
6145 import mozpack.path as mozpath
6146 from mozpack.chrome.flags import Flags
6147 from mozpack.errors import errors
6148@@ -316,7 +316,7 @@ class ManifestContract(ManifestEntry):
6149 return self.serialize(self.contractID, self.cid)
6150
6151 # All manifest classes by their type name.
6152-MANIFESTS_TYPES = dict([(c.type, c) for c in globals().values()
6153+MANIFESTS_TYPES = dict([(c.type, c) for c in list(globals().values())
6154 if type(c) == type and issubclass(c, ManifestEntry)
6155 and hasattr(c, 'type') and c.type])
6156
6157diff --git a/python/mozbuild/mozpack/copier.py b/python/mozbuild/mozpack/copier.py
6158index 1e521e52b..43ed9be4a 100644
6159--- a/python/mozbuild/mozpack/copier.py
6160+++ b/python/mozbuild/mozpack/copier.py
6161@@ -2,7 +2,7 @@
6162 # License, v. 2.0. If a copy of the MPL was not distributed with this
6163 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
6164
6165-from __future__ import absolute_import
6166+
6167
6168 import os
6169 import stat
6170@@ -113,7 +113,7 @@ class FileRegistry(object):
6171 '''
6172 Return all paths stored in the container, in the order they were added.
6173 '''
6174- return self._files.keys()
6175+ return list(self._files.keys())
6176
6177 def __len__(self):
6178 '''
6179@@ -146,7 +146,7 @@ class FileRegistry(object):
6180 for path, file in registry:
6181 (...)
6182 '''
6183- return self._files.iteritems()
6184+ return iter(self._files.items())
6185
6186 def required_directories(self):
6187 '''
6188@@ -155,7 +155,7 @@ class FileRegistry(object):
6189 unspecified (virtual) root directory (and do not include said root
6190 directory).
6191 '''
6192- return set(k for k, v in self._required_directories.items() if v > 0)
6193+ return set(k for k, v in list(self._required_directories.items()) if v > 0)
6194
6195 def output_to_inputs_tree(self):
6196 '''
6197@@ -295,7 +295,7 @@ class FileCopier(FileRegistry):
6198
6199 Returns a FileCopyResult that details what changed.
6200 '''
6201- assert isinstance(destination, basestring)
6202+ assert isinstance(destination, str)
6203 assert not os.path.exists(destination) or os.path.isdir(destination)
6204
6205 result = FileCopyResult()
6206@@ -563,7 +563,7 @@ class Jarrer(FileRegistry, BaseFile):
6207 def exists(self):
6208 return self.deflater is not None
6209
6210- if isinstance(dest, basestring):
6211+ if isinstance(dest, str):
6212 dest = Dest(dest)
6213 assert isinstance(dest, Dest)
6214
6215diff --git a/python/mozbuild/mozpack/files.py b/python/mozbuild/mozpack/files.py
6216index 8ce353375..bf35e39b8 100644
6217--- a/python/mozbuild/mozpack/files.py
6218+++ b/python/mozbuild/mozpack/files.py
6219@@ -2,7 +2,7 @@
6220 # License, v. 2.0. If a copy of the MPL was not distributed with this
6221 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
6222
6223-from __future__ import absolute_import
6224+
6225
6226 import errno
6227 import os
6228@@ -57,7 +57,7 @@ else:
6229
6230 def _copyfile(src, dest):
6231 # False indicates `dest` should be overwritten if it exists already.
6232- if isinstance(src, unicode) and isinstance(dest, unicode):
6233+ if isinstance(src, str) and isinstance(dest, str):
6234 _CopyFileW(src, dest, False)
6235 elif isinstance(src, str) and isinstance(dest, str):
6236 _CopyFileA(src, dest, False)
6237@@ -164,7 +164,7 @@ class BaseFile(object):
6238 disabled when skip_if_older is False.
6239 Returns whether a copy was actually performed (True) or not (False).
6240 '''
6241- if isinstance(dest, basestring):
6242+ if isinstance(dest, str):
6243 dest = Dest(dest)
6244 else:
6245 assert isinstance(dest, Dest)
6246@@ -278,11 +278,11 @@ class ExecutableFile(File):
6247 '''
6248 def copy(self, dest, skip_if_older=True):
6249 real_dest = dest
6250- if not isinstance(dest, basestring):
6251+ if not isinstance(dest, str):
6252 fd, dest = mkstemp()
6253 os.close(fd)
6254 os.remove(dest)
6255- assert isinstance(dest, basestring)
6256+ assert isinstance(dest, str)
6257 # If File.copy didn't actually copy because dest is newer, check the
6258 # file sizes. If dest is smaller, it means it is already stripped and
6259 # elfhacked, so we can skip.
6260@@ -319,7 +319,7 @@ class AbsoluteSymlinkFile(File):
6261 File.__init__(self, path)
6262
6263 def copy(self, dest, skip_if_older=True):
6264- assert isinstance(dest, basestring)
6265+ assert isinstance(dest, str)
6266
6267 # The logic in this function is complicated by the fact that symlinks
6268 # aren't universally supported. So, where symlinks aren't supported, we
6269@@ -410,7 +410,7 @@ class HardlinkFile(File):
6270 '''
6271
6272 def copy(self, dest, skip_if_older=True):
6273- assert isinstance(dest, basestring)
6274+ assert isinstance(dest, str)
6275
6276 if not hasattr(os, 'link'):
6277 return super(HardlinkFile, self).copy(
6278@@ -471,7 +471,7 @@ class ExistingFile(BaseFile):
6279 self.required = required
6280
6281 def copy(self, dest, skip_if_older=True):
6282- if isinstance(dest, basestring):
6283+ if isinstance(dest, str):
6284 dest = Dest(dest)
6285 else:
6286 assert isinstance(dest, Dest)
6287@@ -517,7 +517,7 @@ class PreprocessedFile(BaseFile):
6288 '''
6289 Invokes the preprocessor to create the destination file.
6290 '''
6291- if isinstance(dest, basestring):
6292+ if isinstance(dest, str):
6293 dest = Dest(dest)
6294 else:
6295 assert isinstance(dest, Dest)
6296@@ -657,7 +657,7 @@ class XPTFile(GeneratedFile):
6297 the individual XPTs to link.
6298 skip_if_older is ignored.
6299 '''
6300- if isinstance(dest, basestring):
6301+ if isinstance(dest, str):
6302 dest = Dest(dest)
6303 assert isinstance(dest, Dest)
6304
6305@@ -1108,7 +1108,7 @@ class ComposedFinder(BaseFinder):
6306 from mozpack.copier import FileRegistry
6307 self.files = FileRegistry()
6308
6309- for base, finder in sorted(finders.iteritems()):
6310+ for base, finder in sorted(finders.items()):
6311 if self.files.contains(base):
6312 self.files.remove(base)
6313 for p, f in finder.find(''):
6314diff --git a/python/mozbuild/mozpack/manifests.py b/python/mozbuild/mozpack/manifests.py
6315index 27c66634b..f79b40086 100644
6316--- a/python/mozbuild/mozpack/manifests.py
6317+++ b/python/mozbuild/mozpack/manifests.py
6318@@ -2,8 +2,6 @@
6319 # License, v. 2.0. If a copy of the MPL was not distributed with this
6320 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
6321
6322-from __future__ import absolute_import, unicode_literals
6323-
6324 from contextlib import contextmanager
6325 import json
6326
6327@@ -116,7 +114,7 @@ class InstallManifest(object):
6328 self._source_files = set()
6329
6330 if path or fileobj:
6331- with _auto_fileobj(path, fileobj, 'rb') as fh:
6332+ with _auto_fileobj(path, fileobj, 'r') as fh:
6333 self._source_files.add(fh.name)
6334 self._load_from_fileobj(fh)
6335
6336@@ -175,7 +173,7 @@ class InstallManifest(object):
6337 dest, content = fields[1:]
6338
6339 self.add_content(
6340- self._decode_field_entry(content).encode('utf-8'), dest)
6341+ self._decode_field_entry(content), dest)
6342 continue
6343
6344 # Don't fail for non-actionable items, allowing
6345@@ -228,7 +226,7 @@ class InstallManifest(object):
6346
6347 It is an error if both are specified.
6348 """
6349- with _auto_fileobj(path, fileobj, 'wb') as fh:
6350+ with _auto_fileobj(path, fileobj, 'w') as fh:
6351 fh.write('%d\n' % self.CURRENT_VERSION)
6352
6353 for dest in sorted(self._dests):
6354@@ -242,13 +240,11 @@ class InstallManifest(object):
6355 for path in paths:
6356 source = mozpath.join(base, path)
6357 parts = ['%d' % type, mozpath.join(dest, path), source]
6358- fh.write('%s\n' % self.FIELD_SEPARATOR.join(
6359- p.encode('utf-8') for p in parts))
6360+ fh.write('%s\n' % self.FIELD_SEPARATOR.join(parts))
6361 else:
6362 parts = ['%d' % entry[0], dest]
6363 parts.extend(entry[1:])
6364- fh.write('%s\n' % self.FIELD_SEPARATOR.join(
6365- p.encode('utf-8') for p in parts))
6366+ fh.write('%s\n' % self.FIELD_SEPARATOR.join(parts))
6367
6368 def add_link(self, source, dest):
6369 """Add a link to this manifest.
6370@@ -439,7 +435,7 @@ class InstallManifest(object):
6371 if install_type == self.CONTENT:
6372 # GeneratedFile expect the buffer interface, which the unicode
6373 # type doesn't have, so encode to a str.
6374- content = self._decode_field_entry(entry[1]).encode('utf-8')
6375+ content = self._decode_field_entry(entry[1])
6376 registry.add(dest, GeneratedFile(content))
6377 continue
6378
6379diff --git a/python/mozbuild/mozpack/mozjar.py b/python/mozbuild/mozpack/mozjar.py
6380index a723fd2c0..0b04d233c 100644
6381--- a/python/mozbuild/mozpack/mozjar.py
6382+++ b/python/mozbuild/mozpack/mozjar.py
6383@@ -2,7 +2,7 @@
6384 # License, v. 2.0. If a copy of the MPL was not distributed with this
6385 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
6386
6387-from __future__ import absolute_import
6388+
6389
6390 from io import BytesIO
6391 import struct
6392@@ -14,9 +14,10 @@ from zipfile import (
6393 ZIP_DEFLATED,
6394 )
6395 from collections import OrderedDict
6396-from urlparse import urlparse, ParseResult
6397+from urllib.parse import urlparse, ParseResult
6398 import mozpack.path as mozpath
6399 from mozbuild.util import memoize
6400+from functools import reduce
6401
6402
6403 JAR_STORED = ZIP_STORED
6404@@ -72,7 +73,7 @@ class JarStruct(object):
6405 an instance with empty fields.
6406 '''
6407 assert self.MAGIC and isinstance(self.STRUCT, OrderedDict)
6408- self.size_fields = set(t for t in self.STRUCT.itervalues()
6409+ self.size_fields = set(t for t in self.STRUCT.values()
6410 if not t in JarStruct.TYPE_MAPPING)
6411 self._values = {}
6412 if data:
6413@@ -94,7 +95,7 @@ class JarStruct(object):
6414 # For all fields used as other fields sizes, keep track of their value
6415 # separately.
6416 sizes = dict((t, 0) for t in self.size_fields)
6417- for name, t in self.STRUCT.iteritems():
6418+ for name, t in self.STRUCT.items():
6419 if t in JarStruct.TYPE_MAPPING:
6420 value, size = JarStruct.get_data(t, data[offset:])
6421 else:
6422@@ -113,7 +114,7 @@ class JarStruct(object):
6423 Initialize an instance with empty fields.
6424 '''
6425 self.signature = self.MAGIC
6426- for name, t in self.STRUCT.iteritems():
6427+ for name, t in self.STRUCT.items():
6428 if name in self.size_fields:
6429 continue
6430 self._values[name] = 0 if t in JarStruct.TYPE_MAPPING else ''
6431@@ -138,9 +139,9 @@ class JarStruct(object):
6432 from self.STRUCT.
6433 '''
6434 serialized = struct.pack('<I', self.signature)
6435- sizes = dict((t, name) for name, t in self.STRUCT.iteritems()
6436+ sizes = dict((t, name) for name, t in self.STRUCT.items()
6437 if not t in JarStruct.TYPE_MAPPING)
6438- for name, t in self.STRUCT.iteritems():
6439+ for name, t in self.STRUCT.items():
6440 if t in JarStruct.TYPE_MAPPING:
6441 format, size = JarStruct.TYPE_MAPPING[t]
6442 if name in sizes:
6443@@ -159,7 +160,7 @@ class JarStruct(object):
6444 variable length fields.
6445 '''
6446 size = JarStruct.TYPE_MAPPING['uint32'][1]
6447- for name, type in self.STRUCT.iteritems():
6448+ for name, type in self.STRUCT.items():
6449 if type in JarStruct.TYPE_MAPPING:
6450 size += JarStruct.TYPE_MAPPING[type][1]
6451 else:
6452@@ -180,7 +181,7 @@ class JarStruct(object):
6453 return key in self._values
6454
6455 def __iter__(self):
6456- return self._values.iteritems()
6457+ return iter(self._values.items())
6458
6459 def __repr__(self):
6460 return "<%s %s>" % (self.__class__.__name__,
6461@@ -374,7 +375,7 @@ class JarReader(object):
6462 entries = self.entries
6463 if not entries:
6464 return JAR_STORED
6465- return max(f['compression'] for f in entries.itervalues())
6466+ return max(f['compression'] for f in entries.values())
6467
6468 @property
6469 def entries(self):
6470@@ -390,7 +391,7 @@ class JarReader(object):
6471 preload = JarStruct.get_data('uint32', self._data)[0]
6472 entries = OrderedDict()
6473 offset = self._cdir_end['cdir_offset']
6474- for e in xrange(self._cdir_end['cdir_entries']):
6475+ for e in range(self._cdir_end['cdir_entries']):
6476 entry = JarCdirEntry(self._data[offset:])
6477 offset += entry.size
6478 # Creator host system. 0 is MSDOS, 3 is Unix
6479@@ -452,7 +453,7 @@ class JarReader(object):
6480 for file in jarReader:
6481 ...
6482 '''
6483- for entry in self.entries.itervalues():
6484+ for entry in self.entries.values():
6485 yield self._getreader(entry)
6486
6487 def __getitem__(self, name):
6488@@ -547,7 +548,7 @@ class JarWriter(object):
6489 headers = {}
6490 preload_size = 0
6491 # Prepare central directory entries
6492- for entry, content in self._contents.itervalues():
6493+ for entry, content in self._contents.values():
6494 header = JarLocalFileHeader()
6495 for name in entry.STRUCT:
6496 if name in header:
6497@@ -562,7 +563,7 @@ class JarWriter(object):
6498 end['disk_entries'] = len(self._contents)
6499 end['cdir_entries'] = end['disk_entries']
6500 end['cdir_size'] = reduce(lambda x, y: x + y[0].size,
6501- self._contents.values(), 0)
6502+ list(self._contents.values()), 0)
6503 # On optimized archives, store the preloaded size and the central
6504 # directory entries, followed by the first end of central directory.
6505 if self._optimize:
6506@@ -571,18 +572,18 @@ class JarWriter(object):
6507 if preload_size:
6508 preload_size += offset
6509 self._data.write(struct.pack('<I', preload_size))
6510- for entry, _ in self._contents.itervalues():
6511+ for entry, _ in self._contents.values():
6512 entry['offset'] += offset
6513 self._data.write(entry.serialize())
6514 self._data.write(end.serialize())
6515 # Store local file entries followed by compressed data
6516- for entry, content in self._contents.itervalues():
6517+ for entry, content in self._contents.values():
6518 self._data.write(headers[entry].serialize())
6519 self._data.write(content)
6520 # On non optimized archives, store the central directory entries.
6521 if not self._optimize:
6522 end['cdir_offset'] = offset
6523- for entry, _ in self._contents.itervalues():
6524+ for entry, _ in self._contents.values():
6525 self._data.write(entry.serialize())
6526 # Store the end of central directory.
6527 self._data.write(end.serialize())
6528@@ -622,7 +623,7 @@ class JarWriter(object):
6529 deflater = data
6530 else:
6531 deflater = Deflater(compress, compress_level=self._compress_level)
6532- if isinstance(data, basestring):
6533+ if isinstance(data, str):
6534 deflater.write(data)
6535 elif hasattr(data, 'read'):
6536 if hasattr(data, 'seek'):
6537diff --git a/testing/mozbase/manifestparser/manifestparser/ini.py b/testing/mozbase/manifestparser/manifestparser/ini.py
6538index e5ba249c1..c141a18b7 100644
6539--- a/testing/mozbase/manifestparser/manifestparser/ini.py
6540+++ b/testing/mozbase/manifestparser/manifestparser/ini.py
6541@@ -2,7 +2,7 @@
6542 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
6543 # You can obtain one at http://mozilla.org/MPL/2.0/.
6544
6545-from __future__ import absolute_import
6546+
6547
6548 import os
6549 import sys
6550@@ -12,7 +12,7 @@ __all__ = ['read_ini', 'combine_fields']
6551
6552 class IniParseError(Exception):
6553 def __init__(self, fp, linenum, msg):
6554- if isinstance(fp, basestring):
6555+ if isinstance(fp, str):
6556 path = fp
6557 elif hasattr(fp, 'name'):
6558 path = fp.name
6559@@ -43,12 +43,15 @@ def read_ini(fp, variables=None, default='DEFAULT', defaults_only=False,
6560 sections = []
6561 key = value = None
6562 section_names = set()
6563- if isinstance(fp, basestring):
6564+ if isinstance(fp, str):
6565 fp = file(fp)
6566
6567 # read the lines
6568 for (linenum, line) in enumerate(fp.read().splitlines(), start=1):
6569
6570+ if isinstance(line, bytes):
6571+ line = line.decode('utf-8')
6572+
6573 stripped = line.strip()
6574
6575 # ignore blank lines
6576@@ -66,7 +69,7 @@ def read_ini(fp, variables=None, default='DEFAULT', defaults_only=False,
6577 inline_prefixes = {p: -1 for p in comments}
6578 while comment_start == sys.maxsize and inline_prefixes:
6579 next_prefixes = {}
6580- for prefix, index in inline_prefixes.items():
6581+ for prefix, index in list(inline_prefixes.items()):
6582 index = line.find(prefix, index+1)
6583 if index == -1:
6584 continue
6585@@ -163,7 +166,7 @@ def combine_fields(global_vars, local_vars):
6586 'support-files': '%s %s',
6587 }
6588 final_mapping = global_vars.copy()
6589- for field_name, value in local_vars.items():
6590+ for field_name, value in list(local_vars.items()):
6591 if field_name not in field_patterns or field_name not in global_vars:
6592 final_mapping[field_name] = value
6593 continue
6594diff --git a/testing/mozbase/manifestparser/manifestparser/manifestparser.py b/testing/mozbase/manifestparser/manifestparser/manifestparser.py
6595index 921369fd2..5b2f4c453 100755
6596--- a/testing/mozbase/manifestparser/manifestparser/manifestparser.py
6597+++ b/testing/mozbase/manifestparser/manifestparser/manifestparser.py
6598@@ -2,9 +2,9 @@
6599 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
6600 # You can obtain one at http://mozilla.org/MPL/2.0/.
6601
6602-from __future__ import absolute_import, print_function
6603
6604-from StringIO import StringIO
6605+
6606+from io import StringIO
6607 import json
6608 import fnmatch
6609 import os
6610@@ -23,7 +23,7 @@ from .filters import (
6611 __all__ = ['ManifestParser', 'TestManifest', 'convert']
6612
6613 relpath = os.path.relpath
6614-string = (basestring,)
6615+string = (str,)
6616
6617
6618 # path normalization
6619@@ -195,7 +195,7 @@ class ManifestParser(object):
6620
6621 # otherwise an item
6622 # apply ancestor defaults, while maintaining current file priority
6623- data = dict(self._ancestor_defaults.items() + data.items())
6624+ data = dict(list(self._ancestor_defaults.items()) + list(data.items()))
6625
6626 test = data
6627 test['name'] = section
6628@@ -323,19 +323,19 @@ class ManifestParser(object):
6629 # make some check functions
6630 if inverse:
6631 def has_tags(test):
6632- return not tags.intersection(test.keys())
6633+ return not tags.intersection(list(test.keys()))
6634
6635 def dict_query(test):
6636- for key, value in kwargs.items():
6637+ for key, value in list(kwargs.items()):
6638 if test.get(key) == value:
6639 return False
6640 return True
6641 else:
6642 def has_tags(test):
6643- return tags.issubset(test.keys())
6644+ return tags.issubset(list(test.keys()))
6645
6646 def dict_query(test):
6647- for key, value in kwargs.items():
6648+ for key, value in list(kwargs.items()):
6649 if test.get(key) != value:
6650 return False
6651 return True
6652@@ -359,7 +359,7 @@ class ManifestParser(object):
6653 if tests is None:
6654 manifests = []
6655 # Make sure to return all the manifests, even ones without tests.
6656- for manifest in self.manifest_defaults.keys():
6657+ for manifest in list(self.manifest_defaults.keys()):
6658 if isinstance(manifest, tuple):
6659 parentmanifest, manifest = manifest
6660 if manifest not in manifests:
6661@@ -409,7 +409,7 @@ class ManifestParser(object):
6662 """
6663
6664 files = set([])
6665- if isinstance(directories, basestring):
6666+ if isinstance(directories, str):
6667 directories = [directories]
6668
6669 # get files in directories
6670@@ -476,7 +476,7 @@ class ManifestParser(object):
6671 print('[DEFAULT]', file=fp)
6672 for tag in global_tags:
6673 print('%s =' % tag, file=fp)
6674- for key, value in global_kwargs.items():
6675+ for key, value in list(global_kwargs.items()):
6676 print('%s = %s' % (key, value), file=fp)
6677 print(file=fp)
6678
6679@@ -602,7 +602,7 @@ class ManifestParser(object):
6680 internal function to import directories
6681 """
6682
6683- if isinstance(pattern, basestring):
6684+ if isinstance(pattern, str):
6685 patterns = [pattern]
6686 else:
6687 patterns = pattern
6688diff --git a/testing/mozbase/mozinfo/mozinfo/mozinfo.py b/testing/mozbase/mozinfo/mozinfo/mozinfo.py
6689index 90c187568..6c5a1f322 100755
6690--- a/testing/mozbase/mozinfo/mozinfo/mozinfo.py
6691+++ b/testing/mozbase/mozinfo/mozinfo/mozinfo.py
6692@@ -8,7 +8,7 @@
6693 # linux) to the information; I certainly wouldn't want anyone parsing this
6694 # information and having behaviour depend on it
6695
6696-from __future__ import absolute_import, print_function
6697+
6698
6699 import os
6700 import platform
6701@@ -24,7 +24,7 @@ _os = os
6702 class unknown(object):
6703 """marker class for unknown information"""
6704
6705- def __nonzero__(self):
6706+ def __bool__(self):
6707 return False
6708
6709 def __str__(self):
6710@@ -96,20 +96,17 @@ elif system.startswith(('MINGW', 'MSYS_NT')):
6711 info['os'] = 'win'
6712 os_version = version = unknown
6713 elif system == "Linux":
6714- if hasattr(platform, "linux_distribution"):
6715- (distro, os_version, codename) = platform.linux_distribution()
6716- else:
6717- (distro, os_version, codename) = platform.dist()
6718 if not processor:
6719 processor = machine
6720- version = "%s %s" % (distro, os_version)
6721+
6722+ distro = 'OE/Yocto'
6723+ os_version = version = unknown
6724
6725 # Bug in Python 2's `platform` library:
6726 # It will return a triple of empty strings if the distribution is not supported.
6727 # It works on Python 3. If we don't have an OS version,
6728 # the unit tests fail to run.
6729 if not distro and not os_version and not codename:
6730- distro = 'lfs'
6731 version = release
6732 os_version = release
6733
6734@@ -131,7 +128,7 @@ else:
6735 os_version = version = unknown
6736
6737 info['version'] = version
6738-info['os_version'] = StringVersion(os_version)
6739+info['os_version'] = version
6740
6741 # processor type and bits
6742 if processor in ["i386", "i686"]:
6743@@ -188,12 +185,7 @@ def update(new_info):
6744 to a json file containing the new info.
6745 """
6746
6747- PY3 = sys.version_info[0] == 3
6748- if PY3:
6749- string_types = str,
6750- else:
6751- string_types = basestring,
6752- if isinstance(new_info, string_types):
6753+ if isinstance(new_info, str):
6754 # lazy import
6755 import mozfile
6756 import json
6757@@ -295,7 +287,7 @@ def main(args=None):
6758
6759 # print out choices if requested
6760 flag = False
6761- for key, value in options.__dict__.items():
6762+ for key, value in list(options.__dict__.items()):
6763 if value is True:
6764 print('%s choices: %s' % (key, ' '.join([str(choice)
6765 for choice in choices[key]])))
6766@@ -304,7 +296,7 @@ def main(args=None):
6767 return
6768
6769 # otherwise, print out all info
6770- for key, value in info.items():
6771+ for key, value in list(info.items()):
6772 print('%s: %s' % (key, value))
6773
6774
6775diff --git a/testing/mozbase/mozprocess/mozprocess/processhandler.py b/testing/mozbase/mozprocess/mozprocess/processhandler.py
6776index 3efb650b7..2575a4702 100644
6777--- a/testing/mozbase/mozprocess/mozprocess/processhandler.py
6778+++ b/testing/mozbase/mozprocess/mozprocess/processhandler.py
6779@@ -2,7 +2,7 @@
6780 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
6781 # You can obtain one at http://mozilla.org/MPL/2.0/.
6782
6783-from __future__ import absolute_import, print_function
6784+
6785
6786 import errno
6787 import os
6788@@ -13,7 +13,7 @@ import threading
6789 import time
6790 import traceback
6791
6792-from Queue import Queue, Empty
6793+from queue import Queue, Empty
6794 from datetime import datetime
6795
6796
6797@@ -124,14 +124,14 @@ class ProcessHandlerMixin(object):
6798 thread = threading.current_thread().name
6799 print("DBG::MOZPROC PID:{} ({}) | {}".format(self.pid, thread, msg))
6800
6801- def __del__(self, _maxint=sys.maxint):
6802+ def __del__(self, _maxint=sys.maxsize):
6803 if isWin:
6804 handle = getattr(self, '_handle', None)
6805 if handle:
6806 if hasattr(self, '_internal_poll'):
6807 self._internal_poll(_deadstate=_maxint)
6808 else:
6809- self.poll(_deadstate=sys.maxint)
6810+ self.poll(_deadstate=sys.maxsize)
6811 if handle or self._job or self._io_port:
6812 self._cleanup()
6813 else:
6814@@ -243,7 +243,7 @@ class ProcessHandlerMixin(object):
6815 p2cread, p2cwrite,
6816 c2pread, c2pwrite,
6817 errread, errwrite) = args_tuple
6818- if not isinstance(args, basestring):
6819+ if not isinstance(args, str):
6820 args = subprocess.list2cmdline(args)
6821
6822 # Always or in the create new process group
6823diff --git a/third_party/python/which/which.py b/third_party/python/which/which.py
6824index 9c7d10835..f02b2616e 100644
6825--- a/third_party/python/which/which.py
6826+++ b/third_party/python/which/which.py
6827@@ -90,13 +90,13 @@ def _getRegisteredExecutable(exeName):
6828 if sys.platform.startswith('win'):
6829 if os.path.splitext(exeName)[1].lower() != '.exe':
6830 exeName += '.exe'
6831- import _winreg
6832+ import winreg
6833 try:
6834 key = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\" +\
6835 exeName
6836- value = _winreg.QueryValue(_winreg.HKEY_LOCAL_MACHINE, key)
6837+ value = winreg.QueryValue(winreg.HKEY_LOCAL_MACHINE, key)
6838 registered = (value, "from HKLM\\"+key)
6839- except _winreg.error:
6840+ except winreg.error:
6841 pass
6842 if registered and not os.path.exists(registered[0]):
6843 registered = None
6844@@ -244,7 +244,7 @@ def which(command, path=None, verbose=0, exts=None):
6845 If no match is found for the command, a WhichError is raised.
6846 """
6847 try:
6848- match = whichgen(command, path, verbose, exts).next()
6849+ match = next(whichgen(command, path, verbose, exts))
6850 except StopIteration:
6851 raise WhichError("Could not find '%s' on the path." % command)
6852 return match
6853@@ -281,17 +281,17 @@ def main(argv):
6854 try:
6855 optlist, args = getopt.getopt(argv[1:], 'haVvqp:e:',
6856 ['help', 'all', 'version', 'verbose', 'quiet', 'path=', 'exts='])
6857- except getopt.GetoptError, msg:
6858+ except getopt.GetoptError as msg:
6859 sys.stderr.write("which: error: %s. Your invocation was: %s\n"\
6860 % (msg, argv))
6861 sys.stderr.write("Try 'which --help'.\n")
6862 return 1
6863 for opt, optarg in optlist:
6864 if opt in ('-h', '--help'):
6865- print _cmdlnUsage
6866+ print(_cmdlnUsage)
6867 return 0
6868 elif opt in ('-V', '--version'):
6869- print "which %s" % __version__
6870+ print("which %s" % __version__)
6871 return 0
6872 elif opt in ('-a', '--all'):
6873 all = 1
6874@@ -319,9 +319,9 @@ def main(argv):
6875 nmatches = 0
6876 for match in whichgen(arg, path=altpath, verbose=verbose, exts=exts):
6877 if verbose:
6878- print "%s (%s)" % match
6879+ print("%s (%s)" % match)
6880 else:
6881- print match
6882+ print(match)
6883 nmatches += 1
6884 if not all:
6885 break
6886--
68872.21.0
6888
diff --git a/meta-oe/recipes-extended/mozjs/mozjs/0001-js.pc.in-do-not-include-RequiredDefines.h-for-depend.patch b/meta-oe/recipes-extended/mozjs/mozjs/0002-js.pc.in-do-not-include-RequiredDefines.h-for-depend.patch
index e3f1883a99..e3f1883a99 100644
--- a/meta-oe/recipes-extended/mozjs/mozjs/0001-js.pc.in-do-not-include-RequiredDefines.h-for-depend.patch
+++ b/meta-oe/recipes-extended/mozjs/mozjs/0002-js.pc.in-do-not-include-RequiredDefines.h-for-depend.patch
diff --git a/meta-oe/recipes-extended/mozjs/mozjs/0010-fix-cross-compilation-on-i586-targets.patch b/meta-oe/recipes-extended/mozjs/mozjs/0003-fix-cross-compilation-on-i586-targets.patch
index e0929a8a8f..e0929a8a8f 100644
--- a/meta-oe/recipes-extended/mozjs/mozjs/0010-fix-cross-compilation-on-i586-targets.patch
+++ b/meta-oe/recipes-extended/mozjs/mozjs/0003-fix-cross-compilation-on-i586-targets.patch
diff --git a/meta-oe/recipes-extended/mozjs/mozjs/0001-do-not-create-python-environment.patch b/meta-oe/recipes-extended/mozjs/mozjs/0004-do-not-create-python-environment.patch
index 985fc36c18..985fc36c18 100644
--- a/meta-oe/recipes-extended/mozjs/mozjs/0001-do-not-create-python-environment.patch
+++ b/meta-oe/recipes-extended/mozjs/mozjs/0004-do-not-create-python-environment.patch
diff --git a/meta-oe/recipes-extended/mozjs/mozjs/0002-fix-cannot-find-link.patch b/meta-oe/recipes-extended/mozjs/mozjs/0005-fix-cannot-find-link.patch
index 4f7ebc68d7..4f7ebc68d7 100644
--- a/meta-oe/recipes-extended/mozjs/mozjs/0002-fix-cannot-find-link.patch
+++ b/meta-oe/recipes-extended/mozjs/mozjs/0005-fix-cannot-find-link.patch
diff --git a/meta-oe/recipes-extended/mozjs/mozjs/0003-workaround-autoconf-2.13-detection-failed.patch b/meta-oe/recipes-extended/mozjs/mozjs/0006-workaround-autoconf-2.13-detection-failed.patch
index a754ff16cf..a754ff16cf 100644
--- a/meta-oe/recipes-extended/mozjs/mozjs/0003-workaround-autoconf-2.13-detection-failed.patch
+++ b/meta-oe/recipes-extended/mozjs/mozjs/0006-workaround-autoconf-2.13-detection-failed.patch
diff --git a/meta-oe/recipes-extended/mozjs/mozjs/0005-fix-do_compile-failed-on-mips.patch b/meta-oe/recipes-extended/mozjs/mozjs/0007-fix-do_compile-failed-on-mips.patch
index d1da109720..d1da109720 100644
--- a/meta-oe/recipes-extended/mozjs/mozjs/0005-fix-do_compile-failed-on-mips.patch
+++ b/meta-oe/recipes-extended/mozjs/mozjs/0007-fix-do_compile-failed-on-mips.patch
diff --git a/meta-oe/recipes-extended/mozjs/mozjs/add-riscv-support.patch b/meta-oe/recipes-extended/mozjs/mozjs/0008-add-riscv-support.patch
index 0a41485610..0a41485610 100644
--- a/meta-oe/recipes-extended/mozjs/mozjs/add-riscv-support.patch
+++ b/meta-oe/recipes-extended/mozjs/mozjs/0008-add-riscv-support.patch
diff --git a/meta-oe/recipes-extended/mozjs/mozjs/0001-mozjs-fix-coredump-caused-by-getenv.patch b/meta-oe/recipes-extended/mozjs/mozjs/0009-mozjs-fix-coredump-caused-by-getenv.patch
index 477f73a2f7..477f73a2f7 100644
--- a/meta-oe/recipes-extended/mozjs/mozjs/0001-mozjs-fix-coredump-caused-by-getenv.patch
+++ b/meta-oe/recipes-extended/mozjs/mozjs/0009-mozjs-fix-coredump-caused-by-getenv.patch
diff --git a/meta-oe/recipes-extended/mozjs/mozjs/format-overflow.patch b/meta-oe/recipes-extended/mozjs/mozjs/0010-format-overflow.patch
index e257fc6f62..e257fc6f62 100644
--- a/meta-oe/recipes-extended/mozjs/mozjs/format-overflow.patch
+++ b/meta-oe/recipes-extended/mozjs/mozjs/0010-format-overflow.patch
diff --git a/meta-oe/recipes-extended/mozjs/mozjs/0001-To-fix-build-error-on-arm32BE.patch b/meta-oe/recipes-extended/mozjs/mozjs/0011-To-fix-build-error-on-arm32BE.patch
index 056f74a529..056f74a529 100644
--- a/meta-oe/recipes-extended/mozjs/mozjs/0001-To-fix-build-error-on-arm32BE.patch
+++ b/meta-oe/recipes-extended/mozjs/mozjs/0011-To-fix-build-error-on-arm32BE.patch
diff --git a/meta-oe/recipes-extended/mozjs/mozjs/JS_PUBLIC_API.patch b/meta-oe/recipes-extended/mozjs/mozjs/0012-JS_PUBLIC_API.patch
index 56b18ba8c6..56b18ba8c6 100644
--- a/meta-oe/recipes-extended/mozjs/mozjs/JS_PUBLIC_API.patch
+++ b/meta-oe/recipes-extended/mozjs/mozjs/0012-JS_PUBLIC_API.patch
diff --git a/meta-oe/recipes-extended/mozjs/mozjs/0001-riscv-Disable-atomic-operations.patch b/meta-oe/recipes-extended/mozjs/mozjs/0013-riscv-Disable-atomic-operations.patch
index 2e810c87f9..2e810c87f9 100644
--- a/meta-oe/recipes-extended/mozjs/mozjs/0001-riscv-Disable-atomic-operations.patch
+++ b/meta-oe/recipes-extended/mozjs/mozjs/0013-riscv-Disable-atomic-operations.patch
diff --git a/meta-oe/recipes-extended/mozjs/mozjs/fallback-to-2011-C++-standard.patch b/meta-oe/recipes-extended/mozjs/mozjs/0014-fallback-to-2011-C++-standard.patch
index 7a0d286e14..7a0d286e14 100644
--- a/meta-oe/recipes-extended/mozjs/mozjs/fallback-to-2011-C++-standard.patch
+++ b/meta-oe/recipes-extended/mozjs/mozjs/0014-fallback-to-2011-C++-standard.patch
diff --git a/meta-oe/recipes-extended/mozjs/mozjs/0001-fix-compiling-failure-on-mips64-n32-bsp.patch b/meta-oe/recipes-extended/mozjs/mozjs/mipsarchn32/0001-fix-compiling-failure-on-mips64-n32-bsp.patch
index b882d76ec2..b882d76ec2 100644
--- a/meta-oe/recipes-extended/mozjs/mozjs/0001-fix-compiling-failure-on-mips64-n32-bsp.patch
+++ b/meta-oe/recipes-extended/mozjs/mozjs/mipsarchn32/0001-fix-compiling-failure-on-mips64-n32-bsp.patch
diff --git a/meta-oe/recipes-extended/mozjs/mozjs/0006-support-musl.patch b/meta-oe/recipes-extended/mozjs/mozjs/musl/0001-support-musl.patch
index 770d5e0aaa..770d5e0aaa 100644
--- a/meta-oe/recipes-extended/mozjs/mozjs/0006-support-musl.patch
+++ b/meta-oe/recipes-extended/mozjs/mozjs/musl/0001-support-musl.patch
diff --git a/meta-oe/recipes-extended/mozjs/mozjs/0001-js-Fix-build-with-musl.patch b/meta-oe/recipes-extended/mozjs/mozjs/musl/0002-js-Fix-build-with-musl.patch
index f4c6e2768d..f4c6e2768d 100644
--- a/meta-oe/recipes-extended/mozjs/mozjs/0001-js-Fix-build-with-musl.patch
+++ b/meta-oe/recipes-extended/mozjs/mozjs/musl/0002-js-Fix-build-with-musl.patch
diff --git a/meta-oe/recipes-extended/mozjs/mozjs_60.9.0.bb b/meta-oe/recipes-extended/mozjs/mozjs_60.9.0.bb
index 4f2da492fb..9466c62aac 100644
--- a/meta-oe/recipes-extended/mozjs/mozjs_60.9.0.bb
+++ b/meta-oe/recipes-extended/mozjs/mozjs_60.9.0.bb
@@ -3,42 +3,45 @@ HOMEPAGE = "https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonk
3LICENSE = "MPL-2.0" 3LICENSE = "MPL-2.0"
4LIC_FILES_CHKSUM = "file://LICENSE;md5=dc9b6ecd19a14a54a628edaaf23733bf" 4LIC_FILES_CHKSUM = "file://LICENSE;md5=dc9b6ecd19a14a54a628edaaf23733bf"
5 5
6SRC_URI = "https://archive.mozilla.org/pub/firefox/releases/${PV}esr/source/firefox-${PV}esr.source.tar.xz \ 6SRC_URI = " \
7 file://0001-js.pc.in-do-not-include-RequiredDefines.h-for-depend.patch \ 7 https://archive.mozilla.org/pub/firefox/releases/${PV}esr/source/firefox-${PV}esr.source.tar.xz \
8 file://0010-fix-cross-compilation-on-i586-targets.patch \ 8 file://0001-Port-build-to-python3.patch \
9 file://0001-do-not-create-python-environment.patch \ 9 file://0002-js.pc.in-do-not-include-RequiredDefines.h-for-depend.patch \
10 file://0002-fix-cannot-find-link.patch \ 10 file://0003-fix-cross-compilation-on-i586-targets.patch \
11 file://0003-workaround-autoconf-2.13-detection-failed.patch \ 11 file://0004-do-not-create-python-environment.patch \
12 file://0005-fix-do_compile-failed-on-mips.patch \ 12 file://0005-fix-cannot-find-link.patch \
13 file://add-riscv-support.patch \ 13 file://0006-workaround-autoconf-2.13-detection-failed.patch \
14 file://0001-mozjs-fix-coredump-caused-by-getenv.patch \ 14 file://0007-fix-do_compile-failed-on-mips.patch \
15 file://format-overflow.patch \ 15 file://0008-add-riscv-support.patch \
16 file://0001-To-fix-build-error-on-arm32BE.patch \ 16 file://0009-mozjs-fix-coredump-caused-by-getenv.patch \
17 file://JS_PUBLIC_API.patch \ 17 file://0010-format-overflow.patch \
18 file://0001-riscv-Disable-atomic-operations.patch \ 18 file://0011-To-fix-build-error-on-arm32BE.patch \
19 file://fallback-to-2011-C++-standard.patch \ 19 file://0012-JS_PUBLIC_API.patch \
20 " 20 file://0013-riscv-Disable-atomic-operations.patch \
21 file://0014-fallback-to-2011-C++-standard.patch \
22"
21SRC_URI_append_libc-musl = " \ 23SRC_URI_append_libc-musl = " \
22 file://0006-support-musl.patch \ 24 file://musl/0001-support-musl.patch \
23 file://0001-js-Fix-build-with-musl.patch \ 25 file://musl/0002-js-Fix-build-with-musl.patch \
24 " 26"
25SRC_URI_append_mipsarchn32 = " \ 27SRC_URI_append_mipsarchn32 = " \
26 file://0001-fix-compiling-failure-on-mips64-n32-bsp.patch \ 28 file://mipsarchn32/0001-fix-compiling-failure-on-mips64-n32-bsp.patch \
27 " 29"
28SRC_URI[md5sum] = "69a0be9ce695e5dc4941ed0c78ef00c2" 30SRC_URI[md5sum] = "69a0be9ce695e5dc4941ed0c78ef00c2"
29SRC_URI[sha256sum] = "9f453c8cc5669e46e38f977764d49a36295bf0d023619d9aac782e6bb3e8c53f" 31SRC_URI[sha256sum] = "9f453c8cc5669e46e38f977764d49a36295bf0d023619d9aac782e6bb3e8c53f"
30 32
31S = "${WORKDIR}/firefox-${@d.getVar("PV").replace("esr", "")}" 33S = "${WORKDIR}/firefox-${@d.getVar("PV").replace("esr", "")}"
32 34
33inherit autotools pkgconfig perlnative ${@bb.utils.contains("BBFILE_COLLECTIONS", "meta-python2", "pythonnative", "", d)} 35inherit autotools pkgconfig perlnative python3native
34 36
35inherit features_check 37inherit features_check
36CONFLICT_DISTRO_FEATURES_mipsarchn32 = "ld-is-gold" 38CONFLICT_DISTRO_FEATURES_mipsarchn32 = "ld-is-gold"
37 39
38DEPENDS += "nspr zlib autoconf-2.13-native \ 40DEPENDS += " \
39 python-six-native python-pytoml-native \ 41 nspr zlib autoconf-2.13-native \
40 python-jsmin-native python-futures-native \ 42 python3-six-native python3-pytoml-native \
41 python-which-native" 43 python3-jsmin-native python3-six \
44"
42 45
43# Disable null pointer optimization in gcc >= 6 46# Disable null pointer optimization in gcc >= 6
44# https://bugzilla.redhat.com/show_bug.cgi?id=1328045 47# https://bugzilla.redhat.com/show_bug.cgi?id=1328045
@@ -82,7 +85,7 @@ do_configure() {
82 export SHELL="/bin/sh" 85 export SHELL="/bin/sh"
83 cd ${S} 86 cd ${S}
84 # Add mozjs python-modules necessary 87 # Add mozjs python-modules necessary
85 PYTHONPATH="$PYTHONPATH:${S}/config:${S}/build" 88 PYTHONPATH="${S}/third_party/python/which:${S}/config:${S}/build"
86 for sub_dir in python testing/mozbase; do 89 for sub_dir in python testing/mozbase; do
87 for module_dir in `ls $sub_dir -1`;do 90 for module_dir in `ls $sub_dir -1`;do
88 [ $module_dir = "virtualenv" ] && continue 91 [ $module_dir = "virtualenv" ] && continue
@@ -96,7 +99,6 @@ do_configure() {
96 99
97 cd ${S}/js/src 100 cd ${S}/js/src
98 autoconf213 --macrodir=${STAGING_DATADIR_NATIVE}/autoconf213 old-configure.in > old-configure 101 autoconf213 --macrodir=${STAGING_DATADIR_NATIVE}/autoconf213 old-configure.in > old-configure
99 sed -i 's:refresh = True:refresh = False:g' ${S}/build/moz.configure/old.configure
100 102
101 cd ${B} 103 cd ${B}
102 ${S}/js/src/configure ${EXTRA_OECONF} 104 ${S}/js/src/configure ${EXTRA_OECONF}