From 4f0cf9b96d90c66464e8191b1cbccb9c5a3305d7 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 21 Oct 2021 14:51:22 -0400 Subject: [PATCH 1/3] fix: add missing config-file option to the action --- action.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/action.yml b/action.yml index 4c910ef35..3ce3b9dcb 100644 --- a/action.yml +++ b/action.yml @@ -9,6 +9,10 @@ inputs: description: 'Folder to place the outputs in, defaults to "wheelhouse"' required: false default: wheelhouse + config-file: + description: 'File containing the config, defaults to {package}/pyproject.toml' + required: false + default: '{package}/pyproject.toml' branding: icon: package color: yellow @@ -24,5 +28,6 @@ runs: cibuildwheel ${{ inputs.package-dir }} --output-dir ${{ inputs.output-dir }} + --config-file ${{ input.config-file }} 2>&1 shell: bash From 4b7e0be69d161ee4c322a37d0fc8a2e567e9b6fc Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 22 Oct 2021 11:44:28 -0400 Subject: [PATCH 2/3] feat: empty config-file triggers default behavior --- action.yml | 2 +- cibuildwheel/__main__.py | 7 ++++--- cibuildwheel/options.py | 5 +++-- unit_test/utils.py | 2 +- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/action.yml b/action.yml index 3ce3b9dcb..0f294a3e0 100644 --- a/action.yml +++ b/action.yml @@ -12,7 +12,7 @@ inputs: config-file: description: 'File containing the config, defaults to {package}/pyproject.toml' required: false - default: '{package}/pyproject.toml' + default: '' branding: icon: package color: yellow diff --git a/cibuildwheel/__main__.py b/cibuildwheel/__main__.py index c6a532f95..81a94c9f8 100644 --- a/cibuildwheel/__main__.py +++ b/cibuildwheel/__main__.py @@ -57,14 +57,15 @@ def main() -> None: parser.add_argument( "--output-dir", - help="Destination folder for the wheels.", + help="Destination folder for the wheels. Default: wheelhouse.", ) parser.add_argument( "--config-file", + default="", help=""" - TOML config file for cibuildwheel. Defaults to pyproject.toml, but - can be overridden with this option. + TOML config file for cibuildwheel. If empty, this will use + {package}/pyproject.toml, but will not error if it is missing. """, ) diff --git a/cibuildwheel/options.py b/cibuildwheel/options.py index 902b64fa5..9a207e9e0 100644 --- a/cibuildwheel/options.py +++ b/cibuildwheel/options.py @@ -42,7 +42,7 @@ class CommandLineArguments: platform: Literal["auto", "linux", "macos", "windows"] archs: Optional[str] output_dir: Optional[str] - config_file: Optional[str] + config_file: str package_dir: str print_build_identifiers: bool allow_empty: bool @@ -335,8 +335,9 @@ def __init__(self, platform: PlatformName, command_line_arguments: CommandLineAr def config_file_path(self) -> Optional[Path]: args = self.command_line_arguments - if args.config_file is not None: + if args.config_file: return Path(args.config_file.format(package=args.package_dir)) + # return pyproject.toml, if it's available pyproject_toml_path = Path(args.package_dir) / "pyproject.toml" if pyproject_toml_path.exists(): diff --git a/unit_test/utils.py b/unit_test/utils.py index 0f7359166..61833fa2d 100644 --- a/unit_test/utils.py +++ b/unit_test/utils.py @@ -7,7 +7,7 @@ def get_default_command_line_arguments() -> CommandLineArguments: defaults.platform = "auto" defaults.allow_empty = False defaults.archs = None - defaults.config_file = None + defaults.config_file = "" defaults.output_dir = None defaults.package_dir = "." defaults.prerelease_pythons = False From 4017bea82672a319a8810f10519be5379a1fdbfa Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 22 Oct 2021 13:36:09 -0400 Subject: [PATCH 3/3] Apply suggestions from code review Co-authored-by: Joe Rickerby --- action.yml | 2 +- cibuildwheel/__main__.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 0f294a3e0..3f5bcc074 100644 --- a/action.yml +++ b/action.yml @@ -28,6 +28,6 @@ runs: cibuildwheel ${{ inputs.package-dir }} --output-dir ${{ inputs.output-dir }} - --config-file ${{ input.config-file }} + --config-file "${{ input.config-file }}" 2>&1 shell: bash diff --git a/cibuildwheel/__main__.py b/cibuildwheel/__main__.py index 81a94c9f8..a04d3e82b 100644 --- a/cibuildwheel/__main__.py +++ b/cibuildwheel/__main__.py @@ -64,8 +64,8 @@ def main() -> None: "--config-file", default="", help=""" - TOML config file for cibuildwheel. If empty, this will use - {package}/pyproject.toml, but will not error if it is missing. + TOML config file. Default: "", meaning {package}/pyproject.toml, + if it exists. """, )