Skip to content

Commit b1e8549

Browse files
committed
fix: minor cleanup
1 parent 958a7c3 commit b1e8549

File tree

4 files changed

+15
-22
lines changed

4 files changed

+15
-22
lines changed

cibuildwheel/__main__.py

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
Unbuffered,
2525
chdir,
2626
detect_ci_provider,
27-
format_safe,
2827
)
2928

3029

@@ -75,9 +74,9 @@ def main() -> None:
7574
"--config-file",
7675
default="",
7776
help="""
78-
TOML config file. Default: "", meaning {package}/pyproject.toml,
79-
if it exists. To refer to a project inside your project, use {package}
80-
or {project}.
77+
TOML config file. Default: "", meaning {package}/pyproject.toml, if
78+
it exists. To refer to a project inside your project, use {package};
79+
this matters if you build from an SDist.
8180
""",
8281
)
8382

@@ -87,8 +86,8 @@ def main() -> None:
8786
type=Path,
8887
nargs="?",
8988
help="""
90-
Path to the package that you want wheels for. Must be a
91-
subdirectory of the working directory. When set, the working
89+
Path to the package that you want wheels for. Must be a subdirectory
90+
of the working directory. When set to a directory, the working
9291
directory is still considered the 'project' and is copied into the
9392
Docker container on Linux. Default: the working directory. This can
9493
also be a tar.gz file - if it is, then --config-file and
@@ -117,8 +116,9 @@ def main() -> None:
117116

118117
args = parser.parse_args(namespace=CommandLineArguments())
119118

120-
# These are always relative to the base directory, even in SDist builds
121119
args.package_dir = args.package_dir.resolve()
120+
121+
# This are always relative to the base directory, even in SDist builds
122122
args.output_dir = Path(
123123
args.output_dir
124124
if args.output_dir is not None
@@ -130,9 +130,6 @@ def main() -> None:
130130
build_in_directory(args)
131131
return
132132

133-
if not args.package_dir.name.endswith("tar.gz"):
134-
raise SystemExit("Must be a tar.gz file if a file is given.")
135-
136133
# Tarfile builds require extraction and changing the directory
137134
with tempfile.TemporaryDirectory(prefix="cibw-sdist-") as temp_dir_str:
138135
temp_dir = Path(temp_dir_str)
@@ -145,22 +142,16 @@ def main() -> None:
145142
except ValueError:
146143
raise SystemExit("invalid sdist: didn't contain a single dir") from None
147144

145+
# This is now the new package dir
148146
args.package_dir = project_dir.resolve()
149147

150-
if args.config_file:
151-
# expand the placeholders if they're used
152-
config_file_path = format_safe(
153-
args.config_file,
154-
project=project_dir,
155-
package=project_dir,
156-
)
157-
args.config_file = str(Path(config_file_path).resolve())
158-
159148
with chdir(temp_dir):
160149
build_in_directory(args)
161150

162151

163152
def build_in_directory(args: CommandLineArguments) -> None:
153+
platform: PlatformName
154+
164155
if args.platform != "auto":
165156
platform = args.platform
166157
else:

cibuildwheel/options.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import tomllib
2323
else:
2424
import tomli as tomllib
25+
2526
from packaging.specifiers import SpecifierSet
2627

2728
from .architecture import Architecture
@@ -36,6 +37,7 @@
3637
DependencyConstraints,
3738
TestSelector,
3839
cached_property,
40+
format_safe,
3941
resources_dir,
4042
selector_matches,
4143
strtobool,
@@ -344,7 +346,7 @@ def config_file_path(self) -> Optional[Path]:
344346
args = self.command_line_arguments
345347

346348
if args.config_file:
347-
return Path(args.config_file.format(package=args.package_dir))
349+
return Path(format_safe(args.config_file, package=args.package_dir))
348350

349351
# return pyproject.toml, if it's available
350352
pyproject_toml_path = Path(args.package_dir) / "pyproject.toml"

docs/cpp_standards.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The old `manylinux1` image (based on CentOS 5) contains a version of GCC and lib
1414

1515
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.
1616

17-
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).
17+
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).
1818

1919
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.
2020

test/test_from_sdist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def test_internal_config_file_argument(tmp_path, capfd):
161161
actual_wheels = cibuildwheel_from_sdist_run(
162162
sdist_path,
163163
add_env={"CIBW_BUILD": "cp39-*"},
164-
config_file="{project}/wheel_build_config.toml",
164+
config_file="{package}/wheel_build_config.toml",
165165
)
166166

167167
# check that the expected wheels are produced

0 commit comments

Comments
 (0)