Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
joerick committed Mar 9, 2024
2 parents 442539b + f7de18e commit 9dc73cb
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 38 deletions.
48 changes: 39 additions & 9 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,48 @@ runs:
python-version: "3.8 - 3.12"
update-environment: false

# macos-14 (M1) may be missing pipx (due to it not having CPython)
- run: |
"${{ steps.python.outputs.python-path }}" -m pip install pipx
- id: cibw
run: |
# Install cibuildwheel
"${{ steps.python.outputs.python-path }}" -u << "EOF"
import os
import shutil
import sys
import venv
from pathlib import Path
from subprocess import run
class EnvBuilder(venv.EnvBuilder):
def __init__(self):
super().__init__()
def setup_scripts(self, context):
pass
def post_setup(self, context):
super().post_setup(context)
self.bin_path = Path(context.env_exe).parent
run([sys.executable, "-m", "pip", "--python", context.env_exe, "install", r"${{ github.action_path }}"], check=True)
print("::group::Install cibuildwheel")
venv_path = Path(r"${{ runner.temp }}") / "cibw"
if venv_path.exists():
shutil.rmtree(venv_path)
builder = EnvBuilder()
builder.create(venv_path)
cibw_path = [path for path in builder.bin_path.glob("cibuildwheel*") if path.stem == "cibuildwheel"][0]
with open(os.environ["GITHUB_OUTPUT"], "at") as f:
f.write(f"cibw-path={cibw_path}\n")
print("::endgroup::")
EOF
shell: bash

# Redirecting stderr to stdout to fix interleaving issue in Actions.
- run: >
"${{ steps.python.outputs.python-path }}" -m pipx run
--spec '${{ github.action_path }}'
cibuildwheel
"${{ steps.cibw.outputs.cibw-path }}"
"${{ inputs.package-dir }}"
${{ inputs.output-dir != '' && format('--output-dir "{0}"', inputs.output-dir) || ''}}
${{ inputs.config-file != '' && format('--config-file "{0}"', inputs.config-file) || ''}}
Expand All @@ -51,9 +83,7 @@ runs:
# Windows needs powershell to interact nicely with Meson
- run: >
& "${{ steps.python.outputs.python-path }}" -m pipx run
--spec "${{ github.action_path }}"
cibuildwheel
& "${{ steps.cibw.outputs.cibw-path }}"
"${{ inputs.package-dir }}"
${{ inputs.output-dir != '' && format('--output-dir "{0}"', inputs.output-dir) || ''}}
${{ inputs.config-file != '' && format('--config-file "{0}"', inputs.config-file) || ''}}
Expand Down
2 changes: 1 addition & 1 deletion bin/update_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Image:

images = [
# manylinux1 images
Image("manylinux1", "x86_64", "quay.io/pypa/manylinux1_x86_64", None),
Image("manylinux1", "x86_64", "quay.io/pypa/manylinux1_x86_64", "2024-02-17-6f383ed"),
Image("manylinux1", "i686", "quay.io/pypa/manylinux1_i686", None),
# manylinux2010 images
Image("manylinux2010", "x86_64", "quay.io/pypa/manylinux2010_x86_64", None),
Expand Down
6 changes: 5 additions & 1 deletion cibuildwheel/macos.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,11 @@ def build(options: Options, tmp_path: Path) -> None:
config.version
)
)
build_env["PIP_CONSTRAINT"] = constraint_path.as_uri()
user_constraints = build_env.get("PIP_CONSTRAINT")
our_constraints = constraint_path.as_uri()
build_env["PIP_CONSTRAINT"] = " ".join(
c for c in [user_constraints, our_constraints] if c
)
build_env["VIRTUALENV_PIP"] = get_pip_version(env)
call(
"python",
Expand Down
50 changes: 25 additions & 25 deletions cibuildwheel/resources/pinned_docker_images.cfg
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
[x86_64]
manylinux1 = quay.io/pypa/manylinux1_x86_64:2024-02-17-6f383ed
manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2022-08-05-4535177
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2024-02-16-b3cad8f
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2024-03-04-afcf9ce
manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2022-12-26-0d38463
manylinux_2_28 = quay.io/pypa/manylinux_2_28_x86_64:2024-02-16-b3cad8f
musllinux_1_1 = quay.io/pypa/musllinux_1_1_x86_64:2024-02-16-b3cad8f
musllinux_1_2 = quay.io/pypa/musllinux_1_2_x86_64:2024-02-16-b3cad8f
manylinux_2_28 = quay.io/pypa/manylinux_2_28_x86_64:2024-03-04-afcf9ce
musllinux_1_1 = quay.io/pypa/musllinux_1_1_x86_64:2024-03-04-afcf9ce
musllinux_1_2 = quay.io/pypa/musllinux_1_2_x86_64:2024-03-04-afcf9ce

[i686]
manylinux1 = quay.io/pypa/manylinux1_i686:2024-02-17-6f383ed
manylinux1 = quay.io/pypa/manylinux1_i686:2024-03-04-6999d27
manylinux2010 = quay.io/pypa/manylinux2010_i686:2022-08-05-4535177
manylinux2014 = quay.io/pypa/manylinux2014_i686:2024-02-16-b3cad8f
manylinux2014 = quay.io/pypa/manylinux2014_i686:2024-03-04-afcf9ce
manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2022-12-26-0d38463
musllinux_1_1 = quay.io/pypa/musllinux_1_1_i686:2024-02-16-b3cad8f
musllinux_1_2 = quay.io/pypa/musllinux_1_2_i686:2024-02-16-b3cad8f
musllinux_1_1 = quay.io/pypa/musllinux_1_1_i686:2024-03-04-afcf9ce
musllinux_1_2 = quay.io/pypa/musllinux_1_2_i686:2024-03-04-afcf9ce

[pypy_x86_64]
manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2022-08-05-4535177
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2024-02-16-b3cad8f
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2024-03-04-afcf9ce
manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2022-12-26-0d38463
manylinux_2_28 = quay.io/pypa/manylinux_2_28_x86_64:2024-02-16-b3cad8f
manylinux_2_28 = quay.io/pypa/manylinux_2_28_x86_64:2024-03-04-afcf9ce

[pypy_i686]
manylinux2010 = quay.io/pypa/manylinux2010_i686:2022-08-05-4535177
manylinux2014 = quay.io/pypa/manylinux2014_i686:2024-02-16-b3cad8f
manylinux2014 = quay.io/pypa/manylinux2014_i686:2024-03-04-afcf9ce
manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2022-12-26-0d38463

[aarch64]
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2024-02-16-b3cad8f
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2024-03-04-afcf9ce
manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2022-12-26-0d38463
manylinux_2_28 = quay.io/pypa/manylinux_2_28_aarch64:2024-02-16-b3cad8f
musllinux_1_1 = quay.io/pypa/musllinux_1_1_aarch64:2024-02-16-b3cad8f
musllinux_1_2 = quay.io/pypa/musllinux_1_2_aarch64:2024-02-16-b3cad8f
manylinux_2_28 = quay.io/pypa/manylinux_2_28_aarch64:2024-03-04-afcf9ce
musllinux_1_1 = quay.io/pypa/musllinux_1_1_aarch64:2024-03-04-afcf9ce
musllinux_1_2 = quay.io/pypa/musllinux_1_2_aarch64:2024-03-04-afcf9ce

[ppc64le]
manylinux2014 = quay.io/pypa/manylinux2014_ppc64le:2024-02-16-b3cad8f
manylinux2014 = quay.io/pypa/manylinux2014_ppc64le:2024-03-04-afcf9ce
manylinux_2_24 = quay.io/pypa/manylinux_2_24_ppc64le:2022-12-26-0d38463
manylinux_2_28 = quay.io/pypa/manylinux_2_28_ppc64le:2024-02-16-b3cad8f
musllinux_1_1 = quay.io/pypa/musllinux_1_1_ppc64le:2024-02-16-b3cad8f
musllinux_1_2 = quay.io/pypa/musllinux_1_2_ppc64le:2024-02-16-b3cad8f
manylinux_2_28 = quay.io/pypa/manylinux_2_28_ppc64le:2024-03-04-afcf9ce
musllinux_1_1 = quay.io/pypa/musllinux_1_1_ppc64le:2024-03-04-afcf9ce
musllinux_1_2 = quay.io/pypa/musllinux_1_2_ppc64le:2024-03-04-afcf9ce

[s390x]
manylinux2014 = quay.io/pypa/manylinux2014_s390x:2024-02-08-a1b4ddc
manylinux2014 = quay.io/pypa/manylinux2014_s390x:2024-03-04-afcf9ce
manylinux_2_24 = quay.io/pypa/manylinux_2_24_s390x:2022-12-26-0d38463
manylinux_2_28 = quay.io/pypa/manylinux_2_28_s390x:2024-02-08-a1b4ddc
musllinux_1_1 = quay.io/pypa/musllinux_1_1_s390x:2024-02-16-b3cad8f
musllinux_1_2 = quay.io/pypa/musllinux_1_2_s390x:2024-02-08-a1b4ddc
manylinux_2_28 = quay.io/pypa/manylinux_2_28_s390x:2024-03-04-afcf9ce
musllinux_1_1 = quay.io/pypa/musllinux_1_1_s390x:2024-03-04-afcf9ce
musllinux_1_2 = quay.io/pypa/musllinux_1_2_s390x:2024-03-04-afcf9ce

[pypy_aarch64]
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2024-02-16-b3cad8f
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2024-03-04-afcf9ce
manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2022-12-26-0d38463
manylinux_2_28 = quay.io/pypa/manylinux_2_28_aarch64:2024-02-16-b3cad8f
manylinux_2_28 = quay.io/pypa/manylinux_2_28_aarch64:2024-03-04-afcf9ce

7 changes: 6 additions & 1 deletion cibuildwheel/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,12 @@ def build(options: Options, tmp_path: Path) -> None:
tmp_file.write_bytes(constraints_path.read_bytes())
constraints_path = tmp_file

build_env["PIP_CONSTRAINT"] = str(constraints_path)
our_constraints = str(constraints_path)
user_constraints = build_env.get("PIP_CONSTRAINT")
build_env["PIP_CONSTRAINT"] = " ".join(
c for c in [our_constraints, user_constraints] if c
)

build_env["VIRTUALENV_PIP"] = get_pip_version(env)
call(
"python",
Expand Down
2 changes: 1 addition & 1 deletion docs/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ Platform-specific environment variables are also available:<br/>
cibuildwheel always defines the environment variable `CIBUILDWHEEL=1`. This can be useful for [building wheels with optional extensions](faq.md#building-packages-with-optional-c-extensions).

!!! note
To do its work, cibuildwheel internally sets the options `PIP_CONSTRAINT`, `VIRTUALENV_PIP`, `DIST_EXTRA_CONFIG`, `SETUPTOOLS_EXT_SUFFIX`, `PIP_DISABLE_PIP_VERSION_CHECK`, `PIP_ROOT_USER_ACTION`. Your assignments to these options might be overridden.
To do its work, cibuildwheel sets the variables `VIRTUALENV_PIP`, `DIST_EXTRA_CONFIG`, `SETUPTOOLS_EXT_SUFFIX`, `PIP_DISABLE_PIP_VERSION_CHECK`, `PIP_ROOT_USER_ACTION`, and it extends the variables `PATH` and `PIP_CONSTRAINT`. Your assignments to these options might be replaced or extended.

### `CIBW_ENVIRONMENT_PASS_LINUX` {: #environment-pass}
> Set environment variables on the host to pass-through to the container.
Expand Down
49 changes: 49 additions & 0 deletions test/test_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,52 @@ def test_overridden_path(tmp_path, capfd):
assert len(os.listdir(output_dir)) == 0
captured = capfd.readouterr()
assert "python available on PATH doesn't match our installed instance" in captured.err


@pytest.mark.parametrize("build_frontend", ["pip", "build"])
def test_overridden_pip_constraint(tmp_path, build_frontend):
"""
Verify that users can use PIP_CONSTRAINT to specify a specific version of
a build-system.requires dependency, by asserting the version of pytz in the
setup.py.
"""
project_dir = tmp_path / "project"

project = test_projects.new_c_project(
setup_py_add=textwrap.dedent(
"""
import pytz
assert pytz.__version__ == "2022.4"
"""
)
)
project.files["pyproject.toml"] = textwrap.dedent(
"""
[build-system]
requires = ["setuptools", "pytz"]
build-backend = "setuptools.build_meta"
"""
)
project.generate(project_dir)

if utils.platform == "linux":
# put the constraints file in the project directory, so it's available
# in the docker container
constraints_file = project_dir / "constraints.txt"
else:
constraints_file = tmp_path / "constraints.txt"

constraints_file.write_text("pytz==2022.4")

actual_wheels = utils.cibuildwheel_run(
project_dir,
add_env={
"CIBW_BUILD": "cp312-*",
"CIBW_BUILD_FRONTEND": build_frontend,
"PIP_CONSTRAINT": str(constraints_file),
"CIBW_ENVIRONMENT_LINUX": "PIP_CONSTRAINT=./constraints.txt",
},
)

expected_wheels = [w for w in utils.expected_wheels("spam", "0.1.0") if "cp312" in w]
assert set(actual_wheels) == set(expected_wheels)

0 comments on commit 9dc73cb

Please sign in to comment.