The procedure for packaging Git for Mac and Linux can be found in the third_party_packages recipe.
Overview:
The following instructions are for the 64-bit Python installation, but can be trivially transposed to perform a 32-bit Python installation.
Visit https://www.python.org/downloads/windows/, choose “Windows x86-64 MSI installer” (link).
Install for “All Users”
Install to: C:\infra\bin
.
When customizing, deselect (“Entire feature will not be available”) the following features:
(32-bit) Move pythoncom27.dll
and pywintypes27.dll
from C:\infra\bin
to C:\infra\bin\Lib\site-packages\win32
.
Infra Python includes built-in pywin32
and psutil
packages.
Download the latest pywin32
for Python2.7 from its SourceForce site: https://sourceforge.net/projects/pywin32/files/pywin32/
Run the installer. It should list your recent Python installation as an installation target.
Move the DLLs in C:\infra\bin\Lib\site-packages\pywin32_system32
to C:\infra\bin\Lib\site-packages\win32
.
Scripts\pip.exe install psutil
psutil
exists in your installation's Lib/site-packages
directory.Create a C:\infra\doc\python
folder for documentation. Move text files in C:\infra\bin
(e.g., LICENSE.txt, NEWS.txt, README.txt) into this directory.
Add a new file to C:\infra\doc\python
containing the following text, replacing HASH
with the latest commit hash from the infra/infra repository.
This Python installation was created for Chromium by hand. For instructions on how to generate this package, see: https://chromium.googlesource.com/infra/infra/+/[HASH]/doc/packaging/python.md
Delete compiled Python files. Run the following command in an administrator- owned cmd.exe
shell:
del /s c:\infra\bin\*.pyc
Delete files (if they exist) from C:\infra\bin
:
pywin32-wininst.log
Removepywin32.exe
w9xpopen.exe
Lib\test
Lib\lib-tk
Lib\site-packages\PyWin32.chm
Now, we want to generate the Python CIPD package. The package name has the form infra/python/cpython/windows-[ARCH]
, where:
ARCH
is the current architecture, either 386
or amd64
.Generate the package by running:
cipd pkg-build -name infra/python/cpython/windows-amd64 -in C:\infra -out %USERPROFILE%\python.pkg
Prior to uploading the new CIPD package, it should be verified on a system. Ideally, it will be verified on a different, clean system to ensure its completeness. However, failing that, it may be verified on the builder system.
If verifying on the builder system, uninstall Python.
Create a testing deployment directory under %USERPROFILE%
and deploy the package:
cipd pkg-deploy -root %USERPROFILE%\pytest %USERPROFILE%\python.pkg
Run the deployed Python:
%USERPROFILE%\pytest\bin\python.exe
Verify that the following commands work:
import pywin import psutil import win32api
We need to generate a tag for the Python package. The tag uses the form version:[PYVERSION][SUFFIX]
, where:
PYVERSION
is the Python version, in this case 2.7.13
.SUFFIX
is the value of CPYTHON_PACKAGE_VERSION_SUFFIX
from the third_party_packages.For example, version version:2.7.13.chromium
.
Upload the generated and verified package to CIPD.
cipd pkg-register %USERPROFILE%\python.pkg -tag version:2.7.13.chromium