Building on Windows

The windows build process.

relenv.build.windows.build_python(env: MutableMapping[str, str], dirs: Dirs, logfp: IO[str]) None

Run the commands to build Python.

Parameters:
  • env (dict) – The environment dictionary

  • dirs (relenv.build.common.Dirs) – The working directories

  • logfp (file) – A handle for the log file

relenv.build.windows.finalize(env: MutableMapping[str, str], dirs: Dirs, logfp: IO[str]) None

Finalize sitecustomize, relenv runtime, and pip for Windows.

Parameters:
  • env (dict) – The environment dictionary

  • dirs (relenv.build.common.Dirs) – The working directories

  • logfp (file) – A handle for the log file

relenv.build.windows.get_externals_bin(source_root: Path, url: str) None

Download external binary dependency.

Download binaries to the “externals” directory in the root of the python source.

relenv.build.windows.get_externals_source(externals_dir: Path, url: str) None

Download external source code dependency.

Download source code and extract to the “externals” directory in the root of the python source. Only works with a tarball

relenv.build.windows.populate_env(env: MutableMapping[str, str], dirs: Dirs) None

Make sure we have the correct environment variables set.

Parameters:
  • env (dict) – The environment dictionary

  • dirs (relenv.build.common.Dirs) – The working directories

relenv.build.windows.update_expat(dirs: Dirs, env: MutableMapping[str, str]) None

Update the EXPAT library.

relenv.build.windows.update_props(source: Path, old: str, new: str) None

Overwrite a dependency string for Windows PCBuild.

Parameters:
  • source (str) – Python’s source directory

  • old (str) – Regular expression to search for

  • new (str) – Replacement text

relenv.build.windows.update_sqlite(dirs: Dirs, env: MutableMapping[str, str]) None

Update the SQLITE library.

relenv.build.windows.update_xz(dirs: Dirs, env: MutableMapping[str, str]) None

Update the XZ library.

COMPATIBILITY NOTE: We use config.h from XZ 5.4.7 for all XZ versions. Starting with XZ 5.5.0, the project removed Visual Studio .vcxproj files and switched to CMake. Python’s build system (PCbuild/liblzma.vcxproj) still expects MSBuild-compatible builds, so we maintain a compatibility shim at relenv/_resources/xz/config.h.

When updating XZ versions, verify compatibility by checking: 1. Build completes without compiler errors 2. test_xz_lzma_functionality passes 3. No new HAVE_* defines required in src/liblzma source files 4. No removed HAVE_* defines that config.h references

If compatibility breaks, you have two options: - Use CMake to generate new config.h for Windows (see discussion at

  • Update relenv/_resources/xz/config.h manually from newer XZ source

See also: relenv/_resources/xz/readme.md