Python packaging instructions.

Mac and Linux

The procedure for packaging Git for Mac and Linux can be found in the third_party_packages recipe.



  • First python is installed using the official Python installer.
  • The necessary system dlls are copied into the Python directory.
  • Add additional Python packages to the installation.
  • Generate the CIPD package.
  • Verify the CIPD package.
  • Upload the CIPD package.

The following instructions are for the 64-bit Python installation, but can be trivially transposed to perform a 32-bit Python installation.

Python Installation

  1. Visit, choose “Windows x86-64 MSI installer” (link).

  2. Install for “All Users”

  3. Install to: C:\infra\bin.

  4. When customizing, deselect (“Entire feature will not be available”) the following features:

    • Tcl/Tk
    • Documentation
    • Test suite
    • Add python.exe to Path
  5. (32-bit) Move pythoncom27.dll and pywintypes27.dll from C:\infra\bin to C:\infra\bin\Lib\site-packages\win32.

Add additional packages

Infra Python includes built-in pywin32 and psutil packages.


  1. Download the latest pywin32 for Python2.7 from its SourceForce site:

  2. Run the installer. It should list your recent Python installation as an installation target.

  3. Move the DLLs in C:\infra\bin\Lib\site-packages\pywin32_system32 to C:\infra\bin\Lib\site-packages\win32.


  1. Enter command prompt.
  2. Enter the Python installation directory.
  3. Run Scripts\pip.exe install psutil
  4. Confirm that psutil exists in your installation's Lib/site-packages directory.

Packaging and Cleanup

  1. 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.

  2. 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:[HASH]/doc/packaging/
  3. Delete compiled Python files. Run the following command in an administrator- owned cmd.exe shell:

    del /s c:\infra\bin\*.pyc
  4. 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

Generate the CIPD package

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.
  1. Generate the package by running:

    cipd pkg-build -name infra/python/cpython/windows-amd64 -in C:\infra -out %USERPROFILE%\python.pkg

Verify the CIPD package

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.

  1. If verifying on the builder system, uninstall Python.

  2. Create a testing deployment directory under %USERPROFILE% and deploy the package:

    cipd pkg-deploy -root %USERPROFILE%\pytest %USERPROFILE%\python.pkg
  3. Run the deployed Python:

  4. Verify that the following commands work:

    import pywin
    import psutil
    import win32api

Upload the package to CIPD

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.

  1. Upload the generated and verified package to CIPD.

    cipd pkg-register %USERPROFILE%\python.pkg -tag version:2.7.13.chromium