diff options
author | Steven Knight <knight@baldmt.com> | 2002-04-22 22:45:23 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2002-04-22 22:45:23 (GMT) |
commit | 359e8303a9423cb0ed8ee250042941866eaa64c8 (patch) | |
tree | 9ccd8c13b988e3a0969a1bad5e1baeed6d9f0a04 | |
parent | 094f305d5d6e668a8273b1efc67d89e2414314f6 (diff) | |
download | SCons-359e8303a9423cb0ed8ee250042941866eaa64c8.zip SCons-359e8303a9423cb0ed8ee250042941866eaa64c8.tar.gz SCons-359e8303a9423cb0ed8ee250042941866eaa64c8.tar.bz2 |
Small fix for yacc: only look for a .h file if they used the -d option. (Charles Crain)
-rw-r--r-- | src/engine/SCons/Defaults.py | 30 | ||||
-rw-r--r-- | test/YACC.py | 4 |
2 files changed, 16 insertions, 18 deletions
diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py index ac04d9a..8d6bd34 100644 --- a/src/engine/SCons/Defaults.py +++ b/src/engine/SCons/Defaults.py @@ -80,9 +80,11 @@ class SharedCmdGenerator: 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) @@ -191,21 +193,13 @@ def win32LinkGenerator(env, target, source, **kw): 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): diff --git a/test/YACC.py b/test/YACC.py index 486200c..8fea904 100644 --- a/test/YACC.py +++ b/test/YACC.py @@ -140,12 +140,16 @@ newline: '\n'; 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") |