Browse Source

Chronological shuffle for 77a1

Ian Neal 1 month ago
parent
commit
782d2a33a6

+ 0 - 0
mozilla-release/patches/1616353-1-77a1.patch → mozilla-release/patches/1616353-01-77a1.patch


+ 0 - 0
mozilla-release/patches/1627163-05-77a1.patch → mozilla-release/patches/1627163-05no06-77a1.patch


+ 55 - 0
mozilla-release/patches/1627163-14-77a1.patch

@@ -0,0 +1,55 @@
+# HG changeset patch
+# User Mike Hommey <mh+mozilla@glandium.org>
+# Date 1586297328 0
+# Node ID 832c792b08f41708cbccf5efe785a32dce1411fc
+# Parent  b4fff897aaa054f73178d7f19b321ee24d6b62d1
+Bug 1627163 - Do not rely on write_indented_repr serializing list-like items as lists. r=firefox-build-system-reviewers,rstewart
+
+Many values we get out from configure are of types that look like
+lists/tuples, that write_indented_repr will serialize as lists... but
+only in python 2, because the alternative implementation for python 3
+is not doing that. So sanitize first.
+
+Differential Revision: https://phabricator.services.mozilla.com/D69949
+
+diff --git a/configure.py b/configure.py
+--- a/configure.py
++++ b/configure.py
+@@ -66,31 +66,34 @@ def check_unicode(obj):
+     return True
+ 
+ 
+ def config_status(config):
+     # Sanitize config data to feed config.status
+     # Ideally, all the backend and frontend code would handle the booleans, but
+     # there are so many things involved, that it's easier to keep config.status
+     # untouched for now.
+-    def sanitized_bools(v):
++    def sanitize_config(v):
+         if v is True:
+             return '1'
+         if v is False:
+             return ''
++        # Serialize types that look like lists and tuples as lists.
++        if not isinstance(v, (bytes, six.text_type, dict)) and isinstance(v, Iterable):
++            return list(v)
+         return v
+ 
+     sanitized_config = {}
+     sanitized_config['substs'] = {
+-        k: sanitized_bools(v) for k, v in six.iteritems(config)
++        k: sanitize_config(v) for k, v in six.iteritems(config)
+         if k not in ('DEFINES', 'non_global_defines', 'TOPSRCDIR', 'TOPOBJDIR',
+                      'CONFIG_STATUS_DEPS')
+     }
+     sanitized_config['defines'] = {
+-        k: sanitized_bools(v) for k, v in six.iteritems(config['DEFINES'])
++        k: sanitize_config(v) for k, v in six.iteritems(config['DEFINES'])
+     }
+     sanitized_config['non_global_defines'] = config['non_global_defines']
+     sanitized_config['topsrcdir'] = config['TOPSRCDIR']
+     sanitized_config['topobjdir'] = config['TOPOBJDIR']
+     sanitized_config['mozconfig'] = config.get('MOZCONFIG')
+ 
+     if not check_unicode(sanitized_config):
+         print("Configuration should be all unicode.", file=sys.stderr)

+ 128 - 51
mozilla-release/patches/1627163-15-77a1.patch

@@ -1,55 +1,132 @@
 # HG changeset patch
 # HG changeset patch
 # User Mike Hommey <mh+mozilla@glandium.org>
 # User Mike Hommey <mh+mozilla@glandium.org>
