aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2021-10-10 01:30:43 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2021-10-10 15:01:53 +0300
commit95d8b8787a2dd01e0abb40f7088e706e204a859f (patch)
tree03d59ea3fe3016f45168ed7b7ccac50bb46be339 /mesonbuild
parent6b7d43ebe0d77ac85fa2c01e0e358efc64418126 (diff)
downloadmeson-95d8b8787a2dd01e0abb40f7088e706e204a859f.zip
meson-95d8b8787a2dd01e0abb40f7088e706e204a859f.tar.gz
meson-95d8b8787a2dd01e0abb40f7088e706e204a859f.tar.bz2
Be more strict about target names with slashes.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/interpreter/interpreter.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index 4c5dfbb..7e2a934 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.py
@@ -2566,6 +2566,14 @@ Try setting b_lundef to false instead.'''.format(self.coredata.options[OptionKey
raise InterpreterException('Target name must not be empty.')
if name.strip() == '':
raise InterpreterException('Target name must not consist only of whitespace.')
+ if has_path_sep(name):
+ pathseg = os.path.join(self.subdir, os.path.split(name)[0])
+ if os.path.exists(os.path.join(self.source_root, pathseg)):
+ raise InvalidArguments(textwrap.dedent(f'''\
+ Target "{name}" has a path segment pointing to directory "{pathseg}". This is an error.
+ 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 "
"for Meson's internal use. Please rename.")