Closed Bug 1719144 Opened 3 years ago Closed 3 years ago

Various python errors with python 3.10

Categories

(Firefox Build System :: Task Configuration, defect)

defect

Tracking

(firefox91 fixed)

RESOLVED FIXED
91 Branch
Tracking Status
firefox91 --- fixed

People

(Reporter: emilio, Assigned: emilio)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Lots of errors like:

AttributeError: module 'collections' has no attribute 'Mapping'

  File "/home/emilio/src/moz/gecko-2/python/mozbuild/mozbuild/artifact_commands.py", line 390, in artifact_toolchain
    tasks = toolchain_task_definitions()
  File "/home/emilio/src/moz/gecko-2/python/mozbuild/mozbuild/toolchains.py", line 11, in toolchain_task_definitions
    from taskgraph.generator import load_tasks_for_kind
  File "/home/emilio/src/moz/gecko-2/taskcluster/taskgraph/generator.py", line 13, in <module>
    from . import filter_tasks
  File "/home/emilio/src/moz/gecko-2/taskcluster/taskgraph/filter_tasks.py", line 9, in <module>
    from . import target_tasks
  File "/home/emilio/src/moz/gecko-2/taskcluster/taskgraph/target_tasks.py", line 16, in <module>
    from taskgraph.parameters import Parameters
  File "/home/emilio/src/moz/gecko-2/taskcluster/taskgraph/parameters.py", line 17, in <module>
    from taskgraph.util.schema import validate_schema
  File "/home/emilio/src/moz/gecko-2/taskcluster/taskgraph/util/schema.py", line 238, in <module>
    {voluptuous.Required("task-reference"): text_type},
  File "/home/emilio/src/moz/gecko-2/third_party/python/voluptuous/voluptuous/schema_builder.py", line 1145, in __init__
    super(Required, self).__init__(schema, msg=msg,
  File "/home/emilio/src/moz/gecko-2/third_party/python/voluptuous/voluptuous/schema_builder.py", line 978, in __init__
    self._schema = Schema(schema_)
  File "/home/emilio/src/moz/gecko-2/third_party/python/voluptuous/voluptuous/schema_builder.py", line 202, in __init__
    self._compiled = self._compile(schema)
  File "/home/emilio/src/moz/gecko-2/third_party/python/voluptuous/voluptuous/schema_builder.py", line 283, in _compile
    if isinstance(schema, collections.Mapping):

Since those live now in collections.abc rather than collections.

These are enough for me to run bootstrap+configure+build.

Some touch third-party code, not sure what the right way to deal with
that is though.

The Bugbug bot thinks this bug should belong to the 'Firefox Build System::Task Configuration' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: General → Task Configuration
See Also: → 1718878

Depends on D119080

Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d2a88c5423a0 Fix various imports for Python 3.10. r=firefox-build-system-reviewers,mhentges https://hg.mozilla.org/integration/autoland/rev/8e4b00b9d57c Update voluptuous. r=firefox-build-system-reviewers,mhentges

Hmm, it seems we build some stuff with versions of python < 3.3, is that expected? If so, should I just do the version check a la https://hg.mozilla.org/integration/autoland/rev/8e4b00b9d57c#l11.12? Seems quite unfortunate / ugly...

Flags: needinfo?(emilio) → needinfo?(mhentges)

The error says python3.7. The problem is you don't get collections.abc unless you import it.

Python 3.7.3 (default, Jan 22 2021, 20:04:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import collections
>>> collections.abc
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.7/collections/__init__.py", line 55, in __getattr__
    raise AttributeError(f'module {__name__!r} has no attribute {name!r}')
AttributeError: module 'collections' has no attribute 'abc'
>>> import collections.abc
>>> collections.abc
<module 'collections.abc' from '/usr/lib/python3.7/collections/abc.py'>
Flags: needinfo?(mhentges)

Hmmwat, ok, will fix, thanks so much Mike :)

Flags: needinfo?(emilio)
Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2418633d529c Fix various imports for Python 3.10. r=firefox-build-system-reviewers,mhentges https://hg.mozilla.org/integration/autoland/rev/c3b650ea51c9 Update voluptuous. r=firefox-build-system-reviewers,mhentges
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 91 Branch
Pushed by emilio@crisal.io: https://hg.mozilla.org/integration/autoland/rev/6b2a1a09cd47 Keep some code python2 compatible since we still run it in some windows talos jobs.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: