For this example, we'll be adding ‘scandir’ at version 1.7.
Go to pypi and find the wheel at the appropriate version in question.
Determine what type of wheel it is (in order of preference):
*-py2.py3-none-any.whlfile (may be just py2)
*.tar.gzfile. You'll have to fetch this tarball and look to see if it contains any .c or .cc files. If it does, then this is either
*.tar.gzwith the library source, but may also contain
.whlfiles for some platforms.
Once you've identified the wheel type, open wheels.py and find the relevant section. Each section is ordered by wheel name and then by symver. If you put the wheel definition in the wrong place, dockerbuild will tell you :)
scandir, we see that there are prebuilts for windows, but for everything else we have to build it ourself.
The wheels are built for linux platforms using Docker (hence “dockerbuild”). Unfortunately this tool ONLY supports building for linux this way. For building mac and windows, this can use the ambient toolchain (i.e. have XCode or MSVS installed on your system).
I actually haven't ever run this on windows. Usually python wheels with C extensions that chromium may actually need have pre-built windows wheels.
That said, this is essentially just doing
setup.py bdist_wheel to generate the wheel contents, so if that process works with MSVS, it SHOULD work.
The upshot of this is that if you need to build for e.g. mac or windows, you need to run this from one of those platforms with an appropriate SDK installed.
Back to our example, we'll be adding a new entry to the SourceOrPrebuilt section:
SourceOrPrebuilt('scandir', '1.9.0', packaged=[ 'windows-x86', 'windows-x64', ], ),
This says the wheel
scandir-1.9.0 is either built from source (.tar.gz) or is prebuilt (for the following
And update the wheel.md documentation:
vpython3 -m infra.tools.dockerbuild \ wheel-dump
Now, test that your wheel builds successfully using the following:
vpython3 -m infra.tools.dockerbuild \ --logs-debug \ wheel-build \ --wheel 'scandir-1.9.0' \
Notable options (check
--help for details):
--wheel_re- Use in place of
--wheelto run for multiple wheels or versions.
--platform- Specify a specific platform to build for.
Then you upload your CL and commit as usual.
Once your CL is committed, the wheels will be automatically built and uploaded by the following builders:
While we strongly prefer to not patch anything, sometimes we need a backport or local fix for our system.
Here's the quick overview:
UniversalSourcesince we need to unpack the source & patch it directly before building the wheel.
UniversalSource('scandir', '1.9.0')will have a prefix of
scandir-1.9.0-and a suffix of
A short example:
UniversalSource('scandir', '1.9.0', patches=( 'some-fix', 'another-change', )),
This will apply the two patches: