Skip to content
Open
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
2 changes: 2 additions & 0 deletions bin/generate_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ def build_frontend_schema(
case {"type": "string_table_array"}:
del value["type"]
value["oneOf"] = string_table_array
case _:
pass

overrides = yaml.safe_load(
"""
Expand Down
6 changes: 3 additions & 3 deletions bin/update_pythons.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ def __init__(self, arch_str: ArchStr, free_threaded: bool) -> None:
response.raise_for_status()
api_info = response.json()

for resource in api_info["resources"]:
if resource["@type"] == "PackageBaseAddress/3.0.0":
endpoint = resource["@id"]
endpoint = next(
r["@id"] for r in api_info["resources"] if r["@type"] == "PackageBaseAddress/3.0.0"
)

ARCH_DICT = {"32": "win32", "64": "win_amd64", "ARM64": "win_arm64"}
PACKAGE_DICT = {"32": "pythonx86", "64": "python", "ARM64": "pythonarm64"}
Expand Down
8 changes: 6 additions & 2 deletions cibuildwheel/oci_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,9 +546,14 @@ def call(
else:
output_io = sys.stdout.buffer

while True:
return_code = None
while return_code is None:
line = self.bash_stdout.readline()

if not line:
msg = "Failed to read the return code, the container shell has exited"
raise RuntimeError(msg)

if line.endswith(bytes(end_of_message, encoding="utf8") + b"\n"):
# fmt: off
footer_offset = (
Expand All @@ -563,7 +568,6 @@ def call(
# add the last line to output, without the footer
output_io.write(line[0:footer_offset])
output_io.flush()
break
else:
output_io.write(line)
output_io.flush()
Expand Down
2 changes: 1 addition & 1 deletion cibuildwheel/platforms/ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ def build(options: Options, tmp_path: Path) -> None:
f"that is compatible with {config.identifier}. "
"Skipping build step..."
)
test_wheel = compatible_wheel
repaired_wheel = test_wheel = compatible_wheel
else:
if build_options.before_build:
log.step("Running before_build...")
Expand Down
2 changes: 1 addition & 1 deletion cibuildwheel/platforms/pyodide.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def build(options: Options, tmp_path: Path) -> None:
print(
f"\nFound previously built wheel {compatible_wheel.name}, that's compatible with {config.identifier}. Skipping build step..."
)
built_wheel = compatible_wheel
repaired_wheel = compatible_wheel
else:
if build_options.before_build:
log.step("Running before_build...")
Expand Down
2 changes: 2 additions & 0 deletions cibuildwheel/projectfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ def visit_keyword(self, node: ast.keyword) -> None:
case ast.keyword(arg="python_requires", value=ast.Constant(value=str() as version)):
if unnested or name_main_unnested:
self.requires_python = version
case _:
pass


def setup_py_python_requires(content: str) -> str | None:
Expand Down
2 changes: 1 addition & 1 deletion docs/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def define_env(env: Any) -> None: # noqa: ANN401
"Hook function for mkdocs-macros"

@env.macro # type: ignore[untyped-decorator]
def subprocess_run(*args: str) -> str:
def subprocess_run(*args: str) -> str: # type: ignore[misc]
"Run a subprocess and return the stdout"
env = os.environ.copy()
scripts = sysconfig.get_path("scripts")
Expand Down
23 changes: 22 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,27 @@ files = [
"bin/*.py",
"noxfile.py",
]
disallow_any_decorated = true
disallow_any_unimported = true
disallow_untyped_globals = true
disallow_redefinition = true
warn_unused_configs = true
strict = true
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
enable_error_code = [
"deprecated",
"exhaustive-match",
"ignore-without-code",
"mutable-override",
"possibly-undefined",
"redundant-expr",
"redundant-self",
"truthy-bool",
"truthy-iterable",
"unimported-reveal",
"unused-awaitable",
]
warn_unreachable = false
native_parser = true

[[tool.mypy.overrides]]
module = [
Expand All @@ -130,6 +147,10 @@ module = [
]
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = ["cibuildwheel.bashlex_eval"]
disable_error_code = ["no-any-unimported"]


[tool.pylint]
py-version = "3.11"
Expand Down
18 changes: 17 additions & 1 deletion unit_test/oci_container_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
TYPE_CHECKING = False
if TYPE_CHECKING:
from collections.abc import Iterator
from typing import Any

# Test utilities

Expand Down Expand Up @@ -139,6 +140,7 @@ def test_container_removed(container_engine: OCIContainerEngineConfig) -> None:
) as container:
assert container.name is not None
container_name = container.name
docker_containers_listing = ""
for _ in range(timeout):
docker_containers_listing = subprocess.run(
f"{container.engine.name} container ls",
Expand Down Expand Up @@ -330,7 +332,7 @@ def test_podman_vfs(
# This requires that we write configuration files and point to them
# with environment variables before we run podman
# https://github.com/containers/common/blob/main/docs/containers.conf.5.md
vfs_containers_conf_data = {
vfs_containers_conf_data: dict[str, dict[str, Any]] = {
"containers": {
"default_capabilities": [
"CHOWN",
Expand All @@ -348,6 +350,20 @@ def test_podman_vfs(
},
"engine": {"cgroup_manager": "cgroupfs", "events_logger": "file"},
}

# Setting CONTAINERS_CONF makes podman ignore its usual config files, so
# carry over the default OCI runtime; the fallback found on PATH can be
# too old for the OCI spec version podman generates (e.g. Ubuntu 24.04's
# crun 1.14.1 with podman 5.x).
oci_runtime = subprocess.run(
["podman", "info", "--format", "{{.Host.OCIRuntime.Path}}"],
check=True,
capture_output=True,
text=True,
).stdout.strip()
runtime_name = Path(oci_runtime).name
vfs_containers_conf_data["engine"]["runtime"] = runtime_name
vfs_containers_conf_data["engine"]["runtimes"] = {runtime_name: [oci_runtime]}
# https://github.com/containers/storage/blob/main/docs/containers-storage.conf.5.md
storage_root = vfs_path / ".local/share/containers/vfs-storage"
run_root = vfs_path / ".local/share/containers/vfs-runroot"
Expand Down
Loading