Skip to content

Commit

Permalink
Merge pull request #9776 from sbidoul/ref-build-option-sbi
Browse files Browse the repository at this point in the history
Refactoring of --build-option and --global-option declaration in wheel command
  • Loading branch information
sbidoul authored Apr 7, 2021
2 parents 98fdc7a + 5b9a628 commit 0770b6a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
11 changes: 10 additions & 1 deletion src/pip/_internal/cli/cmdoptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -824,14 +824,23 @@ 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",
dest="global_options",
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(
Expand Down
16 changes: 2 additions & 14 deletions src/pip/_internal/commands/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -81,13 +74,8 @@ def add_options(self):
help="Don't verify if built wheel is valid.",
)

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.build_options())
self.cmd_opts.add_option(cmdoptions.global_options())

self.cmd_opts.add_option(
'--pre',
Expand Down

0 comments on commit 0770b6a

Please sign in to comment.