Skip to content

Commit 0770b6a

Browse files
authored
Merge pull request #9776 from sbidoul/ref-build-option-sbi
Refactoring of --build-option and --global-option declaration in wheel command
2 parents 98fdc7a + 5b9a628 commit 0770b6a

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

src/pip/_internal/cli/cmdoptions.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,14 +824,23 @@ def _handle_no_use_pep517(option, opt, value, parser):
824824
"directory path, be sure to use absolute path.",
825825
) # type: Callable[..., Option]
826826

827+
build_options = partial(
828+
Option,
829+
"--build-option",
830+
dest="build_options",
831+
metavar="options",
832+
action="append",
833+
help="Extra arguments to be supplied to 'setup.py bdist_wheel'.",
834+
) # type: Callable[..., Option]
835+
827836
global_options = partial(
828837
Option,
829838
"--global-option",
830839
dest="global_options",
831840
action="append",
832841
metavar="options",
833842
help="Extra global options to be supplied to the setup.py "
834-
"call before the install command.",
843+
"call before the install or bdist_wheel command.",
835844
) # type: Callable[..., Option]
836845

837846
no_clean = partial(

src/pip/_internal/commands/wheel.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,6 @@ def add_options(self):
5454
self.cmd_opts.add_option(cmdoptions.no_binary())
5555
self.cmd_opts.add_option(cmdoptions.only_binary())
5656
self.cmd_opts.add_option(cmdoptions.prefer_binary())
57-
self.cmd_opts.add_option(
58-
'--build-option',
59-
dest='build_options',
60-
metavar='options',
61-
action='append',
62-
help="Extra arguments to be supplied to 'setup.py bdist_wheel'.",
63-
)
6457
self.cmd_opts.add_option(cmdoptions.no_build_isolation())
6558
self.cmd_opts.add_option(cmdoptions.use_pep517())
6659
self.cmd_opts.add_option(cmdoptions.no_use_pep517())
@@ -81,13 +74,8 @@ def add_options(self):
8174
help="Don't verify if built wheel is valid.",
8275
)
8376

84-
self.cmd_opts.add_option(
85-
'--global-option',
86-
dest='global_options',
87-
action='append',
88-
metavar='options',
89-
help="Extra global options to be supplied to the setup.py "
90-
"call before the 'bdist_wheel' command.")
77+
self.cmd_opts.add_option(cmdoptions.build_options())
78+
self.cmd_opts.add_option(cmdoptions.global_options())
9179

9280
self.cmd_opts.add_option(
9381
'--pre',

0 commit comments

Comments
 (0)