Support for both basename and plainname in generators.

pull/15/head
Jussi Pakkanen 12 years ago
parent 7e9827704c
commit ecd46332af
  1. 9
      interpreter.py
  2. 2
      test cases/common/30 pipeline/prog.c

@ -119,15 +119,16 @@ class Generator(InterpreterObject):
rule = kwargs['output_name']
if not isinstance(rule, str):
raise InvalidArguments('"output_name" keyword argument must be a string.')
if not '@BASENAME@' in rule:
raise InvalidArguments('"output_name" must contain @BASENAME@.')
if not '@BASENAME@' in rule and not '@PLAINNAME@' in rule:
raise InvalidArguments('"output_name" must contain @BASENAME@ or @PLAINNAME@.')
if '/' in rule:
raise InvalidArguments('"output_name" must not contain a slash.')
self.name_rule = rule
def get_base_outname(self, inname):
base = os.path.split(inname)[1]
return self.name_rule.replace('@BASENAME@', base)
plainname = os.path.split(inname)[1]
basename = plainname.split('.')[0]
return self.name_rule.replace('@BASENAME@', basename).replace('@PLAINNAME@', plainname)
def process_method(self, args, kwargs):
if len(kwargs) > 0:

@ -1,4 +1,4 @@
#include"input_src.dat.h"
#include"input_src.h"
int main(int argc, char **argv) {
void *foo = printf;

Loading…
Cancel
Save