Closed Bug 1577501 Opened 5 months ago Closed 5 months ago

Make `mach help <command>` use the right Python

Categories

(Firefox Build System :: Mach Core, defect, P1)

defect

Tracking

(firefox71 fixed)

RESOLVED FIXED
mozilla71
Tracking Status
firefox71 --- fixed

People

(Reporter: ahal, Assigned: ahal)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Turns out that while ./mach help works, sometimes ./mach help &lt;subcommand> doesn't. This is because some subcommands define their argument parsers externally, so running, e.g ./mach help mochitest will import the mochitest harness, which might end up running Python 2-only code.

The easiest fix is to just run ./mach help with Python 2 all the time.. Though I guess we could also look at the next argument if the first one is help.

On second thought, making mach help always use Python 2 isn't great either. It means that future Python 3-only commands that use an external argument parser will need to continue supporting Python 2 (or else do import trickery). That's not great and seems like a good enough reason to solve this properly.

Summary: Revert `mach help` back to Python 2 → Make `mach help <command>` use the right Python

Some commands use external argument parsers, so invoking |mach help <command>| will import
external modules (which may only be Python 2 compatible).

This makes sure that we detect the actual subcommand we're generating help for
and use the proper Python.

A much simpler solution would have been to run |mach help| with Python 2 all
the time. However, as we convert things to Python 3 this would have meant that
Python 3 only code would blow up. This would have forced us to continue
supporting Python 2, even for Python 3-only commands.

Priority: -- → P1
Pushed by mh@glandium.org:
https://hg.mozilla.org/integration/autoland/rev/59610f7142a7
[mach] Make sure ./mach help <command> uses the correct Python, r=glandium
Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla71
Blocks: 1581684
You need to log in before you can comment on or make changes to this bug.