aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2015-06-17 20:50:03 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2015-06-17 20:50:03 +0300
commit8f27cd399e19fb56ceaf98c3bfc477012312a632 (patch)
treeada475442866f9bf25b88ec68da8d21379e63526
parentec74616bbd7b16b3ce0b953e02e83c50252c73db (diff)
downloadmeson-8f27cd399e19fb56ceaf98c3bfc477012312a632.zip
meson-8f27cd399e19fb56ceaf98c3bfc477012312a632.tar.gz
meson-8f27cd399e19fb56ceaf98c3bfc477012312a632.tar.bz2
Fixed broken subdir object extraction and moved tests.
-rw-r--r--backends.py5
-rw-r--r--interpreter.py8
-rw-r--r--test cases/common/84 extract from nested subdir/meson.build (renamed from test cases/failing/16 extract object subdir/meson.build)0
-rw-r--r--test cases/common/84 extract from nested subdir/src/first/lib_first.c (renamed from test cases/failing/16 extract object subdir/src/first/lib_first.c)0
-rw-r--r--test cases/common/84 extract from nested subdir/src/first/meson.build (renamed from test cases/failing/16 extract object subdir/src/first/meson.build)0
-rw-r--r--test cases/common/84 extract from nested subdir/src/meson.build (renamed from test cases/failing/16 extract object subdir/src/meson.build)0
-rw-r--r--test cases/common/84 extract from nested subdir/tst/first/exe_first.c (renamed from test cases/failing/16 extract object subdir/tst/first/exe_first.c)0
-rw-r--r--test cases/common/84 extract from nested subdir/tst/first/meson.build (renamed from test cases/failing/16 extract object subdir/tst/first/meson.build)0
-rw-r--r--test cases/common/84 extract from nested subdir/tst/meson.build (renamed from test cases/failing/16 extract object subdir/tst/meson.build)0
-rw-r--r--test cases/failing/16 extract from subproject/main.c (renamed from test cases/common/84 extract subproject object/main.c)0
-rw-r--r--test cases/failing/16 extract from subproject/meson.build (renamed from test cases/common/84 extract subproject object/meson.build)0
-rw-r--r--test cases/failing/16 extract from subproject/subprojects/sub_project/meson.build (renamed from test cases/common/84 extract subproject object/subprojects/sub_project/meson.build)0
-rw-r--r--test cases/failing/16 extract from subproject/subprojects/sub_project/sub_lib.c (renamed from test cases/common/84 extract subproject object/subprojects/sub_project/sub_lib.c)0
13 files changed, 9 insertions, 4 deletions
diff --git a/backends.py b/backends.py
index 424d900..cf8b90a 100644
--- a/backends.py
+++ b/backends.py
@@ -176,9 +176,12 @@ class Backend():
if pathsegs[0] == 'subprojects':
pathsegs = pathsegs[2:]
fixedpath = os.sep.join(pathsegs)
- objbase = os.path.join(fixedpath, osrc.fname).replace('/', '_').replace('\\', '_')
+ print('fname', osrc.fname)
+ objbase = osrc.fname.replace('/', '_').replace('\\', '_')
+ print('objbase', objbase)
objname = os.path.join(proj_dir_to_build_root,
targetdir, os.path.basename(objbase) + suffix)
+ print('objname', objname)
result.append(objname)
return result
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':
diff --git a/test cases/failing/16 extract object subdir/meson.build b/test cases/common/84 extract from nested subdir/meson.build
index 6db4290..6db4290 100644
--- a/test cases/failing/16 extract object subdir/meson.build
+++ b/test cases/common/84 extract from nested subdir/meson.build
diff --git a/test cases/failing/16 extract object subdir/src/first/lib_first.c b/test cases/common/84 extract from nested subdir/src/first/lib_first.c
index 01e06b6..01e06b6 100644
--- a/test cases/failing/16 extract object subdir/src/first/lib_first.c
+++ b/test cases/common/84 extract from nested subdir/src/first/lib_first.c
diff --git a/test cases/failing/16 extract object subdir/src/first/meson.build b/test cases/common/84 extract from nested subdir/src/first/meson.build
index b97aef4..b97aef4 100644
--- a/test cases/failing/16 extract object subdir/src/first/meson.build
+++ b/test cases/common/84 extract from nested subdir/src/first/meson.build
diff --git a/test cases/failing/16 extract object subdir/src/meson.build b/test cases/common/84 extract from nested subdir/src/meson.build
index 3f5ec32..3f5ec32 100644
--- a/test cases/failing/16 extract object subdir/src/meson.build
+++ b/test cases/common/84 extract from nested subdir/src/meson.build
diff --git a/test cases/failing/16 extract object subdir/tst/first/exe_first.c b/test cases/common/84 extract from nested subdir/tst/first/exe_first.c
index 4f714df..4f714df 100644
--- a/test cases/failing/16 extract object subdir/tst/first/exe_first.c
+++ b/test cases/common/84 extract from nested subdir/tst/first/exe_first.c
diff --git a/test cases/failing/16 extract object subdir/tst/first/meson.build b/test cases/common/84 extract from nested subdir/tst/first/meson.build
index a6fa7da..a6fa7da 100644
--- a/test cases/failing/16 extract object subdir/tst/first/meson.build
+++ b/test cases/common/84 extract from nested subdir/tst/first/meson.build
diff --git a/test cases/failing/16 extract object subdir/tst/meson.build b/test cases/common/84 extract from nested subdir/tst/meson.build
index 3f5ec32..3f5ec32 100644
--- a/test cases/failing/16 extract object subdir/tst/meson.build
+++ b/test cases/common/84 extract from nested subdir/tst/meson.build
diff --git a/test cases/common/84 extract subproject object/main.c b/test cases/failing/16 extract from subproject/main.c
index 0ada338..0ada338 100644
--- a/test cases/common/84 extract subproject object/main.c
+++ b/test cases/failing/16 extract from subproject/main.c
diff --git a/test cases/common/84 extract subproject object/meson.build b/test cases/failing/16 extract from subproject/meson.build
index 286aaa1..286aaa1 100644
--- a/test cases/common/84 extract subproject object/meson.build
+++ b/test cases/failing/16 extract from subproject/meson.build
diff --git a/test cases/common/84 extract subproject object/subprojects/sub_project/meson.build b/test cases/failing/16 extract from subproject/subprojects/sub_project/meson.build
index e0073ea..e0073ea 100644
--- a/test cases/common/84 extract subproject object/subprojects/sub_project/meson.build
+++ b/test cases/failing/16 extract from subproject/subprojects/sub_project/meson.build
diff --git a/test cases/common/84 extract subproject object/subprojects/sub_project/sub_lib.c b/test cases/failing/16 extract from subproject/subprojects/sub_project/sub_lib.c
index be3c9aa..be3c9aa 100644
--- a/test cases/common/84 extract subproject object/subprojects/sub_project/sub_lib.c
+++ b/test cases/failing/16 extract from subproject/subprojects/sub_project/sub_lib.c