Fixed broken subdir object extraction and moved tests.

pull/155/head
Jussi Pakkanen 10 years ago
parent ec74616bbd
commit 8f27cd399e
  1. 5
      backends.py
  2. 8
      interpreter.py
  3. 0
      test cases/common/84 extract from nested subdir/meson.build
  4. 0
      test cases/common/84 extract from nested subdir/src/first/lib_first.c
  5. 0
      test cases/common/84 extract from nested subdir/src/first/meson.build
  6. 0
      test cases/common/84 extract from nested subdir/src/meson.build
  7. 0
      test cases/common/84 extract from nested subdir/tst/first/exe_first.c
  8. 0
      test cases/common/84 extract from nested subdir/tst/first/meson.build
  9. 0
      test cases/common/84 extract from nested subdir/tst/meson.build
  10. 0
      test cases/failing/16 extract from subproject/main.c
  11. 0
      test cases/failing/16 extract from subproject/meson.build
  12. 0
      test cases/failing/16 extract from subproject/subprojects/sub_project/meson.build
  13. 0
      test cases/failing/16 extract from subproject/subprojects/sub_project/sub_lib.c

@ -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

@ -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':

Loading…
Cancel
Save