Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PSA: Certain mach commands (including new ones) starting to run with Python 3

4 views
Skip to first unread message

Andrew Halberstadt

unread,
Aug 28, 2019, 9:46:33 AM8/28/19
to to...@lists.mozilla.org, dev-builds
As of bug 1473498 <https://bugzilla.mozilla.org/show_bug.cgi?id=1473498>,
running `./mach help` and `./mach google` (as well as search, searchfox,
dxr and mdn) will run with Python 3. While this is a seemingly small
accomplishment, it is actually a huge milestone in the Python 3 migration
effort. It means we now have the ability to convert commands one at a time,
opening the door to parallelize our efforts. Even better, all new mach
commands will run with Python 3 by default! I'd like to thank :glandium,
:callek and :mars for their huge help getting this bug landed.

This was accomplished by storing a Python 2 whitelist directly in the mach
driver:
https://hg.mozilla.org/mozilla-central/file/tip/mach#l13

So if you want to try and convert a command, simply remove it from that
list and run the command to see what breaks. Fix it and repeat. Please try
to avoid adding new commands to the whitelist! There are some exceptions to
this rule:

1. Your command depends on other Python 2-only libraries (in which case,
please file a bug for them if there isn't one already).
2. Your command is already implemented locally (you just haven't landed it
yet) and converting would be too burdensome.

When writing new commands, you should target Python 3.6. Again there are
some exceptions:

1. If you are writing a library used by multiple things, you'll likely also
want to support Python 2 at the same time.
2. If you are writing code that the build system depends on, you'll need to
target Python 3.5 instead of 3.6 (of course in addition to Python 2).

If you have any questions feel free to message me, or reach out to #python
on irc.mozilla.org, or #py3 in Slack. Also be sure to check out our migration
wiki <https://wiki.mozilla.org/Firefox/Python_3_Migration> if you'd like to
get involved!
Cheers,
Andrew
0 new messages