fix: minor cleanup

This commit is contained in:
Henry Schreiner
2022-04-27 14:55:30 -04:00
parent 958a7c32c1
commit b1e8549bb1
4 changed files with 15 additions and 22 deletions
+10 -19
View File
@@ -24,7 +24,6 @@ from cibuildwheel.util import (
Unbuffered,
chdir,
detect_ci_provider,
format_safe,
)
@@ -75,9 +74,9 @@ def main() -> None:
"--config-file",
default="",
help="""
TOML config file. Default: "", meaning {package}/pyproject.toml,
if it exists. To refer to a project inside your project, use {package}
or {project}.
TOML config file. Default: "", meaning {package}/pyproject.toml, if
it exists. To refer to a project inside your project, use {package};
this matters if you build from an SDist.
""",
)
@@ -87,8 +86,8 @@ def main() -> None:
type=Path,
nargs="?",
help="""
Path to the package that you want wheels for. Must be a
subdirectory of the working directory. When set, the working
Path to the package that you want wheels for. Must be a subdirectory
of the working directory. When set to a directory, the working
directory is still considered the 'project' and is copied into the
Docker container on Linux. Default: the working directory. This can
also be a tar.gz file - if it is, then --config-file and
@@ -117,8 +116,9 @@ def main() -> None:
args = parser.parse_args(namespace=CommandLineArguments())
# These are always relative to the base directory, even in SDist builds
args.package_dir = args.package_dir.resolve()
# This are always relative to the base directory, even in SDist builds
args.output_dir = Path(
args.output_dir
if args.output_dir is not None
@@ -130,9 +130,6 @@ def main() -> None:
build_in_directory(args)
return
if not args.package_dir.name.endswith("tar.gz"):
raise SystemExit("Must be a tar.gz file if a file is given.")
# Tarfile builds require extraction and changing the directory
with tempfile.TemporaryDirectory(prefix="cibw-sdist-") as temp_dir_str:
temp_dir = Path(temp_dir_str)
@@ -145,22 +142,16 @@ def main() -> None:
except ValueError:
raise SystemExit("invalid sdist: didn't contain a single dir") from None
# This is now the new package dir
args.package_dir = project_dir.resolve()
if args.config_file:
# expand the placeholders if they're used
config_file_path = format_safe(
args.config_file,
project=project_dir,
package=project_dir,
)
args.config_file = str(Path(config_file_path).resolve())
with chdir(temp_dir):
build_in_directory(args)
def build_in_directory(args: CommandLineArguments) -> None:
platform: PlatformName
if args.platform != "auto":
platform = args.platform
else:
+3 -1
View File
@@ -22,6 +22,7 @@ if sys.version_info >= (3, 11):
import tomllib
else:
import tomli as tomllib
from packaging.specifiers import SpecifierSet
from .architecture import Architecture
@@ -36,6 +37,7 @@ from .util import (
DependencyConstraints,
TestSelector,
cached_property,
format_safe,
resources_dir,
selector_matches,
strtobool,
@@ -344,7 +346,7 @@ class Options:
args = self.command_line_arguments
if args.config_file:
return Path(args.config_file.format(package=args.package_dir))
return Path(format_safe(args.config_file, package=args.package_dir))
# return pyproject.toml, if it's available
pyproject_toml_path = Path(args.package_dir) / "pyproject.toml"
+1 -1
View File
@@ -14,7 +14,7 @@ The old `manylinux1` image (based on CentOS 5) contains a version of GCC and lib
OS X/macOS allows you to specify a so-called "deployment target" version that will ensure backwards compatibility with older versions of macOS. One way to do this is by setting the `MACOSX_DEPLOYMENT_TARGET` environment variable.
However, to enable modern C++ standards, the deploment target needs to be set high enough (since older OS X/macOS versions did not have the necessary modern C++ standard library).
However, to enable modern C++ standards, the deployment target needs to be set high enough (since older OS X/macOS versions did not have the necessary modern C++ standard library).
To get C++11 and C++14 support, `MACOSX_DEPLOYMENT_TARGET` needs to be set to (at least) `"10.9"`. By default, `cibuildwheel` already does this, building 64-bit-only wheels for macOS 10.9 and later.
+1 -1
View File
@@ -161,7 +161,7 @@ def test_internal_config_file_argument(tmp_path, capfd):
actual_wheels = cibuildwheel_from_sdist_run(
sdist_path,
add_env={"CIBW_BUILD": "cp39-*"},
config_file="{project}/wheel_build_config.toml",
config_file="{package}/wheel_build_config.toml",
)
# check that the expected wheels are produced