From 2209d1b9a664b2c33d788311add3f5bf7d6caf8c Mon Sep 17 00:00:00 2001 From: Manuel Francisco Naranjo Date: Mon, 3 Jun 2013 12:53:17 -0300 Subject: Allow Literal objects to be compared among each others. This small change allows Literal objects to be compared, so that calls like for example AppendUnique only append one instance when string compares to True instead of duplicated values. --- src/engine/SCons/Subst.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/engine/SCons/Subst.py b/src/engine/SCons/Subst.py index 98097dc..318d7d9 100644 --- a/src/engine/SCons/Subst.py +++ b/src/engine/SCons/Subst.py @@ -78,6 +78,14 @@ class Literal(object): def is_literal(self): return 1 + def __eq__(self, other): + if not isinstance(other, Literal): + return False + return self.lstr == other.lstr + + def __neq__(self, other): + return not self.__eq__(other) + class SpecialAttrWrapper(object): """This is a wrapper for what we call a 'Node special attribute.' This is any of the attributes of a Node that we can reference from @@ -172,7 +180,7 @@ class NLWrapper(object): In practice, this might be a wash performance-wise, but it's a little cleaner conceptually... """ - + def __init__(self, list, func): self.list = list self.func = func @@ -190,7 +198,7 @@ class NLWrapper(object): self._create_nodelist = self._return_nodelist return self.nodelist _create_nodelist = _gen_nodelist - + class Targets_or_Sources(collections.UserList): """A class that implements $TARGETS or $SOURCES expansions by in turn @@ -451,7 +459,7 @@ def scons_subst(strSubst, env, mode=SUBST_RAW, target=None, source=None, gvars={ raise_exception(NameError(key), lvars['TARGETS'], s) else: return '' - + # Before re-expanding the result, handle # recursive expansion by copying the local # variable dictionary and overwriting a null -- cgit v0.12 From b20c2218feb24b73a3d985b1f8121e601e930f45 Mon Sep 17 00:00:00 2001 From: Gary Oberbrunner Date: Sun, 29 Sep 2013 15:50:32 -0400 Subject: Added tests for Literal object comparison, and updated CHANGES.txt. --- src/CHANGES.txt | 4 ++++ src/engine/SCons/EnvironmentTests.py | 8 +++++++- src/engine/SCons/SubstTests.py | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index e80a161..dd6a717 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -6,6 +6,10 @@ RELEASE 2.3.1.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE + From Manuel Francisco Naranjo: + - Allow Subst.Literal string objects to be compared with each other, + so they work better in AddUnique() and Remove(). + From David Rothenberger: - Added cyglink linker that uses Cygwin naming conventions for shared libraries and automatically generates import libraries. diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index 45cf876..db788dc 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -1682,6 +1682,8 @@ def exists(env): CCC1 = '', CCC2 = '', DDD1 = ['a', 'b', 'c']) + env['LL1'] = [env.Literal('a literal'), env.Literal('b literal')] + env['LL2'] = [env.Literal('c literal'), env.Literal('b literal')] env.AppendUnique(AAA1 = 'a1', AAA2 = ['a2'], AAA3 = ['a3', 'b', 'c', 'c', 'b', 'a3'], # ignore dups @@ -1694,7 +1696,9 @@ def exists(env): BBB5 = ['b5.new'], CCC1 = 'c1', CCC2 = ['c2'], - DDD1 = 'b') + DDD1 = 'b', + LL1 = env.Literal('a literal'), + LL2 = env.Literal('a literal')) assert env['AAA1'] == 'a1a1', env['AAA1'] assert env['AAA2'] == ['a2'], env['AAA2'] @@ -1709,6 +1713,8 @@ def exists(env): assert env['CCC1'] == 'c1', env['CCC1'] assert env['CCC2'] == ['c2'], env['CCC2'] assert env['DDD1'] == ['a', 'b', 'c'], env['DDD1'] + assert env['LL1'] == [env.Literal('a literal'), env.Literal('b literal')], env['LL1'] + assert env['LL2'] == [env.Literal('c literal'), env.Literal('b literal'), env.Literal('a literal')], [str(x) for x in env['LL2']] env.AppendUnique(DDD1 = 'b', delete_existing=1) assert env['DDD1'] == ['a', 'c', 'b'], env['DDD1'] # b moves to end diff --git a/src/engine/SCons/SubstTests.py b/src/engine/SCons/SubstTests.py index 420fd73..ee9f3db 100644 --- a/src/engine/SCons/SubstTests.py +++ b/src/engine/SCons/SubstTests.py @@ -1147,6 +1147,11 @@ class LiteralTestCase(unittest.TestCase): cmd_list = escape_list(cmd_list[0], escape_func) assert cmd_list == ['BAZ', '**$BAR**'], cmd_list + def test_LiteralEqualsTest(self): + """Test that Literals compare for equality properly""" + assert Literal('a literal') == Literal('a literal') + assert Literal('a literal') != Literal('b literal') + class SpecialAttrWrapperTestCase(unittest.TestCase): def test_SpecialAttrWrapper(self): """Test the SpecialAttrWrapper() function.""" -- cgit v0.12 From 6ac04c37e028312fa9daaf03a880153b6f0a29af Mon Sep 17 00:00:00 2001 From: antonio Date: Sat, 15 Jun 2013 17:33:18 +0100 Subject: fix for visual studio expres on win7 x86_64 (transplanted from d7e892b4978439c6374d090912f13afa13e8daf8) --- src/engine/SCons/Tool/MSCommon/vc.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index 1266ee8..818475c 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -258,13 +258,14 @@ def find_batch_file(env,msvc_version,host_arch,target_arch): installed_sdks=get_installed_sdks() for _sdk in installed_sdks: - sdk_bat_file=_sdk.get_sdk_vc_script(host_arch,target_arch) - sdk_bat_file_path=os.path.join(pdir,sdk_bat_file) - debug('vc.py:find_batch_file() sdk_bat_file_path:%s'%sdk_bat_file_path) - if os.path.exists(sdk_bat_file_path): + sdk_bat_file = _sdk.get_sdk_vc_script(host_arch,target_arch) + if sdk_bat_file and os.path.join(pdir,sdk_bat_file): + sdk_bat_file_path = os.path.join(pdir,sdk_bat_file) + debug('vc.py:find_batch_file() sdk_bat_file_path:%s'%sdk_bat_file_path) + return (batfilename,sdk_bat_file_path) else: - debug("vc.py:find_batch_file() not found:%s"%sdk_bat_file_path) + debug("vc.py:find_batch_file() not found:%s"%_sdk) else: return (batfilename,None) -- cgit v0.12 From 7f6db37774dd41dec591f0a54eb99ba35d833419 Mon Sep 17 00:00:00 2001 From: antonio Date: Sat, 15 Jun 2013 18:39:51 +0100 Subject: fix missing file test (transplanted from 19a5828d1523a8308cf652d18eb1824e85d1c304) --- src/engine/SCons/Tool/MSCommon/vc.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index 818475c..c970118 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -259,15 +259,15 @@ def find_batch_file(env,msvc_version,host_arch,target_arch): installed_sdks=get_installed_sdks() for _sdk in installed_sdks: sdk_bat_file = _sdk.get_sdk_vc_script(host_arch,target_arch) - if sdk_bat_file and os.path.join(pdir,sdk_bat_file): + if not sdk_bat_file: + debug("vc.py:find_batch_file() not found:%s"%_sdk) + else: sdk_bat_file_path = os.path.join(pdir,sdk_bat_file) - debug('vc.py:find_batch_file() sdk_bat_file_path:%s'%sdk_bat_file_path) + if os.path.exists(sdk_bat_file_path): + debug('vc.py:find_batch_file() sdk_bat_file_path:%s'%sdk_bat_file_path) + return (batfilename,sdk_bat_file_path) + return (batfilename,None) - return (batfilename,sdk_bat_file_path) - else: - debug("vc.py:find_batch_file() not found:%s"%_sdk) - else: - return (batfilename,None) __INSTALLED_VCS_RUN = None -- cgit v0.12 From 25c535f2e5997defdca96a6e0c35a0143e824982 Mon Sep 17 00:00:00 2001 From: Dirk Baechle Date: Wed, 11 Sep 2013 22:44:33 +0200 Subject: - fix for #2916, "Issues with versioned SharedLibrary under OpenBSD" --- src/CHANGES.txt | 4 ++++ src/engine/SCons/Tool/__init__.py | 22 +++++++++++++++------- test/Libs/SharedLibrary.py | 13 +++++++++++++ 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index e80a161..1afe71a 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -6,6 +6,10 @@ RELEASE 2.3.1.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE + From Stefan Sperling: + - Fixed the setup of linker flags for a versioned SharedLibrary + under OpenBSD (#2916). + From David Rothenberger: - Added cyglink linker that uses Cygwin naming conventions for shared libraries and automatically generates import libraries. diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py index b80d6e4..00413e5 100644 --- a/src/engine/SCons/Tool/__init__.py +++ b/src/engine/SCons/Tool/__init__.py @@ -257,6 +257,10 @@ def VersionShLibLinkNames(version, libname, env): print "VersionShLibLinkNames: linkname = ",linkname linknames.append(linkname) elif platform == 'posix': + if sys.platform.startswith('openbsd'): + # OpenBSD uses x.y shared library versioning numbering convention + # and doesn't use symlinks to backwards-compatible libraries + return [] # For libfoo.so.x.y.z, linknames libfoo.so libfoo.so.x.y libfoo.so.x suffix_re = re.escape(shlib_suffix + '.' + version) # First linkname has no version number @@ -302,13 +306,17 @@ symlinks for the platform we are on""" if version: # set the shared library link flags if platform == 'posix': - suffix_re = re.escape(shlib_suffix + '.' + version) - (major, age, revision) = version.split(".") - # soname will have only the major version number in it - soname = re.sub(suffix_re, shlib_suffix, libname) + '.' + major - shlink_flags += [ '-Wl,-Bsymbolic', '-Wl,-soname=%s' % soname ] - if Verbose: - print " soname ",soname,", shlink_flags ",shlink_flags + shlink_flags += [ '-Wl,-Bsymbolic' ] + # OpenBSD doesn't usually use SONAME for libraries + if not sys.platform.startswith('openbsd'): + # continue setup of shlink flags for all other POSIX systems + suffix_re = re.escape(shlib_suffix + '.' + version) + (major, age, revision) = version.split(".") + # soname will have only the major version number in it + soname = re.sub(suffix_re, shlib_suffix, libname) + '.' + major + shlink_flags += [ '-Wl,-soname=%s' % soname ] + if Verbose: + print " soname ",soname,", shlink_flags ",shlink_flags elif platform == 'cygwin': shlink_flags += [ '-Wl,-Bsymbolic', '-Wl,--out-implib,${TARGET.base}.a' ] diff --git a/test/Libs/SharedLibrary.py b/test/Libs/SharedLibrary.py index b7d1374..eac575c 100644 --- a/test/Libs/SharedLibrary.py +++ b/test/Libs/SharedLibrary.py @@ -60,6 +60,13 @@ obj = env.SharedObject('bar', 'foo.c') Default(env.Library(target = 'foo', source = obj)) """) +test.write('SConstructBaz', """ +env=Environment() +env['SHLIBVERSION'] = '1.0.0' +obj = env.SharedObject('baz', 'foo.c') +Default(env.SharedLibrary(target = 'baz', source = obj)) +""") + test.write('foo.c', r""" #include @@ -287,6 +294,12 @@ main(int argc, char *argv[]) test.run(program = test.workpath('progbar'), stdout = "f4.c\nprogbar.c\n") +if sys.platform.startswith('openbsd'): + # Make sure we don't link libraries with -Wl,-soname on OpenBSD. + test.run(arguments = '-f SConstructBaz') + for line in test.stdout().split('\n'): + test.fail_test(line.find('-Wl,-soname=libbaz.so') != -1) + test.pass_test() # Local Variables: -- cgit v0.12 From c5e4dcd21f66eb61f3a0699fc733991b3d16dfc0 Mon Sep 17 00:00:00 2001 From: Alexandre Feblot Date: Sun, 15 Sep 2013 16:35:03 +0200 Subject: Fix http://scons.tigris.org/issues/show_bug.cgi?id=2903 --- src/engine/SCons/Tool/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py index b80d6e4..35885f9 100644 --- a/src/engine/SCons/Tool/__init__.py +++ b/src/engine/SCons/Tool/__init__.py @@ -356,7 +356,9 @@ symlinks for the platform we are on""" print "VerShLib: made sym link of %s -> %s" % (linkname, lib_ver) return result -ShLibAction = SCons.Action.Action(VersionedSharedLibrary, None) +# Fix http://scons.tigris.org/issues/show_bug.cgi?id=2903 : +# varlist=['$SHLINKCOM']: ensure we still depend on SCons.Defaults.ShLinkAction command line which is $SHLINKCOM +ShLibAction = SCons.Action.Action(VersionedSharedLibrary, None, varlist=['SHLINKCOM']) def createSharedLibBuilder(env): """This is a utility function that creates the SharedLibrary -- cgit v0.12 From c76073b8c0dfce959545d8aec1edf0ba09edbd1e Mon Sep 17 00:00:00 2001 From: Gary Oberbrunner Date: Sun, 29 Sep 2013 16:01:02 -0400 Subject: Updated src/CHANGES.txt for pull req #81. --- src/CHANGES.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index dd6a717..f4229be 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -6,6 +6,9 @@ RELEASE 2.3.1.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE + From Antonio Cavallo: + - Improve error if Visual Studio bat file not found. + From Manuel Francisco Naranjo: - Allow Subst.Literal string objects to be compared with each other, so they work better in AddUnique() and Remove(). -- cgit v0.12 From 6ef70e36fef5d954a7de3e17a62d28c148506d58 Mon Sep 17 00:00:00 2001 From: Gary Oberbrunner Date: Sun, 29 Sep 2013 19:21:35 -0400 Subject: Added test for bug 2909, pull req #86. --- src/CHANGES.txt | 3 ++ test/Libs/SharedLibrary-update-deps.py | 57 ++++++++++++++++++++++++++++++++++ test/Libs/bug2909/SConstruct | 3 ++ test/Libs/bug2909/SConstruct-libs | 3 ++ test/Libs/bug2909/lib.c | 1 + test/Libs/bug2909/main.c | 3 ++ 6 files changed, 70 insertions(+) create mode 100644 test/Libs/SharedLibrary-update-deps.py create mode 100644 test/Libs/bug2909/SConstruct create mode 100644 test/Libs/bug2909/SConstruct-libs create mode 100644 test/Libs/bug2909/lib.c create mode 100644 test/Libs/bug2909/main.c diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 1e91144..9fa8985 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -6,6 +6,9 @@ RELEASE 2.3.1.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE + From Alexandre Feblot: + - Make sure SharedLibrary depends on all dependent libs (by depending on SHLINKCOM) + From Stefan Sperling: - Fixed the setup of linker flags for a versioned SharedLibrary under OpenBSD (#2916). diff --git a/test/Libs/SharedLibrary-update-deps.py b/test/Libs/SharedLibrary-update-deps.py new file mode 100644 index 0000000..24c5262 --- /dev/null +++ b/test/Libs/SharedLibrary-update-deps.py @@ -0,0 +1,57 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test that SharedLibrary() updates when a different lib is linked, even if it has the same md5. +This is Tigris bug #2909. +""" + +import os.path +import TestSCons + +test = TestSCons.TestSCons() + +test.dir_fixture( "bug2909" ) + +# Build the sub-libs (don't care about details of this) +test.run(arguments='-f SConstruct-libs') +# This should build the main lib, using libfoo.so +test.run(arguments='libname=foo') +# This should rebuild the main lib, using libbar.so; +# it should NOT say it's already up to date. +test.run(arguments='libname=bar') +test.must_not_contain_any_line(test.stdout(), ["is up to date"]) +# Try it again, in reverse, to make sure: +test.run(arguments='libname=foo') +test.must_not_contain_any_line(test.stdout(), ["is up to date"]) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/Libs/bug2909/SConstruct b/test/Libs/bug2909/SConstruct new file mode 100644 index 0000000..2c5440b --- /dev/null +++ b/test/Libs/bug2909/SConstruct @@ -0,0 +1,3 @@ +env=Environment() +libname=ARGUMENTS.get('libname', 'foo') +env.SharedLibrary('myshared', ['main.c'], LIBS=[libname], LIBPATH='.') \ No newline at end of file diff --git a/test/Libs/bug2909/SConstruct-libs b/test/Libs/bug2909/SConstruct-libs new file mode 100644 index 0000000..3f59f9c --- /dev/null +++ b/test/Libs/bug2909/SConstruct-libs @@ -0,0 +1,3 @@ +env=Environment() +libfoo = env.SharedLibrary('foo', 'lib.c') +env.InstallAs('${SHLIBPREFIX}bar${SHLIBSUFFIX}', libfoo) \ No newline at end of file diff --git a/test/Libs/bug2909/lib.c b/test/Libs/bug2909/lib.c new file mode 100644 index 0000000..048f715 --- /dev/null +++ b/test/Libs/bug2909/lib.c @@ -0,0 +1 @@ +int i; diff --git a/test/Libs/bug2909/main.c b/test/Libs/bug2909/main.c new file mode 100644 index 0000000..3fe7d49 --- /dev/null +++ b/test/Libs/bug2909/main.c @@ -0,0 +1,3 @@ +void func() +{ +} -- cgit v0.12 From 43f296c7c2a350de0c59a442e566c165420803e3 Mon Sep 17 00:00:00 2001 From: Gary Oberbrunner Date: Sun, 29 Sep 2013 20:14:11 -0400 Subject: From Bogdan Tenea: Check for 8.3 filenames on cygwin as well as win32 to make variant_dir work properly. --- src/CHANGES.txt | 3 +++ src/engine/SCons/Node/FS.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 9fa8985..50a27dc 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -6,6 +6,9 @@ RELEASE 2.3.1.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE + From Bogdan Tenea: + - Check for 8.3 filenames on cygwin as well as win32 to make variant_dir work properly. + From Alexandre Feblot: - Make sure SharedLibrary depends on all dependent libs (by depending on SHLINKCOM) diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index f31ca83..4381697 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -1841,7 +1841,7 @@ class Dir(Base): for entry in map(_my_normcase, entries): d[entry] = True self.on_disk_entries = d - if sys.platform == 'win32': + if sys.platform == 'win32' or sys.platform == 'cygwin': name = _my_normcase(name) result = d.get(name) if result is None: -- cgit v0.12