diff --git a/docs/html/reference/requirements-file-format.md b/docs/html/reference/requirements-file-format.md index 75e6d0b1e6b..01047587161 100644 --- a/docs/html/reference/requirements-file-format.md +++ b/docs/html/reference/requirements-file-format.md @@ -109,7 +109,6 @@ and two {ref}`--find-links ` locations: The options which can be applied to individual requirements are: -- {ref}`--install-option ` - {ref}`--global-option ` - {ref}`--config-settings ` - `--hash` (for {ref}`Hash-checking mode`) @@ -161,7 +160,7 @@ This disables the use of wheels (cached or otherwise). This could mean that buil This mechanism is only preserved for backwards compatibility and should be considered deprecated. A future release of pip may drop these options. ``` -The `--global-option` and `--install-option` options are used to pass options to `setup.py`. +The `--global-option` option is used to pass options to `setup.py`. ```{attention} These options are highly coupled with how pip invokes setuptools using the {doc}`../reference/build-system/setup-py` build system interface. It is not compatible with newer {doc}`../reference/build-system/pyproject-toml` build system interface. @@ -171,15 +170,10 @@ This is will not work with other build-backends or newer setup.cfg-only projects If you have a declaration like: - FooProject >= 1.2 --global-option="--no-user-cfg" \ - --install-option="--prefix='/usr/local'" \ - --install-option="--no-compile" + FooProject >= 1.2 --global-option="--no-user-cfg" The above translates roughly into running FooProject's `setup.py` script as: - python setup.py --no-user-cfg install --prefix='/usr/local' --no-compile + python setup.py --no-user-cfg install -Note that the only way of giving more than one option to `setup.py` is through multiple `--global-option` and `--install-option` options, as shown in the example above. The value of each option is passed as a single argument to the `setup.py` script. Therefore, a line such as the following is invalid and would result in an installation error. - - # Invalid. Please use '--install-option' twice as shown above. - FooProject >= 1.2 --install-option="--prefix=/usr/local --no-compile" +Note that the only way of giving more than one option to `setup.py` is through multiple `--global-option` options. diff --git a/news/11358.removal.rst b/news/11358.removal.rst new file mode 100644 index 00000000000..23e388a9a39 --- /dev/null +++ b/news/11358.removal.rst @@ -0,0 +1 @@ +Remove support for the deprecated ``--install-options``. diff --git a/src/pip/_internal/cli/cmdoptions.py b/src/pip/_internal/cli/cmdoptions.py index 6513bec388d..2bbff2d4dc1 100644 --- a/src/pip/_internal/cli/cmdoptions.py +++ b/src/pip/_internal/cli/cmdoptions.py @@ -847,17 +847,6 @@ def _handle_config_settings( "to pass multiple keys to the backend.", ) -install_options: Callable[..., Option] = partial( - Option, - "--install-option", - dest="install_options", - action="append", - metavar="options", - help="This option is deprecated. Using this option with location-changing " - "options may cause unexpected behavior. " - "Use pip-level options like --user, --prefix, --root, and --target.", -) - build_options: Callable[..., Option] = partial( Option, "--build-option", diff --git a/src/pip/_internal/commands/install.py b/src/pip/_internal/commands/install.py index d25ec9631bc..41d22c72825 100644 --- a/src/pip/_internal/commands/install.py +++ b/src/pip/_internal/commands/install.py @@ -5,7 +5,7 @@ import shutil import site from optparse import SUPPRESS_HELP, Values -from typing import Iterable, List, Optional +from typing import List, Optional from pip._vendor.rich import print_json @@ -35,7 +35,6 @@ LegacyInstallReasonFailedBdistWheel, deprecated, ) -from pip._internal.utils.distutils_args import parse_distutils_args from pip._internal.utils.filesystem import test_writable_dir from pip._internal.utils.logging import getLogger from pip._internal.utils.misc import ( @@ -206,7 +205,6 @@ def add_options(self) -> None: self.cmd_opts.add_option(cmdoptions.override_externally_managed()) self.cmd_opts.add_option(cmdoptions.config_settings()) - self.cmd_opts.add_option(cmdoptions.install_options()) self.cmd_opts.add_option(cmdoptions.global_options()) self.cmd_opts.add_option( @@ -297,8 +295,6 @@ def run(self, options: Values, args: List[str]) -> int: cmdoptions.check_dist_restriction(options, check_target=True) - install_options = options.install_options or [] - logger.verbose("Using %s", get_pip_version()) options.use_user_site = decide_user_install( options.use_user_site, @@ -378,8 +374,6 @@ def run(self, options: Values, args: List[str]) -> int: for req in reqs: req.permit_editable_wheels = True - reject_location_related_install_options(reqs, options.install_options) - preparer = self.make_requirement_preparer( temp_build_dir=directory, options=options, @@ -490,7 +484,6 @@ def run(self, options: Values, args: List[str]) -> int: installed = install_given_reqs( to_install, - install_options, global_options, root=options.root_path, home=target_temp_dir_path, @@ -761,45 +754,6 @@ def decide_user_install( return True -def reject_location_related_install_options( - requirements: List[InstallRequirement], options: Optional[List[str]] -) -> None: - """If any location-changing --install-option arguments were passed for - requirements or on the command-line, then show a deprecation warning. - """ - - def format_options(option_names: Iterable[str]) -> List[str]: - return ["--{}".format(name.replace("_", "-")) for name in option_names] - - offenders = [] - - for requirement in requirements: - install_options = requirement.install_options - location_options = parse_distutils_args(install_options) - if location_options: - offenders.append( - "{!r} from {}".format( - format_options(location_options.keys()), requirement - ) - ) - - if options: - location_options = parse_distutils_args(options) - if location_options: - offenders.append( - "{!r} from command line".format(format_options(location_options.keys())) - ) - - if not offenders: - return - - raise CommandError( - "Location-changing options found in --install-option: {}." - " This is unsupported, use pip-level options like --user," - " --prefix, --root, and --target instead.".format("; ".join(offenders)) - ) - - def create_os_error_message( error: OSError, show_traceback: bool, using_user_site: bool ) -> str: diff --git a/src/pip/_internal/operations/install/editable_legacy.py b/src/pip/_internal/operations/install/editable_legacy.py index bb548cdca75..bebe24e6d3a 100644 --- a/src/pip/_internal/operations/install/editable_legacy.py +++ b/src/pip/_internal/operations/install/editable_legacy.py @@ -1,7 +1,7 @@ """Legacy editable installation process, i.e. `setup.py develop`. """ import logging -from typing import List, Optional, Sequence +from typing import Optional, Sequence from pip._internal.build_env import BuildEnvironment from pip._internal.utils.logging import indent_log @@ -12,7 +12,7 @@ def install_editable( - install_options: List[str], + *, global_options: Sequence[str], prefix: Optional[str], home: Optional[str], @@ -31,7 +31,6 @@ def install_editable( args = make_setuptools_develop_args( setup_py_path, global_options=global_options, - install_options=install_options, no_user_config=isolated, prefix=prefix, home=home, diff --git a/src/pip/_internal/operations/install/legacy.py b/src/pip/_internal/operations/install/legacy.py index 290967dd6d5..0b108d0ca71 100644 --- a/src/pip/_internal/operations/install/legacy.py +++ b/src/pip/_internal/operations/install/legacy.py @@ -55,7 +55,6 @@ def prepend_root(path: str) -> str: def install( - install_options: List[str], global_options: Sequence[str], root: Optional[str], home: Optional[str], @@ -79,7 +78,6 @@ def install( install_args = make_setuptools_install_args( setup_py_path, global_options=global_options, - install_options=install_options, record_filename=record_filename, root=root, prefix=prefix, diff --git a/src/pip/_internal/req/__init__.py b/src/pip/_internal/req/__init__.py index 8d563596668..16de903a44c 100644 --- a/src/pip/_internal/req/__init__.py +++ b/src/pip/_internal/req/__init__.py @@ -36,7 +36,6 @@ def _validate_requirements( def install_given_reqs( requirements: List[InstallRequirement], - install_options: List[str], global_options: Sequence[str], root: Optional[str], home: Optional[str], @@ -71,7 +70,6 @@ def install_given_reqs( try: requirement.install( - install_options, global_options, root=root, home=home, diff --git a/src/pip/_internal/req/constructors.py b/src/pip/_internal/req/constructors.py index dea7c3b0116..854b1b058d8 100644 --- a/src/pip/_internal/req/constructors.py +++ b/src/pip/_internal/req/constructors.py @@ -222,7 +222,6 @@ def install_req_from_editable( constraint=constraint, use_pep517=use_pep517, isolated=isolated, - install_options=options.get("install_options", []) if options else [], global_options=options.get("global_options", []) if options else [], hash_options=options.get("hashes", {}) if options else {}, config_settings=config_settings, @@ -399,7 +398,6 @@ def install_req_from_line( markers=parts.markers, use_pep517=use_pep517, isolated=isolated, - install_options=options.get("install_options", []) if options else [], global_options=options.get("global_options", []) if options else [], hash_options=options.get("hashes", {}) if options else {}, config_settings=config_settings, @@ -493,7 +491,6 @@ def install_req_from_link_and_ireq( markers=ireq.markers, use_pep517=ireq.use_pep517, isolated=ireq.isolated, - install_options=ireq.install_options, global_options=ireq.global_options, hash_options=ireq.hash_options, config_settings=ireq.config_settings, diff --git a/src/pip/_internal/req/req_file.py b/src/pip/_internal/req/req_file.py index 11ec699acc5..f8f07b0cd96 100644 --- a/src/pip/_internal/req/req_file.py +++ b/src/pip/_internal/req/req_file.py @@ -69,7 +69,6 @@ # options to be passed to requirements SUPPORTED_OPTIONS_REQ: List[Callable[..., optparse.Option]] = [ - cmdoptions.install_options, cmdoptions.global_options, cmdoptions.hash, ] diff --git a/src/pip/_internal/req/req_install.py b/src/pip/_internal/req/req_install.py index bb38ec09da4..fa5620e1d6e 100644 --- a/src/pip/_internal/req/req_install.py +++ b/src/pip/_internal/req/req_install.py @@ -83,7 +83,7 @@ def __init__( markers: Optional[Marker] = None, use_pep517: Optional[bool] = None, isolated: bool = False, - install_options: Optional[List[str]] = None, + *, global_options: Optional[List[str]] = None, hash_options: Optional[Dict[str, List[str]]] = None, config_settings: Optional[Dict[str, str]] = None, @@ -146,7 +146,6 @@ def __init__( # Set to True after successful installation self.install_succeeded: Optional[bool] = None # Supplied options - self.install_options = install_options if install_options else [] self.global_options = global_options if global_options else [] self.hash_options = hash_options if hash_options else {} self.config_settings = config_settings @@ -746,7 +745,6 @@ def archive(self, build_dir: Optional[str]) -> None: def install( self, - install_options: List[str], global_options: Optional[Sequence[str]] = None, root: Optional[str] = None, home: Optional[str] = None, @@ -767,8 +765,7 @@ def install( global_options = global_options if global_options is not None else [] if self.editable and not self.is_wheel: install_editable_legacy( - install_options, - global_options, + global_options=global_options, prefix=prefix, home=home, use_user_site=use_user_site, @@ -808,13 +805,12 @@ def install( # TODO: Why don't we do this for editable installs? - # Extend the list of global and install options passed on to + # Extend the list of global options passed on to # the setup.py call with the ones from the requirements file. # Options specified in requirements file override those # specified on the command line, since the last option given # to setup.py is the one that is used. global_options = list(global_options) + self.global_options - install_options = list(install_options) + self.install_options try: if ( @@ -823,7 +819,6 @@ def install( ): self.legacy_install_reason.emit_deprecation(self.name) success = install_legacy( - install_options=install_options, global_options=global_options, root=root, home=home, @@ -893,15 +888,6 @@ def _has_option(options: Values, reqs: List[InstallRequirement], option: str) -> return False -def _install_option_ignored( - install_options: List[str], reqs: List[InstallRequirement] -) -> bool: - for req in reqs: - if (install_options or req.install_options) and not req.use_pep517: - return False - return True - - class LegacySetupPyOptionsCheckMode(Enum): INSTALL = 1 WHEEL = 2 @@ -913,34 +899,15 @@ def check_legacy_setup_py_options( reqs: List[InstallRequirement], mode: LegacySetupPyOptionsCheckMode, ) -> None: - has_install_options = _has_option(options, reqs, "install_options") has_build_options = _has_option(options, reqs, "build_options") has_global_options = _has_option(options, reqs, "global_options") - legacy_setup_py_options_present = ( - has_install_options or has_build_options or has_global_options - ) + legacy_setup_py_options_present = has_build_options or has_global_options if not legacy_setup_py_options_present: return options.format_control.disallow_binaries() logger.warning( "Implying --no-binary=:all: due to the presence of " - "--build-option / --global-option / --install-option. " + "--build-option / --global-option. " "Consider using --config-settings for more flexibility.", ) - if mode == LegacySetupPyOptionsCheckMode.INSTALL and has_install_options: - if _install_option_ignored(options.install_options, reqs): - logger.warning( - "Ignoring --install-option when building using PEP 517", - ) - else: - deprecated( - reason=( - "--install-option is deprecated because " - "it forces pip to use the 'setup.py install' " - "command which is itself deprecated." - ), - issue=11358, - replacement="to use --config-settings", - gone_in="23.1", - ) diff --git a/src/pip/_internal/resolution/resolvelib/candidates.py b/src/pip/_internal/resolution/resolvelib/candidates.py index f5bc343b91b..7f09efc1539 100644 --- a/src/pip/_internal/resolution/resolvelib/candidates.py +++ b/src/pip/_internal/resolution/resolvelib/candidates.py @@ -66,7 +66,6 @@ def make_install_req_from_link( isolated=template.isolated, constraint=template.constraint, options=dict( - install_options=template.install_options, global_options=template.global_options, hashes=template.hash_options, ), @@ -90,7 +89,6 @@ def make_install_req_from_editable( constraint=template.constraint, permit_editable_wheels=template.permit_editable_wheels, options=dict( - install_options=template.install_options, global_options=template.global_options, hashes=template.hash_options, ), @@ -115,7 +113,6 @@ def _make_install_req_from_dist( isolated=template.isolated, constraint=template.constraint, options=dict( - install_options=template.install_options, global_options=template.global_options, hashes=template.hash_options, ), diff --git a/src/pip/_internal/utils/distutils_args.py b/src/pip/_internal/utils/distutils_args.py deleted file mode 100644 index 2fd1862073f..00000000000 --- a/src/pip/_internal/utils/distutils_args.py +++ /dev/null @@ -1,43 +0,0 @@ -from getopt import GetoptError, getopt -from typing import Dict, List - -_options = [ - "exec-prefix=", - "home=", - "install-base=", - "install-data=", - "install-headers=", - "install-lib=", - "install-platlib=", - "install-purelib=", - "install-scripts=", - "prefix=", - "root=", - "user", -] - - -def parse_distutils_args(args: List[str]) -> Dict[str, str]: - """Parse provided arguments, returning an object that has the matched arguments. - - Any unknown arguments are ignored. - """ - result = {} - for arg in args: - try: - parsed_opt, _ = getopt(args=[arg], shortopts="", longopts=_options) - except GetoptError: - # We don't care about any other options, which here may be - # considered unrecognized since our option list is not - # exhaustive. - continue - - if not parsed_opt: - continue - - option = parsed_opt[0] - name_from_parsed = option[0][2:].replace("-", "_") - value_from_parsed = option[1] or "true" - result[name_from_parsed] = value_from_parsed - - return result diff --git a/src/pip/_internal/utils/setuptools_build.py b/src/pip/_internal/utils/setuptools_build.py index 01ef4a4ca59..0662915cb05 100644 --- a/src/pip/_internal/utils/setuptools_build.py +++ b/src/pip/_internal/utils/setuptools_build.py @@ -103,8 +103,8 @@ def make_setuptools_clean_args( def make_setuptools_develop_args( setup_py_path: str, + *, global_options: Sequence[str], - install_options: Sequence[str], no_user_config: bool, prefix: Optional[str], home: Optional[str], @@ -120,8 +120,6 @@ def make_setuptools_develop_args( args += ["develop", "--no-deps"] - args += install_options - if prefix: args += ["--prefix", prefix] if home is not None: @@ -150,8 +148,8 @@ def make_setuptools_egg_info_args( def make_setuptools_install_args( setup_py_path: str, + *, global_options: Sequence[str], - install_options: Sequence[str], record_filename: str, root: Optional[str], prefix: Optional[str], @@ -190,6 +188,4 @@ def make_setuptools_install_args( if header_dir: args += ["--install-headers", header_dir] - args += install_options - return args diff --git a/tests/functional/test_install.py b/tests/functional/test_install.py index 94272a63e54..5d2f78c25ec 100644 --- a/tests/functional/test_install.py +++ b/tests/functional/test_install.py @@ -857,29 +857,6 @@ def test_install_with_hacked_egg_info( assert "Successfully installed hackedegginfo-0.0.0\n" in result.stdout -@pytest.mark.network -def test_install_using_install_option_and_editable( - script: PipTestEnvironment, tmpdir: Path -) -> None: - """ - Test installing a tool using -e and --install-option - """ - folder = "script_folder" - script.scratch_path.joinpath(folder).mkdir() - url = local_checkout("git+https://github.com/pypa/pip-test-package", tmpdir) - result = script.pip( - "install", - "-e", - f"{url}#egg=pip-test-package", - f"--install-option=--script-dir={folder}", - expect_stderr=True, - ) - script_file = ( - script.venv / "src/pip-test-package" / folder / f"pip-test-package{script.exe}" - ) - result.did_create(script_file) - - @pytest.mark.xfail @pytest.mark.network @need_mercurial diff --git a/tests/functional/test_install_reqs.py b/tests/functional/test_install_reqs.py index 14e1056ae7a..5490b301cd0 100644 --- a/tests/functional/test_install_reqs.py +++ b/tests/functional/test_install_reqs.py @@ -332,33 +332,6 @@ def test_wheel_user_with_prefix_in_pydistutils_cfg( assert "installed requiresupper" in result.stdout -def test_install_option_in_requirements_file_overrides_cli( - script: PipTestEnvironment, - arg_recording_sdist_maker: Callable[[str], ArgRecordingSdist], -) -> None: - simple_sdist = arg_recording_sdist_maker("simple") - - reqs_file = script.scratch_path.joinpath("reqs.txt") - reqs_file.write_text("simple --install-option='-O0'") - - result = script.pip( - "install", - "--no-index", - "-f", - str(simple_sdist.sdist_path.parent), - "-r", - str(reqs_file), - "--install-option=-O1", - allow_stderr_warning=True, - ) - simple_args = simple_sdist.args() - assert "install" in simple_args - assert simple_args.index("-O1") < simple_args.index("-O0") - assert "Implying --no-binary=:all:" in result.stderr - assert "Consider using --config-settings" in result.stderr - assert "--install-option is deprecated" in result.stderr - - def test_constraints_not_installed_by_default( script: PipTestEnvironment, data: TestData ) -> None: @@ -759,61 +732,3 @@ def test_install_unsupported_wheel_file( in result.stderr ) assert len(result.files_created) == 0 - - -def test_install_options_local_to_package( - script: PipTestEnvironment, - arg_recording_sdist_maker: Callable[[str], ArgRecordingSdist], -) -> None: - """Make sure --install-options does not leak across packages. - - A requirements.txt file can have per-package --install-options; these - should be isolated to just the package instead of leaking to subsequent - packages. This needs to be a functional test because the bug was around - cross-contamination at install time. - """ - - simple1_sdist = arg_recording_sdist_maker("simple1") - simple2_sdist = arg_recording_sdist_maker("simple2") - - reqs_file = script.scratch_path.joinpath("reqs.txt") - reqs_file.write_text( - textwrap.dedent( - """ - simple1 --install-option='-O0' - simple2 - """ - ) - ) - script.pip( - "install", - "--no-index", - "-f", - str(simple1_sdist.sdist_path.parent), - "-r", - reqs_file, - allow_stderr_warning=True, - ) - - simple1_args = simple1_sdist.args() - assert "install" in simple1_args - assert "-O0" in simple1_args - simple2_args = simple2_sdist.args() - assert "install" in simple2_args - assert "-O0" not in simple2_args - - -def test_location_related_install_option_fails(script: PipTestEnvironment) -> None: - simple_sdist = create_basic_sdist_for_package(script, "simple", "0.1.0") - reqs_file = script.scratch_path.joinpath("reqs.txt") - reqs_file.write_text("simple --install-option='--home=/tmp'") - result = script.pip( - "install", - "--no-index", - "-f", - str(simple_sdist.parent), - "-r", - reqs_file, - expect_error=True, - ) - assert "['--home'] from simple" in result.stderr diff --git a/tests/unit/test_command_install.py b/tests/unit/test_command_install.py index 69792dd9839..5e7889fe16b 100644 --- a/tests/unit/test_command_install.py +++ b/tests/unit/test_command_install.py @@ -2,16 +2,9 @@ from unittest import mock import pytest -from pip._vendor.packaging.requirements import Requirement from pip._internal.commands import install -from pip._internal.commands.install import ( - create_os_error_message, - decide_user_install, - reject_location_related_install_options, -) -from pip._internal.exceptions import CommandError -from pip._internal.req.req_install import InstallRequirement +from pip._internal.commands.install import create_os_error_message, decide_user_install class TestDecideUserInstall: @@ -48,37 +41,6 @@ def test_most_cases( assert decide_user_install(use_user_site=None) is result -def test_rejection_for_pip_install_options() -> None: - install_options = ["--prefix=/hello"] - with pytest.raises(CommandError) as e: - reject_location_related_install_options([], install_options) - - assert "['--prefix'] from command line" in str(e.value) - - -def test_rejection_for_location_requirement_options() -> None: - bad_named_req_options = ["--home=/wow"] - bad_named_req = InstallRequirement( - Requirement("hello"), "requirements.txt", install_options=bad_named_req_options - ) - - bad_unnamed_req_options = ["--install-lib=/lib"] - bad_unnamed_req = InstallRequirement( - None, "requirements2.txt", install_options=bad_unnamed_req_options - ) - - with pytest.raises(CommandError) as e: - reject_location_related_install_options( - [bad_named_req, bad_unnamed_req], options=[] - ) - - assert ( - "['--install-lib'] from (from requirements2.txt)" - in str(e.value) - ) - assert "['--home'] from hello (from requirements.txt)" in str(e.value) - - @pytest.mark.parametrize( "error, show_traceback, using_user_site, expected", [ diff --git a/tests/unit/test_req_file.py b/tests/unit/test_req_file.py index 228d0aaa49c..30cbcf71c16 100644 --- a/tests/unit/test_req_file.py +++ b/tests/unit/test_req_file.py @@ -344,14 +344,10 @@ def test_nested_constraints_file( assert reqs[0].constraint def test_options_on_a_requirement_line(self, line_processor: LineProcessor) -> None: - line = ( - "SomeProject --install-option=yo1 --install-option yo2 " - '--global-option="yo3" --global-option "yo4"' - ) + line = 'SomeProject --global-option="yo3" --global-option "yo4"' filename = "filename" req = line_processor(line, filename, 1)[0] assert req.global_options == ["yo3", "yo4"] - assert req.install_options == ["yo1", "yo2"] def test_hash_options(self, line_processor: LineProcessor) -> None: """Test the --hash option: mostly its value storage. @@ -870,14 +866,12 @@ def test_install_requirements_with_options( options: mock.Mock, ) -> None: global_option = "--dry-run" - install_option = "--prefix=/opt" content = """ --only-binary :all: - INITools==2.0 --global-option="{global_option}" \ - --install-option "{install_option}" + INITools==2.0 --global-option="{global_option}" """.format( - global_option=global_option, install_option=install_option + global_option=global_option ) with requirements_file(content, tmpdir) as reqs_file: @@ -897,9 +891,4 @@ def test_install_requirements_with_options( last_call = popen.call_args_list[-1] args = last_call[0][0] - assert ( - 0 - < args.index(global_option) - < args.index("install") - < args.index(install_option) - ) + assert 0 < args.index(global_option) < args.index("install") diff --git a/tests/unit/test_utils_distutils_args.py b/tests/unit/test_utils_distutils_args.py deleted file mode 100644 index 21f31e926f2..00000000000 --- a/tests/unit/test_utils_distutils_args.py +++ /dev/null @@ -1,63 +0,0 @@ -import pytest - -from pip._internal.utils.distutils_args import parse_distutils_args - - -def test_unknown_option_is_ok() -> None: - result = parse_distutils_args(["--foo"]) - assert not result - - -def test_option_is_returned() -> None: - result = parse_distutils_args(["--prefix=hello"]) - assert result["prefix"] == "hello" - - -def test_options_are_clobbered() -> None: - # Matches the current setuptools behavior that the last argument - # wins. - result = parse_distutils_args(["--prefix=hello", "--prefix=world"]) - assert result["prefix"] == "world" - - -def test_multiple_options_work() -> None: - result = parse_distutils_args(["--prefix=hello", "--root=world"]) - assert result["prefix"] == "hello" - assert result["root"] == "world" - - -def test_multiple_invocations_do_not_keep_options() -> None: - result = parse_distutils_args(["--prefix=hello1"]) - assert len(result) == 1 - assert result["prefix"] == "hello1" - - result = parse_distutils_args(["--root=world1"]) - assert len(result) == 1 - assert result["root"] == "world1" - - -@pytest.mark.parametrize( - "name,value", - [ - ("exec-prefix", "1"), - ("home", "2"), - ("install-base", "3"), - ("install-data", "4"), - ("install-headers", "5"), - ("install-lib", "6"), - ("install-platlib", "7"), - ("install-purelib", "8"), - ("install-scripts", "9"), - ("prefix", "10"), - ("root", "11"), - ], -) -def test_all_value_options_work(name: str, value: str) -> None: - result = parse_distutils_args([f"--{name}={value}"]) - key_name = name.replace("-", "_") - assert result[key_name] == value - - -def test_user_option_works() -> None: - result = parse_distutils_args(["--user"]) - assert result["user"]