Skip to content

Commit

Permalink
Remove deprecation warning for config_settings --global-option
Browse files Browse the repository at this point in the history
This interface is not super stable/usable yet, so it should be fine
to remove.
  • Loading branch information
abravalheri committed Sep 28, 2023
1 parent e01ec17 commit a755586
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 30 deletions.
14 changes: 3 additions & 11 deletions setuptools/build_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,9 @@ def _arbitrary_args(self, config_settings: _ConfigSettings) -> Iterator[str]:
['foo']
>>> list(fn({'--build-option': 'foo bar'}))
['foo', 'bar']
>>> warnings.simplefilter('error', SetuptoolsDeprecationWarning)
>>> list(fn({'--global-option': 'foo'})) # doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
SetuptoolsDeprecationWarning: ...arguments given via `--global-option`...
ValueError: Incompatible ...`foo`...
"""
args = self._get_config("--global-option", config_settings)
global_opts = self._valid_global_options()
Expand All @@ -301,15 +300,8 @@ def _arbitrary_args(self, config_settings: _ConfigSettings) -> Iterator[str]:
yield from self._get_config("--build-option", config_settings)

if bad_args:
SetuptoolsDeprecationWarning.emit(
"Incompatible `config_settings` passed to build backend.",
f"""
The arguments {bad_args!r} were given via `--global-option`.
Please use `--build-option` instead,
`--global-option` is reserved for flags like `--verbose` or `--quiet`.
""",
due_date=(2023, 9, 26), # Warning introduced in v64.0.1, 11/Aug/2022.
)
msg = f"Incompatible `config_settings`: {bad_args!r} ({config_settings!r})"
raise ValueError(msg)


class _BuildMetaBackend(_ConfigSettingsTranslator):
Expand Down
19 changes: 0 additions & 19 deletions setuptools/tests/test_build_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,25 +700,6 @@ def _assert_link_tree(self, parent_dir):
for file in files:
assert file.is_symlink() or os.stat(file).st_nlink > 0

@pytest.mark.filterwarnings("ignore::setuptools.SetuptoolsDeprecationWarning")
# Since the backend is running via a process pool, in some operating systems
# we may have problems to make assertions based on warnings/stdout/stderr...
# So the best is to ignore them for the time being.
def test_editable_with_global_option_still_works(self, tmpdir_cwd):
"""The usage of --global-option is now discouraged in favour of --build-option.
This is required to make more sense of the provided scape hatch and align with
previous pip behaviour. See pypa/setuptools#1928.
"""
path.build({**self._simple_pyproject_example, '_meta': {}})
build_backend = self.get_build_backend()
assert not Path("build").exists()

cfg = {"--global-option": ["--mode", "strict"]}
build_backend.prepare_metadata_for_build_editable("_meta", cfg)
build_backend.build_editable("temp", cfg, "_meta")

self._assert_link_tree(next(Path("build").glob("__editable__.*")))

def test_editable_without_config_settings(self, tmpdir_cwd):
"""
Sanity check to ensure tests with --mode=strict are different from the ones
Expand Down

0 comments on commit a755586

Please sign in to comment.