From 5587941cff89c427d047d7426b803045dd2729f1 Mon Sep 17 00:00:00 2001 From: stevenknight Date: Sat, 7 Jun 2003 22:04:31 +0000 Subject: [PATCH] Handle library prefixes correctly if the subdirectory is named lib*. (Matt Balvin) git-svn-id: http://scons.tigris.org/svn/scons/trunk@701 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/CHANGES.txt | 5 +++++ src/engine/SCons/Builder.py | 5 +++-- src/engine/SCons/BuilderTests.py | 3 +++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index aa18bf64..0986d163 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -10,6 +10,11 @@ RELEASE 0.15 - XXX + From Matt Balvin: + + - Fix handling of library prefixes when the subdirectory matches + the prefix. + From Steven Knight: - SCons now enforces (with an error) that construction variables diff --git a/src/engine/SCons/Builder.py b/src/engine/SCons/Builder.py index 414c5de6..6caf5d9a 100644 --- a/src/engine/SCons/Builder.py +++ b/src/engine/SCons/Builder.py @@ -290,9 +290,10 @@ class BuilderBase: for f in files: if SCons.Util.is_String(f): - if pre and f[:len(pre)] != pre: + if pre: path, fn = os.path.split(os.path.normpath(f)) - f = os.path.join(path, pre + fn) + if fn[:len(pre)] != pre: + f = os.path.join(path, pre + fn) # Only append a suffix if the file does not have one. if suf and not SCons.Util.splitext(f)[1]: if f[-len(suf):] != suf: diff --git a/src/engine/SCons/BuilderTests.py b/src/engine/SCons/BuilderTests.py index f7b329de..b856b08c 100644 --- a/src/engine/SCons/BuilderTests.py +++ b/src/engine/SCons/BuilderTests.py @@ -303,6 +303,9 @@ 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'), \ + "Target has unexpected name: %s" % tgt.path def test_src_suffix(self): """Test Builder creation with a specified source file suffix -- 2.26.2