Merge remote-tracking branch 'upstream/main' into arm64

This commit is contained in:
Steve Dower
2022-09-09 11:51:13 +01:00
24 changed files with 344 additions and 182 deletions
+10 -3
View File
@@ -5,7 +5,6 @@ import os
import shutil
import sys
import tarfile
import tempfile
import textwrap
from pathlib import Path
from tempfile import mkdtemp
@@ -130,8 +129,8 @@ def main() -> None:
return
# Tarfile builds require extraction and changing the directory
with tempfile.TemporaryDirectory(prefix="cibw-sdist-") as temp_dir_str:
temp_dir = Path(temp_dir_str)
temp_dir = Path(mkdtemp(prefix="cibw-sdist-")).resolve(strict=True)
try:
with tarfile.open(args.package_dir) as tar:
tar.extractall(path=temp_dir)
@@ -146,6 +145,12 @@ def main() -> None:
with chdir(temp_dir):
build_in_directory(args)
finally:
# avoid https://github.com/python/cpython/issues/86962 by performing
# cleanup manually
shutil.rmtree(temp_dir, ignore_errors=sys.platform.startswith("win"))
if temp_dir.exists():
log.warning(f"Can't delete temporary folder '{str(temp_dir)}'")
def build_in_directory(args: CommandLineArguments) -> None:
@@ -253,6 +258,8 @@ def build_in_directory(args: CommandLineArguments) -> None:
else:
assert_never(platform)
finally:
# avoid https://github.com/python/cpython/issues/86962 by performing
# cleanup manually
shutil.rmtree(tmp_path, ignore_errors=sys.platform.startswith("win"))
if tmp_path.exists():
log.warning(f"Can't delete temporary folder '{str(tmp_path)}'")
+7 -3
View File
@@ -20,6 +20,7 @@ from .util import (
get_build_verbosity_extra_flags,
prepare_command,
read_python_configs,
split_config_settings,
unwrap,
)
@@ -212,8 +213,10 @@ def build_in_container(
container.call(["mkdir", "-p", built_wheel_dir])
verbosity_flags = get_build_verbosity_extra_flags(build_options.build_verbosity)
extra_flags = split_config_settings(build_options.config_settings)
if build_options.build_frontend == "pip":
extra_flags += verbosity_flags
container.call(
[
"python",
@@ -223,12 +226,13 @@ def build_in_container(
container_package_dir,
f"--wheel-dir={built_wheel_dir}",
"--no-deps",
*verbosity_flags,
*extra_flags,
],
env=env,
)
elif build_options.build_frontend == "build":
config_setting = " ".join(verbosity_flags)
verbosity_setting = " ".join(verbosity_flags)
extra_flags += (f"--config-setting={verbosity_setting}",)
container.call(
[
"python",
@@ -237,7 +241,7 @@ def build_in_container(
container_package_dir,
"--wheel",
f"--outdir={built_wheel_dir}",
f"--config-setting={config_setting}",
*extra_flags,
],
env=env,
)
+7 -3
View File
@@ -34,6 +34,7 @@ from .util import (
prepare_command,
read_python_configs,
shell,
split_config_settings,
unwrap,
virtualenv,
)
@@ -345,8 +346,10 @@ def build(options: Options, tmp_path: Path) -> None:
built_wheel_dir.mkdir()
verbosity_flags = get_build_verbosity_extra_flags(build_options.build_verbosity)
extra_flags = split_config_settings(build_options.config_settings)
if build_options.build_frontend == "pip":
extra_flags += verbosity_flags
# Path.resolve() is needed. Without it pip wheel may try to fetch package from pypi.org
# see https://github.com/pypa/cibuildwheel/pull/369
call(
@@ -357,11 +360,12 @@ def build(options: Options, tmp_path: Path) -> None:
build_options.package_dir.resolve(),
f"--wheel-dir={built_wheel_dir}",
"--no-deps",
*verbosity_flags,
*extra_flags,
env=env,
)
elif build_options.build_frontend == "build":
config_setting = " ".join(verbosity_flags)
verbosity_setting = " ".join(verbosity_flags)
extra_flags += (f"--config-setting={verbosity_setting}",)
build_env = env.copy()
if build_options.dependency_constraints:
constraint_path = (
@@ -378,7 +382,7 @@ def build(options: Options, tmp_path: Path) -> None:
build_options.package_dir,
"--wheel",
f"--outdir={built_wheel_dir}",
f"--config-setting={config_setting}",
*extra_flags,
env=build_env,
)
else:
+24 -5
View File
@@ -3,13 +3,14 @@ from __future__ import annotations
import difflib
import functools
import os
import shlex
import sys
import traceback
from configparser import ConfigParser
from contextlib import contextmanager
from dataclasses import asdict, dataclass
from pathlib import Path
from typing import Any, Dict, Generator, List, Mapping, Union, cast
from typing import Any, Dict, Generator, Iterator, List, Mapping, Union, cast
if sys.version_info >= (3, 11):
import tomllib
@@ -77,6 +78,7 @@ class BuildOptions:
test_extras: str
build_verbosity: int
build_frontend: BuildFrontend
config_settings: str
@property
def package_dir(self) -> Path:
@@ -293,8 +295,9 @@ class OptionsReader:
accept platform versions of the environment variable. If this is an
array it will be merged with "sep" before returning. If it is a table,
it will be formatted with "table['item']" using {k} and {v} and merged
with "table['sep']". Empty variables will not override if ignore_empty
is True.
with "table['sep']". If sep is also given, it will be used for arrays
inside the table (must match table['sep']). Empty variables will not
override if ignore_empty is True.
"""
if name not in self.default_options and name not in self.default_platform_options:
@@ -324,7 +327,9 @@ class OptionsReader:
if isinstance(result, dict):
if table is None:
raise ConfigOptionError(f"{name!r} does not accept a table")
return table["sep"].join(table["item"].format(k=k, v=v) for k, v in result.items())
return table["sep"].join(
item for k, v in result.items() for item in _inner_fmt(k, v, table["item"])
)
if isinstance(result, list):
if sep is None:
@@ -337,6 +342,16 @@ class OptionsReader:
return result
def _inner_fmt(k: str, v: Any, table_item: str) -> Iterator[str]:
if isinstance(v, list):
for inner_v in v:
qv = shlex.quote(inner_v)
yield table_item.format(k=k, v=qv)
else:
qv = shlex.quote(v)
yield table_item.format(k=k, v=qv)
class Options:
def __init__(self, platform: PlatformName, command_line_arguments: CommandLineArguments):
self.platform = platform
@@ -427,11 +442,14 @@ class Options:
build_frontend_str = self.reader.get("build-frontend", env_plat=False)
environment_config = self.reader.get(
"environment", table={"item": '{k}="{v}"', "sep": " "}
"environment", table={"item": "{k}={v}", "sep": " "}
)
environment_pass = self.reader.get("environment-pass", sep=" ").split()
before_build = self.reader.get("before-build", sep=" && ")
repair_command = self.reader.get("repair-wheel-command", sep=" && ")
config_settings = self.reader.get(
"config-settings", table={"item": "{k}={v}", "sep": " "}
)
dependency_versions = self.reader.get("dependency-versions")
test_command = self.reader.get("test-command", sep=" && ")
@@ -537,6 +555,7 @@ class Options:
manylinux_images=manylinux_images or None,
musllinux_images=musllinux_images or None,
build_frontend=build_frontend,
config_settings=config_settings,
)
def check_for_invalid_configuration(self, identifiers: list[str]) -> None:
@@ -6,7 +6,7 @@
#
delocate==0.10.2
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.5
distlib==0.3.6
# via virtualenv
filelock==3.8.0
# via virtualenv
@@ -14,7 +14,7 @@ platformdirs==2.5.2
# via virtualenv
typing-extensions==4.3.0
# via delocate
virtualenv==20.16.3
virtualenv==20.16.4
# via -r cibuildwheel/resources/constraints.in
wheel==0.37.1
# via
@@ -24,5 +24,5 @@ wheel==0.37.1
# The following packages are considered to be unsafe in a requirements file:
pip==22.2.2
# via -r cibuildwheel/resources/constraints.in
setuptools==65.2.0
setuptools==65.3.0
# via -r cibuildwheel/resources/constraints.in
@@ -6,7 +6,7 @@
#
delocate==0.10.2
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.5
distlib==0.3.6
# via virtualenv
filelock==3.8.0
# via virtualenv
@@ -14,7 +14,7 @@ platformdirs==2.5.2
# via virtualenv
typing-extensions==4.3.0
# via delocate
virtualenv==20.16.3
virtualenv==20.16.4
# via -r cibuildwheel/resources/constraints.in
wheel==0.37.1
# via
@@ -24,5 +24,5 @@ wheel==0.37.1
# The following packages are considered to be unsafe in a requirements file:
pip==22.2.2
# via -r cibuildwheel/resources/constraints.in
setuptools==65.2.0
setuptools==65.3.0
# via -r cibuildwheel/resources/constraints.in
@@ -6,7 +6,7 @@
#
delocate==0.10.2
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.5
distlib==0.3.6
# via virtualenv
filelock==3.4.1
# via virtualenv
@@ -20,7 +20,7 @@ typing-extensions==4.1.1
# via
# delocate
# importlib-metadata
virtualenv==20.16.3
virtualenv==20.16.4
# via -r cibuildwheel/resources/constraints.in
wheel==0.37.1
# via
@@ -6,7 +6,7 @@
#
delocate==0.10.2
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.5
distlib==0.3.6
# via virtualenv
filelock==3.8.0
# via virtualenv
@@ -18,7 +18,7 @@ typing-extensions==4.3.0
# via
# delocate
# importlib-metadata
virtualenv==20.16.3
virtualenv==20.16.4
# via -r cibuildwheel/resources/constraints.in
wheel==0.37.1
# via
@@ -30,5 +30,5 @@ zipp==3.8.1
# The following packages are considered to be unsafe in a requirements file:
pip==22.2.2
# via -r cibuildwheel/resources/constraints.in
setuptools==65.2.0
setuptools==65.3.0
# via -r cibuildwheel/resources/constraints.in
@@ -6,7 +6,7 @@
#
delocate==0.10.2
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.5
distlib==0.3.6
# via virtualenv
filelock==3.8.0
# via virtualenv
@@ -14,7 +14,7 @@ platformdirs==2.5.2
# via virtualenv
typing-extensions==4.3.0
# via delocate
virtualenv==20.16.3
virtualenv==20.16.4
# via -r cibuildwheel/resources/constraints.in
wheel==0.37.1
# via
@@ -24,5 +24,5 @@ wheel==0.37.1
# The following packages are considered to be unsafe in a requirements file:
pip==22.2.2
# via -r cibuildwheel/resources/constraints.in
setuptools==65.2.0
setuptools==65.3.0
# via -r cibuildwheel/resources/constraints.in
@@ -6,7 +6,7 @@
#
delocate==0.10.2
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.5
distlib==0.3.6
# via virtualenv
filelock==3.8.0
# via virtualenv
@@ -14,7 +14,7 @@ platformdirs==2.5.2
# via virtualenv
typing-extensions==4.3.0
# via delocate
virtualenv==20.16.3
virtualenv==20.16.4
# via -r cibuildwheel/resources/constraints.in
wheel==0.37.1
# via
@@ -24,5 +24,5 @@ wheel==0.37.1
# The following packages are considered to be unsafe in a requirements file:
pip==22.2.2
# via -r cibuildwheel/resources/constraints.in
setuptools==65.2.0
setuptools==65.3.0
# via -r cibuildwheel/resources/constraints.in
+3 -3
View File
@@ -6,7 +6,7 @@
#
delocate==0.10.2
# via -r cibuildwheel/resources/constraints.in
distlib==0.3.5
distlib==0.3.6
# via virtualenv
filelock==3.8.0
# via virtualenv
@@ -14,7 +14,7 @@ platformdirs==2.5.2
# via virtualenv
typing-extensions==4.3.0
# via delocate
virtualenv==20.16.3
virtualenv==20.16.4
# via -r cibuildwheel/resources/constraints.in
wheel==0.37.1
# via
@@ -24,5 +24,5 @@ wheel==0.37.1
# The following packages are considered to be unsafe in a requirements file:
pip==22.2.2
# via -r cibuildwheel/resources/constraints.in
setuptools==65.2.0
setuptools==65.3.0
# via -r cibuildwheel/resources/constraints.in
+1
View File
@@ -5,6 +5,7 @@ test-skip = ""
archs = ["auto"]
build-frontend = "pip"
config-settings = {}
dependency-versions = "pinned"
environment = {}
environment-pass = []
+29 -28
View File
@@ -1,48 +1,49 @@
[x86_64]
manylinux1 = quay.io/pypa/manylinux1_x86_64:2022-08-21-7492cb5
manylinux1 = quay.io/pypa/manylinux1_x86_64:2022-09-04-d1c2903
manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2022-08-05-4535177
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2022-08-21-92d3131
manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2022-08-21-92d3131
manylinux_2_28 = quay.io/pypa/manylinux_2_28_x86_64:2022-08-21-92d3131
musllinux_1_1 = quay.io/pypa/musllinux_1_1_x86_64:2022-08-21-92d3131
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2022-09-04-870f6a2
manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2022-09-04-870f6a2
manylinux_2_28 = quay.io/pypa/manylinux_2_28_x86_64:2022-09-04-870f6a2
musllinux_1_1 = quay.io/pypa/musllinux_1_1_x86_64:2022-09-04-870f6a2
[i686]
manylinux1 = quay.io/pypa/manylinux1_i686:2022-08-21-7492cb5
manylinux1 = quay.io/pypa/manylinux1_i686:2022-09-04-d1c2903
manylinux2010 = quay.io/pypa/manylinux2010_i686:2022-08-05-4535177
manylinux2014 = quay.io/pypa/manylinux2014_i686:2022-08-21-92d3131
manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2022-08-21-92d3131
musllinux_1_1 = quay.io/pypa/musllinux_1_1_i686:2022-08-21-92d3131
manylinux2014 = quay.io/pypa/manylinux2014_i686:2022-09-04-870f6a2
manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2022-09-04-870f6a2
musllinux_1_1 = quay.io/pypa/musllinux_1_1_i686:2022-09-04-870f6a2
[pypy_x86_64]
manylinux2010 = quay.io/pypa/manylinux2010_x86_64:2022-08-05-4535177
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2022-08-21-92d3131
manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2022-08-21-92d3131
manylinux_2_28 = quay.io/pypa/manylinux_2_28_x86_64:2022-08-21-92d3131
manylinux2014 = quay.io/pypa/manylinux2014_x86_64:2022-09-04-870f6a2
manylinux_2_24 = quay.io/pypa/manylinux_2_24_x86_64:2022-09-04-870f6a2
manylinux_2_28 = quay.io/pypa/manylinux_2_28_x86_64:2022-09-04-870f6a2
[pypy_i686]
manylinux2010 = quay.io/pypa/manylinux2010_i686:2022-08-05-4535177
manylinux2014 = quay.io/pypa/manylinux2014_i686:2022-08-21-92d3131
manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2022-08-21-92d3131
manylinux2014 = quay.io/pypa/manylinux2014_i686:2022-09-04-870f6a2
manylinux_2_24 = quay.io/pypa/manylinux_2_24_i686:2022-09-04-870f6a2
[aarch64]
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2022-08-21-92d3131
manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2022-08-21-92d3131
manylinux_2_28 = quay.io/pypa/manylinux_2_28_aarch64:2022-08-21-92d3131
musllinux_1_1 = quay.io/pypa/musllinux_1_1_aarch64:2022-08-21-92d3131
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2022-09-04-870f6a2
manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2022-09-04-870f6a2
manylinux_2_28 = quay.io/pypa/manylinux_2_28_aarch64:2022-09-04-870f6a2
musllinux_1_1 = quay.io/pypa/musllinux_1_1_aarch64:2022-09-04-870f6a2
[ppc64le]
manylinux2014 = quay.io/pypa/manylinux2014_ppc64le:2022-08-21-92d3131
manylinux_2_24 = quay.io/pypa/manylinux_2_24_ppc64le:2022-08-21-92d3131
manylinux_2_28 = quay.io/pypa/manylinux_2_28_ppc64le:2022-08-21-92d3131
musllinux_1_1 = quay.io/pypa/musllinux_1_1_ppc64le:2022-08-21-92d3131
manylinux2014 = quay.io/pypa/manylinux2014_ppc64le:2022-09-04-870f6a2
manylinux_2_24 = quay.io/pypa/manylinux_2_24_ppc64le:2022-09-04-870f6a2
manylinux_2_28 = quay.io/pypa/manylinux_2_28_ppc64le:2022-09-04-870f6a2
musllinux_1_1 = quay.io/pypa/musllinux_1_1_ppc64le:2022-09-04-870f6a2
[s390x]
manylinux2014 = quay.io/pypa/manylinux2014_s390x:2022-08-21-92d3131
manylinux_2_24 = quay.io/pypa/manylinux_2_24_s390x:2022-08-21-92d3131
musllinux_1_1 = quay.io/pypa/musllinux_1_1_s390x:2022-08-21-92d3131
manylinux2014 = quay.io/pypa/manylinux2014_s390x:2022-09-04-870f6a2
manylinux_2_24 = quay.io/pypa/manylinux_2_24_s390x:2022-09-04-870f6a2
manylinux_2_28 = quay.io/pypa/manylinux_2_28_s390x:2022-09-04-870f6a2
musllinux_1_1 = quay.io/pypa/musllinux_1_1_s390x:2022-09-04-870f6a2
[pypy_aarch64]
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2022-08-21-92d3131
manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2022-08-21-92d3131
manylinux_2_28 = quay.io/pypa/manylinux_2_28_aarch64:2022-08-21-92d3131
manylinux2014 = quay.io/pypa/manylinux2014_aarch64:2022-09-04-870f6a2
manylinux_2_24 = quay.io/pypa/manylinux_2_24_aarch64:2022-09-04-870f6a2
manylinux_2_28 = quay.io/pypa/manylinux_2_28_aarch64:2022-09-04-870f6a2
+2 -2
View File
@@ -1,2 +1,2 @@
version = "20.16.3"
url = "https://github.com/pypa/get-virtualenv/blob/20.16.3/public/virtualenv.pyz?raw=true"
version = "20.16.4"
url = "https://github.com/pypa/get-virtualenv/blob/20.16.4/public/virtualenv.pyz?raw=true"
+6
View File
@@ -60,6 +60,7 @@ __all__ = [
"strtobool",
"cached_property",
"chdir",
"split_config_settings",
]
resources_dir: Final = Path(__file__).parent / "resources"
@@ -205,6 +206,11 @@ def get_build_verbosity_extra_flags(level: int) -> list[str]:
return []
def split_config_settings(config_settings: str) -> list[str]:
config_settings_list = shlex.split(config_settings)
return [f"--config-setting={setting}" for setting in config_settings_list]
def read_python_configs(config: PlatformName) -> list[dict[str, str]]:
input_file = resources_dir / "build-platforms.toml"
with input_file.open("rb") as f:
+7 -3
View File
@@ -34,6 +34,7 @@ from .util import (
prepare_command,
read_python_configs,
shell,
split_config_settings,
unwrap,
virtualenv,
)
@@ -407,8 +408,10 @@ def build(options: Options, tmp_path: Path) -> None:
built_wheel_dir.mkdir()
verbosity_flags = get_build_verbosity_extra_flags(build_options.build_verbosity)
extra_flags = split_config_settings(build_options.config_settings)
if build_options.build_frontend == "pip":
extra_flags += verbosity_flags
# Path.resolve() is needed. Without it pip wheel may try to fetch package from pypi.org
# see https://github.com/pypa/cibuildwheel/pull/369
call(
@@ -419,11 +422,12 @@ def build(options: Options, tmp_path: Path) -> None:
options.globals.package_dir.resolve(),
f"--wheel-dir={built_wheel_dir}",
"--no-deps",
*get_build_verbosity_extra_flags(build_options.build_verbosity),
*extra_flags,
env=env,
)
elif build_options.build_frontend == "build":
config_setting = " ".join(verbosity_flags)
verbosity_setting = " ".join(verbosity_flags)
extra_flags += (f"--config-setting={verbosity_setting}",)
build_env = env.copy()
if build_options.dependency_constraints:
constraints_path = (
@@ -450,7 +454,7 @@ def build(options: Options, tmp_path: Path) -> None:
build_options.package_dir,
"--wheel",
f"--outdir={built_wheel_dir}",
f"--config-setting={config_setting}",
*extra_flags,
env=build_env,
)
else: