Generators work in subdirectories.

pull/15/head
Jussi Pakkanen 10 years ago
parent d61529caf0
commit 01f8a1455e
  1. 7
      interpreter.py
  2. 15
      test cases/common/30 pipeline/meson.build
  3. 0
      test cases/common/30 pipeline/src/input_src.dat
  4. 12
      test cases/common/30 pipeline/src/meson.build
  5. 0
      test cases/common/30 pipeline/src/prog.c
  6. 0
      test cases/common/30 pipeline/src/srcgen.c

@ -210,8 +210,9 @@ class ExternalLibraryHolder(InterpreterObject):
return self.el.get_exe_args()
class GeneratorHolder(InterpreterObject):
def __init__(self, args, kwargs):
def __init__(self, interpreter, args, kwargs):
super().__init__()
self.interpreter = interpreter
self.generator = build.Generator(args, kwargs)
self.methods.update({'process' : self.process_method})
@ -226,7 +227,7 @@ class GeneratorHolder(InterpreterObject):
if not isinstance(a, str):
raise InvalidArguments('A non-string object in "process" arguments.')
gl = GeneratedListHolder(self)
[gl.add_file(a) for a in args]
[gl.add_file(os.path.join(self.interpreter.subdir, a)) for a in args]
return gl
class GeneratedListHolder(InterpreterObject):
@ -1085,7 +1086,7 @@ class Interpreter():
return tg
def func_generator(self, node, args, kwargs):
gen = GeneratorHolder(args, kwargs)
gen = GeneratorHolder(self, args, kwargs)
self.generators.append(gen)
return gen

@ -1,14 +1,5 @@
project('pipeline test', 'c')
e1 = executable('srcgen', 'srcgen.c', native : true)
# Generate a header file that needs to be included.
gen = generator(e1,
output : '@BASENAME@.h',
arguments : ['@INPUT@', '@OUTPUT@'])
generated = gen.process('input_src.dat')
e2 = executable('prog', 'prog.c', generated)
test('pipelined', e2)
# This is in a subdirectory to make sure
# we write proper subdir paths to output.
subdir('src')

@ -0,0 +1,12 @@
e1 = executable('srcgen', 'srcgen.c', native : true)
# Generate a header file that needs to be included.
gen = generator(e1,
output : '@BASENAME@.h',
arguments : ['@INPUT@', '@OUTPUT@'])
generated = gen.process('input_src.dat')
e2 = executable('prog', 'prog.c', generated)
test('pipelined', e2)
Loading…
Cancel
Save