Renamed file function to files and made it take multiple arguments.

pull/103/head
Jussi Pakkanen 10 years ago
parent 9117e2b076
commit c78f8c9945
  1. 10
      interpreter.py
  2. 4
      test cases/common/81 file object/meson.build
  3. 4
      test cases/common/81 file object/subdir1/meson.build
  4. 4
      test cases/common/81 file object/subdir2/meson.build

@ -787,7 +787,7 @@ class Interpreter():
'vcs_tag' : self.func_vcs_tag,
'set_variable' : self.func_set_variable,
'import' : self.func_import,
'file' : self.func_file,
'files' : self.func_files,
}
def module_method_callback(self, invalues):
@ -890,12 +890,8 @@ class Interpreter():
@stringArgs
@noKwargs
def func_file(self, node, args, kwargs):
if len(args) != 1:
raise InvalidCode('File takes one argument.')
fname = args[0]
fobj = File.from_source_file(self.environment.source_dir, self.subdir, fname)
return fobj
def func_files(self, node, args, kwargs):
return [File.from_source_file(self.environment.source_dir, self.subdir, fname) for fname in args]
def set_variable(self, varname, variable):
if variable is None:

@ -1,7 +1,7 @@
project('file object', 'c')
prog0 = file('prog.c')
lib0 = file('lib.c')
prog0 = files('prog.c')
lib0 = files('lib.c')
test('fobj', executable('fobj', prog0, lib0))
subdir('subdir1')

@ -1,5 +1,5 @@
prog1 = file('prog.c')
lib1 = file('lib.c')
prog1 = files('prog.c')
lib1 = files('lib.c')
test('subdir0', executable('subdir0', prog0, lib1), should_fail : true)
test('subdir1', executable('subdir1', prog1, lib0), should_fail : true)

@ -1,5 +1,5 @@
prog2 = file('prog.c')
lib2 = file('lib.c')
prog2 = files('prog.c')
lib2 = files('lib.c')
test('subdir3', executable('subdir3', prog1, lib2), should_fail : true)
test('subdir4', executable('subdir4', prog2, lib1), should_fail : true)

Loading…
Cancel
Save