Closed Bug 1929447 Opened 1 year ago Closed 1 year ago

./mach -<tab> autocomplete triggers error in uniffi-bindgen-gecko-js/mach_commands.py: ModuleNotFoundError: No module named 'distutils'

Categories

(Toolkit :: UniFFI Bindings, defect)

defect

Tracking

()

RESOLVED FIXED
134 Branch
Tracking Status
firefox-esr128 --- unaffected
firefox132 --- wontfix
firefox133 --- wontfix
firefox134 --- fixed

People

(Reporter: robwu, Assigned: bdk)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

When I press ./mach -<TAB> to trigger autocompletion, the following error is reported after a few seconds:

ModuleNotFoundError: No module named 'distutils'

This is because of import distutils.ccompiler in https://searchfox.org/mozilla-central/rev/fcf53e1685bfb990b5abc7312ac1daf617f0991f/toolkit/components/uniffi-bindgen-gecko-js/mach_commands.py#5 which was added in bug 1910404.
distutils is deprecated and should not be used (bug 1743785). It was removed from Python 3.12.

According to https://peps.python.org/pep-0632/#migration-advice, the replacement for distutils.ccompiler is setuptools.

The full log is below.

$  ./mach -Traceback (most recent call last):
  File "/path/to/gecko/./mach", line 155, in main
    mach = check_and_get_mach(os.path.dirname(os.path.realpath(__file__)), args)
  File "/path/to/gecko/./mach", line 39, in check_and_get_mach
    return load_mach(dir_path, mach_path, args)
  File "/path/to/gecko/./mach", line 25, in load_mach
    return mach_initialize.initialize(dir_path, args)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/path/to/gecko/build/mach_initialize.py", line 399, in initialize
    load_commands_from_spec(command_modules_to_load, topsrcdir, missing_ok=missing_ok)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/gecko/python/mach/mach/command_util.py", line 486, in load_commands_from_spec
    load_commands_from_file(Path(topsrcdir) / path)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/gecko/python/mach/mach/command_util.py", line 467, in load_commands_from_file
    load_source(module_name, str(path))
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/gecko/testing/mozbase/mozfile/mozfile/mozfile.py", line 649, in load_source
    loader.exec_module(module)
    ~~~~~~~~~~~~~~~~~~^^^^^^^^
  File "<frozen importlib._bootstrap_external>", line 1022, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/path/to/gecko/toolkit/components/uniffi-bindgen-gecko-js/mach_commands.py", line 5, in <module>
    import distutils.ccompiler
ModuleNotFoundError: No module named 'distutils'

Set release status flags based on info from the regressing bug 1910404

:bdk, since you are the author of the regressor, bug 1910404, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Flags: needinfo?(bdeankawamura)

This is deprecated and causing issues for users on Python 3.12. Changed
the code to manually find the library file rather than depending on any
library.

Assignee: nobody → bdeankawamura
Status: NEW → ASSIGNED
Flags: needinfo?(bdeankawamura)
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 134 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: