aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-05-26 22:49:50 -0400
committerEli Schwartz <eschwartz@archlinux.org>2022-05-31 17:49:29 -0400
commit38c00feb9d2004c05491f52d6ec40f2ed8467b4e (patch)
tree2ec0065cf2b143f8328cbdada94ff7f29840e363 /mesonbuild/interpreter
parentdd2f1c4c57874a0efcd9f6d331985c408101c30d (diff)
downloadmeson-38c00feb9d2004c05491f52d6ec40f2ed8467b4e.zip
meson-38c00feb9d2004c05491f52d6ec40f2ed8467b4e.tar.gz
meson-38c00feb9d2004c05491f52d6ec40f2ed8467b4e.tar.bz2
relax target name restrictions to cater to internal use
We don't want to allow targets that conflict with: - our aliased meson-* targets for phony commands - any meson-*/ directories we create for internal purposes We do want to allow targets such as: - our own meson-*.X manpages There are a couple routes we could take. Using a better restriction, such as `meson-internal__*`, is trivially done for our aliased targets, but changing directory names is... awkward. We probably cannot do this, and doing the former but not the latter is not very useful. We could also carefully allow patterns we know we won't use, such as file extensions, but which the manpages need, which works for our directories and for many aliased targets, but run_target() is user-specified and can be anything. Use a hybrid approach to cover both use cases. We will now allow target names that fulfill *all* the following criteria: - it begins with "meson-" - it doesn't continue with "internal__" - it has a file extension
Diffstat (limited to 'mesonbuild/interpreter')
-rw-r--r--mesonbuild/interpreter/interpreter.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index af83c0e54..53e819b 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.py
@@ -2927,9 +2927,12 @@ Try setting b_lundef to false instead.'''.format(self.coredata.options[OptionKey
To define a target that builds in that directory you must define it
in the meson.build file in that directory.
'''))
- if name.startswith('meson-'):
- raise InvalidArguments("Target names starting with 'meson-' are reserved "
+ if name.startswith('meson-internal__'):
+ raise InvalidArguments("Target names starting with 'meson-internal__' are reserved "
"for Meson's internal use. Please rename.")
+ if name.startswith('meson-') and '.' not in name:
+ raise InvalidArguments("Target names starting with 'meson-' and without a file extension "
+ "are reserved for Meson's internal use. Please rename.")
if name in coredata.FORBIDDEN_TARGET_NAMES:
raise InvalidArguments(f"Target name '{name}' is reserved for Meson's "
"internal use. Please rename.")