From 6f9eca57d390bd3fffffb8017f1c52f160c89bce Mon Sep 17 00:00:00 2001 From: stevenknight Date: Wed, 2 Jul 2003 16:06:39 +0000 Subject: [PATCH] Make builder prefixes work correctly when deducing a target name from a source file in another directory. Fix a man page bug. Document the yacc -d *.yy fix previously checked in. git-svn-id: http://scons.tigris.org/svn/scons/trunk@732 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- doc/man/scons.1 | 7 ++++++- src/CHANGES.txt | 5 +++++ src/engine/SCons/Builder.py | 7 +++++-- src/engine/SCons/BuilderTests.py | 7 +++++-- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/doc/man/scons.1 b/doc/man/scons.1 index cdfc7d80..7c93e0e3 100644 --- a/doc/man/scons.1 +++ b/doc/man/scons.1 @@ -3315,6 +3315,11 @@ to generate a source file. .IP YACCFLAGS General options passed to the parser generator. +If $YACCFLAGS contains a \-d option, +SCons assumes that the call will also create a .h file +(if the yacc source file ends in a .y suffix) +or a .hpp file +(if the yacc source file ends in a .yy suffix) .IP ZIP The zip compression and file packaging utility. @@ -5549,7 +5554,7 @@ to the BUILDERS construction variable, such as: .ES env = Environment() -env.['BUILDERS]['PDFBuilder'] = bld +env['BUILDERS]['PDFBuilder'] = bld .EE .SS Defining Your Own Scanner Object diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 03bd9dea..bd8c5da3 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -17,6 +17,11 @@ RELEASE 0.XX - XXX - When the input yacc file ends in .yy and the -d flag is specified, recognize that a .hpp file (not a .h file) will be created. + - Make builder prefixes work correctly when deducing a target + from a source file name in another directory. + + - Documentation fixes: typo in the man page. + RELEASE 0.90 - Wed, 25 Jun 2003 14:24:52 -0500 diff --git a/src/engine/SCons/Builder.py b/src/engine/SCons/Builder.py index 6caf5d9a..f19983d3 100644 --- a/src/engine/SCons/Builder.py +++ b/src/engine/SCons/Builder.py @@ -311,8 +311,11 @@ class BuilderBase: if target is None: s = source[0] if isinstance(s, SCons.Node.Node): - s = os.path.split(str(s))[1] - target = [ pre + os.path.splitext(s)[0] + suf ] + s = str(s) + dir, s = os.path.split(s) + target = pre + os.path.splitext(s)[0] + suf + if dir: + target = [ os.path.join(dir, target) ] else: target = adjustixes(target, pre, suf) diff --git a/src/engine/SCons/BuilderTests.py b/src/engine/SCons/BuilderTests.py index b856b08c..062f8b9d 100644 --- a/src/engine/SCons/BuilderTests.py +++ b/src/engine/SCons/BuilderTests.py @@ -303,8 +303,11 @@ class BuilderTestCase(unittest.TestCase): tgt = builder(env, source = 'src3') assert tgt.path == 'libsrc3', \ "Target has unexpected name: %s" % tgt.path - tgt = builder(env, target = 'lib/tgt4', source = 'lib/src4') - assert tgt.path == os.path.join('lib', 'libtgt4'), \ + tgt = builder(env, source = 'lib/src4') + assert tgt.path == os.path.join('lib', 'libsrc4'), \ + "Target has unexpected name: %s" % tgt.path + tgt = builder(env, target = 'lib/tgt5', source = 'lib/src5') + assert tgt.path == os.path.join('lib', 'libtgt5'), \ "Target has unexpected name: %s" % tgt.path def test_src_suffix(self): -- 2.26.2