-# Date 1586297328 0
-# Node ID 832c792b08f41708cbccf5efe785a32dce1411fc
-# Parent  b4fff897aaa054f73178d7f19b321ee24d6b62d1
-Bug 1627163 - Do not rely on write_indented_repr serializing list-like items as lists. r=firefox-build-system-reviewers,rstewart
+# Date 1586273998 0
+# Node ID d3eb1d4ffd63d919acbc688b873067137e255e1a
+# Parent  e79ebbe674ae543dad951968eb8302389abe68e7
+Bug 1627163 - Fix a few python 3 issues in mozbuild.backend.visualstudio. r=firefox-build-system-reviewers,rstewart
 
 
-Many values we get out from configure are of types that look like
-lists/tuples, that write_indented_repr will serialize as lists... but
-only in python 2, because the alternative implementation for python 3
-is not doing that. So sanitize first.
+Differential Revision: https://phabricator.services.mozilla.com/D69950
 
 
-Differential Revision: https://phabricator.services.mozilla.com/D69949
-
-diff --git a/configure.py b/configure.py
---- a/configure.py
-+++ b/configure.py
-@@ -66,31 +66,34 @@ def check_unicode(obj):
-     return True
- 
- 
- def config_status(config):
-     # Sanitize config data to feed config.status
-     # Ideally, all the backend and frontend code would handle the booleans, but
-     # there are so many things involved, that it's easier to keep config.status
-     # untouched for now.
--    def sanitized_bools(v):
-+    def sanitize_config(v):
-         if v is True:
-             return '1'
-         if v is False:
-             return ''
-+        # Serialize types that look like lists and tuples as lists.
-+        if not isinstance(v, (bytes, six.text_type, dict)) and isinstance(v, Iterable):
-+            return list(v)
-         return v
- 
-     sanitized_config = {}
-     sanitized_config['substs'] = {
--        k: sanitized_bools(v) for k, v in six.iteritems(config)
-+        k: sanitize_config(v) for k, v in six.iteritems(config)
-         if k not in ('DEFINES', 'non_global_defines', 'TOPSRCDIR', 'TOPOBJDIR',
-                      'CONFIG_STATUS_DEPS')
-     }
-     sanitized_config['defines'] = {
--        k: sanitized_bools(v) for k, v in six.iteritems(config['DEFINES'])
-+        k: sanitize_config(v) for k, v in six.iteritems(config['DEFINES'])
-     }
-     sanitized_config['non_global_defines'] = config['non_global_defines']
-     sanitized_config['topsrcdir'] = config['TOPSRCDIR']
-     sanitized_config['topobjdir'] = config['TOPOBJDIR']
-     sanitized_config['mozconfig'] = config.get('MOZCONFIG')
- 
-     if not check_unicode(sanitized_config):
-         print("Configuration should be all unicode.", file=sys.stderr)
+diff --git a/python/mozbuild/mozbuild/backend/visualstudio.py b/python/mozbuild/mozbuild/backend/visualstudio.py
+--- a/python/mozbuild/mozbuild/backend/visualstudio.py
++++ b/python/mozbuild/mozbuild/backend/visualstudio.py
+@@ -5,16 +5,17 @@
+ # This file contains a build backend for generating Visual Studio project
+ # files.
+ 
+ from __future__ import absolute_import, print_function, unicode_literals
+ 
+ import errno
+ import os
+ import re
++import sys
+ import uuid
+ 
+ from xml.dom import getDOMImplementation
+ 
+ from mozpack.files import FileFinder
+ 
+ from .common import CommonBackend
+ from ..frontend.data import (
+@@ -30,16 +31,18 @@ from ..frontend.data import (
+ )
+ from mozbuild.base import ExecutionSummary
+ 
+ 
+ MSBUILD_NAMESPACE = 'http://schemas.microsoft.com/developer/msbuild/2003'
+ 
+ 
+ def get_id(name):
++    if sys.version_info[0] == 2:
++        name = name.encode('utf-8')
+     return str(uuid.uuid5(uuid.NAMESPACE_URL, name)).upper()
+ 
+ 
+ def visual_studio_product_to_solution_version(version):
+     if version == '2019':
+         return '12.00', '16'
+     if version == '2017':
+         return '12.00', '15'
+@@ -306,17 +309,17 @@ class VisualStudioBackend(CommonBackend)
+             fh.write('EndProject\r\n')
+ 
+         # Write out solution folders for organizing things.
+ 
+         # This is the UUID you use for solution folders.
+         container_id = '2150E333-8FDC-42A3-9474-1A3956D46DE8'
+ 
+         def write_container(desc):
+-            cid = get_id(desc.encode('utf-8'))
++            cid = get_id(desc)
+             fh.write('Project("{%s}") = "%s", "%s", "{%s}"\r\n' % (
+                 container_id, desc, desc, cid))
+             fh.write('EndProject\r\n')
+ 
+             return cid
+ 
+         library_id = write_container('Libraries')
+         target_id = write_container('Build Targets')
+@@ -418,22 +421,22 @@ class VisualStudioBackend(CommonBackend)
+ 
+             yield k, v
+ 
+         yield 'TOPSRCDIR', self.environment.topsrcdir
+         yield 'TOPOBJDIR', self.environment.topobjdir
+ 
+     def _write_mach_powershell(self, fh):
+         for k, v in self._relevant_environment_variables():
+-            fh.write(b'$env:%s = "%s"\r\n' % (k, v))
++            fh.write(b'$env:%s = "%s"\r\n' % (k.encode('utf-8'), v.encode('utf-8')))
+ 
+         relpath = os.path.relpath(self.environment.topsrcdir,
+                                   self.environment.topobjdir).replace('\\', '/')
+ 
+-        fh.write(b'$bashargs = "%s/mach", "--log-no-times"\r\n' % relpath)
++        fh.write(b'$bashargs = "%s/mach", "--log-no-times"\r\n' % relpath.encode('utf-8'))
+         fh.write(b'$bashargs = $bashargs + $args\r\n')
+ 
+         fh.write(b"$expanded = $bashargs -join ' '\r\n")
+         fh.write(b'$procargs = "-c", $expanded\r\n')
+ 
+         fh.write(b'Start-Process -WorkingDirectory $env:TOPOBJDIR '
+                  b'-FilePath $env:MOZILLABUILD\\msys\\bin\\bash '
+                  b'-ArgumentList $procargs '
+@@ -442,34 +445,35 @@ class VisualStudioBackend(CommonBackend)
+     def _write_mach_batch(self, fh):
+         """Write out a batch script that builds the tree.
+ 
+         The script "bootstraps" into the MozillaBuild environment by setting
+         the environment variables that are active in the current MozillaBuild
+         environment. Then, it builds the tree.
+         """
+         for k, v in self._relevant_environment_variables():
+-            fh.write(b'SET "%s=%s"\r\n' % (k, v))
++            fh.write(b'SET "%s=%s"\r\n' % (k.encode('utf-8'), v.encode('utf-8')))
+ 
+         fh.write(b'cd %TOPOBJDIR%\r\n')
+ 
+         # We need to convert Windows-native paths to msys paths. Easiest way is
+         # relative paths, since munging c:\ to /c/ is slightly more
+         # complicated.
+         relpath = os.path.relpath(self.environment.topsrcdir,
+                                   self.environment.topobjdir).replace('\\', '/')
+ 
+         # We go through mach because it has the logic for choosing the most
+         # appropriate build tool.
+         fh.write(b'"%%MOZILLABUILD%%\\msys\\bin\\bash" '
+-                 b'-c "%s/mach --log-no-times %%1 %%2 %%3 %%4 %%5 %%6 %%7"' % relpath)
++                 b'-c "%s/mach --log-no-times %%1 %%2 %%3 %%4 %%5 %%6 %%7"'
++                 % relpath.encode('utf-8'))
+ 
+     def _write_vs_project(self, out_dir, basename, name, **kwargs):
+         root = '%s.vcxproj' % basename
+-        project_id = get_id(basename.encode('utf-8'))
++        project_id = get_id(basename)
+ 
+         with self._write_file(os.path.join(out_dir, root), readmode='rb') as fh:
+             project_id, name = VisualStudioBackend.write_vs_project(
+                 fh, self._version, project_id, name, **kwargs)
+ 
+         with self._write_file(os.path.join(out_dir, '%s.user' % root), readmode='rb') as fh:
+             fh.write('<?xml version="1.0" encoding="utf-8"?>\r\n')
+             fh.write('<Project ToolsVersion="4.0" xmlns="%s">\r\n' %

+ 544 - 99
mozilla-release/patches/1627163-16-77a1.patch

@@ -1,132 +1,577 @@
 # HG changeset patch
 # HG changeset patch
 # User Mike Hommey <mh+mozilla@glandium.org>
 # User Mike Hommey <mh+mozilla@glandium.org>
-# Date 1586273998 0
-# Node ID d3eb1d4ffd63d919acbc688b873067137e255e1a
-# Parent  e79ebbe674ae543dad951968eb8302389abe68e7
-Bug 1627163 - Fix a few python 3 issues in mozbuild.backend.visualstudio. r=firefox-build-system-reviewers,rstewart
+# Date 1586284316 0
+# Node ID 407894bc5f9c2e2dc6ed89a188a09b1f9a242a9d
+# Parent  39068e161c7130c1b7f404e39205502eda8935f0
+Bug 1627163 - Switch python configure to python 3. r=firefox-build-system-reviewers,rstewart
 
 
-Differential Revision: https://phabricator.services.mozilla.com/D69950
+This also does a few remaining python 2 incompatible changes to
+.configure files.
 
 
-diff --git a/python/mozbuild/mozbuild/backend/visualstudio.py b/python/mozbuild/mozbuild/backend/visualstudio.py
---- a/python/mozbuild/mozbuild/backend/visualstudio.py
-+++ b/python/mozbuild/mozbuild/backend/visualstudio.py
-@@ -5,16 +5,17 @@
- # This file contains a build backend for generating Visual Studio project
- # files.
+Differential Revision: https://phabricator.services.mozilla.com/D69538
+
+diff --git a/build/moz.configure/bindgen.configure.1627163.later b/build/moz.configure/bindgen.configure.1627163.later
+new file mode 100644
+--- /dev/null
++++ b/build/moz.configure/bindgen.configure.1627163.later
+@@ -0,0 +1,21 @@
++--- bindgen.configure
+++++ bindgen.configure
++@@ -219,17 +219,17 @@ def bindgen_config_paths(clang, libclang
++ 
++ 
++ @depends(bindgen_config_paths.libclang, when=bindgen_config_paths)
++ @checking('that libclang is new enough', lambda s: 'yes' if s else 'no')
++ @imports(_from='ctypes', _import='CDLL')
++ @imports(_from='textwrap', _import='dedent')
++ def min_libclang_version(libclang):
++     try:
++-        lib = CDLL(libclang.encode('utf-8'))
+++        lib = CDLL(libclang)
++         # We want at least 4.0. The API we test below is enough for that.
++         # Just accessing it should throw if not found.
++         fun = lib.clang_EvalResult_getAsLongLong
++         return True
++     except:
++         die(dedent('''\
++         The libclang located at {} is too old (need at least 4.0).
++ 
+diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure
+--- a/build/moz.configure/init.configure
++++ b/build/moz.configure/init.configure
+@@ -225,69 +225,69 @@ def shell(value, mozillabuild):
+ def help_shell(help, shell):
+     if help and not shell:
+         return 'sh'
+ 
+ 
+ shell = help_shell | shell
+ 
+ 
+-# Python 2
++# Python 3
+ # ========
+ 
+-option(env='PYTHON', nargs=1, help='Python 2.7 interpreter')
++option(env='PYTHON3', nargs=1, help='Python 3 interpreter (3.5 or later)')
+ 
+ 
+-@depends('PYTHON', check_build_environment, 'MOZILLABUILD', mozconfig, '--help')
++@depends('PYTHON3', check_build_environment, 'MOZILLABUILD', mozconfig, '--help')
+ @imports(_from='__builtin__', _import='Exception')
+ @imports('os')
+ @imports('sys')
+ @imports('subprocess')
+ @imports('distutils.sysconfig')
+ @imports(_from='mozbuild.configure.util', _import='LineIO')
+ @imports(_from='mozbuild.virtualenv', _import='VirtualenvManager')
+ @imports(_from='mozbuild.virtualenv', _import='verify_python_version')
+-@imports(_from='mozbuild.virtualenv', _import='PY2')
+-@imports(_from='mozbuild.pythonutil', _import='find_python2_executable')
++@imports(_from='mozbuild.virtualenv', _import='PY3')
++@imports(_from='mozbuild.pythonutil', _import='find_python3_executable')
+ @imports(_from='mozbuild.pythonutil', _import='python_executable_version')
+ @imports(_from='six', _import='ensure_text')
+-def virtualenv_python2(env_python, build_env, mozillabuild, mozconfig, help):
++def virtualenv_python3(env_python, build_env, mozillabuild, mozconfig, help):
+     # Avoid re-executing python when running configure --help.
+     if help:
+         return
+ 
+     # NOTE: We cannot assume the Python we are calling this code with is the
+     # Python we want to set up a virtualenv for.
+     #
+     # We also cannot assume that the Python the caller is configuring meets our
+     # build requirements.
+     #
+     # Because of this the code is written to re-execute itself with the correct
+     # interpreter if required.
+ 
+-    log.debug("python2: running with pid %r" % os.getpid())
+-    log.debug("python2: sys.executable: %r" % sys.executable)
++    log.debug("python3: running with pid %r" % os.getpid())
++    log.debug("python3: sys.executable: %r" % sys.executable)
+ 
+     python = env_python[0] if env_python else None
+ 
+     # Did our python come from mozconfig? Overrides environment setting.
+     # Ideally we'd rely on the mozconfig injection from mozconfig_options,
+     # but we'd rather avoid the verbosity when we need to reexecute with
+     # a different python.
+     if mozconfig['path']:
+-        if 'PYTHON' in mozconfig['env']['added']:
+-            python = mozconfig['env']['added']['PYTHON']
+-        elif 'PYTHON' in mozconfig['env']['modified']:
+-            python = mozconfig['env']['modified']['PYTHON'][1]
+-        elif 'PYTHON' in mozconfig['vars']['added']:
+-            python = mozconfig['vars']['added']['PYTHON']
+-        elif 'PYTHON' in mozconfig['vars']['modified']:
+-            python = mozconfig['vars']['modified']['PYTHON'][1]
++        if 'PYTHON3' in mozconfig['env']['added']:
++            python = mozconfig['env']['added']['PYTHON3']
++        elif 'PYTHON3' in mozconfig['env']['modified']:
++            python = mozconfig['env']['modified']['PYTHON3'][1]
++        elif 'PYTHON3' in mozconfig['vars']['added']:
++            python = mozconfig['vars']['added']['PYTHON3']
++        elif 'PYTHON3' in mozconfig['vars']['modified']:
++            python = mozconfig['vars']['modified']['PYTHON3'][1]
+ 
+-    log.debug("python2: executable from configuration: %r" % python)
++    log.debug("python3: executable from configuration: %r" % python)
+ 
+     # Verify that the Python version we executed this code with is the minimum
+     # required version to handle all project code.
+     with LineIO(lambda l: log.error(l)) as out:
+         verify_python_version(out)
+ 
+     # If this is a mozilla-central build, we'll find the virtualenv in the top
+     # source directory. If this is a SpiderMonkey build, we assume we're at
+@@ -297,91 +297,96 @@ def virtualenv_python2(env_python, build
+     topsrcdir, topobjdir = build_env.topsrcdir, build_env.topobjdir
+     if topobjdir.endswith('/js/src'):
+         topobjdir = topobjdir[:-7]
+ 
+     virtualenvs_root = os.path.join(topobjdir, '_virtualenvs')
+     with LineIO(lambda l: log.info(l), 'replace') as out:
+         manager = VirtualenvManager(
+             topsrcdir, topobjdir,
+-            os.path.join(virtualenvs_root, 'init'), out,
++            os.path.join(virtualenvs_root, 'init_py3'), out,
+             os.path.join(topsrcdir, 'build', 'virtualenv_packages.txt'))
+ 
+     # If we're not in the virtualenv, we need to update the path to include some
+     # necessary modules for find_program.
+     if normsep(sys.executable) != normsep(manager.python_path):
+         sys.path.insert(
+             0, os.path.join(topsrcdir, 'testing', 'mozbase', 'mozfile'))
+         sys.path.insert(
+             0, os.path.join(topsrcdir, 'third_party', 'python', 'backports'))
+ 
+     # If we know the Python executable the caller is asking for then verify its
+     # version. If the caller did not ask for a specific executable then find
+     # a reasonable default.
+     if python:
+         found_python = find_program(python)
+         if not found_python:
+-            die('The PYTHON environment variable does not contain '
++            die('The PYTHON3 environment variable does not contain '
+                 'a valid path. Cannot find %s', python)
+         python = found_python
+         try:
+             version = python_executable_version(python).version
+         except Exception as e:
+-            raise FatalCheckError(
+-                'could not determine version of given PYTHON: %s' % e)
++            raise FatalCheckError('could not determine version of PYTHON3 '
++                                  '(%s): %s' % (python, e))
+     elif mozillabuild:
+-        # MozillaBuild provides a Python 2.
+-        python = normsep('%s/python/python2.exe' % mozillabuild)
++        # MozillaBuild provides a Python 3.
++        python = normsep('%s/python3/python3.exe' % mozillabuild)
+ 
+         try:
+             version = python_executable_version(python).version
+         except Exception as e:
+             raise FatalCheckError('could not determine version of '
+-                                  'MozillaBuild python: %s' % e)
++                                  'MozillaBuild python3: %s' % e)
+     else:
+         # Fall back to the search routine.
+-        python, version = find_python2_executable()
++        python, version = find_python3_executable(min_version='3.5.0')
++
+         # The API returns a bytes whereas everything in configure is unicode.
+         if python:
+             python = ensure_text(python)
+ 
+     if not python:
+-        raise FatalCheckError(
+-            'Python 2.7 is required to build. Ensure a `python2.7` executable '
+-            'is in your PATH or define PYTHON to point to a Python 2.7 '
+-            'executable.')
++        raise FatalCheckError('Python 3.5 or newer is required to build. '
++                              'Ensure a `python3.x` executable is in your '
++                              'PATH or define PYTHON3 to point to a Python '
++                              '3.5 executable.')
+ 
+-    if version < (2, 7, 0):
+-        raise FatalCheckError(
+-            'Python 2.7 is required to build; '
+-            '%s is Python %d.%d' % (python, version[0], version[1]))
++    if version < (3, 5, 0):
++        raise FatalCheckError('Python 3.5 or newer is required to build; '
++                              '%s is Python %d.%d' % (python, version[0],
++                                                      version[1]))
+ 
+-    log.debug("python2: found executable: %r" % python)
++    log.debug("python3: found executable: %r" % python)
+ 
+     if not manager.up_to_date(python):
+-        log.info('Creating Python 2 environment')
++        log.info('Creating Python 3 environment')
+         manager.build(python)
+     else:
+-        log.debug("python2: venv is up to date")
++        log.debug("python3: venv is up to date")
+ 
+     python = normsep(manager.python_path)
+ 
+     # The currently running interpreter could be Python 2 or Python 3. We make the
+     # part of the code that re-executes everything with the virtualenv's Python
+     # conditional on running the same major version as the current interpreter. If we
+     # don't do this then the configure code for the Py 2 and Py 3 virtualenvs could
+     # activate each other from inside the other's virtualenv.  We can't guarantee
+     # how the virtualenvs would interact if that happens.
+-    if PY2:
++    if PY3:
+         if not normsep(sys.executable).startswith(normsep(virtualenvs_root)):
+-            log.debug("python2: executing as %s, should be running as %s" % (
++            log.debug("python3: executing as %s, should be running as %s" % (
+                 sys.executable, manager.python_path))
+             log.info('Re-executing in the virtualenv')
+             if env_python:
+-                del os.environ['PYTHON']
++                del os.environ['PYTHON3']
++            # Homebrew on macOS will change Python's sys.executable to a custom
++            # value which messes with mach's virtualenv handling code. Override
++            # Homebrew's changes with the correct sys.executable value.
++            os.environ['PYTHONEXECUTABLE'] = python
+             # One would prefer to use os.execl, but that's completely borked on
+             # Windows.
+             sys.exit(subprocess.call([python] + sys.argv))
+ 
+         # We are now in the virtualenv
+         if not distutils.sysconfig.get_python_lib():
+             die('Could not determine python site packages directory')
+ 
+@@ -389,24 +394,24 @@ def virtualenv_python2(env_python, build
+ 
+     return namespace(
+         path=python,
+         version=version,
+         str_version=str_version,
+     )
+ 
+ 
+-@depends(virtualenv_python2)
+-@checking('for Python 2', callback=lambda x: '%s (%s)' % (x.path, x.str_version))
+-def virtualenv_python2(venv):
++@depends(virtualenv_python3)
++@checking('for Python 3', callback=lambda x: '%s (%s)' % (x.path, x.str_version))
++def virtualenv_python3(venv):
+     return venv
+ 
+ 
+-set_config('PYTHON', virtualenv_python2.path)
+-add_old_configure_assignment('PYTHON', virtualenv_python2.path)
++set_config('PYTHON3', virtualenv_python3.path)
++set_config('PYTHON3_VERSION', virtualenv_python3.str_version)
+ 
+ 
+ # Inject mozconfig options
+ # ==============================================================
+ # All options defined above this point can't be injected in mozconfig_options
+ # below, so collect them.
+ 
+ 
+@@ -464,39 +469,39 @@ def mozconfig_options(mozconfig, automat
+             add(key, value)
+             os.environ[key] = value
+         for key, value in six.iteritems(mozconfig['vars']['added']):
+             add(key, value)
+         for key, (_, value) in six.iteritems(mozconfig['vars']['modified']):
+             add(key, value)
+ 
+ 
+-# Python 3
++# Python 2
+ # ========
+ 
+-option(env='PYTHON3', nargs=1, help='Python 3 interpreter (3.5 or later)')
++option(env='PYTHON', nargs=1, help='Python 2.7 interpreter')
+ 
+ 
+-@depends('PYTHON3', check_build_environment, 'MOZILLABUILD')
++@depends('PYTHON', check_build_environment, 'MOZILLABUILD')
+ @imports(_from='__builtin__', _import='Exception')
+ @imports(_from='mozbuild.configure.util', _import='LineIO')
+ @imports(_from='mozbuild.virtualenv', _import='VirtualenvManager')
+ @imports(_from='mozbuild.virtualenv', _import='verify_python_version')
+-@imports(_from='mozbuild.pythonutil', _import='find_python3_executable')
++@imports(_from='mozbuild.pythonutil', _import='find_python2_executable')
+ @imports(_from='mozbuild.pythonutil', _import='python_executable_version')
+ @imports(_from='six', _import='ensure_text')
+-def virtualenv_python3(env_python, build_env, mozillabuild):
++def virtualenv_python2(env_python, build_env, mozillabuild):
+     # Verify that the Python version we executed this code with is the minimum
+     # required version to handle all project code.
+     with LineIO(lambda l: log.error(l)) as out:
+         verify_python_version(out)
+ 
+     python = env_python[0] if env_python else None
+ 
+-    log.debug("python3: executable from configuration: %r" % python)
++    log.debug("python2: executable from configuration: %r" % python)
+ 
+     # If this is a mozilla-central build, we'll find the virtualenv in the top
+     # source directory. If this is a SpiderMonkey build, we assume we're at
+     # js/src and try to find the virtualenv from the mozilla-central root.
+     # See mozilla-central changeset d2cce982a7c809815d86d5daecefe2e7a563ecca
+     # Bug 784841
+     topsrcdir, topobjdir = build_env.topsrcdir, build_env.topobjdir
+     if topobjdir.endswith('/js/src'):
+@@ -507,79 +512,79 @@ def virtualenv_python3(env_python, build
+     # a reasonable default.
+     if python:
+         try:
+             version = python_executable_version(python).version
+         except Exception as e:
+             raise FatalCheckError('could not determine version of PYTHON '
+                                   '(%s): %s' % (python, e))
+     elif mozillabuild:
+-        # MozillaBuild provides a Python 3.
+-        python = normsep('%s/python3/python3.exe' % mozillabuild)
++        # MozillaBuild provides a Python 2.
++        python = normsep('%s/python/python2.exe' % mozillabuild)
+ 
+         try:
+             version = python_executable_version(python).version
+         except Exception as e:
+             raise FatalCheckError('could not determine version of '
+                                   'MozillaBuild python: %s' % e)
+     else:
+         # Fall back to the search routine.
+-        python, version = find_python3_executable(min_version='3.5.0')
++        python, version = find_python2_executable()
+ 
+         # The API returns a bytes whereas everything in configure is unicode.
+         if python:
+             python = ensure_text(python)
+ 
+     if not python:
+-        raise FatalCheckError('Python 3.5 or newer is required to build. '
+-                              'Ensure a `python3.x` executable is in your '
+-                              'PATH or define PYTHON3 to point to a Python '
+-                              '3.5 executable.')
++        raise FatalCheckError('Python 2.7 is required to build. '
++                              'Ensure a `python2.7` executable is in your '
++                              'PATH or define PYTHON to point to a Python '
++                              '2.7 executable.')
+ 
+-    if version < (3, 5, 0):
+-        raise FatalCheckError('Python 3.5 or newer is required to build; '
++    if version < (2, 7, 0):
++        raise FatalCheckError('Python 2.7 required to build; '
+                               '%s is Python %d.%d' % (python, version[0],
+                                                       version[1]))
+ 
+-    log.debug("python3: found executable: %r" % python)
++    log.debug("python2: found executable: %r" % python)
+ 
+     virtualenvs_root = os.path.join(topobjdir, '_virtualenvs')
+     with LineIO(lambda l: log.info(l), 'replace') as out:
+         manager = VirtualenvManager(
+             topsrcdir, topobjdir,
+-            os.path.join(virtualenvs_root, 'init_py3'), out,
++            os.path.join(virtualenvs_root, 'init'), out,
+             os.path.join(topsrcdir, 'build', 'virtualenv_packages.txt'))
+ 
+-    log.debug("python3: using venv: %r" % manager.virtualenv_root)
++    log.debug("python: using venv: %r" % manager.virtualenv_root)
+ 
+     if not manager.up_to_date(python):
+-        log.info('Creating Python 3 environment')
++        log.info('Creating Python 2 environment')
+         manager.build(python)
+     else:
+-        log.debug("python3: venv is up to date")
++        log.debug("python2: venv is up to date")
+ 
+     python = normsep(manager.python_path)
+ 
+     str_version = '.'.join(str(v) for v in version)
+ 
+     return namespace(
+         path=python,
+         version=version,
+         str_version=str_version,
+     )
+ 
  
  
- from __future__ import absolute_import, print_function, unicode_literals
+-@depends(virtualenv_python3)
+-@checking('for Python 3', callback=lambda x: '%s (%s)' % (x.path, x.str_version))
+-def virtualenv_python3(venv):
++@depends(virtualenv_python2)
++@checking('for Python 2', callback=lambda x: '%s (%s)' % (x.path, x.str_version))
++def virtualenv_python2(venv):
+     return venv
  
  
- import errno
- import os
- import re
-+import sys
- import uuid
  
  
- from xml.dom import getDOMImplementation
+-set_config('PYTHON3', virtualenv_python3.path)
+-set_config('PYTHON3_VERSION', virtualenv_python3.str_version)
++set_config('PYTHON', virtualenv_python2.path)
++add_old_configure_assignment('PYTHON', virtualenv_python2.path)
  
  
- from mozpack.files import FileFinder
  
  
- from .common import CommonBackend
- from ..frontend.data import (
-@@ -30,16 +31,18 @@ from ..frontend.data import (
- )
- from mozbuild.base import ExecutionSummary
+ # Source checkout and version control integration.
+ # ================================================
  
  
  
  
- MSBUILD_NAMESPACE = 'http://schemas.microsoft.com/developer/msbuild/2003'
+ @depends(check_build_environment, 'MOZ_AUTOMATION', '--help')
+ @checking('for vcs source checkout')
+diff --git a/build/moz.configure/node.configure b/build/moz.configure/node.configure
+--- a/build/moz.configure/node.configure
++++ b/build/moz.configure/node.configure
+@@ -9,17 +9,16 @@ option('--disable-nodejs',
+ option(env='NODEJS', nargs=1, help='Path to nodejs')
  
  
  
  
- def get_id(name):
-+    if sys.version_info[0] == 2:
-+        name = name.encode('utf-8')
-     return str(uuid.uuid5(uuid.NAMESPACE_URL, name)).upper()
+ @depends('--enable-nodejs', 'NODEJS')
+ @checking('for nodejs',
+           callback=lambda x: '%s (%s)' % (x.path, x.str_version) if x else 'no')
+ @imports(_from='mozbuild.nodeutil', _import='find_node_executable')
+ @imports(_from='mozbuild.nodeutil', _import='NODE_MIN_VERSION')
+-@imports(_from='mozbuild.util', _import='system_encoding')
+ def nodejs(require, env_node):
+     node_exe = env_node[0] if env_node else None
  
  
+     nodejs, version = find_node_executable(node_exe)
  
  
- def visual_studio_product_to_solution_version(version):
-     if version == '2019':
-         return '12.00', '16'
-     if version == '2017':
-         return '12.00', '15'
-@@ -306,17 +309,17 @@ class VisualStudioBackend(CommonBackend)
-             fh.write('EndProject\r\n')
+     MAYBE_FILE_A_BUG = '''
  
  
-         # Write out solution folders for organizing things.
+     Executing `mach bootstrap --no-system-changes` should
+@@ -47,15 +46,15 @@ def nodejs(require, env_node):
  
  
-         # This is the UUID you use for solution folders.
-         container_id = '2150E333-8FDC-42A3-9474-1A3956D46DE8'
+         if require:
+             raise FatalCheckError(msg)
+         else:
+             log.warning(msg)
+             return
  
  
-         def write_container(desc):
--            cid = get_id(desc.encode('utf-8'))
-+            cid = get_id(desc)
-             fh.write('Project("{%s}") = "%s", "%s", "{%s}"\r\n' % (
-                 container_id, desc, desc, cid))
-             fh.write('EndProject\r\n')
+     return namespace(
+-        path=nodejs.decode(system_encoding),
++        path=nodejs,
+         version=version,
+         str_version='.'.join(str(v) for v in version),
+     )
  
  
-             return cid
  
  
-         library_id = write_container('Libraries')
-         target_id = write_container('Build Targets')
-@@ -418,22 +421,22 @@ class VisualStudioBackend(CommonBackend)
+ set_config('NODEJS', depends_if(nodejs)(lambda p: p.path))
+diff --git a/build/moz.configure/util.configure b/build/moz.configure/util.configure
+--- a/build/moz.configure/util.configure
++++ b/build/moz.configure/util.configure
+@@ -283,17 +283,17 @@ def unique_list(l):
+ #      r'C:\Program Files (x86)\Windows Kits\10\')
+ #
+ #   get_registry_values(r'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\'
+ #                       r'VisualStudio\VC\*\x86\*\Compiler')
+ #   yields e.g.:
+ #     ('19.0', 'arm', r'C:\...\amd64_arm\cl.exe')
+ #     ('19.0', 'x64', r'C:\...\amd64\cl.exe')
+ #     ('19.0', 'x86', r'C:\...\amd64_x86\cl.exe')
+-@imports(_import='_winreg', _as='winreg')
++@imports(_import='winreg')
+ @imports(_from='__builtin__', _import='WindowsError')
+ @imports(_from='fnmatch', _import='fnmatch')
+ def get_registry_values(pattern, get_32_and_64_bit=False):
+     def enum_helper(func, key):
+         i = 0
+         while True:
+             try:
+                 yield func(key, i)
+diff --git a/configure.in b/configure.in
+--- a/configure.in
++++ b/configure.in
+@@ -17,9 +17,9 @@
+ # below ensures the script that follows is output by autoconf.
+ : "divert(0)dnl"
+ #!/bin/sh
  
  
-             yield k, v
+ SRCDIR=$(dirname $0)
+ TOPSRCDIR="$SRCDIR"
+ export OLD_CONFIGURE="$SRCDIR"/old-configure
  
  
-         yield 'TOPSRCDIR', self.environment.topsrcdir
-         yield 'TOPOBJDIR', self.environment.topobjdir
+-which python2.7 > /dev/null && exec python2.7 "$TOPSRCDIR/configure.py" "$@" || exec python "$TOPSRCDIR/configure.py" "$@"
++exec python3 "$TOPSRCDIR/configure.py" "$@"
+diff --git a/configure.py b/configure.py
+--- a/configure.py
++++ b/configure.py
+@@ -110,17 +110,17 @@ def config_status(config):
+     # here, when we're able to skip configure tests/use cached results/not rely
+     # on autoconf.
+     logging.getLogger('moz.configure').info('Creating config.status')
+     with codecs.open('config.status', 'w', 'utf-8') as fh:
+         fh.write(textwrap.dedent('''\
+             #!%(python)s
+             # coding=utf-8
+             from __future__ import unicode_literals
+-        ''') % {'python': config['PYTHON']})
++        ''') % {'python': config['PYTHON3']})
+         for k, v in six.iteritems(sanitized_config):
+             fh.write('%s = ' % k)
+             write_indented_repr(fh, v)
+         fh.write("__all__ = ['topobjdir', 'topsrcdir', 'defines', "
+                  "'non_global_defines', 'substs', 'mozconfig']")
  
  
-     def _write_mach_powershell(self, fh):
-         for k, v in self._relevant_environment_variables():
--            fh.write(b'$env:%s = "%s"\r\n' % (k, v))
-+            fh.write(b'$env:%s = "%s"\r\n' % (k.encode('utf-8'), v.encode('utf-8')))
+         if config.get('MOZ_BUILD_APP') != 'js' or config.get('JS_STANDALONE'):
+             fh.write(textwrap.dedent('''
+diff --git a/js/src/configure.in b/js/src/configure.in
+--- a/js/src/configure.in
++++ b/js/src/configure.in
+@@ -19,9 +19,9 @@
+ #!/bin/sh
  
  
-         relpath = os.path.relpath(self.environment.topsrcdir,
-                                   self.environment.topobjdir).replace('\\', '/')
+ SRCDIR=$(dirname $0)
+ TOPSRCDIR="$SRCDIR"/../..
+ export OLD_CONFIGURE="$SRCDIR"/old-configure
  
  
--        fh.write(b'$bashargs = "%s/mach", "--log-no-times"\r\n' % relpath)
-+        fh.write(b'$bashargs = "%s/mach", "--log-no-times"\r\n' % relpath.encode('utf-8'))
-         fh.write(b'$bashargs = $bashargs + $args\r\n')
+ set -- "$@" --enable-project=js
  
  
-         fh.write(b"$expanded = $bashargs -join ' '\r\n")
-         fh.write(b'$procargs = "-c", $expanded\r\n')
+-which python2.7 > /dev/null && exec python2.7 "$TOPSRCDIR/configure.py" "$@" || exec python "$TOPSRCDIR/configure.py" "$@"
++exec python3 "$TOPSRCDIR/configure.py" "$@"
+diff --git a/python/mozbuild/mozbuild/virtualenv.py b/python/mozbuild/mozbuild/virtualenv.py
+--- a/python/mozbuild/mozbuild/virtualenv.py
++++ b/python/mozbuild/mozbuild/virtualenv.py
+@@ -190,16 +190,21 @@ class VirtualenvManager(object):
+         # __PYVENV_LAUNCHER__ confuses pip about the python interpreter
+         # See https://bugzilla.mozilla.org/show_bug.cgi?id=1607470
+         os.environ.pop('__PYVENV_LAUNCHER__', None)
+         if self.up_to_date(python):
+             return self.virtualenv_root
+         return self.build(python)
  
  
-         fh.write(b'Start-Process -WorkingDirectory $env:TOPOBJDIR '
-                  b'-FilePath $env:MOZILLABUILD\\msys\\bin\\bash '
-                  b'-ArgumentList $procargs '
-@@ -442,34 +445,35 @@ class VisualStudioBackend(CommonBackend)
-     def _write_mach_batch(self, fh):
-         """Write out a batch script that builds the tree.
+     def _log_process_output(self, *args, **kwargs):
++        env = kwargs.pop('env', None) or os.environ.copy()
++        # PYTHONEXECUTABLE can mess up the creation of virtualenvs when set.
++        env.pop('PYTHONEXECUTABLE', None)
++        kwargs['env'] = ensure_subprocess_env(env)
++
+         if hasattr(self.log_handle, 'fileno'):
+             return subprocess.call(*args, stdout=self.log_handle,
+                                    stderr=subprocess.STDOUT, **kwargs)
  
  
-         The script "bootstraps" into the MozillaBuild environment by setting
-         the environment variables that are active in the current MozillaBuild
-         environment. Then, it builds the tree.
-         """
-         for k, v in self._relevant_environment_variables():
--            fh.write(b'SET "%s=%s"\r\n' % (k, v))
-+            fh.write(b'SET "%s=%s"\r\n' % (k.encode('utf-8'), v.encode('utf-8')))
+         proc = subprocess.Popen(*args, stdout=subprocess.PIPE,
+                                 stderr=subprocess.STDOUT, **kwargs)
  
  
-         fh.write(b'cd %TOPOBJDIR%\r\n')
+         for line in proc.stdout:
+@@ -221,18 +226,17 @@ class VirtualenvManager(object):
+         args = [python, self.virtualenv_script_path,
+                 # Without this, virtualenv.py may attempt to contact the outside
+                 # world and search for or download a newer version of pip,
+                 # setuptools, or wheel. This is bad for security, reproducibility,
+                 # and speed.
+                 '--no-download',
+                 self.virtualenv_root]
  
  
-         # We need to convert Windows-native paths to msys paths. Easiest way is
-         # relative paths, since munging c:\ to /c/ is slightly more
-         # complicated.
-         relpath = os.path.relpath(self.environment.topsrcdir,
-                                   self.environment.topobjdir).replace('\\', '/')
+-        result = self._log_process_output(args,
+-                                          env=ensure_subprocess_env(os.environ))
++        result = self._log_process_output(args)
  
  
-         # We go through mach because it has the logic for choosing the most
-         # appropriate build tool.
-         fh.write(b'"%%MOZILLABUILD%%\\msys\\bin\\bash" '
--                 b'-c "%s/mach --log-no-times %%1 %%2 %%3 %%4 %%5 %%6 %%7"' % relpath)
-+                 b'-c "%s/mach --log-no-times %%1 %%2 %%3 %%4 %%5 %%6 %%7"'
-+                 % relpath.encode('utf-8'))
+         if result:
+             raise Exception(
+                 'Failed to create virtualenv: %s (virtualenv.py retcode: %s)' % (
+                     self.virtualenv_root, result))
  
  
-     def _write_vs_project(self, out_dir, basename, name, **kwargs):
-         root = '%s.vcxproj' % basename
--        project_id = get_id(basename.encode('utf-8'))
-+        project_id = get_id(basename)
+         self.write_exe_info(python)
  
  
-         with self._write_file(os.path.join(out_dir, root), readmode='rb') as fh:
-             project_id, name = VisualStudioBackend.write_vs_project(
-                 fh, self._version, project_id, name, **kwargs)
- 
-         with self._write_file(os.path.join(out_dir, '%s.user' % root), readmode='rb') as fh:
-             fh.write('<?xml version="1.0" encoding="utf-8"?>\r\n')
-             fh.write('<Project ToolsVersion="4.0" xmlns="%s">\r\n' %

+ 0 - 577
mozilla-release/patches/1627163-17-77a1.patch

@@ -1,577 +0,0 @@
-# HG changeset patch
-# User Mike Hommey <mh+mozilla@glandium.org>
-# Date 1586284316 0
-# Node ID 407894bc5f9c2e2dc6ed89a188a09b1f9a242a9d
-# Parent  39068e161c7130c1b7f404e39205502eda8935f0
-Bug 1627163 - Switch python configure to python 3. r=firefox-build-system-reviewers,rstewart
-
-This also does a few remaining python 2 incompatible changes to
-.configure files.
-
-Differential Revision: https://phabricator.services.mozilla.com/D69538
-
-diff --git a/build/moz.configure/bindgen.configure.1627163.later b/build/moz.configure/bindgen.configure.1627163.later
-new file mode 100644
---- /dev/null
-+++ b/build/moz.configure/bindgen.configure.1627163.later
-@@ -0,0 +1,21 @@
-+--- bindgen.configure
-++++ bindgen.configure
-+@@ -219,17 +219,17 @@ def bindgen_config_paths(clang, libclang
-+ 
-+ 
-+ @depends(bindgen_config_paths.libclang, when=bindgen_config_paths)
-+ @checking('that libclang is new enough', lambda s: 'yes' if s else 'no')
-+ @imports(_from='ctypes', _import='CDLL')
-+ @imports(_from='textwrap', _import='dedent')
-+ def min_libclang_version(libclang):
-+     try:
-+-        lib = CDLL(libclang.encode('utf-8'))
-++        lib = CDLL(libclang)
-+         # We want at least 4.0. The API we test below is enough for that.
-+         # Just accessing it should throw if not found.
-+         fun = lib.clang_EvalResult_getAsLongLong
-+         return True
-+     except:
-+         die(dedent('''\
-+         The libclang located at {} is too old (need at least 4.0).
-+ 
-diff --git a/build/moz.configure/init.configure b/build/moz.configure/init.configure
---- a/build/moz.configure/init.configure
-+++ b/build/moz.configure/init.configure
-@@ -225,69 +225,69 @@ def shell(value, mozillabuild):
- def help_shell(help, shell):
-     if help and not shell:
-         return 'sh'
- 
- 
- shell = help_shell | shell
- 
- 
--# Python 2
-+# Python 3
- # ========
- 
--option(env='PYTHON', nargs=1, help='Python 2.7 interpreter')
-+option(env='PYTHON3', nargs=1, help='Python 3 interpreter (3.5 or later)')
- 
- 
--@depends('PYTHON', check_build_environment, 'MOZILLABUILD', mozconfig, '--help')
-+@depends('PYTHON3', check_build_environment, 'MOZILLABUILD', mozconfig, '--help')
- @imports(_from='__builtin__', _import='Exception')
- @imports('os')
- @imports('sys')
- @imports('subprocess')
- @imports('distutils.sysconfig')
- @imports(_from='mozbuild.configure.util', _import='LineIO')
- @imports(_from='mozbuild.virtualenv', _import='VirtualenvManager')
- @imports(_from='mozbuild.virtualenv', _import='verify_python_version')
--@imports(_from='mozbuild.virtualenv', _import='PY2')
--@imports(_from='mozbuild.pythonutil', _import='find_python2_executable')
-+@imports(_from='mozbuild.virtualenv', _import='PY3')
-+@imports(_from='mozbuild.pythonutil', _import='find_python3_executable')
- @imports(_from='mozbuild.pythonutil', _import='python_executable_version')
- @imports(_from='six', _import='ensure_text')
--def virtualenv_python2(env_python, build_env, mozillabuild, mozconfig, help):
-+def virtualenv_python3(env_python, build_env, mozillabuild, mozconfig, help):
-     # Avoid re-executing python when running configure --help.
-     if help:
-         return
- 
-     # NOTE: We cannot assume the Python we are calling this code with is the
-     # Python we want to set up a virtualenv for.
-     #
-     # We also cannot assume that the Python the caller is configuring meets our
-     # build requirements.
-     #
-     # Because of this the code is written to re-execute itself with the correct
-     # interpreter if required.
- 
--    log.debug("python2: running with pid %r" % os.getpid())
--    log.debug("python2: sys.executable: %r" % sys.executable)
-+    log.debug("python3: running with pid %r" % os.getpid())
-+    log.debug("python3: sys.executable: %r" % sys.executable)
- 
-     python = env_python[0] if env_python else None
- 
-     # Did our python come from mozconfig? Overrides environment setting.
-     # Ideally we'd rely on the mozconfig injection from mozconfig_options,
-     # but we'd rather avoid the verbosity when we need to reexecute with
-     # a different python.
-     if mozconfig['path']:
--        if 'PYTHON' in mozconfig['env']['added']:
--            python = mozconfig['env']['added']['PYTHON']
--        elif 'PYTHON' in mozconfig['env']['modified']:
--            python = mozconfig['env']['modified']['PYTHON'][1]
--        elif 'PYTHON' in mozconfig['vars']['added']:
--            python = mozconfig['vars']['added']['PYTHON']
--        elif 'PYTHON' in mozconfig['vars']['modified']:
--            python = mozconfig['vars']['modified']['PYTHON'][1]
-+        if 'PYTHON3' in mozconfig['env']['added']:
-+            python = mozconfig['env']['added']['PYTHON3']
-+        elif 'PYTHON3' in mozconfig['env']['modified']:
-+            python = mozconfig['env']['modified']['PYTHON3'][1]
-+        elif 'PYTHON3' in mozconfig['vars']['added']:
-+            python = mozconfig['vars']['added']['PYTHON3']
-+        elif 'PYTHON3' in mozconfig['vars']['modified']:
-+            python = mozconfig['vars']['modified']['PYTHON3'][1]
- 
--    log.debug("python2: executable from configuration: %r" % python)
-+    log.debug("python3: executable from configuration: %r" % python)
- 
-     # Verify that the Python version we executed this code with is the minimum
-     # required version to handle all project code.
-     with LineIO(lambda l: log.error(l)) as out:
-         verify_python_version(out)
- 
-     # If this is a mozilla-central build, we'll find the virtualenv in the top
-     # source directory. If this is a SpiderMonkey build, we assume we're at
-@@ -297,91 +297,96 @@ def virtualenv_python2(env_python, build
-     topsrcdir, topobjdir = build_env.topsrcdir, build_env.topobjdir
-     if topobjdir.endswith('/js/src'):
-         topobjdir = topobjdir[:-7]
- 
-     virtualenvs_root = os.path.join(topobjdir, '_virtualenvs')
-     with LineIO(lambda l: log.info(l), 'replace') as out:
-         manager = VirtualenvManager(
-             topsrcdir, topobjdir,
--            os.path.join(virtualenvs_root, 'init'), out,
-+            os.path.join(virtualenvs_root, 'init_py3'), out,
-             os.path.join(topsrcdir, 'build', 'virtualenv_packages.txt'))
- 
-     # If we're not in the virtualenv, we need to update the path to include some
-     # necessary modules for find_program.
-     if normsep(sys.executable) != normsep(manager.python_path):
-         sys.path.insert(
-             0, os.path.join(topsrcdir, 'testing', 'mozbase', 'mozfile'))
-         sys.path.insert(
-             0, os.path.join(topsrcdir, 'third_party', 'python', 'backports'))
- 
-     # If we know the Python executable the caller is asking for then verify its
-     # version. If the caller did not ask for a specific executable then find
-     # a reasonable default.
-     if python:
-         found_python = find_program(python)
-         if not found_python:
--            die('The PYTHON environment variable does not contain '
-+            die('The PYTHON3 environment variable does not contain '
-                 'a valid path. Cannot find %s', python)
-         python = found_python
-         try:
-             version = python_executable_version(python).version
-         except Exception as e:
--            raise FatalCheckError(
--                'could not determine version of given PYTHON: %s' % e)
-+            raise FatalCheckError('could not determine version of PYTHON3 '
-+                                  '(%s): %s' % (python, e))
-     elif mozillabuild:
--        # MozillaBuild provides a Python 2.
--        python = normsep('%s/python/python2.exe' % mozillabuild)
-+        # MozillaBuild provides a Python 3.
-+        python = normsep('%s/python3/python3.exe' % mozillabuild)
- 
-         try:
-             version = python_executable_version(python).version
-         except Exception as e:
-             raise FatalCheckError('could not determine version of '
--                                  'MozillaBuild python: %s' % e)
-+                                  'MozillaBuild python3: %s' % e)
-     else:
-         # Fall back to the search routine.
--        python, version = find_python2_executable()
-+        python, version = find_python3_executable(min_version='3.5.0')
-+
-         # The API returns a bytes whereas everything in configure is unicode.
-         if python:
-             python = ensure_text(python)
- 
-     if not python:
--        raise FatalCheckError(
--            'Python 2.7 is required to build. Ensure a `python2.7` executable '
--            'is in your PATH or define PYTHON to point to a Python 2.7 '
--            'executable.')
-+        raise FatalCheckError('Python 3.5 or newer is required to build. '
-+                              'Ensure a `python3.x` executable is in your '
-+                              'PATH or define PYTHON3 to point to a Python '
-+                              '3.5 executable.')
- 
--    if version < (2, 7, 0):
--        raise FatalCheckError(
--            'Python 2.7 is required to build; '
--            '%s is Python %d.%d' % (python, version[0], version[1]))
-+    if version < (3, 5, 0):
-+        raise FatalCheckError('Python 3.5 or newer is required to build; '
-+                              '%s is Python %d.%d' % (python, version[0],
-+                                                      version[1]))
- 
--    log.debug("python2: found executable: %r" % python)
-+    log.debug("python3: found executable: %r" % python)
- 
-     if not manager.up_to_date(python):
--        log.info('Creating Python 2 environment')
-+        log.info('Creating Python 3 environment')
-         manager.build(python)
-     else:
--        log.debug("python2: venv is up to date")
-+        log.debug("python3: venv is up to date")
- 
-     python = normsep(manager.python_path)
- 
-     # The currently running interpreter could be Python 2 or Python 3. We make the
-     # part of the code that re-executes everything with the virtualenv's Python
-     # conditional on running the same major version as the current interpreter. If we
-     # don't do this then the configure code for the Py 2 and Py 3 virtualenvs could
-     # activate each other from inside the other's virtualenv.  We can't guarantee
-     # how the virtualenvs would interact if that happens.
--    if PY2:
-+    if PY3:
-         if not normsep(sys.executable).startswith(normsep(virtualenvs_root)):
--            log.debug("python2: executing as %s, should be running as %s" % (
-+            log.debug("python3: executing as %s, should be running as %s" % (
-                 sys.executable, manager.python_path))
-             log.info('Re-executing in the virtualenv')
-             if env_python:
--                del os.environ['PYTHON']
-+                del os.environ['PYTHON3']
-+            # Homebrew on macOS will change Python's sys.executable to a custom
-+            # value which messes with mach's virtualenv handling code. Override
-+            # Homebrew's changes with the correct sys.executable value.
-+            os.environ['PYTHONEXECUTABLE'] = python
-             # One would prefer to use os.execl, but that's completely borked on
-             # Windows.
-             sys.exit(subprocess.call([python] + sys.argv))
- 
-         # We are now in the virtualenv
-         if not distutils.sysconfig.get_python_lib():
-             die('Could not determine python site packages directory')
- 
-@@ -389,24 +394,24 @@ def virtualenv_python2(env_python, build
- 
-     return namespace(
-         path=python,
-         version=version,
-         str_version=str_version,
-     )
- 
- 
--@depends(virtualenv_python2)
--@checking('for Python 2', callback=lambda x: '%s (%s)' % (x.path, x.str_version))
--def virtualenv_python2(venv):
-+@depends(virtualenv_python3)
-+@checking('for Python 3', callback=lambda x: '%s (%s)' % (x.path, x.str_version))
-+def virtualenv_python3(venv):
-     return venv
- 
- 
--set_config('PYTHON', virtualenv_python2.path)
--add_old_configure_assignment('PYTHON', virtualenv_python2.path)
-+set_config('PYTHON3', virtualenv_python3.path)
-+set_config('PYTHON3_VERSION', virtualenv_python3.str_version)
- 
- 
- # Inject mozconfig options
- # ==============================================================
- # All options defined above this point can't be injected in mozconfig_options
- # below, so collect them.
- 
- 
-@@ -464,39 +469,39 @@ def mozconfig_options(mozconfig, automat
-             add(key, value)
-             os.environ[key] = value
-         for key, value in six.iteritems(mozconfig['vars']['added']):
-             add(key, value)
-         for key, (_, value) in six.iteritems(mozconfig['vars']['modified']):
-             add(key, value)
- 
- 
--# Python 3
-+# Python 2
- # ========
- 
--option(env='PYTHON3', nargs=1, help='Python 3 interpreter (3.5 or later)')
-+option(env='PYTHON', nargs=1, help='Python 2.7 interpreter')
- 
- 
--@depends('PYTHON3', check_build_environment, 'MOZILLABUILD')
-+@depends('PYTHON', check_build_environment, 'MOZILLABUILD')
- @imports(_from='__builtin__', _import='Exception')
- @imports(_from='mozbuild.configure.util', _import='LineIO')
- @imports(_from='mozbuild.virtualenv', _import='VirtualenvManager')
- @imports(_from='mozbuild.virtualenv', _import='verify_python_version')
--@imports(_from='mozbuild.pythonutil', _import='find_python3_executable')
-+@imports(_from='mozbuild.pythonutil', _import='find_python2_executable')
- @imports(_from='mozbuild.pythonutil', _import='python_executable_version')
- @imports(_from='six', _import='ensure_text')
--def virtualenv_python3(env_python, build_env, mozillabuild):
-+def virtualenv_python2(env_python, build_env, mozillabuild):
-     # Verify that the Python version we executed this code with is the minimum
-     # required version to handle all project code.
-     with LineIO(lambda l: log.error(l)) as out:
-         verify_python_version(out)
- 
-     python = env_python[0] if env_python else None
- 
--    log.debug("python3: executable from configuration: %r" % python)
-+    log.debug("python2: executable from configuration: %r" % python)
- 
-     # If this is a mozilla-central build, we'll find the virtualenv in the top
-     # source directory. If this is a SpiderMonkey build, we assume we're at
-     # js/src and try to find the virtualenv from the mozilla-central root.
-     # See mozilla-central changeset d2cce982a7c809815d86d5daecefe2e7a563ecca
-     # Bug 784841
-     topsrcdir, topobjdir = build_env.topsrcdir, build_env.topobjdir
-     if topobjdir.endswith('/js/src'):
-@@ -507,79 +512,79 @@ def virtualenv_python3(env_python, build
-     # a reasonable default.
-     if python:
-         try:
-             version = python_executable_version(python).version
-         except Exception as e:
-             raise FatalCheckError('could not determine version of PYTHON '
-                                   '(%s): %s' % (python, e))
-     elif mozillabuild:
--        # MozillaBuild provides a Python 3.
--        python = normsep('%s/python3/python3.exe' % mozillabuild)
-+        # MozillaBuild provides a Python 2.
-+        python = normsep('%s/python/python2.exe' % mozillabuild)
- 
-         try:
-             version = python_executable_version(python).version
-         except Exception as e:
-             raise FatalCheckError('could not determine version of '
-                                   'MozillaBuild python: %s' % e)
-     else:
-         # Fall back to the search routine.
--        python, version = find_python3_executable(min_version='3.5.0')
-+        python, version = find_python2_executable()
- 
-         # The API returns a bytes whereas everything in configure is unicode.
-         if python:
-             python = ensure_text(python)
- 
-     if not python:
--        raise FatalCheckError('Python 3.5 or newer is required to build. '
--                              'Ensure a `python3.x` executable is in your '
--                              'PATH or define PYTHON3 to point to a Python '
--                              '3.5 executable.')
-+        raise FatalCheckError('Python 2.7 is required to build. '
-+                              'Ensure a `python2.7` executable is in your '
-+                              'PATH or define PYTHON to point to a Python '
-+                              '2.7 executable.')
- 
--    if version < (3, 5, 0):
--        raise FatalCheckError('Python 3.5 or newer is required to build; '
-+    if version < (2, 7, 0):
-+        raise FatalCheckError('Python 2.7 required to build; '
-                               '%s is Python %d.%d' % (python, version[0],
-                                                       version[1]))
- 
--    log.debug("python3: found executable: %r" % python)
-+    log.debug("python2: found executable: %r" % python)
- 
-     virtualenvs_root = os.path.join(topobjdir, '_virtualenvs')
-     with LineIO(lambda l: log.info(l), 'replace') as out:
-         manager = VirtualenvManager(
-             topsrcdir, topobjdir,
--            os.path.join(virtualenvs_root, 'init_py3'), out,
-+            os.path.join(virtualenvs_root, 'init'), out,
-             os.path.join(topsrcdir, 'build', 'virtualenv_packages.txt'))
- 
--    log.debug("python3: using venv: %r" % manager.virtualenv_root)
-+    log.debug("python: using venv: %r" % manager.virtualenv_root)
- 
-     if not manager.up_to_date(python):
--        log.info('Creating Python 3 environment')
-+        log.info('Creating Python 2 environment')
-         manager.build(python)
-     else:
--        log.debug("python3: venv is up to date")
-+        log.debug("python2: venv is up to date")
- 
-     python = normsep(manager.python_path)
- 
-     str_version = '.'.join(str(v) for v in version)
- 
-     return namespace(
-         path=python,
-         version=version,
-         str_version=str_version,
-     )
- 
- 
--@depends(virtualenv_python3)
--@checking('for Python 3', callback=lambda x: '%s (%s)' % (x.path, x.str_version))
--def virtualenv_python3(venv):
-+@depends(virtualenv_python2)
-+@checking('for Python 2', callback=lambda x: '%s (%s)' % (x.path, x.str_version))
-+def virtualenv_python2(venv):
-     return venv
- 
- 
--set_config('PYTHON3', virtualenv_python3.path)
--set_config('PYTHON3_VERSION', virtualenv_python3.str_version)
-+set_config('PYTHON', virtualenv_python2.path)
-+add_old_configure_assignment('PYTHON', virtualenv_python2.path)
- 
- 
- # Source checkout and version control integration.
- # ================================================
- 
- 
- @depends(check_build_environment, 'MOZ_AUTOMATION', '--help')
- @checking('for vcs source checkout')
-diff --git a/build/moz.configure/node.configure b/build/moz.configure/node.configure
---- a/build/moz.configure/node.configure
-+++ b/build/moz.configure/node.configure
-@@ -9,17 +9,16 @@ option('--disable-nodejs',
- option(env='NODEJS', nargs=1, help='Path to nodejs')
- 
- 
- @depends('--enable-nodejs', 'NODEJS')
- @checking('for nodejs',
-           callback=lambda x: '%s (%s)' % (x.path, x.str_version) if x else 'no')
- @imports(_from='mozbuild.nodeutil', _import='find_node_executable')
- @imports(_from='mozbuild.nodeutil', _import='NODE_MIN_VERSION')
--@imports(_from='mozbuild.util', _import='system_encoding')
- def nodejs(require, env_node):
-     node_exe = env_node[0] if env_node else None
- 
-     nodejs, version = find_node_executable(node_exe)
- 
-     MAYBE_FILE_A_BUG = '''
- 
-     Executing `mach bootstrap --no-system-changes` should
-@@ -47,15 +46,15 @@ def nodejs(require, env_node):
- 
-         if require:
-             raise FatalCheckError(msg)
-         else:
-             log.warning(msg)
-             return
- 
-     return namespace(
--        path=nodejs.decode(system_encoding),
-+        path=nodejs,
-         version=version,
-         str_version='.'.join(str(v) for v in version),
-     )
- 
- 
- set_config('NODEJS', depends_if(nodejs)(lambda p: p.path))
-diff --git a/build/moz.configure/util.configure b/build/moz.configure/util.configure
---- a/build/moz.configure/util.configure
-+++ b/build/moz.configure/util.configure
-@@ -283,17 +283,17 @@ def unique_list(l):
- #      r'C:\Program Files (x86)\Windows Kits\10\')
- #
- #   get_registry_values(r'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\'
- #                       r'VisualStudio\VC\*\x86\*\Compiler')
- #   yields e.g.:
- #     ('19.0', 'arm', r'C:\...\amd64_arm\cl.exe')
- #     ('19.0', 'x64', r'C:\...\amd64\cl.exe')
- #     ('19.0', 'x86', r'C:\...\amd64_x86\cl.exe')
--@imports(_import='_winreg', _as='winreg')
-+@imports(_import='winreg')
- @imports(_from='__builtin__', _import='WindowsError')
- @imports(_from='fnmatch', _import='fnmatch')
- def get_registry_values(pattern, get_32_and_64_bit=False):
-     def enum_helper(func, key):
-         i = 0
-         while True:
-             try:
-                 yield func(key, i)
-diff --git a/configure.in b/configure.in
---- a/configure.in
-+++ b/configure.in
-@@ -17,9 +17,9 @@
- # below ensures the script that follows is output by autoconf.
- : "divert(0)dnl"
- #!/bin/sh
- 
- SRCDIR=$(dirname $0)
- TOPSRCDIR="$SRCDIR"
- export OLD_CONFIGURE="$SRCDIR"/old-configure
- 
--which python2.7 > /dev/null && exec python2.7 "$TOPSRCDIR/configure.py" "$@" || exec python "$TOPSRCDIR/configure.py" "$@"
-+exec python3 "$TOPSRCDIR/configure.py" "$@"
-diff --git a/configure.py b/configure.py
---- a/configure.py
-+++ b/configure.py
-@@ -110,17 +110,17 @@ def config_status(config):
-     # here, when we're able to skip configure tests/use cached results/not rely
-     # on autoconf.
-     logging.getLogger('moz.configure').info('Creating config.status')
-     with codecs.open('config.status', 'w', 'utf-8') as fh:
-         fh.write(textwrap.dedent('''\
-             #!%(python)s
-             # coding=utf-8
-             from __future__ import unicode_literals
--        ''') % {'python': config['PYTHON']})
-+        ''') % {'python': config['PYTHON3']})
-         for k, v in six.iteritems(sanitized_config):
-             fh.write('%s = ' % k)
-             write_indented_repr(fh, v)
-         fh.write("__all__ = ['topobjdir', 'topsrcdir', 'defines', "
-                  "'non_global_defines', 'substs', 'mozconfig']")
- 
-         if config.get('MOZ_BUILD_APP') != 'js' or config.get('JS_STANDALONE'):
-             fh.write(textwrap.dedent('''
-diff --git a/js/src/configure.in b/js/src/configure.in
---- a/js/src/configure.in
-+++ b/js/src/configure.in
-@@ -19,9 +19,9 @@
- #!/bin/sh
- 
- SRCDIR=$(dirname $0)
- TOPSRCDIR="$SRCDIR"/../..
- export OLD_CONFIGURE="$SRCDIR"/old-configure
- 
- set -- "$@" --enable-project=js
- 
--which python2.7 > /dev/null && exec python2.7 "$TOPSRCDIR/configure.py" "$@" || exec python "$TOPSRCDIR/configure.py" "$@"
-+exec python3 "$TOPSRCDIR/configure.py" "$@"
-diff --git a/python/mozbuild/mozbuild/virtualenv.py b/python/mozbuild/mozbuild/virtualenv.py
---- a/python/mozbuild/mozbuild/virtualenv.py
-+++ b/python/mozbuild/mozbuild/virtualenv.py
-@@ -190,16 +190,21 @@ class VirtualenvManager(object):
-         # __PYVENV_LAUNCHER__ confuses pip about the python interpreter
-         # See https://bugzilla.mozilla.org/show_bug.cgi?id=1607470
-         os.environ.pop('__PYVENV_LAUNCHER__', None)
-         if self.up_to_date(python):
-             return self.virtualenv_root
-         return self.build(python)
- 
-     def _log_process_output(self, *args, **kwargs):
-+        env = kwargs.pop('env', None) or os.environ.copy()
-+        # PYTHONEXECUTABLE can mess up the creation of virtualenvs when set.
-+        env.pop('PYTHONEXECUTABLE', None)
-+        kwargs['env'] = ensure_subprocess_env(env)
-+
-         if hasattr(self.log_handle, 'fileno'):
-             return subprocess.call(*args, stdout=self.log_handle,
-                                    stderr=subprocess.STDOUT, **kwargs)
- 
-         proc = subprocess.Popen(*args, stdout=subprocess.PIPE,
-                                 stderr=subprocess.STDOUT, **kwargs)
- 
-         for line in proc.stdout:
-@@ -221,18 +226,17 @@ class VirtualenvManager(object):
-         args = [python, self.virtualenv_script_path,
-                 # Without this, virtualenv.py may attempt to contact the outside
-                 # world and search for or download a newer version of pip,
-                 # setuptools, or wheel. This is bad for security, reproducibility,
-                 # and speed.
-                 '--no-download',
-                 self.virtualenv_root]
- 
--        result = self._log_process_output(args,
--                                          env=ensure_subprocess_env(os.environ))
-+        result = self._log_process_output(args)
- 
-         if result:
-             raise Exception(
-                 'Failed to create virtualenv: %s (virtualenv.py retcode: %s)' % (
-                     self.virtualenv_root, result))
- 
-         self.write_exe_info(python)
- 

+ 21 - 21
mozilla-release/patches/series

@@ -6300,42 +6300,42 @@ NOBUG-removenonascii67a1-25314.patch
 1626640-76a1.patch
 1626640-76a1.patch
 1623321-76a1.patch
 1623321-76a1.patch
 1627439-76a1.patch
 1627439-76a1.patch
-1624670-2-77a1.patch
-1581684-2-77a1.patch
-1581684-3-77a1.patch
 1606703-77a1.patch
 1606703-77a1.patch
-1616353-1-77a1.patch
-1627255-1-77a1.patch
-1627255-2-77a1.patch
-1627992-77a1.patch
-1625285-77a1.patch
-1623701-77a1.patch
 1627163-01-77a1.patch
 1627163-01-77a1.patch
 1627163-02-77a1.patch
 1627163-02-77a1.patch
 1627163-03-77a1.patch
 1627163-03-77a1.patch
 1627163-04-77a1.patch
 1627163-04-77a1.patch
-1627163-05-77a1.patch
+1627163-05no06-77a1.patch
 1627163-07-77a1.patch
 1627163-07-77a1.patch
 1627163-08-77a1.patch
 1627163-08-77a1.patch
 1627163-09-77a1.patch
 1627163-09-77a1.patch
+1627255-1-77a1.patch
+1627255-2-77a1.patch
+1627992-77a1.patch
+1624670-2-77a1.patch
+1616353-01-77a1.patch
 1627163-10-77a1.patch
 1627163-10-77a1.patch
 1627163-11-77a1.patch
 1627163-11-77a1.patch
 1627163-12-77a1.patch
 1627163-12-77a1.patch
 1627163-13-77a1.patch
 1627163-13-77a1.patch
+1627163-14-77a1.patch
 1627163-15-77a1.patch
 1627163-15-77a1.patch
 1627163-16-77a1.patch
 1627163-16-77a1.patch
-1627163-17-77a1.patch
-1628683-77a1.patch
+1625285-77a1.patch
+1623701-77a1.patch
 1628205-77a1.patch
 1628205-77a1.patch
+1617748-77a1.patch
+1621436-77a1.patch
+1581684-2-77a1.patch
 1628748-77a1.patch
 1628748-77a1.patch
 1628641-77a1.patch
 1628641-77a1.patch
 1628498-1-77a1.patch
 1628498-1-77a1.patch
-1617748-77a1.patch
-1621436-77a1.patch
-1628498-2-77a1.patch
+1628683-77a1.patch
 1628131-77a1.patch
 1628131-77a1.patch
 1628976-77a1.patch
 1628976-77a1.patch
+1628498-2-77a1.patch
 1628927-77a1.patch
 1628927-77a1.patch
+1581684-3-77a1.patch
 1629159-77a1.patch
 1629159-77a1.patch
 1621359-1-77a1.patch
 1621359-1-77a1.patch
 1621359-2-77a1.patch
 1621359-2-77a1.patch
@@ -6343,31 +6343,31 @@ NOBUG-removenonascii67a1-25314.patch
 1628663-2-77a1.patch
 1628663-2-77a1.patch
 1629595-77a1.patch
 1629595-77a1.patch
 1628621-77a1.patch
 1628621-77a1.patch
-1630426-77a1.patch
 1628954-1-77a1.patch
 1628954-1-77a1.patch
-1628954-2-77a1.patch
+1630426-77a1.patch
 1630047-77a1.patch
 1630047-77a1.patch
+1628954-2-77a1.patch
 1630668-77a1.patch
 1630668-77a1.patch
 1621440-77a1.patch
 1621440-77a1.patch
 1629797-77a1.patch
 1629797-77a1.patch
 1621441-77a1.patch
 1621441-77a1.patch
 1632354-77a1.patch
 1632354-77a1.patch
-1632353-77a1.patch
+1631211-77a1.patch
 1632531-1only-PARTIAL-77a1.patch
 1632531-1only-PARTIAL-77a1.patch
+1632353-77a1.patch
+1632688-77a1.patch
 1627072-77a1.patch
 1627072-77a1.patch
 1628726-77a1.patch
 1628726-77a1.patch
 1578917-77a1.patch
 1578917-77a1.patch
 1621361-77a1.patch
 1621361-77a1.patch
-1632688-77a1.patch
 1632348-77a1.patch
 1632348-77a1.patch
 1631063-77a1.patch
 1631063-77a1.patch
 1632461-77a1.patch
 1632461-77a1.patch
 1632770-77a1.patch
 1632770-77a1.patch
 1632974-77a1.patch
 1632974-77a1.patch
+1634187-77a1.patch
 1632300-77a1.patch
 1632300-77a1.patch
 1634834-77a1.patch
 1634834-77a1.patch
-1634187-77a1.patch
-1631211-77a1.patch
 1634050-77a1.patch
 1634050-77a1.patch
 1634623-1-78a1.patch
 1634623-1-78a1.patch
 1634623-2-78a1.patch
 1634623-2-78a1.patch