Renamed file function to files and made it take multiple arguments.
This commit is contained in:
parent
9117e2b076
commit
c78f8c9945
|
@ -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…
Reference in New Issue