def yaccEmitter(target, source, env, **kw):
# Yacc can be configured to emit a .h file as well
- # as a .c file. Append that as a target.
- if len(source) and os.path.splitext(SCons.Util.to_String(source[0]))[1] in \
- [ '.y', '.yy']:
+ # as a .c file, if -d is specified on the command line.
+ if len(source) and \
+ os.path.splitext(SCons.Util.to_String(source[0]))[1] in \
+ [ '.y', '.yy'] and \
+ '-d' in string.split(env.subst("$YACCFLAGS")):
target.append(os.path.splitext(SCons.Util.to_String(target[0]))[0] + \
'.h')
return (target, source)
args.extend(map(SCons.Util.to_String, source))
return win32TempFileMunge(env, args)
-kw = {
- 'name' : 'Program',
- 'prefix' : '$PROGPREFIX',
- 'suffix' : '$PROGSUFFIX',
- 'src_suffix' : '$OBJSUFFIX',
- 'src_builder' : Object,
- 'scanner' : SCons.Scanner.Prog.ProgScan()
-}
-
-if sys.platform == 'win32':
- kw['generator'] = win32LinkGenerator
-else:
- kw['action'] = '$LINKCOM'
-
-Program = apply(SCons.Builder.Builder, (), kw)
+Program = SCons.Builder.Builder(name='Program',
+ action='$LINKCOM',
+ prefix='$PROGPREFIX',
+ suffix='$PROGSUFFIX',
+ src_suffix='$OBJSUFFIX',
+ src_builder=Object,
+ scanner = SCons.Scanner.Prog.ProgScan())
class LibAffixGenerator:
def __init__(self, static, shared):
test.run(arguments = 'foo' + _exe, stderr = None)
+ test.up_to_date(arguments = 'foo' + _exe)
+
test.fail_test(os.path.exists(test.workpath('wrapper.out')))
test.run(program = test.workpath('foo'), stdin = "a\n", stdout = "foo.y\n")
test.run(arguments = 'bar' + _exe)
+ test.up_to_date(arguments = 'bar' + _exe)
+
test.fail_test(test.read('wrapper.out') != "wrapper.py\n")
test.run(program = test.workpath('bar'), stdin = "b\n", stdout = "bar.y\n")