fix: minor cleanup
This commit is contained in:
+10
-19
@@ -24,7 +24,6 @@ from cibuildwheel.util import (
|
|||||||
Unbuffered,
|
Unbuffered,
|
||||||
chdir,
|
chdir,
|
||||||
detect_ci_provider,
|
detect_ci_provider,
|
||||||
format_safe,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -75,9 +74,9 @@ def main() -> None:
|
|||||||
"--config-file",
|
"--config-file",
|
||||||
default="",
|
default="",
|
||||||
help="""
|
help="""
|
||||||
TOML config file. Default: "", meaning {package}/pyproject.toml,
|
TOML config file. Default: "", meaning {package}/pyproject.toml, if
|
||||||
if it exists. To refer to a project inside your project, use {package}
|
it exists. To refer to a project inside your project, use {package};
|
||||||
or {project}.
|
this matters if you build from an SDist.
|
||||||
""",
|
""",
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -87,8 +86,8 @@ def main() -> None:
|
|||||||
type=Path,
|
type=Path,
|
||||||
nargs="?",
|
nargs="?",
|
||||||
help="""
|
help="""
|
||||||
Path to the package that you want wheels for. Must be a
|
Path to the package that you want wheels for. Must be a subdirectory
|
||||||
subdirectory of the working directory. When set, the working
|
of the working directory. When set to a directory, the working
|
||||||
directory is still considered the 'project' and is copied into the
|
directory is still considered the 'project' and is copied into the
|
||||||
Docker container on Linux. Default: the working directory. This can
|
Docker container on Linux. Default: the working directory. This can
|
||||||
also be a tar.gz file - if it is, then --config-file and
|
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())
|
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()
|
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 = Path(
|
||||||
args.output_dir
|
args.output_dir
|
||||||
if args.output_dir is not None
|
if args.output_dir is not None
|
||||||
@@ -130,9 +130,6 @@ def main() -> None:
|
|||||||
build_in_directory(args)
|
build_in_directory(args)
|
||||||
return
|
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
|
# Tarfile builds require extraction and changing the directory
|
||||||
with tempfile.TemporaryDirectory(prefix="cibw-sdist-") as temp_dir_str:
|
with tempfile.TemporaryDirectory(prefix="cibw-sdist-") as temp_dir_str:
|
||||||
temp_dir = Path(temp_dir_str)
|
temp_dir = Path(temp_dir_str)
|
||||||
@@ -145,22 +142,16 @@ def main() -> None:
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
raise SystemExit("invalid sdist: didn't contain a single dir") from None
|
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()
|
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):
|
with chdir(temp_dir):
|
||||||
build_in_directory(args)
|
build_in_directory(args)
|
||||||
|
|
||||||
|
|
||||||
def build_in_directory(args: CommandLineArguments) -> None:
|
def build_in_directory(args: CommandLineArguments) -> None:
|
||||||
|
platform: PlatformName
|
||||||
|
|
||||||
if args.platform != "auto":
|
if args.platform != "auto":
|
||||||
platform = args.platform
|
platform = args.platform
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ if sys.version_info >= (3, 11):
|
|||||||
import tomllib
|
import tomllib
|
||||||
else:
|
else:
|
||||||
import tomli as tomllib
|
import tomli as tomllib
|
||||||
|
|
||||||
from packaging.specifiers import SpecifierSet
|
from packaging.specifiers import SpecifierSet
|
||||||
|
|
||||||
from .architecture import Architecture
|
from .architecture import Architecture
|
||||||
@@ -36,6 +37,7 @@ from .util import (
|
|||||||
DependencyConstraints,
|
DependencyConstraints,
|
||||||
TestSelector,
|
TestSelector,
|
||||||
cached_property,
|
cached_property,
|
||||||
|
format_safe,
|
||||||
resources_dir,
|
resources_dir,
|
||||||
selector_matches,
|
selector_matches,
|
||||||
strtobool,
|
strtobool,
|
||||||
@@ -344,7 +346,7 @@ class Options:
|
|||||||
args = self.command_line_arguments
|
args = self.command_line_arguments
|
||||||
|
|
||||||
if args.config_file:
|
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
|
# return pyproject.toml, if it's available
|
||||||
pyproject_toml_path = Path(args.package_dir) / "pyproject.toml"
|
pyproject_toml_path = Path(args.package_dir) / "pyproject.toml"
|
||||||
|
|||||||
@@ -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.
|
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.
|
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.
|
||||||
|
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ def test_internal_config_file_argument(tmp_path, capfd):
|
|||||||
actual_wheels = cibuildwheel_from_sdist_run(
|
actual_wheels = cibuildwheel_from_sdist_run(
|
||||||
sdist_path,
|
sdist_path,
|
||||||
add_env={"CIBW_BUILD": "cp39-*"},
|
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
|
# check that the expected wheels are produced
|
||||||
|
|||||||
Reference in New Issue
Block a user