diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2015-06-17 20:50:03 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2015-06-17 20:50:03 +0300 |
commit | 8f27cd399e19fb56ceaf98c3bfc477012312a632 (patch) | |
tree | ada475442866f9bf25b88ec68da8d21379e63526 /interpreter.py | |
parent | ec74616bbd7b16b3ce0b953e02e83c50252c73db (diff) | |
download | meson-8f27cd399e19fb56ceaf98c3bfc477012312a632.zip meson-8f27cd399e19fb56ceaf98c3bfc477012312a632.tar.gz meson-8f27cd399e19fb56ceaf98c3bfc477012312a632.tar.bz2 |
Fixed broken subdir object extraction and moved tests.
Diffstat (limited to 'interpreter.py')
-rw-r--r-- | interpreter.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/interpreter.py b/interpreter.py index 5db9717..05e30a1 100644 --- a/interpreter.py +++ b/interpreter.py @@ -1774,14 +1774,16 @@ class Interpreter(): self.validate_extraction(obj.held_object) return obj.method_call(method_name, args, kwargs) + # Only permit object extraction from the same subproject def validate_extraction(self, buildtarget): - if self.subproject_dir == '': + if not self.subdir.startswith(self.subproject_dir): if buildtarget.subdir.startswith(self.subproject_dir): raise InterpreterException('Tried to extract objects from a subproject target.') else: - lead = '/'.join(self.subdir.split('/')[0:2]) if not buildtarget.subdir.startswith(lead): - raise InterpreterException('Tried to extract objects from a different subproject target.') + raise InterpreterException('Tried to extract objects from the main project from a subproject.') + if self.subdir.split('/')[1] != buildtarget.subdir.split('/')[1]: + raise InterpreterException('Tried to extract objects from a different subproject.') def array_method_call(self, obj, method_name, args): if method_name == 'contains': |