Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ jobs:
with:
persist-credentials: false

- name: Install Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
- name: Set up uv
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
with:
python-version: "3.11"
enable-cache: false

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
Expand All @@ -88,7 +88,7 @@ jobs:

- name: Generate Dockerfiles
run: |
./build-linux.py --make-target empty
./build-uv.py --make-target empty
repo_name=$(echo "${GITHUB_REPOSITORY,,}" | sed 's|\.|_|g')
git_ref_name=$(echo "${GITHUB_REF_NAME,,}" | sed 's|[^a-z0-9_-]|_|g')
echo "REPO_NAME=${repo_name}" >> "${GITHUB_ENV}"
Expand Down Expand Up @@ -150,8 +150,10 @@ jobs:
fetch-depth: 0
persist-credentials: false

- name: Set up Python
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4.2.0
- name: Set up uv
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
with:
enable-cache: false

- name: Get pull request labels
id: get-labels
Expand Down Expand Up @@ -222,10 +224,10 @@ jobs:
fetch-depth: 0
persist-credentials: false

- name: Install Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
- name: Set up uv
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
with:
python-version: "3.11"
enable-cache: false

- name: Download pythonbuild
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
Expand Down Expand Up @@ -265,12 +267,12 @@ jobs:
if: ${{ ! matrix.dry-run }}
run: |
# Do empty target so all generated files are touched.
./build-linux.py --make-target empty
./build-uv.py --make-target empty

# Touch mtimes of all images so they are newer than autogenerated files above.
touch build/image-*

./build-linux.py --target-triple ${MATRIX_TARGET_TRIPLE} --python cpython-${MATRIX_PYTHON} --options ${MATRIX_BUILD_OPTIONS}
./build-uv.py --target-triple ${MATRIX_TARGET_TRIPLE} --python cpython-${MATRIX_PYTHON} --options ${MATRIX_BUILD_OPTIONS}
env:
MATRIX_TARGET_TRIPLE: ${{ matrix.target_triple }}
MATRIX_PYTHON: ${{ matrix.python }}
Expand Down Expand Up @@ -330,10 +332,10 @@ jobs:
fetch-depth: 0
persist-credentials: false

- name: Install Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
- name: Set up uv
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
with:
python-version: "3.11"
enable-cache: false

- name: Download pythonbuild
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
Expand Down Expand Up @@ -373,12 +375,12 @@ jobs:
if: ${{ ! matrix.dry-run }}
run: |
# Do empty target so all generated files are touched.
./build-linux.py --make-target empty
./build-uv.py --make-target empty

# Touch mtimes of all images so they are newer than autogenerated files above.
touch build/image-*

./build-linux.py --target-triple ${MATRIX_TARGET_TRIPLE} --python cpython-${MATRIX_PYTHON} --options ${MATRIX_BUILD_OPTIONS}
./build-uv.py --target-triple ${MATRIX_TARGET_TRIPLE} --python cpython-${MATRIX_PYTHON} --options ${MATRIX_BUILD_OPTIONS}
env:
MATRIX_TARGET_TRIPLE: ${{ matrix.target_triple }}
MATRIX_PYTHON: ${{ matrix.python }}
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ jobs:
fetch-depth: 0
persist-credentials: false

- name: Set up Python
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4.2.0
- name: Set up uv
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
with:
enable-cache: false

- name: Get pull request labels
id: get-labels
Expand Down Expand Up @@ -128,10 +130,10 @@ jobs:
fetch-depth: 0
persist-credentials: false

- name: Install Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
- name: Set up uv
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
with:
python-version: "3.11"
enable-cache: false

- name: Download pythonbuild
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
Expand All @@ -142,7 +144,7 @@ jobs:
- name: Build
if: ${{ ! matrix.dry-run }}
run: |
./build-macos.py --target-triple ${MATRIX_TARGET_TRIPLE} --python cpython-${MATRIX_PYTHON} --options ${MATRIX_BUILD_OPTIONS}
./build-uv.py --target-triple ${MATRIX_TARGET_TRIPLE} --python cpython-${MATRIX_PYTHON} --options ${MATRIX_BUILD_OPTIONS}
env:
MATRIX_TARGET_TRIPLE: ${{ matrix.target_triple }}
MATRIX_PYTHON: ${{ matrix.python }}
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ jobs:
fetch-depth: 0
persist-credentials: false

