From d53ddb938031b67d0030f9d6cff75083090ef2b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sun, 3 Jan 2021 13:26:28 +0100 Subject: [PATCH 1/2] Refactor --build-option declaration --- src/pip/_internal/cli/cmdoptions.py | 9 +++++++++ src/pip/_internal/commands/wheel.py | 8 +------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/pip/_internal/cli/cmdoptions.py b/src/pip/_internal/cli/cmdoptions.py index 24dc9d14107..8502da97b29 100644 --- a/src/pip/_internal/cli/cmdoptions.py +++ b/src/pip/_internal/cli/cmdoptions.py @@ -824,6 +824,15 @@ def _handle_no_use_pep517(option, opt, value, parser): "directory path, be sure to use absolute path.", ) # type: Callable[..., Option] +build_options = partial( + Option, + "--build-option", + dest="build_options", + metavar="options", + action="append", + help="Extra arguments to be supplied to 'setup.py bdist_wheel'.", +) # type: Callable[..., Option] + global_options = partial( Option, "--global-option", diff --git a/src/pip/_internal/commands/wheel.py b/src/pip/_internal/commands/wheel.py index 842988ba570..507913fe5fb 100644 --- a/src/pip/_internal/commands/wheel.py +++ b/src/pip/_internal/commands/wheel.py @@ -54,13 +54,6 @@ def add_options(self): self.cmd_opts.add_option(cmdoptions.no_binary()) self.cmd_opts.add_option(cmdoptions.only_binary()) self.cmd_opts.add_option(cmdoptions.prefer_binary()) - self.cmd_opts.add_option( - '--build-option', - dest='build_options', - metavar='options', - action='append', - help="Extra arguments to be supplied to 'setup.py bdist_wheel'.", - ) self.cmd_opts.add_option(cmdoptions.no_build_isolation()) self.cmd_opts.add_option(cmdoptions.use_pep517()) self.cmd_opts.add_option(cmdoptions.no_use_pep517()) @@ -81,6 +74,7 @@ def add_options(self): help="Don't verify if built wheel is valid.", ) + self.cmd_opts.add_option(cmdoptions.build_options()) self.cmd_opts.add_option( '--global-option', dest='global_options', From 5b9a628873c338f56c5ecef2d55b38ccc9967508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sun, 4 Apr 2021 17:07:31 +0200 Subject: [PATCH 2/2] Refactor --global-option declaration in wheel command --- src/pip/_internal/cli/cmdoptions.py | 2 +- src/pip/_internal/commands/wheel.py | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/pip/_internal/cli/cmdoptions.py b/src/pip/_internal/cli/cmdoptions.py index 8502da97b29..f71c0b02011 100644 --- a/src/pip/_internal/cli/cmdoptions.py +++ b/src/pip/_internal/cli/cmdoptions.py @@ -840,7 +840,7 @@ def _handle_no_use_pep517(option, opt, value, parser): action="append", metavar="options", help="Extra global options to be supplied to the setup.py " - "call before the install command.", + "call before the install or bdist_wheel command.", ) # type: Callable[..., Option] no_clean = partial( diff --git a/src/pip/_internal/commands/wheel.py b/src/pip/_internal/commands/wheel.py index 507913fe5fb..ff47dbac51c 100644 --- a/src/pip/_internal/commands/wheel.py +++ b/src/pip/_internal/commands/wheel.py @@ -75,13 +75,7 @@ def add_options(self): ) self.cmd_opts.add_option(cmdoptions.build_options()) - self.cmd_opts.add_option( - '--global-option', - dest='global_options', - action='append', - metavar='options', - help="Extra global options to be supplied to the setup.py " - "call before the 'bdist_wheel' command.") + self.cmd_opts.add_option(cmdoptions.global_options()) self.cmd_opts.add_option( '--pre',