Closed Bug 1473499 (mozbuild-py3) Opened 6 years ago Closed 4 years ago

[mozbuild] Add support for Python 3

Categories

(Firefox Build System :: General, enhancement, P4)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: davehunt, Unassigned)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

User Story

To work on this bug you will need to install and configure Mercurial, which will enable you to download the Firefox source code. It will also be used to commit your changes locally and prepare a patch for review. See the installation guide at https://mozilla-version-control-tools.readthedocs.io/en/latest/hgmozilla/installing.html for help getting Mercurial on your system. Once installed, there are some extensions we recommend installing, details of these can be found here: https://mozilla-version-control-tools.readthedocs.io/en/latest/hgmozilla/extensions.html

To clone the Firefox source code we recommend using the unified repository. Details of this and how to create a bookmark for your work can be found here: https://mozilla-version-control-tools.readthedocs.io/en/latest/hgmozilla/unifiedrepo.html

As this bug relates to Python 3, you will need to have this installed on your system. Our continuous integration is currently using Python 3.5, so for best results we recommend using the same version locally. There are a number of ways to install Python, and they vary depending on your environment. We suggest reading over the guides at http://docs.python-guide.org/en/latest/starting/installation/#python-3-installation-guides to find the best method for you. Note that we also need to maintain support for Python 2, so you'll also need to have Python 2.7 installed.

Whilst we're moving towards adding support for Python 3, we've disabled any tests that fail against this version. This means that in order to work on this bug you will need to enable the tests. This can be done by removing "skip-if = python == 3" from the manifest file in `python/mozbuild/mozbuild/test/python.ini`

To run the tests against Python 3, execute the following command:

```
mach python-test --python=3.5 python/mozbuild
```

Work through the test failures, and update the tests and source code for the package to simultaneously support Python 2.7 and Python 3.5. You can always check that your changes have not inadvertently broken support for Python 2 by using `--python=2.7` on the command line. 

If you're new to Python 3, the guide at https://docs.python.org/3/howto/pyporting.html may help you to get started with understanding the differences. To assist with supporting both Python 2 and 3, we have vendored the "six" package. You can read more about this and how to use it at https://pythonhosted.org/six/

Once the package supports Python 3 and the tests pass, bump the version number in `python/mozbuild/setup.py` to "1.0.0", and update the classifiers so they reflect the versions of Python that we now support.

When your patch(es) are ready, you will need to push them for review. We are use MozReview for this, and instructions for how to prepare your machine and how to structure your commit messages can be found in our guide: https://mozilla-version-control-tools.readthedocs.io/en/latest/mozreview-user.html

There may be some review issues to address, but once your contribution has been approved and subsequently landed, we will release the new version of the package!
Without dropping support for legacy Python, we need to add support for Python 3 to mozbuild.
Keywords: in-triage
Keywords: in-triage
Priority: -- → P4
Blocks: 1526335

I've been trying to identify the scope of python3 migration work for a bunch of mach subcommands (eg. bug 1579329) and the general impression so far is that mozbuild is referenced by a whole lot of mach subcommands.

So it may be worthwhile to look into how mozbuild can be migrated, and how the task should be broken down.

We have a rough plan for the mozbuild porting effort here.

Alias: mozbuild-py3
Depends on: 1611213
Depends on: 1619845

The build system supports Python 3; we run all builds in Python 3 and Python 2 is never required to build. I'm closing this as complete in light of that.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED

Congratulations Ricky and everyone else who worked on this very large and complex project!

You need to log in before you can comment on or make changes to this bug.