From 91fae8268eb35c67d63af3d4d46a51e507928e4c Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Sun, 3 Apr 2022 11:01:01 +0100 Subject: [PATCH] Add prog arguments to ArgumentParser to prevent the wrong inferred name when calling like 'python -m cibuildwheel', we get errors like usage: __main__.py [-h] [--platform {auto,linux,macos,windows}] [--archs ARCHS] [--output-dir OUTPUT_DIR] [--config-file CONFIG_FILE] [--print-build-identifiers] [--allow-empty] [--prerelease-pythons] [package_dir] __main__.py: error: unrecognized arguments: --sad With this change, we get error outputs like: usage: cibuildwheel [-h] [--platform {auto,linux,macos,windows}] [--archs ARCHS] [--output-dir OUTPUT_DIR] [--config-file CONFIG_FILE] [--print-build-identifiers] [--allow-empty] [--prerelease-pythons] [package_dir] cibuildwheel: error: unrecognized arguments: --asda --- cibuildwheel/__main__.py | 1 + cibuildwheel/from_sdist.py | 1 + 2 files changed, 2 insertions(+) diff --git a/cibuildwheel/__main__.py b/cibuildwheel/__main__.py index 306e73ab..5ddd2b63 100644 --- a/cibuildwheel/__main__.py +++ b/cibuildwheel/__main__.py @@ -28,6 +28,7 @@ def main() -> None: platform: PlatformName parser = argparse.ArgumentParser( + prog="cibuildwheel", description="Build wheels for all the platforms.", epilog=""" Most options are supplied via environment variables or in diff --git a/cibuildwheel/from_sdist.py b/cibuildwheel/from_sdist.py index 8bff69a0..f24834f5 100644 --- a/cibuildwheel/from_sdist.py +++ b/cibuildwheel/from_sdist.py @@ -11,6 +11,7 @@ from cibuildwheel.util import format_safe def main() -> None: parser = argparse.ArgumentParser( + prog="cibuildwheel-from-sdist", description=textwrap.dedent( """ Build wheels from an sdist archive.