- name: Set up Python
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4.2.0
- name: Set up uv
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
with:
enable-cache: false

- name: Get pull request labels
id: get-labels
Expand Down Expand Up @@ -134,10 +136,10 @@ jobs:
with:
packages: autoconf automake libtool

- name: Install Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
- name: Set up uv
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
with:
python-version: "3.12"
enable-cache: false

- name: Download pythonbuild Executable
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
Expand All @@ -148,14 +150,14 @@ jobs:
# don't get compiled properly.
- name: Bootstrap Python environment
run: |
py.exe -3.12 build-windows.py --help
uv run build-uv.py --help

- name: Build
if: ${{ ! matrix.dry-run }}
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\%MATRIX_VCVARS%"
py.exe -3.12 build-windows.py --python cpython-%MATRIX_PYTHON% --sh c:\cygwin\bin\sh.exe --options %MATRIX_BUILD_OPTIONS%
uv run build-uv.py --python cpython-%MATRIX_PYTHON% --sh c:\cygwin\bin\sh.exe --options %MATRIX_BUILD_OPTIONS%
env:
MATRIX_VCVARS: ${{ matrix.vcvars }}
MATRIX_PYTHON: ${{ matrix.python }}
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13
46 changes: 46 additions & 0 deletions build-uv.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env -S uv run
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.

import os
import pathlib
import platform
import subprocess
import sys

ROOT = pathlib.Path(os.path.abspath(__file__)).parent


def run():
env = dict(os.environ)
env["PYTHONUNBUFFERED"] = "1"
python = sys.executable
system = platform.system()

if system == "Darwin" or system == "Linux":
args = [
python,
"build-main.py",
*sys.argv[1:],
]
make_dir = ROOT / "cpython-unix"
os.chdir(make_dir)
return os.execve(python, args, env)
elif system == "Windows":
args = [
python,
"build.py",
*sys.argv[1:],
]
cwd = str(ROOT / "cpython-windows")
return subprocess.run(args, cwd=cwd, env=env, check=True, bufsize=0)
else:
raise Exception(f"Unsupported host system: {system}")


if __name__ == "__main__":
try:
run()
except subprocess.CalledProcessError as e:
sys.exit(e.returncode)
4 changes: 3 additions & 1 deletion cpython-windows/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -1512,7 +1512,8 @@ def build_cpython(
p for p in env["PATH"].split(";") if p != str(BUILD / "venv" / "bin")
]
env["PATH"] = ";".join(paths)
del env["PYTHONPATH"]
if "PYTHONPATH" in env:
del env["PYTHONPATH"]

env["PYTHONHOME"] = str(cpython_source_path)

Expand Down Expand Up @@ -1974,6 +1975,7 @@ def main() -> None:
release_tag = release_tag_from_git()

# Create, e.g., `cpython-3.10.13+20240224-x86_64-pc-windows-msvc-pgo.tar.zst`.
DIST.mkdir(exist_ok=True)
compress_python_archive(
tar_path,
DIST,
Expand Down
25 changes: 25 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[project]
name = "python-build-standalone"
version = "0.1.0"
description = "Produces standalone, highly-redistributable builds of Python."
readme = "README.rst"
requires-python = ">=3.10"
dependencies = [
"docker>=7.1.0",
"jinja2>=3.1.5",
"jsonschema>=4.23.0",
"pygithub>=2.6.1 ; platform_machine != 'aarch64' or sys_platform != 'win32'",
"pyyaml>=6.0.2",
"six>=1.17.0",
"tomli>=2.2.1",
"typing-extensions>=4.14.1",
"zstandard>=0.23.0",
]

[build-system]
requires = ["uv_build>=0.9.12,<0.10.0"]
build-backend = "uv_build"

[tool.uv.build-backend]
module-name = "pythonbuild"
module-root = ""
Loading
Loading