summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-08-16 04:28:52 (GMT)
committerSteven Knight <knight@baldmt.com>2003-08-16 04:28:52 (GMT)
commitd5adf36ac53b97889bc171147e1cc96bdc6f8d8e (patch)
tree9b232b6ac692e5391c8a416f3e4fa7512e5d126b
parentaed679bb2f98521dbe07cba65ef22e1c482993f0 (diff)
downloadSCons-d5adf36ac53b97889bc171147e1cc96bdc6f8d8e.zip
SCons-d5adf36ac53b97889bc171147e1cc96bdc6f8d8e.tar.gz
SCons-d5adf36ac53b97889bc171147e1cc96bdc6f8d8e.tar.bz2
Fix a yacc regression.
-rw-r--r--src/CHANGES.txt5
-rw-r--r--src/engine/SCons/Tool/yacc.py1
-rw-r--r--test/YACC.py28
3 files changed, 28 insertions, 6 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index db8ac76..3b4fcab 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -12,6 +12,11 @@ RELEASE X.XX - XXX, XX XXX XXXX XX:XX:XX XXXXX
From Steven Knight
+ From Gerard Patel
+
+ - When the yacc -d flag is used, take the .h file base name from the
+ target .c file, not the source (matching what yacc does).
+
RELEASE 0.91 - Thu, 14 Aug 2003 13:00:44 -0500
diff --git a/src/engine/SCons/Tool/yacc.py b/src/engine/SCons/Tool/yacc.py
index e46ecdd..c0274ce 100644
--- a/src/engine/SCons/Tool/yacc.py
+++ b/src/engine/SCons/Tool/yacc.py
@@ -46,6 +46,7 @@ def _yaccEmitter(target, source, env, ysuf, hsuf):
if len(source) and '-d' in string.split(env.subst("$YACCFLAGS")):
base, ext = os.path.splitext(SCons.Util.to_String(source[0]))
if ext == ysuf:
+ base, ext = os.path.splitext(SCons.Util.to_String(target[0]))
target.append(base + hsuf)
return (target, source)
diff --git a/test/YACC.py b/test/YACC.py
index a93b968..13203ff 100644
--- a/test/YACC.py
+++ b/test/YACC.py
@@ -105,6 +105,7 @@ foo.Program(target = 'foo', source = 'foo.y')
bar.Program(target = 'bar', source = 'bar.y')
foo.Program(target = 'hello', source = ['hello.cpp'])
foo.CXXFile(target = 'file.cpp', source = ['file.yy'], YACCFLAGS='-d')
+foo.CFile(target = 'not_foo', source = 'foo.y')
""" % python)
yacc = r"""
@@ -161,6 +162,7 @@ int main()
test.write('bar.y', yacc % 'bar.y')
+ # Build the foo program
test.run(arguments = 'foo' + _exe, stderr = None)
test.up_to_date(arguments = 'foo' + _exe)
@@ -169,20 +171,34 @@ int main()
test.run(program = test.workpath('foo'), stdin = "a\n", stdout = "foo.y\n")
- test.run(arguments = 'bar' + _exe)
+ test.fail_test(not os.path.exists(test.workpath('foo.h')))
- test.up_to_date(arguments = 'bar' + _exe)
+ test.run(arguments = '-c .')
- test.fail_test(test.read('wrapper.out') != "wrapper.py\n")
+ test.fail_test(os.path.exists(test.workpath('foo.h')))
- test.run(program = test.workpath('bar'), stdin = "b\n", stdout = "bar.y\n")
+ #
+ test.run(arguments = 'not_foo.c')
- test.fail_test(not os.path.exists(test.workpath('foo.h')))
+ test.up_to_date(arguments = 'not_foo.c')
+
+ test.fail_test(os.path.exists(test.workpath('foo.h')))
+ test.fail_test(not os.path.exists(test.workpath('not_foo.h')))
test.run(arguments = '-c .')
- test.fail_test(os.path.exists(test.workpath('foo.h')))
+ test.fail_test(os.path.exists(test.workpath('not_foo.h')))
+
+ #
+ 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")
+ #
test.run(arguments = '.')
test.up_to_date(arguments = '.')