Skip to content

Commit 12c6436

Browse files
henryiiijoerick
andauthored
fix: add missing config-file option to the action (#883)
* fix: add missing config-file option to the action * feat: empty config-file triggers default behavior * Apply suggestions from code review Co-authored-by: Joe Rickerby <[email protected]> Co-authored-by: Joe Rickerby <[email protected]>
1 parent e7da783 commit 12c6436

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ inputs:
99
description: 'Folder to place the outputs in, defaults to "wheelhouse"'
1010
required: false
1111
default: wheelhouse
12+
config-file:
13+
description: 'File containing the config, defaults to {package}/pyproject.toml'
14+
required: false
15+
default: ''
1216
branding:
1317
icon: package
1418
color: yellow
@@ -24,5 +28,6 @@ runs:
2428
cibuildwheel
2529
${{ inputs.package-dir }}
2630
--output-dir ${{ inputs.output-dir }}
31+
--config-file "${{ input.config-file }}"
2732
2>&1
2833
shell: bash

cibuildwheel/__main__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,15 @@ def main() -> None:
5757

5858
parser.add_argument(
5959
"--output-dir",
60-
help="Destination folder for the wheels.",
60+
help="Destination folder for the wheels. Default: wheelhouse.",
6161
)
6262

6363
parser.add_argument(
6464
"--config-file",
65+
default="",
6566
help="""
66-
TOML config file for cibuildwheel. Defaults to pyproject.toml, but
67-
can be overridden with this option.
67+
TOML config file. Default: "", meaning {package}/pyproject.toml,
68+
if it exists.
6869
""",
6970
)
7071

cibuildwheel/options.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class CommandLineArguments:
4242
platform: Literal["auto", "linux", "macos", "windows"]
4343
archs: Optional[str]
4444
output_dir: Optional[str]
45-
config_file: Optional[str]
45+
config_file: str
4646
package_dir: str
4747
print_build_identifiers: bool
4848
allow_empty: bool
@@ -335,8 +335,9 @@ def __init__(self, platform: PlatformName, command_line_arguments: CommandLineAr
335335
def config_file_path(self) -> Optional[Path]:
336336
args = self.command_line_arguments
337337

338-
if args.config_file is not None:
338+
if args.config_file:
339339
return Path(args.config_file.format(package=args.package_dir))
340+
340341
# return pyproject.toml, if it's available
341342
pyproject_toml_path = Path(args.package_dir) / "pyproject.toml"
342343
if pyproject_toml_path.exists():

unit_test/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def get_default_command_line_arguments() -> CommandLineArguments:
77
defaults.platform = "auto"
88
defaults.allow_empty = False
99
defaults.archs = None
10-
defaults.config_file = None
10+
defaults.config_file = ""
1111
defaults.output_dir = None
1212
defaults.package_dir = "."
1313
defaults.prerelease_pythons = False

0 commit comments

Comments
 (0)