Index: ps/trunk/libraries/source/spidermonkey/FixPythonCollectionABC.diff =================================================================== --- ps/trunk/libraries/source/spidermonkey/FixPythonCollectionABC.diff +++ ps/trunk/libraries/source/spidermonkey/FixPythonCollectionABC.diff @@ -0,0 +1,87 @@ +--- a/python/mach/mach/config.py ++++ b/python/mach/mach/config.py +@@ -144,7 +144,7 @@ + return _ + + +-class ConfigSettings(collections.Mapping): ++class ConfigSettings(collections.abc.Mapping): + """Interface for configuration settings. + + This is the main interface to the configuration. +@@ -190,7 +190,7 @@ + will result in exceptions being raised. + """ + +- class ConfigSection(collections.MutableMapping, object): ++ class ConfigSection(collections.abc.MutableMapping, object): + """Represents an individual config section.""" + def __init__(self, config, name, settings): + object.__setattr__(self, '_config', config) +--- a/python/mach/mach/decorators.py ++++ b/python/mach/mach/decorators.py +@@ -159,7 +159,7 @@ + 'Conditions argument must take a list ' + \ + 'of functions. Found %s instead.' + +- if not isinstance(command.conditions, collections.Iterable): ++ if not isinstance(command.conditions, collections.abc.Iterable): + msg = msg % (command.name, type(command.conditions)) + raise MachError(msg) + +--- a/python/mach/mach/main.py ++++ b/python/mach/mach/main.py +@@ -16,7 +16,7 @@ + import sys + import traceback + import uuid +-from collections import Iterable ++from collections.abc import Iterable + + from six import string_types + +--- a/python/mozbuild/mozbuild/backend/configenvironment.py ++++ b/python/mozbuild/mozbuild/backend/configenvironment.py +@@ -9,7 +9,8 @@ + import sys + import json + +-from collections import Iterable, OrderedDict ++from collections import OrderedDict ++from collections.abc import Iterable + from types import ModuleType + + import mozpack.path as mozpath +--- a/python/mozbuild/mozbuild/makeutil.py ++++ b/python/mozbuild/mozbuild/makeutil.py +@@ -7,7 +7,7 @@ + import os + import re + import six +-from collections import Iterable ++from collections.abc import Iterable + + + class Makefile(object): +--- a/python/mozbuild/mozbuild/util.py ++++ b/python/mozbuild/mozbuild/util.py +@@ -782,7 +782,7 @@ + self._strings = StrictOrderingOnAppendList() + self._children = {} + +- class StringListAdaptor(collections.Sequence): ++ class StringListAdaptor(collections.abc.Sequence): + def __init__(self, hsl): + self._hsl = hsl + +--- a/testing/mozbase/manifestparser/manifestparser/filters.py ++++ b/testing/mozbase/manifestparser/manifestparser/filters.py +@@ -15,1 +15,2 @@ +-from collections import defaultdict, MutableSequence ++from collections import defaultdict ++from collections.abc import MutableSequence +--- a/third_party/python/pipenv/pipenv/vendor/jinja2/sandbox.py ++++ b/third_party/python/pipenv/pipenv/vendor/jinja2/sandbox.py +@@ -82,1 +82,1 @@ +-from collections import MutableSet, MutableMapping, MutableSequence ++from collections.abc import MutableSet, MutableMapping, MutableSequence Index: ps/trunk/libraries/source/spidermonkey/FixVirtualenvForPython310.diff =================================================================== --- ps/trunk/libraries/source/spidermonkey/FixVirtualenvForPython310.diff +++ ps/trunk/libraries/source/spidermonkey/FixVirtualenvForPython310.diff @@ -0,0 +1,15 @@ +--- a/third_party/python/virtualenv/virtualenv.py ++++ b/third_party/python/virtualenv/virtualenv.py +@@ -1804,7 +1804,11 @@ + pass + else: + # noinspection PyProtectedMember +- if sysconfig._get_default_scheme() == "posix_local": ++ try: # Python >= 3.10 ++ default_scheme = sysconfig.get_default_scheme() ++ except: # Python < 3.10 ++ default_scheme = sysconfig._get_default_scheme() ++ if default_scheme == "posix_local": + local_path = os.path.join(home_dir, "local") + if not os.path.exists(local_path): + os.mkdir(local_path) Index: ps/trunk/libraries/source/spidermonkey/patch.sh =================================================================== --- ps/trunk/libraries/source/spidermonkey/patch.sh +++ ps/trunk/libraries/source/spidermonkey/patch.sh @@ -18,6 +18,14 @@ export PYTHONPATH="$(pwd)/virtualenv:$PYTHONPATH" patch -p1 < ../FixVirtualEnv.diff fi +else + # In python 3.10 `sysconfig._get_default_scheme()` was renamed to + # `sysconfig.get_default_scheme()`. This breaks the version of + # `virtualenv` bundled with the spidermonkey source code. + # + # It is assumed that the updated version fetched for macOS systems + # above does not have this problem. + patch -p1 < ../FixVirtualenvForPython310.diff fi # Mozglue symbols need to be linked against static builds. @@ -52,6 +60,11 @@ # so this patches it to an arbitrarily high Mac OS 11 patch -p1 < ../FixMacBuild.diff +# In python 3.3, the Collections' Abstract Base Classes were moved from `collections` to +# `collections.abc`, and aliases were set up for backwards compatibility. +# In python 3.10, these aliases were removed, requiring all code that used them to update. +patch -p1 < ../FixPythonCollectionABC.diff + # Fix FP access breaking compilation on RPI3+ # https://bugzilla.mozilla.org/show_bug.cgi?id=1526653 # https://bugzilla.mozilla.org/show_bug.cgi?id=1536491