diff options
| author | Eli Schwartz <eschwartz@archlinux.org> | 2022-08-16 15:53:26 -0400 |
|---|---|---|
| committer | Eli Schwartz <eschwartz@archlinux.org> | 2022-08-16 17:40:03 -0400 |
| commit | 3c7ab542c0c4770241eae149b0d4cd8de329aee0 (patch) | |
| tree | 5f6959dd4d0d74ddf854d6c07237a3be4705d634 | |
| parent | 25b0988d4e40d22d907169b4f73ff07b4cb7fd0e (diff) | |
| download | meson-3c7ab542c0c4770241eae149b0d4cd8de329aee0.tar.gz | |
deprecate running "meson builddir" without setup subcommand
This is ambiguous, if the build directory has the same name as a
subcommand then we end up running the subcommand. It also means we have
a hard time adding *new* subcommands, because if it is a popular name of
a build directory then suddenly scripts that try to set up a build
directory end up running a subcommand instead.
The fact that we support this at all is a legacy design. Back in the
day, the "meson" program was for setting up a build directory and all
other tools were their own entry points, e.g. `mesontest` or
`mesonconf`. Then in commit fa278f351fe3d6924b4d1961f77b5b4a36e133f8 we
migrated to the subcommand mechanism. So, for backwards compatibility,
we made those tools print a warning and then invoke `meson <tool>`. We
also made the `meson` tool default to setup.
However, we only warned for the other tools whose entry points were
eventually deleted. We never warned for setup itself, we just continued
to silently default to setup if no tool was provided.
`meson setup` has worked since 0.42, which is 5 years old this week.
It's available essentially everywhere. No one needs to use the old
backwards-compatible invocation method, but it continues to drag down
our ability to innovate. Let's finally do what we should have done a
long time ago, and sunset it.
| -rw-r--r-- | docs/markdown/Commands.md | 4 | ||||
| -rw-r--r-- | mesonbuild/mesonmain.py | 5 | ||||
| -rwxr-xr-x | run_project_tests.py | 2 | ||||
| -rw-r--r-- | unittests/baseplatformtests.py | 4 |
4 files changed, 11 insertions, 4 deletions
diff --git a/docs/markdown/Commands.md b/docs/markdown/Commands.md index f7ef0090d..11ca6e07a 100644 --- a/docs/markdown/Commands.md +++ b/docs/markdown/Commands.md @@ -240,7 +240,9 @@ See [the Meson file rewriter documentation](Rewriter.md) for more info. Configures a build directory for the Meson project. -This is the default Meson command (invoked if there was no COMMAND supplied). +*Deprecated since 0.64.0*: This is the default Meson command (invoked if there +was no COMMAND supplied). However, supplying the command is necessary to avoid +clashes with future added commands, so "setup" should be used explicitly. {{ setup_arguments.inc }} diff --git a/mesonbuild/mesonmain.py b/mesonbuild/mesonmain.py index ec4bfff35..37b2502c3 100644 --- a/mesonbuild/mesonmain.py +++ b/mesonbuild/mesonmain.py @@ -121,11 +121,13 @@ class CommandLineParser: return 0 def run(self, args): + implicit_setup_command_notice = False pending_python_deprecation_notice = False # If first arg is not a known command, assume user wants to run the setup # command. known_commands = list(self.commands.keys()) + ['-h', '--help'] if not args or args[0] not in known_commands: + implicit_setup_command_notice = True args = ['setup'] + args # Hidden commands have their own parser instead of using the global one @@ -190,6 +192,9 @@ class CommandLineParser: mlog.exception(e) return 2 finally: + if implicit_setup_command_notice: + mlog.warning('Running the setup command as `meson [options]` instead of ' + '`meson setup [options]` is ambiguous and deprecated.', fatal=False) if pending_python_deprecation_notice: mlog.notice('You are using Python 3.6 which is EOL. Starting with v0.62.0, ' 'Meson will require Python 3.7 or newer', fatal=False) diff --git a/run_project_tests.py b/run_project_tests.py index fc5a969b7..f125a804a 100755 --- a/run_project_tests.py +++ b/run_project_tests.py @@ -635,7 +635,7 @@ def _run_test(test: TestDef, should_fail: str) -> TestResult: gen_start = time.time() # Configure in-process - gen_args = [] # type: T.List[str] + gen_args = ['setup'] if 'prefix' not in test.do_not_set_opts: gen_args += ['--prefix', 'x:/usr'] if mesonlib.is_windows() else ['--prefix', '/usr'] if 'libdir' not in test.do_not_set_opts: diff --git a/unittests/baseplatformtests.py b/unittests/baseplatformtests.py index 458218871..e97c880fc 100644 --- a/unittests/baseplatformtests.py +++ b/unittests/baseplatformtests.py @@ -59,7 +59,7 @@ class BasePlatformTests(TestCase): self.meson_native_files = [] self.meson_cross_files = [] self.meson_command = python_command + [get_meson_script()] - self.setup_command = self.meson_command + self.meson_args + self.setup_command = self.meson_command + ['setup'] + self.meson_args self.mconf_command = self.meson_command + ['configure'] self.mintro_command = self.meson_command + ['introspect'] self.wrap_command = self.meson_command + ['wrap'] @@ -205,7 +205,7 @@ class BasePlatformTests(TestCase): self.privatedir = os.path.join(self.builddir, 'meson-private') if inprocess: try: - returncode, out, err = run_configure_inprocess(self.meson_args + args + extra_args, override_envvars) + returncode, out, err = run_configure_inprocess(['setup'] + self.meson_args + args + extra_args, override_envvars) except Exception as e: if not allow_fail: self._print_meson_log() |
