diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index f4bc11f8f..bfd946aeb 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1373,6 +1373,9 @@ class Interpreter(InterpreterBase): self.coredata = self.environment.get_coredata() self.backend = backend self.subproject = subproject + # Subproject directory is usually the name of the subproject, but can + # be different for dependencies provided by wrap files. + self.subproject_directory_name = subdir.split(os.path.sep)[-1] self.subproject_dir = subproject_dir self.option_file = os.path.join(self.source_root, self.subdir, 'meson_options.txt') self.load_root_meson_file() @@ -2785,7 +2788,6 @@ different subdirectory. super().run() mlog.log('Build targets in project:', mlog.bold(str(len(self.build.targets)))) - # Check that the indicated file is within the same subproject # as we currently are. This is to stop people doing # nasty things like: @@ -2816,7 +2818,7 @@ different subdirectory. if num_sps > 1: raise InterpreterException('Sandbox violation: Tried to grab file %s from a nested subproject.' % segments[-1]) sproj_name = segments[segments.index(self.subproject_dir) + 1] - if sproj_name != self.subproject: + if sproj_name != self.subproject_directory_name: raise InterpreterException('Sandbox violation: Tried to grab file %s from a different subproject.' % segments[-1]) def source_strings_to_files(self, sources): diff --git a/test cases/common/162 wrap file should not failed/meson.build b/test cases/common/162 wrap file should not failed/meson.build new file mode 100644 index 000000000..64d8d1faf --- /dev/null +++ b/test cases/common/162 wrap file should not failed/meson.build @@ -0,0 +1,3 @@ +project('mainproj', 'c') + +subproject('zlib') diff --git a/test cases/common/162 wrap file should not failed/subprojects/packagecache/zlib-1.2.8-8-wrap.zip b/test cases/common/162 wrap file should not failed/subprojects/packagecache/zlib-1.2.8-8-wrap.zip new file mode 100644 index 000000000..421376db9 --- /dev/null +++ b/test cases/common/162 wrap file should not failed/subprojects/packagecache/zlib-1.2.8-8-wrap.zip @@ -0,0 +1 @@ +dummy diff --git a/test cases/common/162 wrap file should not failed/subprojects/packagecache/zlib-1.2.8.tar.gz b/test cases/common/162 wrap file should not failed/subprojects/packagecache/zlib-1.2.8.tar.gz new file mode 100644 index 000000000..421376db9 --- /dev/null +++ b/test cases/common/162 wrap file should not failed/subprojects/packagecache/zlib-1.2.8.tar.gz @@ -0,0 +1 @@ +dummy diff --git a/test cases/common/162 wrap file should not failed/subprojects/zlib-1.2.8/foo.c b/test cases/common/162 wrap file should not failed/subprojects/zlib-1.2.8/foo.c new file mode 100644 index 000000000..e69de29bb diff --git a/test cases/common/162 wrap file should not failed/subprojects/zlib-1.2.8/meson.build b/test cases/common/162 wrap file should not failed/subprojects/zlib-1.2.8/meson.build new file mode 100644 index 000000000..8d8008e47 --- /dev/null +++ b/test cases/common/162 wrap file should not failed/subprojects/zlib-1.2.8/meson.build @@ -0,0 +1,2 @@ +project('shared lib', 'c') +shared_library('foo', 'foo.c') diff --git a/test cases/common/162 wrap file should not failed/subprojects/zlib.wrap b/test cases/common/162 wrap file should not failed/subprojects/zlib.wrap new file mode 100644 index 000000000..6d5896f79 --- /dev/null +++ b/test cases/common/162 wrap file should not failed/subprojects/zlib.wrap @@ -0,0 +1,10 @@ +[wrap-file] +directory = zlib-1.2.8 + +source_url = http://zlib.net/fossils/zlib-1.2.8.tar.gz +source_filename = zlib-1.2.8.tar.gz +source_hash = 36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d + +patch_url = https://wrapdb.mesonbuild.com/v1/projects/zlib/1.2.8/8/get_zip +patch_filename = zlib-1.2.8-8-wrap.zip +patch_hash = 17c52a0e0c59ce926d3959005d5cd8178c6c7e2c9a4a1304279a8320c955ac60