From dc6191b6556ab6188dc58ada2cc943c45e64f08b Mon Sep 17 00:00:00 2001 From: Russel Winder Date: Fri, 10 Aug 2012 13:34:02 +0100 Subject: Merge in changes from the old repository that used a named branch. --- src/CHANGES.txt | 5 ++++ src/engine/SCons/Tool/dmd.py | 69 +++++++++++++++++++++++++++++++++++++------- 2 files changed, 63 insertions(+), 11 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 2636403..7b27507 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -4,6 +4,11 @@ Change Log + From Russel Winder: + - Changes made to the dmd tool to allow for various breaking changes + made in D 1.068 and 2.053 to do with the introduction of 64-bit + builds of DMD. NB D v.1 is now deprecated. + RELEASE 2.X.X - From dubcanada on Bitbucket: diff --git a/src/engine/SCons/Tool/dmd.py b/src/engine/SCons/Tool/dmd.py index a8faf5d..2d6d464 100644 --- a/src/engine/SCons/Tool/dmd.py +++ b/src/engine/SCons/Tool/dmd.py @@ -7,7 +7,7 @@ Coded by Andy Friesen (andy@ikagames.com) 15 November 2003 Amended by Russel Winder (russel@russel.org.uk) -2010-02-07 +2010-02-07, 2010-11-17, 2011-02, 2011-05-14 There are a number of problems with this script at this point in time. The one that irritates me the most is the Windows linker setup. The D @@ -60,6 +60,7 @@ Lib tool variables: __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os +import subprocess import SCons.Action import SCons.Builder @@ -129,6 +130,27 @@ def generate(env): env['DFLAGSUFFIX'] = '' env['DFILESUFFIX'] = '.d' + if dc == 'dmd' : + # + # We have to know exactly which version of DMD is in use so as to ensure correct behaviour. DMD has + # no option to return the version number. The only place it is found is int he first line of the + # help output. So grab that first line and then scan it. + # + process = subprocess.Popen ('dmd', stdout=subprocess.PIPE) + versionLine = process.stdout.readline() + process.kill() + # + # Up to and including DMD 1.067 and 2.052 the first line of the help starte "Digital Mars D Compiler + # v" followed by the version number. As of version 1.068 and 2.053, this string has changed to + # "DMD## D Compiler v" where ## is either 32 or 64 depending on the build of the executable. So + # instead of a simple replacement, extra work is needed. + # + #env['DMDVERSIONNUMBER'] = tuple([int(i) for i in versionLine.replace('Digital Mars D Compiler v', '').strip().split('.')]) + if 'DMD32' in versionLine : stringToReplace = 'DMD32 D Compiler v' + elif 'DMD64' in versionLine : stringToReplace = 'DMD64 D Compiler v' + else : stringToReplace = 'Digital Mars D Compiler v' + env['DMDVERSIONNUMBER'] = tuple([int(i) for i in versionLine.replace(stringToReplace, '').strip().split('.')]) + # Need to use the Digital Mars linker/lib on windows. # *nix can just use GNU link. if env['PLATFORM'] == 'win32': @@ -203,19 +225,40 @@ def generate(env): except KeyError: libs = [] if dc == 'dmd': - # TODO: This assumes that the dmd executable is in the - # bin directory and that the libraries are in a peer - # directory lib. This true of the Digital Mars - # distribution but . . . - import glob + # + # TODO: This assumes that the dmd executable is in the bin (or as of 1.068 and 2.053 + # possible bin32 or bin64 -- at least on Linux) directory and that the libraries + # are in a peer directory lib (for versions prior to 1.067 and 2.052) or lib32 and + # lib64 (for version 1.067 and 2.052 and later on Linux, Mac OS X remains with + # lib as there is no 64-bit backend or build for DMD on this platform). This is + # true of the Digital Mars distribution but what about Debian, Ubuntu, Fedora, + # FreeBSD, etc. packagings? + # + platformName , _ , _ , _ , architectureName = os.uname ( ) + mode64bit = False + if architectureName == 'x86_64' and '-m32' not in env['DFLAGS']: + mode64bit = True + if mode64bit and '-m64' not in env['DFLAGS']: + env.Append(DFLAGS = ['-m64']) dHome = env.WhereIs(dc).replace('/dmd' , '/..') - if glob.glob(dHome + '/lib/*phobos2*'): + if (env['DMDVERSIONNUMBER'][0] == 1 and env['DMDVERSIONNUMBER'][1] < 67 ) or \ + (env['DMDVERSIONNUMBER'][0] == 2 and env['DMDVERSIONNUMBER'][1] < 52 ): + libComponent = 'lib' + else: + if platformName == 'Linux' : + libComponent = 'lib64' if mode64bit else 'lib32' + else : + libComponent = 'lib' + import glob + if glob.glob(dHome + '/' + libComponent + '/*phobos2*'): if 'phobos2' not in libs: - env.Append(LIBPATH = [dHome + '/lib']) + env.Append(LIBPATH = [dHome + '/' + libComponent]) env.Append(LIBS = ['phobos2']) - # TODO: Find out when there will be a - # 64-bit version of D. - env.Append(LINKFLAGS = ['-m32']) + if (env['DMDVERSIONNUMBER'][0] == 1 and env['DMDVERSIONNUMBER'][1] < 67 ) or \ + (env['DMDVERSIONNUMBER'][0] == 2 and env['DMDVERSIONNUMBER'][1] < 52 ) : + env.Append(LINKFLAGS = ['-m32']) + else: + pass else: if 'phobos' not in libs: env.Append(LIBS = ['phobos']) @@ -225,6 +268,10 @@ def generate(env): env.Append(LIBS = ['pthread']) if 'm' not in libs: env.Append(LIBS = ['m']) + if (env['DMDVERSIONNUMBER'][0] == 1 and env['DMDVERSIONNUMBER'][1] >= 67 ) or \ + (env['DMDVERSIONNUMBER'][0] == 2 and env['DMDVERSIONNUMBER'][1] >= 52 ): + if platformName == 'Linux' and 'rt' not in libs : + env.Append(LIBS = ['rt']) return defaultLinker env['SMART_LINKCOM'] = smart_link[linkcom] = _smartLink -- cgit v0.12 From 3177be42c6ba22fb598172076b6e93c098d62e44 Mon Sep 17 00:00:00 2001 From: Russel Winder Date: Mon, 3 Sep 2012 13:15:54 +0100 Subject: Strip out all the Linux specific stuff as not being the right direction to handle all the variation. --- src/engine/SCons/Tool/dmd.py | 210 ++++++++++++------------------------------- test/D/DMD2.py | 64 +++++++++++++ 2 files changed, 123 insertions(+), 151 deletions(-) create mode 100644 test/D/DMD2.py diff --git a/src/engine/SCons/Tool/dmd.py b/src/engine/SCons/Tool/dmd.py index 2d6d464..45567e0 100644 --- a/src/engine/SCons/Tool/dmd.py +++ b/src/engine/SCons/Tool/dmd.py @@ -3,14 +3,14 @@ Tool-specific initialization for the Digital Mars D compiler. (http://digitalmars.com/d) -Coded by Andy Friesen (andy@ikagames.com) +Originally coded by Andy Friesen (andy@ikagames.com) 15 November 2003 -Amended by Russel Winder (russel@russel.org.uk) -2010-02-07, 2010-11-17, 2011-02, 2011-05-14 +Evolved by Russel Winder (russel@winder.org.uk) +2010-02-07, 2010-11-17, 2011-02, 2011-05-14, 2012-05-08, 2012-09-02 There are a number of problems with this script at this point in time. -The one that irritates me the most is the Windows linker setup. The D +The one that irritates the most is the Windows linker setup. The D linker doesn't have a way to add lib paths on the commandline, as far as I can see. You have to specify paths relative to the SConscript or use absolute paths. To hack around it, add '#/blah'. This will link @@ -68,11 +68,9 @@ import SCons.Defaults import SCons.Scanner.D import SCons.Tool -# Adapted from c++.py def isD(source): if not source: return 0 - for s in source: if s.sources: ext = os.path.splitext(str(s.sources[0]))[1] @@ -130,152 +128,62 @@ def generate(env): env['DFLAGSUFFIX'] = '' env['DFILESUFFIX'] = '.d' - if dc == 'dmd' : - # - # We have to know exactly which version of DMD is in use so as to ensure correct behaviour. DMD has - # no option to return the version number. The only place it is found is int he first line of the - # help output. So grab that first line and then scan it. - # - process = subprocess.Popen ('dmd', stdout=subprocess.PIPE) - versionLine = process.stdout.readline() - process.kill() - # - # Up to and including DMD 1.067 and 2.052 the first line of the help starte "Digital Mars D Compiler - # v" followed by the version number. As of version 1.068 and 2.053, this string has changed to - # "DMD## D Compiler v" where ## is either 32 or 64 depending on the build of the executable. So - # instead of a simple replacement, extra work is needed. - # - #env['DMDVERSIONNUMBER'] = tuple([int(i) for i in versionLine.replace('Digital Mars D Compiler v', '').strip().split('.')]) - if 'DMD32' in versionLine : stringToReplace = 'DMD32 D Compiler v' - elif 'DMD64' in versionLine : stringToReplace = 'DMD64 D Compiler v' - else : stringToReplace = 'Digital Mars D Compiler v' - env['DMDVERSIONNUMBER'] = tuple([int(i) for i in versionLine.replace(stringToReplace, '').strip().split('.')]) - - # Need to use the Digital Mars linker/lib on windows. - # *nix can just use GNU link. - if env['PLATFORM'] == 'win32': - env['DLINK'] = '$DC' - env['DLINKCOM'] = '$DLINK -of$TARGET $SOURCES $DFLAGS $DLINKFLAGS $_DLINKLIBFLAGS' - env['DLIB'] = 'lib' - env['DLIBCOM'] = '$DLIB $_DLIBFLAGS -c $TARGET $SOURCES $_DLINKLIBFLAGS' - - env['_DLINKLIBFLAGS'] = '$( ${_concat(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' - env['_DLIBFLAGS'] = '$( ${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)} $)' - env['DLINKFLAGS'] = [] - env['DLIBLINKPREFIX'] = '' - env['DLIBLINKSUFFIX'] = '.lib' - env['DLIBFLAGPREFIX'] = '-' - env['DLIBFLAGSUFFIX'] = '' - env['DLINKFLAGPREFIX'] = '-' - env['DLINKFLAGSUFFIX'] = '' - - SCons.Tool.createStaticLibBuilder(env) - - # Basically, we hijack the link and ar builders with our own. - # these builders check for the presence of D source, and swap out - # the system's defaults for the Digital Mars tools. If there's no D - # source, then we silently return the previous settings. - linkcom = env.get('LINKCOM') - try: - env['SMART_LINKCOM'] = smart_link[linkcom] - except KeyError: - def _smartLink(source, target, env, for_signature, - defaultLinker=linkcom): - if isD(source): - # XXX I'm not sure how to add a $DLINKCOMSTR variable - # so that it works with this _smartLink() logic, - # and I don't have a D compiler/linker to try it out, - # so we'll leave it alone for now. - return '$DLINKCOM' - else: - return defaultLinker - env['SMART_LINKCOM'] = smart_link[linkcom] = _smartLink - - arcom = env.get('ARCOM') - try: - env['SMART_ARCOM'] = smart_lib[arcom] - except KeyError: - def _smartLib(source, target, env, for_signature, - defaultLib=arcom): - if isD(source): - # XXX I'm not sure how to add a $DLIBCOMSTR variable - # so that it works with this _smartLib() logic, and - # I don't have a D compiler/archiver to try it out, - # so we'll leave it alone for now. - return '$DLIBCOM' - else: - return defaultLib - env['SMART_ARCOM'] = smart_lib[arcom] = _smartLib - - # It is worth noting that the final space in these strings is - # absolutely pivotal. SCons sees these as actions and not generators - # if it is not there. (very bad) - env['ARCOM'] = '$SMART_ARCOM ' - env['LINKCOM'] = '$SMART_LINKCOM ' - else: # assuming linux - linkcom = env.get('LINKCOM') - try: - env['SMART_LINKCOM'] = smart_link[linkcom] - except KeyError: - def _smartLink(source, target, env, for_signature, - defaultLinker=linkcom, dc=dc): - if isD(source): - try: - libs = env['LIBS'] - except KeyError: - libs = [] - if dc == 'dmd': - # - # TODO: This assumes that the dmd executable is in the bin (or as of 1.068 and 2.053 - # possible bin32 or bin64 -- at least on Linux) directory and that the libraries - # are in a peer directory lib (for versions prior to 1.067 and 2.052) or lib32 and - # lib64 (for version 1.067 and 2.052 and later on Linux, Mac OS X remains with - # lib as there is no 64-bit backend or build for DMD on this platform). This is - # true of the Digital Mars distribution but what about Debian, Ubuntu, Fedora, - # FreeBSD, etc. packagings? - # - platformName , _ , _ , _ , architectureName = os.uname ( ) - mode64bit = False - if architectureName == 'x86_64' and '-m32' not in env['DFLAGS']: - mode64bit = True - if mode64bit and '-m64' not in env['DFLAGS']: - env.Append(DFLAGS = ['-m64']) - dHome = env.WhereIs(dc).replace('/dmd' , '/..') - if (env['DMDVERSIONNUMBER'][0] == 1 and env['DMDVERSIONNUMBER'][1] < 67 ) or \ - (env['DMDVERSIONNUMBER'][0] == 2 and env['DMDVERSIONNUMBER'][1] < 52 ): - libComponent = 'lib' - else: - if platformName == 'Linux' : - libComponent = 'lib64' if mode64bit else 'lib32' - else : - libComponent = 'lib' - import glob - if glob.glob(dHome + '/' + libComponent + '/*phobos2*'): - if 'phobos2' not in libs: - env.Append(LIBPATH = [dHome + '/' + libComponent]) - env.Append(LIBS = ['phobos2']) - if (env['DMDVERSIONNUMBER'][0] == 1 and env['DMDVERSIONNUMBER'][1] < 67 ) or \ - (env['DMDVERSIONNUMBER'][0] == 2 and env['DMDVERSIONNUMBER'][1] < 52 ) : - env.Append(LINKFLAGS = ['-m32']) - else: - pass - else: - if 'phobos' not in libs: - env.Append(LIBS = ['phobos']) - elif dc is 'gdmd': - env.Append(LIBS = ['gphobos']) - if 'pthread' not in libs: - env.Append(LIBS = ['pthread']) - if 'm' not in libs: - env.Append(LIBS = ['m']) - if (env['DMDVERSIONNUMBER'][0] == 1 and env['DMDVERSIONNUMBER'][1] >= 67 ) or \ - (env['DMDVERSIONNUMBER'][0] == 2 and env['DMDVERSIONNUMBER'][1] >= 52 ): - if platformName == 'Linux' and 'rt' not in libs : - env.Append(LIBS = ['rt']) + env['DLINK'] = '$DC' + env['DLINKCOM'] = '$DLINK -of$TARGET $SOURCES $DFLAGS $DLINKFLAGS $_DLINKLIBFLAGS' + env['DLIB'] = 'lib' + env['DLIBCOM'] = '$DLIB $_DLIBFLAGS -c $TARGET $SOURCES $_DLINKLIBFLAGS' + + env['_DLINKLIBFLAGS'] = '$( ${_concat(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' + env['_DLIBFLAGS'] = '$( ${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)} $)' + env['DLINKFLAGS'] = [] + env['DLIBLINKPREFIX'] = '' + env['DLIBLINKSUFFIX'] = '.lib' + env['DLIBFLAGPREFIX'] = '-' + env['DLIBFLAGSUFFIX'] = '' + env['DLINKFLAGPREFIX'] = '-' + env['DLINKFLAGSUFFIX'] = '' + + SCons.Tool.createStaticLibBuilder(env) + + # Basically, we hijack the link and ar builders with our own. + # these builders check for the presence of D source, and swap out + # the system's defaults for the Digital Mars tools. If there's no D + # source, then we silently return the previous settings. + linkcom = env.get('LINKCOM') + try: + env['SMART_LINKCOM'] = smart_link[linkcom] + except KeyError: + def _smartLink(source, target, env, for_signature, defaultLinker=linkcom): + if isD(source): + # TODO: I'm not sure how to add a $DLINKCOMSTR variable + # so that it works with this _smartLink() logic, + # and I don't have a D compiler/linker to try it out, + # so we'll leave it alone for now. + return '$DLINKCOM' + else: return defaultLinker - env['SMART_LINKCOM'] = smart_link[linkcom] = _smartLink - - env['LINKCOM'] = '$SMART_LINKCOM ' + env['SMART_LINKCOM'] = smart_link[linkcom] = _smartLink + + arcom = env.get('ARCOM') + try: + env['SMART_ARCOM'] = smart_lib[arcom] + except KeyError: + def _smartLib(source, target, env, for_signature, defaultLib=arcom): + if isD(source): + # TODO: I'm not sure how to add a $DLIBCOMSTR variable + # so that it works with this _smartLib() logic, and + # I don't have a D compiler/archiver to try it out, + # so we'll leave it alone for now. + return '$DLIBCOM' + else: + return defaultLib + env['SMART_ARCOM'] = smart_lib[arcom] = _smartLib + + # It is worth noting that the final space in these strings is + # absolutely pivotal. SCons sees these as actions and not generators + # if it is not there. (very bad) + env['ARCOM'] = '$SMART_ARCOM ' + env['LINKCOM'] = '$SMART_LINKCOM ' def exists(env): return env.Detect(['dmd', 'gdmd']) diff --git a/test/D/DMD2.py b/test/D/DMD2.py new file mode 100644 index 0000000..c85d4ce --- /dev/null +++ b/test/D/DMD2.py @@ -0,0 +1,64 @@ +#!/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. +# + +# Amended by Russel Winder 2010-05-05 + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +import TestSCons + +_exe = TestSCons._exe +test = TestSCons.TestSCons() + +if not test.where_is('dmd') and not test.where_is('gdmd'): + test.skip_test("Could not find 'dmd' or 'gdmd'; skipping test.\n") + +test.write('SConstruct', """\ +import os +env = Environment(ENV=os.environ) +if env['PLATFORM'] == 'cygwin': env['OBJSUFFIX'] = '.obj' # trick DMD +env.Program('foo', 'foo.d') +""") + +test.write('foo.d', """\ +import std.stdio; +int main(string[] args) { + printf("Hello!"); + return 0; +} +""") + +test.run() + +test.run(program=test.workpath('foo'+_exe)) + +test.fail_test(not test.stdout() == 'Hello!') + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: -- cgit v0.12 From c27e712330e6a98fdf7ef6534b7b2225c0c2ebda Mon Sep 17 00:00:00 2001 From: Russel Winder Date: Mon, 3 Sep 2012 19:04:47 +0100 Subject: Be specific about which tools to use. --- test/D/DMD2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/D/DMD2.py b/test/D/DMD2.py index c85d4ce..d49f5e4 100644 --- a/test/D/DMD2.py +++ b/test/D/DMD2.py @@ -36,7 +36,7 @@ if not test.where_is('dmd') and not test.where_is('gdmd'): test.write('SConstruct', """\ import os -env = Environment(ENV=os.environ) +env = Environment(tools=['link', 'dmd'], ENV=os.environ) if env['PLATFORM'] == 'cygwin': env['OBJSUFFIX'] = '.obj' # trick DMD env.Program('foo', 'foo.d') """) -- cgit v0.12 From e0d371b1ab03860336878436882c14c1d88e94d6 Mon Sep 17 00:00:00 2001 From: Russel Winder Date: Mon, 3 Sep 2012 19:05:13 +0100 Subject: Add a first cut at GDC support. --- src/engine/SCons/Tool/gdc.py | 97 ++++++++++++++++++++++++++++++++++++++++++++ test/D/GDC.py | 64 +++++++++++++++++++++++++++++ 2 files changed, 161 insertions(+) create mode 100644 src/engine/SCons/Tool/gdc.py create mode 100644 test/D/GDC.py diff --git a/src/engine/SCons/Tool/gdc.py b/src/engine/SCons/Tool/gdc.py new file mode 100644 index 0000000..dfba9b3 --- /dev/null +++ b/src/engine/SCons/Tool/gdc.py @@ -0,0 +1,97 @@ +"""SCons.Tool.gdc + +Tool-specific initialization for the GDC compiler. +(https://github.com/D-Programming-GDC/GDC) + +Coded by Russel Winder (russel@winder.org.uk) +2012-05-09 + +Compiler variables: + DC - The name of the D compiler to use. Defaults to gdc. + DPATH - List of paths to search for import modules. + DVERSIONS - List of version tags to enable when compiling. + DDEBUG - List of debug tags to enable when compiling. + +Linker related variables: + LIBS - List of library files to link in. + DLINK - Name of the linker to use. Defaults to gcc. + DLINKFLAGS - List of linker flags. + +Lib tool variables: + DLIB - Name of the lib tool to use. Defaults to lib. + DLIBFLAGS - List of flags to pass to the lib tool. + LIBS - Same as for the linker. (libraries to pull into the .lib) +""" + +# +# __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__" + +import SCons.Action +import SCons.Defaults +import SCons.Tool + +def generate(env): + + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + + DAction = SCons.Action.Action('$DCOM', '$DCOMSTR') + + static_obj.add_action('.d', DAction) + shared_obj.add_action('.d', DAction) + static_obj.add_emitter('.d', SCons.Defaults.StaticObjectEmitter) + shared_obj.add_emitter('.d', SCons.Defaults.SharedObjectEmitter) + + env['DC'] = env.Detect('gdc') + env['DCOM'] = '$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -c -o $TARGET $SOURCES' + env['_DINCFLAGS'] = '$( ${_concat(DINCPREFIX, DPATH, DINCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' + env['_DVERFLAGS'] = '$( ${_concat(DVERPREFIX, DVERSIONS, DVERSUFFIX, __env__)} $)' + env['_DDEBUGFLAGS'] = '$( ${_concat(DDEBUGPREFIX, DDEBUG, DDEBUGSUFFIX, __env__)} $)' + env['_DFLAGS'] = '$( ${_concat(DFLAGPREFIX, DFLAGS, DFLAGSUFFIX, __env__)} $)' + + env['DPATH'] = ['#/'] + env['DFLAGS'] = [] + env['DVERSIONS'] = [] + env['DDEBUG'] = [] + + env['DINCPREFIX'] = '-I' + env['DINCSUFFIX'] = '' + env['DVERPREFIX'] = '-version=' + env['DVERSUFFIX'] = '' + env['DDEBUGPREFIX'] = '-debug=' + env['DDEBUGSUFFIX'] = '' + env['DFLAGPREFIX'] = '-' + env['DFLAGSUFFIX'] = '' + env['DFILESUFFIX'] = '.d' + + env['LINK'] = '$DC' + +def exists(env): + return env.Detect('gdc') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/GDC.py b/test/D/GDC.py new file mode 100644 index 0000000..e24ec43 --- /dev/null +++ b/test/D/GDC.py @@ -0,0 +1,64 @@ +#!/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. +# + +# Amended by Russel Winder 2010-05-05 + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +import TestSCons + +_exe = TestSCons._exe +test = TestSCons.TestSCons() + +if not test.where_is('gdc'): + test.skip_test("Could not find 'gdc', skipping test.\n") + +test.write('SConstruct', """\ +import os +env = Environment(tools=['link', 'gdc'], ENV=os.environ) +if env['PLATFORM'] == 'cygwin': env['OBJSUFFIX'] = '.obj' # trick DMD +env.Program('foo', 'foo.d') +""") + +test.write('foo.d', """\ +import std.stdio; +int main(string[] args) { + printf("Hello!"); + return 0; +} +""") + +test.run() + +test.run(program=test.workpath('foo'+_exe)) + +test.fail_test(not test.stdout() == 'Hello!') + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: -- cgit v0.12 From d867806da130625c9e87a074ee87583464446275 Mon Sep 17 00:00:00 2001 From: Russel Winder Date: Wed, 5 Sep 2012 13:58:46 +0100 Subject: Start the process of getting better support for D builds. --- runtest.py | 0 src/engine/SCons/Tool/dmd.py | 4 +- src/engine/SCons/Tool/ldc.py | 129 +++++++++++++++++++++ test/D/CoreScanner/Image/SConstruct_template | 5 + test/D/CoreScanner/Image/ignored.d | 3 + test/D/CoreScanner/Image/module1.d | 3 + test/D/CoreScanner/Image/module2.d | 3 + test/D/CoreScanner/Image/module3.di | 3 + test/D/CoreScanner/Image/p/ignored.d | 3 + test/D/CoreScanner/Image/p/submodule1.d | 3 + test/D/CoreScanner/Image/p/submodule2.d | 3 + test/D/CoreScanner/Image/test1.d | 9 ++ test/D/CoreScanner/Image/test2.d | 11 ++ test/D/CoreScanner/common.py | 97 ++++++++++++++++ test/D/CoreScanner/sconstest-dmd.py | 37 ++++++ test/D/CoreScanner/sconstest-gdc.py | 37 ++++++ test/D/CoreScanner/sconstest-ldc.py | 37 ++++++ test/D/DMD2.py | 2 +- test/D/HSTeoh/LinkingProblem/SConstruct_template | 18 +++ test/D/HSTeoh/LinkingProblem/cprog.c | 7 ++ test/D/HSTeoh/LinkingProblem/ncurs_impl.c | 13 +++ test/D/HSTeoh/LinkingProblem/prog.d | 14 +++ test/D/HSTeoh/README.txt | 1 + .../SConstruct_template | 14 +++ .../SingleStringCannotBeMultipleOptions/cmod.c | 5 + .../SingleStringCannotBeMultipleOptions/mod1.d | 6 + .../SingleStringCannotBeMultipleOptions/proj.d | 13 +++ test/D/HSTeoh/linkingProblem_common.py | 59 ++++++++++ test/D/HSTeoh/sconstest-linkingProblem_dmd.py | 37 ++++++ test/D/HSTeoh/sconstest-linkingProblem_gdc.py | 37 ++++++ test/D/HSTeoh/sconstest-linkingProblem_ldc.py | 37 ++++++ ...test-singleStringCannotBeMultipleOptions_dmd.py | 37 ++++++ ...test-singleStringCannotBeMultipleOptions_gdc.py | 37 ++++++ ...test-singleStringCannotBeMultipleOptions_ldc.py | 37 ++++++ .../singleStringCannotBeMultipleOptions_common.py | 63 ++++++++++ .../Image/SConstruct_template | 5 + .../CompileAndLinkOneStep/Image/helloWorld.d | 6 + test/D/HelloWorld/CompileAndLinkOneStep/common.py | 66 +++++++++++ .../CompileAndLinkOneStep/sconstest-dmd.py | 37 ++++++ .../CompileAndLinkOneStep/sconstest-gdc.py | 37 ++++++ .../CompileAndLinkOneStep/sconstest-ldc.py | 37 ++++++ .../Image/SConstruct_template | 7 ++ .../CompileThenLinkTwoSteps/Image/helloWorld.d | 6 + .../D/HelloWorld/CompileThenLinkTwoSteps/common.py | 66 +++++++++++ .../CompileThenLinkTwoSteps/sconstest-dmd.py | 37 ++++++ .../CompileThenLinkTwoSteps/sconstest-gdc.py | 37 ++++++ .../CompileThenLinkTwoSteps/sconstest-ldc.py | 37 ++++++ test/D/LDC.py | 64 ++++++++++ test/D/MixedDAndC/Image/SConstruct | 9 ++ test/D/MixedDAndC/Image/cmod.c | 3 + test/D/MixedDAndC/Image/dmod.d | 6 + test/D/MixedDAndC/Image/proj.d | 12 ++ test/D/MixedDAndC/sconstest-mixedcompile.py | 44 +++++++ 53 files changed, 1337 insertions(+), 3 deletions(-) mode change 100644 => 100755 runtest.py create mode 100644 src/engine/SCons/Tool/ldc.py create mode 100644 test/D/CoreScanner/Image/SConstruct_template create mode 100644 test/D/CoreScanner/Image/ignored.d create mode 100644 test/D/CoreScanner/Image/module1.d create mode 100644 test/D/CoreScanner/Image/module2.d create mode 100644 test/D/CoreScanner/Image/module3.di create mode 100644 test/D/CoreScanner/Image/p/ignored.d create mode 100644 test/D/CoreScanner/Image/p/submodule1.d create mode 100644 test/D/CoreScanner/Image/p/submodule2.d create mode 100644 test/D/CoreScanner/Image/test1.d create mode 100644 test/D/CoreScanner/Image/test2.d create mode 100644 test/D/CoreScanner/common.py create mode 100644 test/D/CoreScanner/sconstest-dmd.py create mode 100644 test/D/CoreScanner/sconstest-gdc.py create mode 100644 test/D/CoreScanner/sconstest-ldc.py create mode 100644 test/D/HSTeoh/LinkingProblem/SConstruct_template create mode 100644 test/D/HSTeoh/LinkingProblem/cprog.c create mode 100644 test/D/HSTeoh/LinkingProblem/ncurs_impl.c create mode 100644 test/D/HSTeoh/LinkingProblem/prog.d create mode 100644 test/D/HSTeoh/README.txt create mode 100644 test/D/HSTeoh/SingleStringCannotBeMultipleOptions/SConstruct_template create mode 100644 test/D/HSTeoh/SingleStringCannotBeMultipleOptions/cmod.c create mode 100644 test/D/HSTeoh/SingleStringCannotBeMultipleOptions/mod1.d create mode 100644 test/D/HSTeoh/SingleStringCannotBeMultipleOptions/proj.d create mode 100644 test/D/HSTeoh/linkingProblem_common.py create mode 100644 test/D/HSTeoh/sconstest-linkingProblem_dmd.py create mode 100644 test/D/HSTeoh/sconstest-linkingProblem_gdc.py create mode 100644 test/D/HSTeoh/sconstest-linkingProblem_ldc.py create mode 100644 test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_dmd.py create mode 100644 test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_gdc.py create mode 100644 test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_ldc.py create mode 100644 test/D/HSTeoh/singleStringCannotBeMultipleOptions_common.py create mode 100644 test/D/HelloWorld/CompileAndLinkOneStep/Image/SConstruct_template create mode 100644 test/D/HelloWorld/CompileAndLinkOneStep/Image/helloWorld.d create mode 100644 test/D/HelloWorld/CompileAndLinkOneStep/common.py create mode 100644 test/D/HelloWorld/CompileAndLinkOneStep/sconstest-dmd.py create mode 100644 test/D/HelloWorld/CompileAndLinkOneStep/sconstest-gdc.py create mode 100644 test/D/HelloWorld/CompileAndLinkOneStep/sconstest-ldc.py create mode 100644 test/D/HelloWorld/CompileThenLinkTwoSteps/Image/SConstruct_template create mode 100644 test/D/HelloWorld/CompileThenLinkTwoSteps/Image/helloWorld.d create mode 100644 test/D/HelloWorld/CompileThenLinkTwoSteps/common.py create mode 100644 test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-dmd.py create mode 100644 test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-gdc.py create mode 100644 test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-ldc.py create mode 100644 test/D/LDC.py create mode 100644 test/D/MixedDAndC/Image/SConstruct create mode 100644 test/D/MixedDAndC/Image/cmod.c create mode 100644 test/D/MixedDAndC/Image/dmod.d create mode 100644 test/D/MixedDAndC/Image/proj.d create mode 100644 test/D/MixedDAndC/sconstest-mixedcompile.py diff --git a/runtest.py b/runtest.py old mode 100644 new mode 100755 diff --git a/src/engine/SCons/Tool/dmd.py b/src/engine/SCons/Tool/dmd.py index 45567e0..bc9e0ce 100644 --- a/src/engine/SCons/Tool/dmd.py +++ b/src/engine/SCons/Tool/dmd.py @@ -136,8 +136,8 @@ def generate(env): env['_DLINKLIBFLAGS'] = '$( ${_concat(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' env['_DLIBFLAGS'] = '$( ${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)} $)' env['DLINKFLAGS'] = [] - env['DLIBLINKPREFIX'] = '' - env['DLIBLINKSUFFIX'] = '.lib' + env['DLIBLINKPREFIX'] = '' if env['PLATFORM'] == 'win32' else '-L-l' + env['DLIBLINKSUFFIX'] = '.lib' if env['PLATFORM'] == 'win32' else '' env['DLIBFLAGPREFIX'] = '-' env['DLIBFLAGSUFFIX'] = '' env['DLINKFLAGPREFIX'] = '-' diff --git a/src/engine/SCons/Tool/ldc.py b/src/engine/SCons/Tool/ldc.py new file mode 100644 index 0000000..c8f8ad2 --- /dev/null +++ b/src/engine/SCons/Tool/ldc.py @@ -0,0 +1,129 @@ +"""SCons.Tool.ldc + +Tool-specific initialization for the LDC compiler. +(http://www.dsource.org/projects/ldc) + +Coded by Russel Winder (russel@winder.org.uk) +2012-05-09 + +Compiler variables: + DC - The name of the D compiler to use. Defaults to ldc. + DPATH - List of paths to search for import modules. + DVERSIONS - List of version tags to enable when compiling. + DDEBUG - List of debug tags to enable when compiling. + +Linker related variables: + LIBS - List of library files to link in. + DLINK - Name of the linker to use. Defaults to gcc. + DLINKFLAGS - List of linker flags. + +Lib tool variables: + DLIB - Name of the lib tool to use. Defaults to lib. + DLIBFLAGS - List of flags to pass to the lib tool. + LIBS - Same as for the linker. (libraries to pull into the .lib) +""" + +# +# __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__" + +import os +import subprocess + +import SCons.Action +import SCons.Builder +import SCons.Defaults +import SCons.Scanner.D +import SCons.Tool + +# Adapted from c++.py +def isD(source): + if not source: + return 0 + + for s in source: + if s.sources: + ext = os.path.splitext(str(s.sources[0]))[1] + if ext == '.d': + return 1 + return 0 + +def generate(env): + + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + + DAction = SCons.Action.Action('$DCOM', '$DCOMSTR') + + static_obj.add_action('.d', DAction) + shared_obj.add_action('.d', DAction) + static_obj.add_emitter('.d', SCons.Defaults.StaticObjectEmitter) + shared_obj.add_emitter('.d', SCons.Defaults.SharedObjectEmitter) + + dc = env.Detect('ldc') + env['DC'] = dc + env['DCOM'] = '$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -c -of=$TARGET $SOURCES' + env['_DINCFLAGS'] = '$( ${_concat(DINCPREFIX, DPATH, DINCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' + env['_DVERFLAGS'] = '$( ${_concat(DVERPREFIX, DVERSIONS, DVERSUFFIX, __env__)} $)' + env['_DDEBUGFLAGS'] = '$( ${_concat(DDEBUGPREFIX, DDEBUG, DDEBUGSUFFIX, __env__)} $)' + env['_DFLAGS'] = '$( ${_concat(DFLAGPREFIX, DFLAGS, DFLAGSUFFIX, __env__)} $)' + + env['DPATH'] = ['#/'] + env['DFLAGS'] = [] + env['DVERSIONS'] = [] + env['DDEBUG'] = [] + + if dc: + # Add the path to the standard library. + # This is merely for the convenience of the dependency scanner. + dmd_path = env.WhereIs(dc) + if dmd_path: + x = dmd_path.rindex(dc) + phobosDir = dmd_path[:x] + '/../src/phobos' + if os.path.isdir(phobosDir): + env.Append(DPATH = [phobosDir]) + + env['DINCPREFIX'] = '-I=' + env['DINCSUFFIX'] = '' + env['DVERPREFIX'] = '-version=' + env['DVERSUFFIX'] = '' + env['DDEBUGPREFIX'] = '-debug=' + env['DDEBUGSUFFIX'] = '' + env['DFLAGPREFIX'] = '-' + env['DFLAGSUFFIX'] = '' + env['DFILESUFFIX'] = '.d' + + try : + env['LIBS'].append ( [ '-lgphobos2' ] ) + except KeyError : + env['LIBS'] = [ '-lgphobos2' , '-lpthread' , '-lrt' , '-lm' ] + + +def exists(env): + return env.Detect('ldc') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/CoreScanner/Image/SConstruct_template b/test/D/CoreScanner/Image/SConstruct_template new file mode 100644 index 0000000..23cc7af --- /dev/null +++ b/test/D/CoreScanner/Image/SConstruct_template @@ -0,0 +1,5 @@ +# -*- mode:python; coding:utf-8; -*- + +environment = Environment(tools=['link', '{}']) +environment.Program('test1.d') +environment.Program('test2.d') diff --git a/test/D/CoreScanner/Image/ignored.d b/test/D/CoreScanner/Image/ignored.d new file mode 100644 index 0000000..5b54a07 --- /dev/null +++ b/test/D/CoreScanner/Image/ignored.d @@ -0,0 +1,3 @@ +module ignored; + +int something; diff --git a/test/D/CoreScanner/Image/module1.d b/test/D/CoreScanner/Image/module1.d new file mode 100644 index 0000000..487c358 --- /dev/null +++ b/test/D/CoreScanner/Image/module1.d @@ -0,0 +1,3 @@ +module module1; + +int something; diff --git a/test/D/CoreScanner/Image/module2.d b/test/D/CoreScanner/Image/module2.d new file mode 100644 index 0000000..198fb74 --- /dev/null +++ b/test/D/CoreScanner/Image/module2.d @@ -0,0 +1,3 @@ +module module2; + +int something; diff --git a/test/D/CoreScanner/Image/module3.di b/test/D/CoreScanner/Image/module3.di new file mode 100644 index 0000000..effd4eb --- /dev/null +++ b/test/D/CoreScanner/Image/module3.di @@ -0,0 +1,3 @@ +module module3; + +int something; diff --git a/test/D/CoreScanner/Image/p/ignored.d b/test/D/CoreScanner/Image/p/ignored.d new file mode 100644 index 0000000..43d2bd8 --- /dev/null +++ b/test/D/CoreScanner/Image/p/ignored.d @@ -0,0 +1,3 @@ +module p.ignored; + +int something; diff --git a/test/D/CoreScanner/Image/p/submodule1.d b/test/D/CoreScanner/Image/p/submodule1.d new file mode 100644 index 0000000..1ec0369 --- /dev/null +++ b/test/D/CoreScanner/Image/p/submodule1.d @@ -0,0 +1,3 @@ +module p.submodule1; + +int something; diff --git a/test/D/CoreScanner/Image/p/submodule2.d b/test/D/CoreScanner/Image/p/submodule2.d new file mode 100644 index 0000000..57a2825 --- /dev/null +++ b/test/D/CoreScanner/Image/p/submodule2.d @@ -0,0 +1,3 @@ +module p.submodule2; + +int something; diff --git a/test/D/CoreScanner/Image/test1.d b/test/D/CoreScanner/Image/test1.d new file mode 100644 index 0000000..d386d97 --- /dev/null +++ b/test/D/CoreScanner/Image/test1.d @@ -0,0 +1,9 @@ +import module1; +import module2; +import module3; +import p.submodule1; +import p.submodule2; + +int main() { + return 0; +} diff --git a/test/D/CoreScanner/Image/test2.d b/test/D/CoreScanner/Image/test2.d new file mode 100644 index 0000000..f880d2f --- /dev/null +++ b/test/D/CoreScanner/Image/test2.d @@ -0,0 +1,11 @@ +import + module1, + module2, + module3; +import + p.submodule1, + p.submodule2; + +int main() { + return 0; +} diff --git a/test/D/CoreScanner/common.py b/test/D/CoreScanner/common.py new file mode 100644 index 0000000..fbc584d --- /dev/null +++ b/test/D/CoreScanner/common.py @@ -0,0 +1,97 @@ +""" +Verify that the D scanner can return multiple modules imported by +a single statement. +""" + +# +# __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__" + +import TestSCons + +from os.path import isfile + +def testForTool(tool): + + test = TestSCons.TestSCons() + + _obj = TestSCons._obj + + toolPath = '../../../{}.py'.format(tool) + if isfile(toolPath): + test.file_fixture(toolPath) + if not test.where_is(tool) : + test.skip_test("Could not find '{}'; skipping test.\n".format(tool)) + + test.dir_fixture('Image') + test.write('SConstruct', open('SConstruct_template', 'r').read().format(tool)) + + arguments = 'test1%(_obj)s test2%(_obj)s' % locals() + + if tool == 'dmd': + # The gdmd executable in Debian Unstable as at 2012-05-12, version 4.6.3 puts out messages on stderr + # that cause inappropriate failure of the tests, so simply ignore them. + test.run(arguments=arguments, stderr=None) + else: + test.run(arguments=arguments) + + test.up_to_date(arguments=arguments) + + test.write(['module2.d'], """\ +module module2; + +int something_else; +""") + + if tool == 'dmd': + # The gdmd executable in Debian Unstable as at 2012-05-12, version 4.6.3 puts out messages on stderr + # that cause inappropriate failure of the tests, so simply ignore them. + test.not_up_to_date(arguments=arguments, stderr=None) + else: + test.not_up_to_date(arguments=arguments) + + test.up_to_date(arguments=arguments) + + test.write(['p', 'submodule2.d'], """\ +module p.submodule2; + +int something_else; +""") + + if tool == 'dmd': + # The gdmd executable in Debian Unstable as at 2012-05-12, version 4.6.3 puts out messages on stderr + # that cause inappropriate failure of the tests, so simply ignore them. + test.not_up_to_date(arguments=arguments, stderr=None) + else: + test.not_up_to_date(arguments=arguments) + + test.up_to_date(arguments=arguments) + + test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/CoreScanner/sconstest-dmd.py b/test/D/CoreScanner/sconstest-dmd.py new file mode 100644 index 0000000..7ee8955 --- /dev/null +++ b/test/D/CoreScanner/sconstest-dmd.py @@ -0,0 +1,37 @@ +""" +Test compiling and executing using the dmd tool. +""" + +# +# __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__" + +from common import testForTool +testForTool('dmd') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/CoreScanner/sconstest-gdc.py b/test/D/CoreScanner/sconstest-gdc.py new file mode 100644 index 0000000..d6a7bee --- /dev/null +++ b/test/D/CoreScanner/sconstest-gdc.py @@ -0,0 +1,37 @@ +""" +Test compiling and executing using the gdc tool. +""" + +# +# __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__" + +from common import testForTool +testForTool('gdc') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/CoreScanner/sconstest-ldc.py b/test/D/CoreScanner/sconstest-ldc.py new file mode 100644 index 0000000..4b90d07 --- /dev/null +++ b/test/D/CoreScanner/sconstest-ldc.py @@ -0,0 +1,37 @@ +""" +Test compiling and executing using the ldc tool. +""" + +# +# __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__" + +from common import testForTool +testForTool('ldc') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/DMD2.py b/test/D/DMD2.py index d49f5e4..cc8ab93 100644 --- a/test/D/DMD2.py +++ b/test/D/DMD2.py @@ -32,7 +32,7 @@ _exe = TestSCons._exe test = TestSCons.TestSCons() if not test.where_is('dmd') and not test.where_is('gdmd'): - test.skip_test("Could not find 'dmd' or 'gdmd'; skipping test.\n") + test.skip_test("Could not find 'dmd' or 'gdmd', skipping test.\n") test.write('SConstruct', """\ import os diff --git a/test/D/HSTeoh/LinkingProblem/SConstruct_template b/test/D/HSTeoh/LinkingProblem/SConstruct_template new file mode 100644 index 0000000..2acfd04 --- /dev/null +++ b/test/D/HSTeoh/LinkingProblem/SConstruct_template @@ -0,0 +1,18 @@ +# -*- mode:python; coding=utf-8; -*- + +environment = Environment( + tools = ['cc', 'link' , '{}'], + LIBS = ['ncurses'] +) + +environment.Object('ncurs_impl.o', 'ncurs_impl.c') + +environment.Program('prog', Split(""" + prog.d + ncurs_impl.o +""")) + +environment.Program('cprog', Split(""" + cprog.c + ncurs_impl.o +""")) diff --git a/test/D/HSTeoh/LinkingProblem/cprog.c b/test/D/HSTeoh/LinkingProblem/cprog.c new file mode 100644 index 0000000..0871609 --- /dev/null +++ b/test/D/HSTeoh/LinkingProblem/cprog.c @@ -0,0 +1,7 @@ +extern int ncurs_init(); +extern int ncurs_cleanup(); + +int main() { + ncurs_init(); + ncurs_cleanup(); +} diff --git a/test/D/HSTeoh/LinkingProblem/ncurs_impl.c b/test/D/HSTeoh/LinkingProblem/ncurs_impl.c new file mode 100644 index 0000000..01b6acb --- /dev/null +++ b/test/D/HSTeoh/LinkingProblem/ncurs_impl.c @@ -0,0 +1,13 @@ +/* Ncurses wrappers */ +#include + +int ncurs_init() { + initscr(); + cbreak(); + noecho(); + keypad(stdscr, TRUE); +} + +int ncurs_cleanup() { + endwin(); +} diff --git a/test/D/HSTeoh/LinkingProblem/prog.d b/test/D/HSTeoh/LinkingProblem/prog.d new file mode 100644 index 0000000..a6b2c85 --- /dev/null +++ b/test/D/HSTeoh/LinkingProblem/prog.d @@ -0,0 +1,14 @@ +/* + * Simple D program that links to ncurses via a C wrapping file. + */ + +extern(C) { + int ncurs_init(); + int ncurs_cleanup(); +} + +void main() { + ncurs_init(); + ncurs_cleanup(); +} + diff --git a/test/D/HSTeoh/README.txt b/test/D/HSTeoh/README.txt new file mode 100644 index 0000000..cb18b88 --- /dev/null +++ b/test/D/HSTeoh/README.txt @@ -0,0 +1 @@ +The tests here are evolutions of test cases provided by H.S.Teoh via email. diff --git a/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/SConstruct_template b/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/SConstruct_template new file mode 100644 index 0000000..1638c30 --- /dev/null +++ b/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/SConstruct_template @@ -0,0 +1,14 @@ +# -*- mode:python; coding=utf-8; -*- + +environment = Environment( + tools=['link', '{}'], + # It might be thought that a single string can contain multiple options space separated. Actually this + # is deemed to be a single option, so leads to an error. + DFLAGS = '-m64 -O' + ) + +environment.Program('proj', Split(""" +proj.d +mod1.d +cmod.c +""")) diff --git a/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/cmod.c b/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/cmod.c new file mode 100644 index 0000000..41c57f3 --- /dev/null +++ b/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/cmod.c @@ -0,0 +1,5 @@ +/* This is a sample C module. */ + +int csqr(int arg) { + return arg*arg; +} diff --git a/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/mod1.d b/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/mod1.d new file mode 100644 index 0000000..5f61802 --- /dev/null +++ b/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/mod1.d @@ -0,0 +1,6 @@ +module mod1; +import std.stdio; + +void print_msg() { + writeln("Hello, this is a test program for the new SCons D support"); +} diff --git a/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/proj.d b/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/proj.d new file mode 100644 index 0000000..e97f9dd --- /dev/null +++ b/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/proj.d @@ -0,0 +1,13 @@ +import std.stdio; +import mod1; + +extern(C) { + int csqr(int arg); +} + +void main() { + print_msg(); + + auto i = 17; + writefln("The square of %d is %d", i, csqr(i)); +} diff --git a/test/D/HSTeoh/linkingProblem_common.py b/test/D/HSTeoh/linkingProblem_common.py new file mode 100644 index 0000000..1fcbfc0 --- /dev/null +++ b/test/D/HSTeoh/linkingProblem_common.py @@ -0,0 +1,59 @@ +""" +These tests check an issue with the LIBS environment variable. +""" + +# +# __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__" + +import TestSCons + +from os.path import isfile + +def testForTool(tool): + + test = TestSCons.TestSCons() + + toolPath = '../../{}.py'.format(tool) + if isfile(toolPath): + test.file_fixture(toolPath) + if not test.where_is(tool) : + test.skip_test("Could not find '{}'; skipping test.\n".format(tool)) + + test.dir_fixture('LinkingProblem') + test.write('SConstruct', open('SConstruct_template', 'r').read().format(tool)) + + test.run() + + test.must_exist(test.workpath('ncurs_impl.o')) + test.must_exist(test.workpath('cprog')) + test.must_exist(test.workpath('prog')) + + test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HSTeoh/sconstest-linkingProblem_dmd.py b/test/D/HSTeoh/sconstest-linkingProblem_dmd.py new file mode 100644 index 0000000..ba9608a --- /dev/null +++ b/test/D/HSTeoh/sconstest-linkingProblem_dmd.py @@ -0,0 +1,37 @@ +""" +Test compiling and executing using the gdc tool. +""" + +# +# __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__" + +from linkingProblem_common import testForTool +testForTool('dmd') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HSTeoh/sconstest-linkingProblem_gdc.py b/test/D/HSTeoh/sconstest-linkingProblem_gdc.py new file mode 100644 index 0000000..94a9aa1 --- /dev/null +++ b/test/D/HSTeoh/sconstest-linkingProblem_gdc.py @@ -0,0 +1,37 @@ +""" +Test compiling and executing using the gdc tool. +""" + +# +# __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__" + +from linkingProblem_common import testForTool +testForTool('gdc') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HSTeoh/sconstest-linkingProblem_ldc.py b/test/D/HSTeoh/sconstest-linkingProblem_ldc.py new file mode 100644 index 0000000..f3f7af2 --- /dev/null +++ b/test/D/HSTeoh/sconstest-linkingProblem_ldc.py @@ -0,0 +1,37 @@ +""" +Test compiling and executing using the gdc tool. +""" + +# +# __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__" + +from linkingProblem_common import testForTool +testForTool('ldc') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_dmd.py b/test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_dmd.py new file mode 100644 index 0000000..83fc3f2 --- /dev/null +++ b/test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_dmd.py @@ -0,0 +1,37 @@ +""" +Test compiling and executing using the dmd tool. +""" + +# +# __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__" + +from singleStringCannotBeMultipleOptions_common import testForTool +testForTool('dmd') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_gdc.py b/test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_gdc.py new file mode 100644 index 0000000..55008fe --- /dev/null +++ b/test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_gdc.py @@ -0,0 +1,37 @@ +""" +Test compiling and executing using the gdc tool. +""" + +# +# __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__" + +from singleStringCannotBeMultipleOptions_common import testForTool +testForTool('gdc') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_ldc.py b/test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_ldc.py new file mode 100644 index 0000000..1912713 --- /dev/null +++ b/test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_ldc.py @@ -0,0 +1,37 @@ +""" +Test compiling and executing using the ldc tool. +""" + +# +# __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__" + +from singleStringCannotBeMultipleOptions_common import testForTool +testForTool('ldc') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HSTeoh/singleStringCannotBeMultipleOptions_common.py b/test/D/HSTeoh/singleStringCannotBeMultipleOptions_common.py new file mode 100644 index 0000000..a4bfba0 --- /dev/null +++ b/test/D/HSTeoh/singleStringCannotBeMultipleOptions_common.py @@ -0,0 +1,63 @@ +""" +These tests verify that SCons fails appropriately where the user has tried to supply multiple command line +options via a single string rather than providing a list of strings, one string per option. +""" + +# +# __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__" + +import TestSCons + +from os.path import isfile + +def testForTool(tool): + + test = TestSCons.TestSCons() + + toolPath = '../../../{}.py'.format(tool) + if isfile(toolPath): + test.file_fixture(toolPath) + if not test.where_is(tool) : + test.skip_test("Could not find '{}', skipping test.\n".format(tool)) + + test.dir_fixture('SingleStringCannotBeMultipleOptions') + test.write('SConstruct', open('SConstruct_template', 'r').read().format(tool)) + + test.run(status=2, stdout=None, stderr=None) + + if tool == 'gdc': + result = ".*unrecognized command line option '-m64 -O'.*" + else: + result = ".*unrecognized switch '-m64 -O'.*" + + test.fail_test(not test.match_re_dotall(test.stderr(), result)) + + test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HelloWorld/CompileAndLinkOneStep/Image/SConstruct_template b/test/D/HelloWorld/CompileAndLinkOneStep/Image/SConstruct_template new file mode 100644 index 0000000..985ff0f --- /dev/null +++ b/test/D/HelloWorld/CompileAndLinkOneStep/Image/SConstruct_template @@ -0,0 +1,5 @@ +# -*- mode:python; coding:utf-8; -*- + +environment = Environment(tools=['link', '{}']) + +environment.Program('helloWorld.d') diff --git a/test/D/HelloWorld/CompileAndLinkOneStep/Image/helloWorld.d b/test/D/HelloWorld/CompileAndLinkOneStep/Image/helloWorld.d new file mode 100644 index 0000000..4d95b24 --- /dev/null +++ b/test/D/HelloWorld/CompileAndLinkOneStep/Image/helloWorld.d @@ -0,0 +1,6 @@ +import std.stdio; + +int main(immutable string[] args) { + writeln("Hello World."); + return 0; +} diff --git a/test/D/HelloWorld/CompileAndLinkOneStep/common.py b/test/D/HelloWorld/CompileAndLinkOneStep/common.py new file mode 100644 index 0000000..f3ea916 --- /dev/null +++ b/test/D/HelloWorld/CompileAndLinkOneStep/common.py @@ -0,0 +1,66 @@ +""" +Support functions for all the tests. +""" + +# +# __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__" + +import TestSCons + +from os.path import isfile + +def testForTool(tool): + + test = TestSCons.TestSCons() + + toolPath = '../../../{}.py'.format(tool) + if isfile(toolPath): + test.file_fixture(toolPath) + if not test.where_is(tool): + test.skip_test("Could not find '{}', skipping test.\n".format(tool)) + + test.dir_fixture('Image') + test.write('SConstruct', open('SConstruct_template', 'r').read().format(tool)) + + if tool == 'dmd': + # The gdmd executable in Debian Unstable as at 2012-05-12, version 4.6.3 puts out messages on stderr + # that cause inappropriate failure of the tests, so simply ignore them. + test.run(stderr=None) + else: + test.run() + + test.must_exist(test.workpath('helloWorld.o')) + test.must_exist(test.workpath('helloWorld')) + + test.run(program=test.workpath('helloWorld'+TestSCons._exe)) + test.fail_test(test.stdout() != 'Hello World.\n') + + test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HelloWorld/CompileAndLinkOneStep/sconstest-dmd.py b/test/D/HelloWorld/CompileAndLinkOneStep/sconstest-dmd.py new file mode 100644 index 0000000..7ee8955 --- /dev/null +++ b/test/D/HelloWorld/CompileAndLinkOneStep/sconstest-dmd.py @@ -0,0 +1,37 @@ +""" +Test compiling and executing using the dmd tool. +""" + +# +# __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__" + +from common import testForTool +testForTool('dmd') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HelloWorld/CompileAndLinkOneStep/sconstest-gdc.py b/test/D/HelloWorld/CompileAndLinkOneStep/sconstest-gdc.py new file mode 100644 index 0000000..d6a7bee --- /dev/null +++ b/test/D/HelloWorld/CompileAndLinkOneStep/sconstest-gdc.py @@ -0,0 +1,37 @@ +""" +Test compiling and executing using the gdc tool. +""" + +# +# __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__" + +from common import testForTool +testForTool('gdc') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HelloWorld/CompileAndLinkOneStep/sconstest-ldc.py b/test/D/HelloWorld/CompileAndLinkOneStep/sconstest-ldc.py new file mode 100644 index 0000000..4b90d07 --- /dev/null +++ b/test/D/HelloWorld/CompileAndLinkOneStep/sconstest-ldc.py @@ -0,0 +1,37 @@ +""" +Test compiling and executing using the ldc tool. +""" + +# +# __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__" + +from common import testForTool +testForTool('ldc') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/SConstruct_template b/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/SConstruct_template new file mode 100644 index 0000000..057b7d6 --- /dev/null +++ b/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/SConstruct_template @@ -0,0 +1,7 @@ +# -*- mode:python; coding:utf-8; -*- + +environment = Environment(tools=['link', '{}']) + +objects = environment.Object('helloWorld.d') + +environment.Program('helloWorld', objects) diff --git a/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/helloWorld.d b/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/helloWorld.d new file mode 100644 index 0000000..4d95b24 --- /dev/null +++ b/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/helloWorld.d @@ -0,0 +1,6 @@ +import std.stdio; + +int main(immutable string[] args) { + writeln("Hello World."); + return 0; +} diff --git a/test/D/HelloWorld/CompileThenLinkTwoSteps/common.py b/test/D/HelloWorld/CompileThenLinkTwoSteps/common.py new file mode 100644 index 0000000..0af32ba --- /dev/null +++ b/test/D/HelloWorld/CompileThenLinkTwoSteps/common.py @@ -0,0 +1,66 @@ +""" +Support functions for all the tests. +""" + +# +# __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__" + +import TestSCons + +from os.path import isfile + +def testForTool(tool): + + test = TestSCons.TestSCons() + + toolPath = '../../../{}.py'.format(tool) + if isfile(toolPath): + test.file_fixture(toolPath) + if not test.where_is(tool) : + test.skip_test("Could not find '{}'; skipping test.\n".format(tool)) + + test.dir_fixture('Image') + test.write('SConstruct', open('SConstruct_template', 'r').read().format(tool)) + + if tool == 'dmd': + # The gdmd executable in Debian Unstable as at 2012-05-12, version 4.6.3 puts out messages on stderr + # that cause inappropriate failure of the tests, so simply ignore them. + test.run(stderr=None) + else: + test.run() + + test.must_exist(test.workpath('helloWorld.o')) + test.must_exist(test.workpath('helloWorld')) + + test.run(program=test.workpath('helloWorld'+TestSCons._exe)) + test.fail_test(test.stdout() != 'Hello World.\n') + + test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-dmd.py b/test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-dmd.py new file mode 100644 index 0000000..7ee8955 --- /dev/null +++ b/test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-dmd.py @@ -0,0 +1,37 @@ +""" +Test compiling and executing using the dmd tool. +""" + +# +# __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__" + +from common import testForTool +testForTool('dmd') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-gdc.py b/test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-gdc.py new file mode 100644 index 0000000..e8a2b4b --- /dev/null +++ b/test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-gdc.py @@ -0,0 +1,37 @@ +""" +Test compiling and executing using the gcd tool. +""" + +# +# __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__" + +from common import testForTool +testForTool('gdc') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-ldc.py b/test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-ldc.py new file mode 100644 index 0000000..4b90d07 --- /dev/null +++ b/test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-ldc.py @@ -0,0 +1,37 @@ +""" +Test compiling and executing using the ldc tool. +""" + +# +# __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__" + +from common import testForTool +testForTool('ldc') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/LDC.py b/test/D/LDC.py new file mode 100644 index 0000000..02d5919 --- /dev/null +++ b/test/D/LDC.py @@ -0,0 +1,64 @@ +#!/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. +# + +# Amended by Russel Winder 2010-05-05 + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +import TestSCons + +_exe = TestSCons._exe +test = TestSCons.TestSCons() + +if not test.where_is('ldc'): + test.skip_test("Could not find 'ldc', skipping test.\n") + +test.write('SConstruct', """\ +import os +env = Environment(tools=['link', 'ldc'], ENV=os.environ) +if env['PLATFORM'] == 'cygwin': env['OBJSUFFIX'] = '.obj' # trick DMD +env.Program('foo', 'foo.d') +""") + +test.write('foo.d', """\ +import std.stdio; +int main(string[] args) { + printf("Hello!"); + return 0; +} +""") + +test.run() + +test.run(program=test.workpath('foo'+_exe)) + +test.fail_test(not test.stdout() == 'Hello!') + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/MixedDAndC/Image/SConstruct b/test/D/MixedDAndC/Image/SConstruct new file mode 100644 index 0000000..d6dd73d --- /dev/null +++ b/test/D/MixedDAndC/Image/SConstruct @@ -0,0 +1,9 @@ +env = Environment( + DFLAGS=['-O'], + ) + +env.Program('proj', [ +'proj.d', +'dmod.d', +'cmod.c', +]) diff --git a/test/D/MixedDAndC/Image/cmod.c b/test/D/MixedDAndC/Image/cmod.c new file mode 100644 index 0000000..31be5e9 --- /dev/null +++ b/test/D/MixedDAndC/Image/cmod.c @@ -0,0 +1,3 @@ +int csqr(int arg) { + return arg*arg; +} diff --git a/test/D/MixedDAndC/Image/dmod.d b/test/D/MixedDAndC/Image/dmod.d new file mode 100644 index 0000000..c609b9c --- /dev/null +++ b/test/D/MixedDAndC/Image/dmod.d @@ -0,0 +1,6 @@ +module dmod; +import std.stdio; + +void print_msg() { + writeln("Hello, this is a test program for the new SCons D support"); +} diff --git a/test/D/MixedDAndC/Image/proj.d b/test/D/MixedDAndC/Image/proj.d new file mode 100644 index 0000000..3e0bf95 --- /dev/null +++ b/test/D/MixedDAndC/Image/proj.d @@ -0,0 +1,12 @@ +import std.stdio; +import dmod; + +extern (C) { + int csqr(int arg); +} + +void main() { + print_msg(); + auto i = 17; + writefln("The square of %d is %d", i, csqr(i)); +} diff --git a/test/D/MixedDAndC/sconstest-mixedcompile.py b/test/D/MixedDAndC/sconstest-mixedcompile.py new file mode 100644 index 0000000..0fd1a12 --- /dev/null +++ b/test/D/MixedDAndC/sconstest-mixedcompile.py @@ -0,0 +1,44 @@ +""" +Test compiling and executing a project with a C module. +""" + +# +# __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__" + +import TestSCons + +test = TestSCons.TestSCons() + +test.dir_fixture('Image') + +test.run() + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: -- cgit v0.12 From 39199ef7146837361c0a340459bf6125f3a0a8b3 Mon Sep 17 00:00:00 2001 From: Russel Winder Date: Wed, 5 Sep 2012 14:22:29 +0100 Subject: The test needs two parameters to compare against the problem. --- test/D/HelloWorld/CompileThenLinkTwoSteps/common.py | 2 +- test/D/MixedDAndC/Image/SConstruct | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/D/HelloWorld/CompileThenLinkTwoSteps/common.py b/test/D/HelloWorld/CompileThenLinkTwoSteps/common.py index 0af32ba..70262e0 100644 --- a/test/D/HelloWorld/CompileThenLinkTwoSteps/common.py +++ b/test/D/HelloWorld/CompileThenLinkTwoSteps/common.py @@ -32,7 +32,7 @@ import TestSCons from os.path import isfile def testForTool(tool): - + test = TestSCons.TestSCons() toolPath = '../../../{}.py'.format(tool) diff --git a/test/D/MixedDAndC/Image/SConstruct b/test/D/MixedDAndC/Image/SConstruct index d6dd73d..f83a11d 100644 --- a/test/D/MixedDAndC/Image/SConstruct +++ b/test/D/MixedDAndC/Image/SConstruct @@ -1,5 +1,5 @@ env = Environment( - DFLAGS=['-O'], + DFLAGS=['-m64', '-O'], ) env.Program('proj', [ -- cgit v0.12 From ce7d47c6f0d98d017b53387615b87d131a7861db Mon Sep 17 00:00:00 2001 From: Russel Winder Date: Thu, 6 Sep 2012 05:32:39 +0100 Subject: Rearrange, refactor, rework, rewrite, fix. --- src/engine/SCons/Tool/DCommon.py | 56 +++++++++++++++++++ src/engine/SCons/Tool/dmd.py | 53 ++---------------- src/engine/SCons/Tool/gdc.py | 41 ++++++++++++-- src/engine/SCons/Tool/ldc.py | 63 ++++++++++++---------- test/D/CoreScanner/Image/SConstruct_template | 6 ++- test/D/CoreScanner/common.py | 14 ++--- test/D/HSTeoh/LinkingProblem/SConstruct_template | 6 ++- .../SConstruct_template | 6 ++- test/D/HSTeoh/linkingProblem_common.py | 14 ++--- test/D/HSTeoh/sconstest-linkingProblem_ldc.py | 2 +- .../singleStringCannotBeMultipleOptions_common.py | 23 ++++---- .../Image/SConstruct_template | 6 ++- test/D/HelloWorld/CompileAndLinkOneStep/common.py | 14 ++--- .../Image/SConstruct_template | 6 ++- .../D/HelloWorld/CompileThenLinkTwoSteps/common.py | 14 ++--- test/D/LDC.py | 9 +++- test/D/MixedDAndC/Image/SConstruct | 12 +++-- test/D/Support/executablesSearch.py | 37 +++++++++++++ test/D/Support/sconstest.skip | 0 19 files changed, 255 insertions(+), 127 deletions(-) create mode 100644 src/engine/SCons/Tool/DCommon.py create mode 100644 test/D/Support/executablesSearch.py create mode 100644 test/D/Support/sconstest.skip diff --git a/src/engine/SCons/Tool/DCommon.py b/src/engine/SCons/Tool/DCommon.py new file mode 100644 index 0000000..b00d9fb --- /dev/null +++ b/src/engine/SCons/Tool/DCommon.py @@ -0,0 +1,56 @@ +""" +Common code for the various D tools. + +Coded by Russel Winder (russel@winder.org.uk) +2012-09-06 +""" +import os.path + +def isD(source): + if not source: + return 0 + for s in source: + if s.sources: + ext = os.path.splitext(str(s.sources[0]))[1] + if ext == '.d': + return 1 + return 0 + +def addDPATHToEnv(env, executable): + dPath = env.WhereIs(executable) + if dPath: + phobosDir = dPath[:dPath.rindex(executable)] + '/../src/phobos' + if os.path.isdir(phobosDir): + env.Append(DPATH=[phobosDir]) + +def setSmartLink(env, smart_link, smart_lib): + linkcom = env.get('LINKCOM') + try: + env['SMART_LINKCOM'] = smart_link[linkcom] + except KeyError: + def _smartLink(source, target, env, for_signature, defaultLinker=linkcom): + if isD(source): + # TODO: I'm not sure how to add a $DLINKCOMSTR variable + # so that it works with this _smartLink() logic, + # and I don't have a D compiler/linker to try it out, + # so we'll leave it alone for now. + return '$DLINKCOM' + else: + return defaultLinker + env['SMART_LINKCOM'] = smart_link[linkcom] = _smartLink + + arcom = env.get('ARCOM') + try: + env['SMART_ARCOM'] = smart_lib[arcom] + except KeyError: + def _smartLib(source, target, env, for_signature, defaultLib=arcom): + if isD(source): + # TODO: I'm not sure how to add a $DLIBCOMSTR variable + # so that it works with this _smartLib() logic, and + # I don't have a D compiler/archiver to try it out, + # so we'll leave it alone for now. + return '$DLIBCOM' + else: + return defaultLib + env['SMART_ARCOM'] = smart_lib[arcom] = _smartLib + diff --git a/src/engine/SCons/Tool/dmd.py b/src/engine/SCons/Tool/dmd.py index bc9e0ce..1f6ec1c 100644 --- a/src/engine/SCons/Tool/dmd.py +++ b/src/engine/SCons/Tool/dmd.py @@ -68,24 +68,12 @@ import SCons.Defaults import SCons.Scanner.D import SCons.Tool -def isD(source): - if not source: - return 0 - for s in source: - if s.sources: - ext = os.path.splitext(str(s.sources[0]))[1] - if ext == '.d': - return 1 - return 0 +import DCommon smart_link = {} - smart_lib = {} def generate(env): - global smart_link - global smart_lib - static_obj, shared_obj = SCons.Tool.createObjBuilders(env) DAction = SCons.Action.Action('$DCOM', '$DCOMSTR') @@ -109,14 +97,7 @@ def generate(env): env['DDEBUG'] = [] if dc: - # Add the path to the standard library. - # This is merely for the convenience of the dependency scanner. - dmd_path = env.WhereIs(dc) - if dmd_path: - x = dmd_path.rindex(dc) - phobosDir = dmd_path[:x] + '/../src/phobos' - if os.path.isdir(phobosDir): - env.Append(DPATH = [phobosDir]) + DCommon.addDPATHToEnv(env, dc) env['DINCPREFIX'] = '-I' env['DINCSUFFIX'] = '' @@ -149,35 +130,7 @@ def generate(env): # these builders check for the presence of D source, and swap out # the system's defaults for the Digital Mars tools. If there's no D # source, then we silently return the previous settings. - linkcom = env.get('LINKCOM') - try: - env['SMART_LINKCOM'] = smart_link[linkcom] - except KeyError: - def _smartLink(source, target, env, for_signature, defaultLinker=linkcom): - if isD(source): - # TODO: I'm not sure how to add a $DLINKCOMSTR variable - # so that it works with this _smartLink() logic, - # and I don't have a D compiler/linker to try it out, - # so we'll leave it alone for now. - return '$DLINKCOM' - else: - return defaultLinker - env['SMART_LINKCOM'] = smart_link[linkcom] = _smartLink - - arcom = env.get('ARCOM') - try: - env['SMART_ARCOM'] = smart_lib[arcom] - except KeyError: - def _smartLib(source, target, env, for_signature, defaultLib=arcom): - if isD(source): - # TODO: I'm not sure how to add a $DLIBCOMSTR variable - # so that it works with this _smartLib() logic, and - # I don't have a D compiler/archiver to try it out, - # so we'll leave it alone for now. - return '$DLIBCOM' - else: - return defaultLib - env['SMART_ARCOM'] = smart_lib[arcom] = _smartLib + DCommon.setSmartLink(env, smart_link, smart_lib) # It is worth noting that the final space in these strings is # absolutely pivotal. SCons sees these as actions and not generators diff --git a/src/engine/SCons/Tool/gdc.py b/src/engine/SCons/Tool/gdc.py index dfba9b3..17c0f52 100644 --- a/src/engine/SCons/Tool/gdc.py +++ b/src/engine/SCons/Tool/gdc.py @@ -52,8 +52,12 @@ import SCons.Action import SCons.Defaults import SCons.Tool -def generate(env): +import DCommon + +smart_link = {} +smart_lib = {} +def generate(env): static_obj, shared_obj = SCons.Tool.createObjBuilders(env) DAction = SCons.Action.Action('$DCOM', '$DCOMSTR') @@ -63,7 +67,8 @@ def generate(env): static_obj.add_emitter('.d', SCons.Defaults.StaticObjectEmitter) shared_obj.add_emitter('.d', SCons.Defaults.SharedObjectEmitter) - env['DC'] = env.Detect('gdc') + dc = env.Detect('gdc') + env['DC'] = dc env['DCOM'] = '$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -c -o $TARGET $SOURCES' env['_DINCFLAGS'] = '$( ${_concat(DINCPREFIX, DPATH, DINCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' env['_DVERFLAGS'] = '$( ${_concat(DVERPREFIX, DVERSIONS, DVERSUFFIX, __env__)} $)' @@ -75,6 +80,9 @@ def generate(env): env['DVERSIONS'] = [] env['DDEBUG'] = [] + if dc: + DCommon.addDPATHToEnv(env, dc) + env['DINCPREFIX'] = '-I' env['DINCSUFFIX'] = '' env['DVERPREFIX'] = '-version=' @@ -85,7 +93,34 @@ def generate(env): env['DFLAGSUFFIX'] = '' env['DFILESUFFIX'] = '.d' - env['LINK'] = '$DC' + env['DLINK'] = '$DC' + env['DLINKCOM'] = '$DLINK -o $TARGET $SOURCES $DFLAGS $DLINKFLAGS $_DLINKLIBFLAGS' + env['DLIB'] = 'lib' + env['DLIBCOM'] = '$DLIB $_DLIBFLAGS -c $TARGET $SOURCES $_DLINKLIBFLAGS' + + env['_DLINKLIBFLAGS'] = '$( ${_concat(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' + env['_DLIBFLAGS'] = '$( ${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)} $)' + env['DLINKFLAGS'] = [] + env['DLIBLINKPREFIX'] = '' if env['PLATFORM'] == 'win32' else '-l' + env['DLIBLINKSUFFIX'] = '.lib' if env['PLATFORM'] == 'win32' else '' + env['DLIBFLAGPREFIX'] = '-' + env['DLIBFLAGSUFFIX'] = '' + env['DLINKFLAGPREFIX'] = '-' + env['DLINKFLAGSUFFIX'] = '' + + SCons.Tool.createStaticLibBuilder(env) + + # Basically, we hijack the link and ar builders with our own. + # these builders check for the presence of D source, and swap out + # the system's defaults for the Digital Mars tools. If there's no D + # source, then we silently return the previous settings. + DCommon.setSmartLink(env, smart_link, smart_lib) + + # It is worth noting that the final space in these strings is + # absolutely pivotal. SCons sees these as actions and not generators + # if it is not there. (very bad) + env['ARCOM'] = '$SMART_ARCOM ' + env['LINKCOM'] = '$SMART_LINKCOM ' def exists(env): return env.Detect('gdc') diff --git a/src/engine/SCons/Tool/ldc.py b/src/engine/SCons/Tool/ldc.py index c8f8ad2..ad1a64d 100644 --- a/src/engine/SCons/Tool/ldc.py +++ b/src/engine/SCons/Tool/ldc.py @@ -4,10 +4,10 @@ Tool-specific initialization for the LDC compiler. (http://www.dsource.org/projects/ldc) Coded by Russel Winder (russel@winder.org.uk) -2012-05-09 +2012-05-09, 2012-09-06 Compiler variables: - DC - The name of the D compiler to use. Defaults to ldc. + DC - The name of the D compiler to use. Defaults to ldc2. DPATH - List of paths to search for import modules. DVERSIONS - List of version tags to enable when compiling. DDEBUG - List of debug tags to enable when compiling. @@ -57,20 +57,12 @@ import SCons.Defaults import SCons.Scanner.D import SCons.Tool -# Adapted from c++.py -def isD(source): - if not source: - return 0 +import DCommon - for s in source: - if s.sources: - ext = os.path.splitext(str(s.sources[0]))[1] - if ext == '.d': - return 1 - return 0 +smart_link = {} +smart_lib = {} def generate(env): - static_obj, shared_obj = SCons.Tool.createObjBuilders(env) DAction = SCons.Action.Action('$DCOM', '$DCOMSTR') @@ -80,7 +72,7 @@ def generate(env): static_obj.add_emitter('.d', SCons.Defaults.StaticObjectEmitter) shared_obj.add_emitter('.d', SCons.Defaults.SharedObjectEmitter) - dc = env.Detect('ldc') + dc = env.Detect('ldc2') env['DC'] = dc env['DCOM'] = '$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -c -of=$TARGET $SOURCES' env['_DINCFLAGS'] = '$( ${_concat(DINCPREFIX, DPATH, DINCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' @@ -94,14 +86,7 @@ def generate(env): env['DDEBUG'] = [] if dc: - # Add the path to the standard library. - # This is merely for the convenience of the dependency scanner. - dmd_path = env.WhereIs(dc) - if dmd_path: - x = dmd_path.rindex(dc) - phobosDir = dmd_path[:x] + '/../src/phobos' - if os.path.isdir(phobosDir): - env.Append(DPATH = [phobosDir]) + DCommon.addDPATHToEnv(env, dc) env['DINCPREFIX'] = '-I=' env['DINCSUFFIX'] = '' @@ -113,14 +98,38 @@ def generate(env): env['DFLAGSUFFIX'] = '' env['DFILESUFFIX'] = '.d' - try : - env['LIBS'].append ( [ '-lgphobos2' ] ) - except KeyError : - env['LIBS'] = [ '-lgphobos2' , '-lpthread' , '-lrt' , '-lm' ] + env['DLINK'] = '$DC' + env['DLINKCOM'] = '$DLINK -of$TARGET $SOURCES $DFLAGS $DLINKFLAGS $_DLINKLIBFLAGS' + env['DLIB'] = 'lib' + env['DLIBCOM'] = '$DLIB $_DLIBFLAGS -c $TARGET $SOURCES $_DLINKLIBFLAGS' + + env['_DLINKLIBFLAGS'] = '$( ${_concat(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' + env['_DLIBFLAGS'] = '$( ${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)} $)' + env['DLINKFLAGS'] = [] + env['DLIBLINKPREFIX'] = '' if env['PLATFORM'] == 'win32' else '-L-l' + env['DLIBLINKSUFFIX'] = '.lib' if env['PLATFORM'] == 'win32' else '' + env['DLIBFLAGPREFIX'] = '-' + env['DLIBFLAGSUFFIX'] = '' + env['DLINKFLAGPREFIX'] = '-' + env['DLINKFLAGSUFFIX'] = '' + + SCons.Tool.createStaticLibBuilder(env) + + # Basically, we hijack the link and ar builders with our own. + # these builders check for the presence of D source, and swap out + # the system's defaults for the Digital Mars tools. If there's no D + # source, then we silently return the previous settings. + DCommon.setSmartLink(env, smart_link, smart_lib) + + # It is worth noting that the final space in these strings is + # absolutely pivotal. SCons sees these as actions and not generators + # if it is not there. (very bad) + env['ARCOM'] = '$SMART_ARCOM ' + env['LINKCOM'] = '$SMART_LINKCOM ' def exists(env): - return env.Detect('ldc') + return env.Detect('ldc2') # Local Variables: # tab-width:4 diff --git a/test/D/CoreScanner/Image/SConstruct_template b/test/D/CoreScanner/Image/SConstruct_template index 23cc7af..a128c67 100644 --- a/test/D/CoreScanner/Image/SConstruct_template +++ b/test/D/CoreScanner/Image/SConstruct_template @@ -1,5 +1,9 @@ # -*- mode:python; coding:utf-8; -*- -environment = Environment(tools=['link', '{}']) +import os + +environment = Environment( + ENV=os.environ, + tools=['link', '{}']) environment.Program('test1.d') environment.Program('test2.d') diff --git a/test/D/CoreScanner/common.py b/test/D/CoreScanner/common.py index fbc584d..821e4df 100644 --- a/test/D/CoreScanner/common.py +++ b/test/D/CoreScanner/common.py @@ -30,7 +30,12 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import TestSCons -from os.path import isfile +from os.path import abspath, dirname + +import sys +sys.path.insert(1, abspath(dirname(__file__) + '/../Support')) + +from executablesSearch import isExecutableOfToolAvailable def testForTool(tool): @@ -38,11 +43,8 @@ def testForTool(tool): _obj = TestSCons._obj - toolPath = '../../../{}.py'.format(tool) - if isfile(toolPath): - test.file_fixture(toolPath) - if not test.where_is(tool) : - test.skip_test("Could not find '{}'; skipping test.\n".format(tool)) + if not isExecutableOfToolAvailable(test, tool) : + test.skip_test("Required executable for tool '{}' not found, skipping test.\n".format(tool)) test.dir_fixture('Image') test.write('SConstruct', open('SConstruct_template', 'r').read().format(tool)) diff --git a/test/D/HSTeoh/LinkingProblem/SConstruct_template b/test/D/HSTeoh/LinkingProblem/SConstruct_template index 2acfd04..6815cdf 100644 --- a/test/D/HSTeoh/LinkingProblem/SConstruct_template +++ b/test/D/HSTeoh/LinkingProblem/SConstruct_template @@ -1,9 +1,11 @@ # -*- mode:python; coding=utf-8; -*- +import os + environment = Environment( + ENV=os.environ, tools = ['cc', 'link' , '{}'], - LIBS = ['ncurses'] -) + LIBS = ['ncurses']) environment.Object('ncurs_impl.o', 'ncurs_impl.c') diff --git a/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/SConstruct_template b/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/SConstruct_template index 1638c30..89c603b 100644 --- a/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/SConstruct_template +++ b/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/SConstruct_template @@ -1,11 +1,13 @@ # -*- mode:python; coding=utf-8; -*- +import os + environment = Environment( + ENV=os.environ, tools=['link', '{}'], # It might be thought that a single string can contain multiple options space separated. Actually this # is deemed to be a single option, so leads to an error. - DFLAGS = '-m64 -O' - ) + DFLAGS = '-m64 -O') environment.Program('proj', Split(""" proj.d diff --git a/test/D/HSTeoh/linkingProblem_common.py b/test/D/HSTeoh/linkingProblem_common.py index 1fcbfc0..cb012ac 100644 --- a/test/D/HSTeoh/linkingProblem_common.py +++ b/test/D/HSTeoh/linkingProblem_common.py @@ -29,17 +29,19 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import TestSCons -from os.path import isfile +from os.path import abspath, dirname + +import sys +sys.path.insert(1, abspath(dirname(__file__) + '/../Support')) + +from executablesSearch import isExecutableOfToolAvailable def testForTool(tool): test = TestSCons.TestSCons() - toolPath = '../../{}.py'.format(tool) - if isfile(toolPath): - test.file_fixture(toolPath) - if not test.where_is(tool) : - test.skip_test("Could not find '{}'; skipping test.\n".format(tool)) + if not isExecutableOfToolAvailable(test, tool) : + test.skip_test("Required executable for tool '{}' not found, skipping test.\n".format(tool)) test.dir_fixture('LinkingProblem') test.write('SConstruct', open('SConstruct_template', 'r').read().format(tool)) diff --git a/test/D/HSTeoh/sconstest-linkingProblem_ldc.py b/test/D/HSTeoh/sconstest-linkingProblem_ldc.py index f3f7af2..28ee64d 100644 --- a/test/D/HSTeoh/sconstest-linkingProblem_ldc.py +++ b/test/D/HSTeoh/sconstest-linkingProblem_ldc.py @@ -1,5 +1,5 @@ """ -Test compiling and executing using the gdc tool. +Test compiling and executing using the ldc tool. """ # diff --git a/test/D/HSTeoh/singleStringCannotBeMultipleOptions_common.py b/test/D/HSTeoh/singleStringCannotBeMultipleOptions_common.py index a4bfba0..e01e2d6 100644 --- a/test/D/HSTeoh/singleStringCannotBeMultipleOptions_common.py +++ b/test/D/HSTeoh/singleStringCannotBeMultipleOptions_common.py @@ -30,27 +30,30 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import TestSCons -from os.path import isfile +from os.path import abspath, dirname + +import sys +sys.path.insert(1, abspath(dirname(__file__) + '/../Support')) + +from executablesSearch import isExecutableOfToolAvailable def testForTool(tool): test = TestSCons.TestSCons() - toolPath = '../../../{}.py'.format(tool) - if isfile(toolPath): - test.file_fixture(toolPath) - if not test.where_is(tool) : - test.skip_test("Could not find '{}', skipping test.\n".format(tool)) + if not isExecutableOfToolAvailable(test, tool) : + test.skip_test("Required executable for tool '{}' not found, skipping test.\n".format(tool)) test.dir_fixture('SingleStringCannotBeMultipleOptions') test.write('SConstruct', open('SConstruct_template', 'r').read().format(tool)) test.run(status=2, stdout=None, stderr=None) - if tool == 'gdc': - result = ".*unrecognized command line option '-m64 -O'.*" - else: - result = ".*unrecognized switch '-m64 -O'.*" + result = { + 'dmd': ".*unrecognized switch '-m64 -O'.*", + 'gdc': ".*unrecognized command line option.*", + 'ldc': ".*Unknown command line argument '-m64 -O'.*", + }[tool] test.fail_test(not test.match_re_dotall(test.stderr(), result)) diff --git a/test/D/HelloWorld/CompileAndLinkOneStep/Image/SConstruct_template b/test/D/HelloWorld/CompileAndLinkOneStep/Image/SConstruct_template index 985ff0f..c688ab7 100644 --- a/test/D/HelloWorld/CompileAndLinkOneStep/Image/SConstruct_template +++ b/test/D/HelloWorld/CompileAndLinkOneStep/Image/SConstruct_template @@ -1,5 +1,9 @@ # -*- mode:python; coding:utf-8; -*- -environment = Environment(tools=['link', '{}']) +import os + +environment = Environment( + ENV=os.environ, + tools=['link', '{}']) environment.Program('helloWorld.d') diff --git a/test/D/HelloWorld/CompileAndLinkOneStep/common.py b/test/D/HelloWorld/CompileAndLinkOneStep/common.py index f3ea916..9694ebb 100644 --- a/test/D/HelloWorld/CompileAndLinkOneStep/common.py +++ b/test/D/HelloWorld/CompileAndLinkOneStep/common.py @@ -29,17 +29,19 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import TestSCons -from os.path import isfile +from os.path import abspath, dirname + +import sys +sys.path.insert(1, abspath(dirname(__file__) + '/../../Support')) + +from executablesSearch import isExecutableOfToolAvailable def testForTool(tool): test = TestSCons.TestSCons() - toolPath = '../../../{}.py'.format(tool) - if isfile(toolPath): - test.file_fixture(toolPath) - if not test.where_is(tool): - test.skip_test("Could not find '{}', skipping test.\n".format(tool)) + if not isExecutableOfToolAvailable(test, tool) : + test.skip_test("Required executable for tool '{}' not found, skipping test.\n".format(tool)) test.dir_fixture('Image') test.write('SConstruct', open('SConstruct_template', 'r').read().format(tool)) diff --git a/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/SConstruct_template b/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/SConstruct_template index 057b7d6..425970a 100644 --- a/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/SConstruct_template +++ b/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/SConstruct_template @@ -1,6 +1,10 @@ # -*- mode:python; coding:utf-8; -*- -environment = Environment(tools=['link', '{}']) +import os + +environment = Environment( + ENV=os.environ, + tools=['link', '{}']) objects = environment.Object('helloWorld.d') diff --git a/test/D/HelloWorld/CompileThenLinkTwoSteps/common.py b/test/D/HelloWorld/CompileThenLinkTwoSteps/common.py index 70262e0..9694ebb 100644 --- a/test/D/HelloWorld/CompileThenLinkTwoSteps/common.py +++ b/test/D/HelloWorld/CompileThenLinkTwoSteps/common.py @@ -29,17 +29,19 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import TestSCons -from os.path import isfile +from os.path import abspath, dirname + +import sys +sys.path.insert(1, abspath(dirname(__file__) + '/../../Support')) + +from executablesSearch import isExecutableOfToolAvailable def testForTool(tool): test = TestSCons.TestSCons() - toolPath = '../../../{}.py'.format(tool) - if isfile(toolPath): - test.file_fixture(toolPath) - if not test.where_is(tool) : - test.skip_test("Could not find '{}'; skipping test.\n".format(tool)) + if not isExecutableOfToolAvailable(test, tool) : + test.skip_test("Required executable for tool '{}' not found, skipping test.\n".format(tool)) test.dir_fixture('Image') test.write('SConstruct', open('SConstruct_template', 'r').read().format(tool)) diff --git a/test/D/LDC.py b/test/D/LDC.py index 02d5919..94acf1c 100644 --- a/test/D/LDC.py +++ b/test/D/LDC.py @@ -28,10 +28,17 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import TestSCons +from os.path import abspath, dirname + +import sys +sys.path.insert(1, abspath(dirname(__file__) + '/Support')) + +from executablesSearch import isExecutableOfToolAvailable + _exe = TestSCons._exe test = TestSCons.TestSCons() -if not test.where_is('ldc'): +if not isExecutableOfToolAvailable(test, 'ldc'): test.skip_test("Could not find 'ldc', skipping test.\n") test.write('SConstruct', """\ diff --git a/test/D/MixedDAndC/Image/SConstruct b/test/D/MixedDAndC/Image/SConstruct index f83a11d..47870d7 100644 --- a/test/D/MixedDAndC/Image/SConstruct +++ b/test/D/MixedDAndC/Image/SConstruct @@ -1,8 +1,12 @@ -env = Environment( - DFLAGS=['-m64', '-O'], - ) +# -*- codig:utf-8; -*- -env.Program('proj', [ +import os + +environment = Environment( + ENV=os.environ, + DFLAGS=['-m64', '-O']) + +environment.Program('proj', [ 'proj.d', 'dmod.d', 'cmod.c', diff --git a/test/D/Support/executablesSearch.py b/test/D/Support/executablesSearch.py new file mode 100644 index 0000000..ccb9fa5 --- /dev/null +++ b/test/D/Support/executablesSearch.py @@ -0,0 +1,37 @@ +""" +Support functions for all the tests. +""" + +# +# __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__" + +def isExecutableOfToolAvailable(test, tool): + for executable in { + 'dmd': ['dmd', 'gdmd'], + 'gdc': ['gdc'], + 'ldc': ['ldc2', 'ldc']}[tool]: + if test.where_is(executable): + return True + return False diff --git a/test/D/Support/sconstest.skip b/test/D/Support/sconstest.skip new file mode 100644 index 0000000..e69de29 -- cgit v0.12 From 9d73e32a3162f6909137bbd84cf5f86456bd4f68 Mon Sep 17 00:00:00 2001 From: Russel Winder Date: Thu, 6 Sep 2012 07:25:29 +0100 Subject: Fix a few bugs. Integrate D better into the selection system, and defaulting system. --- src/engine/MANIFEST-xml.in | 2 ++ src/engine/MANIFEST.in | 3 +++ src/engine/SCons/Tool/DCommon.py | 33 ++++++++++++++++++++++++- src/engine/SCons/Tool/__init__.py | 8 +++--- src/engine/SCons/Tool/dmd.py | 6 ++--- src/engine/SCons/Tool/dmd.xml | 3 +-- src/engine/SCons/Tool/gdc.py | 6 ++--- src/engine/SCons/Tool/gdc.xml | 52 +++++++++++++++++++++++++++++++++++++++ src/engine/SCons/Tool/ldc.py | 6 ++--- src/engine/SCons/Tool/ldc.xml | 52 +++++++++++++++++++++++++++++++++++++++ 10 files changed, 156 insertions(+), 15 deletions(-) create mode 100644 src/engine/SCons/Tool/gdc.xml create mode 100644 src/engine/SCons/Tool/ldc.xml diff --git a/src/engine/MANIFEST-xml.in b/src/engine/MANIFEST-xml.in index d2df751..4a39c7d 100644 --- a/src/engine/MANIFEST-xml.in +++ b/src/engine/MANIFEST-xml.in @@ -41,6 +41,7 @@ SCons/Tool/g++.xml SCons/Tool/g77.xml SCons/Tool/gas.xml SCons/Tool/gcc.xml +SCons/Tool/gdc.xml SCons/Tool/gfortran.xml SCons/Tool/gnulink.xml SCons/Tool/gs.xml @@ -59,6 +60,7 @@ SCons/Tool/jar.xml SCons/Tool/javac.xml SCons/Tool/javah.xml SCons/Tool/latex.xml +SCons/Tool/ldc.xml SCons/Tool/lex.xml SCons/Tool/link.xml SCons/Tool/linkloc.xml diff --git a/src/engine/MANIFEST.in b/src/engine/MANIFEST.in index 4f175bd..fedb8dd 100644 --- a/src/engine/MANIFEST.in +++ b/src/engine/MANIFEST.in @@ -76,6 +76,7 @@ SCons/Tool/c++.py SCons/Tool/cc.py SCons/Tool/cvf.py SCons/Tool/CVS.py +SCons/Tool/DCommon.py SCons/Tool/default.py SCons/Tool/dmd.py SCons/Tool/dvi.py @@ -92,6 +93,7 @@ SCons/Tool/g++.py SCons/Tool/g77.py SCons/Tool/gas.py SCons/Tool/gcc.py +SCons/Tool/gdc.py SCons/Tool/gfortran.py SCons/Tool/gnulink.py SCons/Tool/gs.py @@ -112,6 +114,7 @@ SCons/Tool/JavaCommon.py SCons/Tool/javac.py SCons/Tool/javah.py SCons/Tool/latex.py +SCons/Tool/ldc.py SCons/Tool/lex.py SCons/Tool/link.py SCons/Tool/linkloc.py diff --git a/src/engine/SCons/Tool/DCommon.py b/src/engine/SCons/Tool/DCommon.py index b00d9fb..10baa1f 100644 --- a/src/engine/SCons/Tool/DCommon.py +++ b/src/engine/SCons/Tool/DCommon.py @@ -1,9 +1,35 @@ -""" +"""SCons.Tool.DCommon + Common code for the various D tools. Coded by Russel Winder (russel@winder.org.uk) 2012-09-06 """ +# +# __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__" + import os.path def isD(source): @@ -54,3 +80,8 @@ def setSmartLink(env, smart_link, smart_lib): return defaultLib env['SMART_ARCOM'] = smart_lib[arcom] = _smartLib +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py index 5357959..19c320d 100644 --- a/src/engine/SCons/Tool/__init__.py +++ b/src/engine/SCons/Tool/__init__.py @@ -563,7 +563,7 @@ def tool_list(platform, env): assemblers = ['masm', 'nasm', 'gas', '386asm' ] fortran_compilers = ['gfortran', 'g77', 'ifl', 'cvf', 'f95', 'f90', 'fortran'] ars = ['mslib', 'ar', 'tlib'] - other_plat_tools=['msvs','midl'] + other_plat_tools = ['msvs', 'midl'] elif str(platform) == 'os2': "prefer IBM tools on OS/2" linkers = ['ilink', 'gnulink', ]#'mslink'] @@ -645,8 +645,10 @@ def tool_list(platform, env): fortran_compiler = FindTool(fortran_compilers, env) or fortran_compilers[0] ar = FindTool(ars, env) or ars[0] + d_compilers = ['dmd', 'gdc', 'lcd2'] + d_compiler = FindTool(d_compilers, env) or d_compilers[0] + other_tools = FindAllTools(other_plat_tools + [ - 'dmd', #TODO: merge 'install' into 'filesystem' and # make 'filesystem' the default 'filesystem', @@ -669,7 +671,7 @@ def tool_list(platform, env): ], env) tools = ([linker, c_compiler, cxx_compiler, - fortran_compiler, assembler, ar] + fortran_compiler, assembler, ar, d_compiler] + other_tools) return [x for x in tools if x] diff --git a/src/engine/SCons/Tool/dmd.py b/src/engine/SCons/Tool/dmd.py index 1f6ec1c..1ffd6ad 100644 --- a/src/engine/SCons/Tool/dmd.py +++ b/src/engine/SCons/Tool/dmd.py @@ -68,7 +68,7 @@ import SCons.Defaults import SCons.Scanner.D import SCons.Tool -import DCommon +import SCons.Tool.DCommon smart_link = {} smart_lib = {} @@ -97,7 +97,7 @@ def generate(env): env['DDEBUG'] = [] if dc: - DCommon.addDPATHToEnv(env, dc) + SCons.Tool.DCommon.addDPATHToEnv(env, dc) env['DINCPREFIX'] = '-I' env['DINCSUFFIX'] = '' @@ -130,7 +130,7 @@ def generate(env): # these builders check for the presence of D source, and swap out # the system's defaults for the Digital Mars tools. If there's no D # source, then we silently return the previous settings. - DCommon.setSmartLink(env, smart_link, smart_lib) + SCons.Tool.DCommon.setSmartLink(env, smart_link, smart_lib) # It is worth noting that the final space in these strings is # absolutely pivotal. SCons sees these as actions and not generators diff --git a/src/engine/SCons/Tool/dmd.xml b/src/engine/SCons/Tool/dmd.xml index 835a4eb..fd2a8c6 100644 --- a/src/engine/SCons/Tool/dmd.xml +++ b/src/engine/SCons/Tool/dmd.xml @@ -6,8 +6,7 @@ See its __doc__ string for a discussion of the format. --> -Sets construction variables for D language compilers -(the Digital Mars D compiler, or GDC). +Sets construction variables for the D language compiler DMD or GDMD. + + +Sets construction variables for the D language compiler GDC. + + + + + + + diff --git a/src/engine/SCons/Tool/ldc.py b/src/engine/SCons/Tool/ldc.py index ad1a64d..cc197ab 100644 --- a/src/engine/SCons/Tool/ldc.py +++ b/src/engine/SCons/Tool/ldc.py @@ -57,7 +57,7 @@ import SCons.Defaults import SCons.Scanner.D import SCons.Tool -import DCommon +import SCons.Tool.DCommon smart_link = {} smart_lib = {} @@ -86,7 +86,7 @@ def generate(env): env['DDEBUG'] = [] if dc: - DCommon.addDPATHToEnv(env, dc) + SCons.Tool.DCommon.addDPATHToEnv(env, dc) env['DINCPREFIX'] = '-I=' env['DINCSUFFIX'] = '' @@ -119,7 +119,7 @@ def generate(env): # these builders check for the presence of D source, and swap out # the system's defaults for the Digital Mars tools. If there's no D # source, then we silently return the previous settings. - DCommon.setSmartLink(env, smart_link, smart_lib) + SCons.Tool.DCommon.setSmartLink(env, smart_link, smart_lib) # It is worth noting that the final space in these strings is # absolutely pivotal. SCons sees these as actions and not generators diff --git a/src/engine/SCons/Tool/ldc.xml b/src/engine/SCons/Tool/ldc.xml new file mode 100644 index 0000000..6785dad --- /dev/null +++ b/src/engine/SCons/Tool/ldc.xml @@ -0,0 +1,52 @@ + + + +Sets construction variables for the D language compiler LDC2. + + + + + + + -- cgit v0.12 From 87bf700266e276ec4b1d200b5d8787ed24da21af Mon Sep 17 00:00:00 2001 From: Russel Winder Date: Sat, 8 Sep 2012 11:44:42 +0100 Subject: Correct the date of last update. --- src/engine/SCons/Tool/dmd.py | 2 +- src/engine/SCons/Tool/gdc.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/SCons/Tool/dmd.py b/src/engine/SCons/Tool/dmd.py index 1ffd6ad..8329696 100644 --- a/src/engine/SCons/Tool/dmd.py +++ b/src/engine/SCons/Tool/dmd.py @@ -7,7 +7,7 @@ Originally coded by Andy Friesen (andy@ikagames.com) 15 November 2003 Evolved by Russel Winder (russel@winder.org.uk) -2010-02-07, 2010-11-17, 2011-02, 2011-05-14, 2012-05-08, 2012-09-02 +2010-02-07, 2010-11-17, 2011-02, 2011-05-14, 2012-05-08, 2012-09-02, 2012-09-06 There are a number of problems with this script at this point in time. The one that irritates the most is the Windows linker setup. The D diff --git a/src/engine/SCons/Tool/gdc.py b/src/engine/SCons/Tool/gdc.py index b7085d2..56efbb0 100644 --- a/src/engine/SCons/Tool/gdc.py +++ b/src/engine/SCons/Tool/gdc.py @@ -4,7 +4,7 @@ Tool-specific initialization for the GDC compiler. (https://github.com/D-Programming-GDC/GDC) Coded by Russel Winder (russel@winder.org.uk) -2012-05-09 +2012-05-09, 2012-09-06 Compiler variables: DC - The name of the D compiler to use. Defaults to gdc. -- cgit v0.12 From af2b9e2f216459fcdc26f367aaaf528d8122283b Mon Sep 17 00:00:00 2001 From: dirkbaechle Date: Wed, 3 Oct 2012 13:40:03 +0200 Subject: - final changes for bug2872 "Fix tests on Buildbot slaves", mainly switched all RPM tests to using the new rpmutils module --- src/engine/SCons/Tool/xgettext.py | 5 ++++- test/packaging/option--package-type.py | 7 ++++--- test/packaging/rpm/cleanup.py | 5 +++-- test/packaging/rpm/internationalization.py | 17 ++++++++--------- test/runtest/python.py | 4 +++- test/sconsign/script/Configure.py | 6 +++++- 6 files changed, 27 insertions(+), 17 deletions(-) diff --git a/src/engine/SCons/Tool/xgettext.py b/src/engine/SCons/Tool/xgettext.py index 17e055f..64436b8 100644 --- a/src/engine/SCons/Tool/xgettext.py +++ b/src/engine/SCons/Tool/xgettext.py @@ -271,7 +271,10 @@ def generate(env,**kw): import SCons.Util from SCons.Tool.GettextCommon import RPaths, _detect_xgettext - env['XGETTEXT'] = _detect_xgettext(env) + try: + env['XGETTEXT'] = _detect_xgettext(env) + except: + env['XGETTEXT'] = 'xgettext' # NOTE: sources="$SOURCES" would work as well. However, we use following # construction to convert absolute paths provided by scons onto paths # relative to current working dir. Note, that scons expands $SOURCE(S) to diff --git a/test/packaging/option--package-type.py b/test/packaging/option--package-type.py index 2a898ff..c8f22ca 100644 --- a/test/packaging/option--package-type.py +++ b/test/packaging/option--package-type.py @@ -29,6 +29,7 @@ Test the --package-type option. """ import TestSCons +import SCons.Tool.rpmutils _python_ = TestSCons._python_ @@ -67,12 +68,12 @@ env.Package( NAME = 'foo', """ % locals()) src_rpm = 'foo-1.2.3-0.src.rpm' -machine_rpm = 'foo-1.2.3-0.*.rpm' +machine_rpm = 'foo-1.2.3-0.%s.rpm' % SCons.Tool.rpmutils.defaultMachine() test.run(arguments='package PACKAGETYPE=rpm', stderr = None) test.must_exist( src_rpm ) -test.must_exist_one_of( [machine_rpm] ) +test.must_exist( machine_rpm ) test.must_not_exist( 'bin/main.c' ) test.must_not_exist( '/bin/main.c' ) @@ -80,7 +81,7 @@ test.run(arguments='-c package PACKAGETYPE=rpm', stderr = None) test.run(arguments='package --package-type=rpm', stderr = None) test.must_exist( src_rpm ) -test.must_exist_one_of( [machine_rpm] ) +test.must_exist( machine_rpm ) test.must_not_exist( 'bin/main.c' ) test.must_not_exist( '/bin/main.c' ) diff --git a/test/packaging/rpm/cleanup.py b/test/packaging/rpm/cleanup.py index 91feba1..b77dfd1 100644 --- a/test/packaging/rpm/cleanup.py +++ b/test/packaging/rpm/cleanup.py @@ -29,6 +29,7 @@ Assert that files created by the RPM packager will be removed by 'scons -c'. """ import TestSCons +import SCons.Tool.rpmutils _python_ = TestSCons._python_ test = TestSCons.TestSCons() @@ -88,9 +89,9 @@ test.up_to_date( arguments='.' ) test.run( arguments='-c .' ) src_rpm = 'foo-1.2.3-0.src.rpm' -machine_rpm = 'foo-1.2.3-0.*.rpm' +machine_rpm = 'foo-1.2.3-0.%s.rpm' % SCons.Tool.rpmutils.defaultMachine() -test.must_not_exist_any_of( [machine_rpm] ) +test.must_not_exist( machine_rpm ) test.must_not_exist( src_rpm ) test.must_not_exist( 'foo-1.2.3.tar.gz' ) test.must_not_exist( 'foo-1.2.3.spec' ) diff --git a/test/packaging/rpm/internationalization.py b/test/packaging/rpm/internationalization.py index 4b75de4..2ef0dfd 100644 --- a/test/packaging/rpm/internationalization.py +++ b/test/packaging/rpm/internationalization.py @@ -32,7 +32,7 @@ These are x-rpm-Group, description, summary and the lang_xx file tag. """ import os -import glob +import SCons.Tool.rpmutils import TestSCons @@ -95,30 +95,29 @@ env.Alias ( 'install', prog ) test.run(arguments='', stderr = None) src_rpm = 'foo-1.2.3-0.src.rpm' -machine_rpm = 'foo-1.2.3-0.*.rpm' +machine_rpm = 'foo-1.2.3-0.%s.rpm' % SCons.Tool.rpmutils.defaultMachine() test.must_exist( src_rpm ) -test.must_exist_one_of( [machine_rpm] ) +test.must_exist( machine_rpm ) test.must_not_exist( 'bin/main' ) -machine_rpm_path = glob.glob(machine_rpm)[0].lstrip('./') cmd = 'rpm -qp --queryformat \'%%{GROUP}-%%{SUMMARY}-%%{DESCRIPTION}\' %s' os.environ['LANGUAGE'] = 'de' -out = os.popen( cmd % test.workpath(machine_rpm_path) ).read() +out = os.popen( cmd % test.workpath(machine_rpm) ).read() test.fail_test( out != 'Applikation/büro-hallo-das sollte wirklich lang sein' ) os.environ['LANGUAGE'] = 'fr' -out = os.popen( cmd % test.workpath(machine_rpm_path) ).read() +out = os.popen( cmd % test.workpath(machine_rpm) ).read() test.fail_test( out != 'Application/bureau-bonjour-ceci devrait être vraiment long' ) os.environ['LANGUAGE'] = 'en' -out = os.popen( cmd % test.workpath(machine_rpm_path) ).read() +out = os.popen( cmd % test.workpath(machine_rpm) ).read() test.fail_test( out != 'Application/office-hello-this should be really long' ) os.environ['LC_ALL'] = 'ae' -out = os.popen( cmd % test.workpath(machine_rpm_path) ).read() +out = os.popen( cmd % test.workpath(machine_rpm) ).read() test.fail_test( out != 'Application/office-hello-this should be really long' ) # @@ -177,7 +176,7 @@ env.Alias ( 'install', [ prog, man_pages ] ) test.run(arguments='--install-sandbox=blubb install', stderr = None) test.must_exist( src_rpm ) -test.must_exist_one_of( [machine_rpm] ) +test.must_exist( machine_rpm ) test.pass_test() diff --git a/test/runtest/python.py b/test/runtest/python.py index d406be4..bcbc062 100644 --- a/test/runtest/python.py +++ b/test/runtest/python.py @@ -43,7 +43,9 @@ test_pass_py = os.path.join('test', 'pass.py') head, python = os.path.split(TestRuntest.python) head, dir = os.path.split(head) -mypython = os.path.join(head, dir, os.path.pardir, dir, python) +# We have to normalize the python path here, because some installations don't like +# getting called with "/bin/../bin/python" as first argument, e.g. Fedora 17 Desktop. +mypython = os.path.normpath(os.path.join(head, dir, os.path.pardir, dir, python)) def escape(s): return s.replace('\\', '\\\\') diff --git a/test/sconsign/script/Configure.py b/test/sconsign/script/Configure.py index 865b607..3b43def 100644 --- a/test/sconsign/script/Configure.py +++ b/test/sconsign/script/Configure.py @@ -40,7 +40,11 @@ _obj = TestSCons._obj test = TestSConsign.TestSConsign(match = TestSConsign.match_re, diff = TestSConsign.diff_re) -CC = test.detect('CC', norm=1) +# Note: Here we pass the full search PATH of our current system to +# the detect() method. This way we try to ensure that we find the same +# compiler executable as the SConstruct below, which uses +# os.environ['PATH'] too. +CC = test.detect('CC', ENV={'PATH' : os.environ.get('PATH','')}, norm=1) CC_dir, CC_file = os.path.split(CC) CC = re.escape(CC) -- cgit v0.12 From dafe6278b77d2987fb7845c711068168a7576df7 Mon Sep 17 00:00:00 2001 From: Russel Winder Date: Sat, 6 Oct 2012 17:59:14 +0100 Subject: Correct the spelling of the LDC compiler. --- src/engine/SCons/Tool/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py index 19c320d..fccd655 100644 --- a/src/engine/SCons/Tool/__init__.py +++ b/src/engine/SCons/Tool/__init__.py @@ -645,7 +645,7 @@ def tool_list(platform, env): fortran_compiler = FindTool(fortran_compilers, env) or fortran_compilers[0] ar = FindTool(ars, env) or ars[0] - d_compilers = ['dmd', 'gdc', 'lcd2'] + d_compilers = ['dmd', 'gdc', 'ldc2'] d_compiler = FindTool(d_compilers, env) or d_compilers[0] other_tools = FindAllTools(other_plat_tools + [ -- cgit v0.12 From 1f035386be2924e356d385e813703b761f3dd43b Mon Sep 17 00:00:00 2001 From: Russel Winder Date: Sat, 6 Oct 2012 18:15:39 +0100 Subject: It's the tool name not the compiler name in this list. --- src/engine/SCons/Tool/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py index fccd655..969733c 100644 --- a/src/engine/SCons/Tool/__init__.py +++ b/src/engine/SCons/Tool/__init__.py @@ -645,7 +645,7 @@ def tool_list(platform, env): fortran_compiler = FindTool(fortran_compilers, env) or fortran_compilers[0] ar = FindTool(ars, env) or ars[0] - d_compilers = ['dmd', 'gdc', 'ldc2'] + d_compilers = ['dmd', 'gdc', 'ldc'] d_compiler = FindTool(d_compilers, env) or d_compilers[0] other_tools = FindAllTools(other_plat_tools + [ -- cgit v0.12 From 46043901f7a93385e5bb2d3243073bd6c5634ca8 Mon Sep 17 00:00:00 2001 From: Gary Oberbrunner Date: Sat, 6 Oct 2012 17:54:14 -0400 Subject: Fix nested LIBPATH expansion by flattening sequences in subst_path. Patch from Alexey Klimkin; fixes issue #2660. --- src/CHANGES.txt | 3 +++ src/engine/SCons/EnvironmentTests.py | 15 +++++++++++++++ src/engine/SCons/PathList.py | 10 ++++++---- src/engine/SCons/PathListTests.py | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 4 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index c903ece..ca6c5df 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -6,6 +6,9 @@ RELEASE 2.X.X - + From Alexey Klimkin: + - Fix nested LIBPATH expansion by flattening sequences in subst_path. + From eyan on Bitbucket: - Print target name with command execution time with --debug=time diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index 9237c8a..45cf876 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -1440,6 +1440,21 @@ def exists(env): x = s("${_concat(PRE, LIST, SUF, __env__)}") assert x == 'preasuf prebsuf', x + def test_concat_nested(self): + "Test _concat() on a nested substitution strings." + e = self.TestEnvironment(PRE='pre', SUF='suf', + L1=['a', 'b'], + L2=['c', 'd'], + L3=['$L2']) + x = e.subst('$( ${_concat(PRE, L1, SUF, __env__)} $)') + assert x == 'preasuf prebsuf', x + e.AppendUnique(L1 = ['$L2']) + x = e.subst('$( ${_concat(PRE, L1, SUF, __env__)} $)') + assert x == 'preasuf prebsuf precsuf predsuf', x + e.AppendUnique(L1 = ['$L3']) + x = e.subst('$( ${_concat(PRE, L1, SUF, __env__)} $)') + assert x == 'preasuf prebsuf precsuf predsuf precsuf predsuf', x + def test_gvars(self): """Test the Environment gvars() method""" env = self.TestEnvironment(XXX = 'x', YYY = 'y', ZZZ = 'z') diff --git a/src/engine/SCons/PathList.py b/src/engine/SCons/PathList.py index 870c195..f3de57c 100644 --- a/src/engine/SCons/PathList.py +++ b/src/engine/SCons/PathList.py @@ -131,12 +131,14 @@ class _PathList(object): value = env.subst(value, target=target, source=source, conv=node_conv) if SCons.Util.is_Sequence(value): - result.extend(value) - continue - + result.extend(SCons.Util.flatten(value)) + elif value: + result.append(value) elif type == TYPE_OBJECT: value = node_conv(value) - if value: + if value: + result.append(value) + elif value: result.append(value) return tuple(result) diff --git a/src/engine/SCons/PathListTests.py b/src/engine/SCons/PathListTests.py index 212c761..e83fc50 100644 --- a/src/engine/SCons/PathListTests.py +++ b/src/engine/SCons/PathListTests.py @@ -48,6 +48,8 @@ class subst_pathTestCase(unittest.TestCase): return s self.env = FakeEnvironment(AAA = 'aaa', NULL = '') + from SCons.Environment import Environment + self.env = Environment(AAA = 'aaa', NULL = '') def test_node(self): """Test the subst_path() method on a Node @@ -120,6 +122,40 @@ class subst_pathTestCase(unittest.TestCase): assert result == ('aaa',), result + def test_list_of_lists(self): + """Test the subst_path() method on substitution of nested lists. + """ + pl = SCons.PathList.PathList((['$AAA', '$AAA'], '$NULL')) + result = pl.subst_path(self.env, 'y', 'z') + assert result == ('aaa', 'aaa'), result + + def test_subst_nested(self): + """Test the subst_path() method on nested substitution of strings. + """ + self.env.Append(L1 = ['a', 'b'], + L2 = ['c', 'd'], + L3 = ['$L2']) + pl = SCons.PathList.PathList(['$L1']) + result = pl.subst_path(self.env, 'y', 'z') + assert result == ('a', 'b'), result + self.env.Append(L1 = ['$L2']) + pl = SCons.PathList.PathList(['$L1']) + result = pl.subst_path(self.env, 'y', 'z') + assert result == ('a', 'b', 'c', 'd'), result + self.env.Append(L1 = ['$L3']) + pl = SCons.PathList.PathList(['$L1']) + result = pl.subst_path(self.env, 'y', 'z') + assert result == ('a', 'b', 'c', 'd', 'c', 'd'), result + + def test_another_env(self): + """Test the subst_path does lazy evaluation. + """ + pl = SCons.PathList.PathList(('$AAA', '$NULL')) + result = pl.subst_path(self.env, 'y', 'z') + assert result == ('aaa',), result + e = self.env.Clone(AAA = 'bbb') + result = pl.subst_path(e, 'y', 'z') + assert result == ('bbb',), result class PathListCacheTestCase(unittest.TestCase): -- cgit v0.12 From d3e6150b00540fc5fee56e46441dbb2390ad96b1 Mon Sep 17 00:00:00 2001 From: Robert Managan Date: Sat, 6 Oct 2012 22:22:26 -0700 Subject: Add separate biber action and add logic to call either bibtex or biber depending on which is needed; the files created tell us which to call. --- src/CHANGES.txt | 2 + src/engine/SCons/Tool/tex.py | 22 ++++++-- test/TEX/biber_biblatex2.py | 128 +++++++++++++++++++++++++++++++++++++++++++ test/TEX/biblatex.py | 2 +- 4 files changed, 149 insertions(+), 5 deletions(-) create mode 100644 test/TEX/biber_biblatex2.py diff --git a/src/CHANGES.txt b/src/CHANGES.txt index c903ece..06e8e05 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -37,6 +37,8 @@ RELEASE 2.X.X - From Rob Managan: - Updated the TeX builder to support the \newglossary command in LaTeX's glossaries package and the files it creates. + - Improve support for new versions of biblatex in the TeX builder + so biber is called automatically if biblatex requires it. RELEASE 2.2.0 - Mon, 05 Aug 2012 15:37:48 +0000 diff --git a/src/engine/SCons/Tool/tex.py b/src/engine/SCons/Tool/tex.py index 0695755..5f24df0 100644 --- a/src/engine/SCons/Tool/tex.py +++ b/src/engine/SCons/Tool/tex.py @@ -129,6 +129,9 @@ LaTeXAction = None # An action to run BibTeX on a file. BibTeXAction = None +# An action to run Biber on a file. +BiberAction = None + # An action to run MakeIndex on a file. MakeIndexAction = None @@ -344,7 +347,9 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None must_rerun_latex = True # Now decide if biber will need to be run. - # The information that bibtex reads from the .bcf file is + # When the backend for biblatex is biber (by choice or default) the + # citation information is put in the .bcf file. + # The information that biber reads from the .bcf file is # pass-independent. If we find (below) that the .bbl file is unchanged, # then the last latex saw a correct bibliography. # Therefore only do this once @@ -357,11 +362,11 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None content = open(target_bcf, "rb").read() if content.find("bibdata") != -1: if Verbose: - print "Need to run bibtex on ",bcffilename + print "Need to run biber on ",bcffilename bibfile = env.fs.File(SCons.Util.splitext(target_bcf)[0]) - result = BibTeXAction(bibfile, bibfile, env) + result = BiberAction(bibfile, bibfile, env) if result != 0: - check_file_error_message(env['BIBTEX'], 'blg') + check_file_error_message(env['BIBER'], 'blg') must_rerun_latex = True # Now decide if latex will need to be run again due to index. @@ -880,6 +885,11 @@ def generate_common(env): if BibTeXAction is None: BibTeXAction = SCons.Action.Action("$BIBTEXCOM", "$BIBTEXCOMSTR") + # Define an action to run Biber on a file. + global BiberAction + if BiberAction is None: + BiberAction = SCons.Action.Action("$BIBERCOM", "$BIBERCOMSTR") + # Define an action to run MakeIndex on a file. global MakeIndexAction if MakeIndexAction is None: @@ -939,6 +949,10 @@ def generate_common(env): env['BIBTEXFLAGS'] = SCons.Util.CLVar('') env['BIBTEXCOM'] = CDCOM + '${TARGET.dir} && $BIBTEX $BIBTEXFLAGS ${SOURCE.filebase}' + env['BIBER'] = 'biber' + env['BIBERFLAGS'] = SCons.Util.CLVar('') + env['BIBERCOM'] = CDCOM + '${TARGET.dir} && $BIBER $BIBERFLAGS ${SOURCE.filebase}' + env['MAKEINDEX'] = 'makeindex' env['MAKEINDEXFLAGS'] = SCons.Util.CLVar('') env['MAKEINDEXCOM'] = CDCOM + '${TARGET.dir} && $MAKEINDEX $MAKEINDEXFLAGS ${SOURCE.file}' diff --git a/test/TEX/biber_biblatex2.py b/test/TEX/biber_biblatex2.py new file mode 100644 index 0000000..95b5617 --- /dev/null +++ b/test/TEX/biber_biblatex2.py @@ -0,0 +1,128 @@ +#!/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 creation of a Tex document that uses the biblatex package +It uses the default backend, could be bibtex or biber. +Require both be installed + +Test courtesy Rob Managan. +""" + +import TestSCons +import os + +test = TestSCons.TestSCons() + +latex = test.where_is('pdflatex') +if not latex: + test.skip_test("Could not find 'pdflatex'; skipping test.\n") + +biber = test.where_is('biber') +if not biber: + test.skip_test("Could not find 'biber'; skipping test.\n") + +bibtex = test.where_is('bibtex') +if not bibtex: + test.skip_test("Could not find 'bibtex'; skipping test.\n") + +biblatex = os.system('kpsewhich biblatex.sty') +if not biblatex==0: + test.skip_test("biblatex.sty not installed; skipping test(s).\n") + + +test.write(['SConstruct'], """\ +#!/usr/bin/env python + +import os +env = Environment(ENV=os.environ) +main_output = env.PDF('bibertest.tex') +""") + + +sources_bib_content = r""" +@book{mybook, + title={Title}, + author={Author, A}, + year={%s}, + publisher={Publisher}, +} +""" +test.write(['ref.bib'],sources_bib_content % '2013' ) + +test.write(['bibertest.tex'],r""" +\documentclass{article} + +\usepackage{biblatex} +\addbibresource{ref.bib} + +\begin{document} + +Hello. This is boring. +\cite{mybook} +And even more boring. + +\printbibliography +\end{document} +""") + + +test.run() + + +# All (?) the files we expect will get created in the docs directory +files = [ + 'bibertest.aux', + 'bibertest.bbl', + 'bibertest.blg', + 'bibertest.fls', + 'bibertest.log', + 'bibertest.pdf', + 'bibertest.run.xml', +] + + +for f in files: + test.must_exist([ f]) + +pdf_output_1 = test.read('bibertest.pdf') + + + +test.write(['ref.bib'],sources_bib_content % '1982') + +test.run() + +pdf_output_2 = test.read('bibertest.pdf') + +pdf_output_1 = test.normalize_pdf(pdf_output_1) +pdf_output_2 = test.normalize_pdf(pdf_output_2) + +# If the PDF file is the same as it was previously, then it didn't +# pick up the change from 1981 to 1982, so fail. +test.fail_test(pdf_output_1 == pdf_output_2) + +test.pass_test() diff --git a/test/TEX/biblatex.py b/test/TEX/biblatex.py index d0663f7..a70e103 100755 --- a/test/TEX/biblatex.py +++ b/test/TEX/biblatex.py @@ -25,7 +25,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ -Test creation of a Tex document that uses the multibib package +Test creation of a Tex document that uses the biblatex package Test courtesy Rob Managan. """ -- cgit v0.12 From f9c10087c8be7de44caa38aab2f59a3c6f489367 Mon Sep 17 00:00:00 2001 From: dirkbaechle Date: Sun, 7 Oct 2012 13:28:24 +0200 Subject: - minor fix: catching NotFoundError exceptions for all other gettext tools --- src/engine/SCons/Tool/msgfmt.py | 10 ++++++++-- src/engine/SCons/Tool/msginit.py | 10 ++++++++-- src/engine/SCons/Tool/msgmerge.py | 10 ++++++++-- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/engine/SCons/Tool/msgfmt.py b/src/engine/SCons/Tool/msgfmt.py index 83b54f7..352ba77 100644 --- a/src/engine/SCons/Tool/msgfmt.py +++ b/src/engine/SCons/Tool/msgfmt.py @@ -77,7 +77,10 @@ def generate(env,**kw): """ Generate `msgfmt` tool """ import SCons.Util from SCons.Tool.GettextCommon import _detect_msgfmt - env['MSGFMT'] = _detect_msgfmt(env) + try: + env['MSGFMT'] = _detect_msgfmt(env) + except: + env['MSGFMT'] = 'msgfmt' env.SetDefault( MSGFMTFLAGS = [ SCons.Util.CLVar('-c') ], MSGFMTCOM = '$MSGFMT $MSGFMTFLAGS -o $TARGET $SOURCE', @@ -92,7 +95,10 @@ def generate(env,**kw): def exists(env): """ Check if the tool exists """ from SCons.Tool.GettextCommon import _msgfmt_exists - return _msgfmt_exists(env) + try: + return _msgfmt_exists(env) + except: + return False ############################################################################# # Local Variables: diff --git a/src/engine/SCons/Tool/msginit.py b/src/engine/SCons/Tool/msginit.py index 87b3eec..5e9c0e4 100644 --- a/src/engine/SCons/Tool/msginit.py +++ b/src/engine/SCons/Tool/msginit.py @@ -79,7 +79,10 @@ def generate(env,**kw): """ Generate the `msginit` tool """ import SCons.Util from SCons.Tool.GettextCommon import _detect_msginit - env['MSGINIT'] = _detect_msginit(env) + try: + env['MSGINIT'] = _detect_msginit(env) + except: + env['MSGINIT'] = 'msginit' msginitcom = '$MSGINIT ${_MSGNoTranslator(__env__)} -l ${_MSGINITLOCALE}' \ + ' $MSGINITFLAGS -i $SOURCE -o $TARGET' # NOTE: We set POTSUFFIX here, in case the 'xgettext' is not loaded @@ -104,7 +107,10 @@ def generate(env,**kw): def exists(env): """ Check if the tool exists """ from SCons.Tool.GettextCommon import _msginit_exists - return _msginit_exists(env) + try: + return _msginit_exists(env) + except: + return False ############################################################################# # Local Variables: diff --git a/src/engine/SCons/Tool/msgmerge.py b/src/engine/SCons/Tool/msgmerge.py index 78eb2c5..f3710ab 100644 --- a/src/engine/SCons/Tool/msgmerge.py +++ b/src/engine/SCons/Tool/msgmerge.py @@ -70,7 +70,10 @@ def _POUpdateBuilderWrapper(env, target=None, source=_null, **kw): def generate(env,**kw): """ Generate the `xgettext` tool """ from SCons.Tool.GettextCommon import _detect_msgmerge - env['MSGMERGE'] = _detect_msgmerge(env) + try: + env['MSGMERGE'] = _detect_msgmerge(env) + except: + env['MSGMERGE'] = 'msgmerge' env.SetDefault( POTSUFFIX = ['.pot'], POSUFFIX = ['.po'], @@ -88,7 +91,10 @@ def generate(env,**kw): def exists(env): """ Check if the tool exists """ from SCons.Tool.GettextCommon import _msgmerge_exists - return _msgmerge_exists(env) + try: + return _msgmerge_exists(env) + except: + return False ############################################################################# # Local Variables: -- cgit v0.12 From c3c4deb28d68fc28c41b0c06185c7d03c2d0247b Mon Sep 17 00:00:00 2001 From: Russel Winder Date: Sat, 13 Oct 2012 07:00:38 +0100 Subject: Update the README to be a ReStructured Text file. --- README | 779 ------------------------------------------------------------- README.rst | 748 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 748 insertions(+), 779 deletions(-) delete mode 100644 README create mode 100644 README.rst diff --git a/README b/README deleted file mode 100644 index 1f82c58..0000000 --- a/README +++ /dev/null @@ -1,779 +0,0 @@ - SCons - a software construction tool - -Welcome to the SCons development tree. The real purpose of this tree -is to package SCons for production distribution in a variety of formats, -not just to hack SCons code. - -If all you want to do is install and run SCons, it will be easier for you -to download and install the scons-{version}.tar.gz or scons-{version}.zip -package rather than to work with the packaging logic in this tree. - -To the extent that this tree is about building SCons packages, the *full* -development cycle is not just to test the code directly, but to package -SCons, unpack the package, "install" SCons in a test subdirectory, -and then to run the tests against the unpacked and installed software. -This helps eliminate problems caused by, for example, failure to update -the list of files to be packaged. - -For just working on making an individual change to the SCons source, -however, you don't actually need to build or install SCons; you -*can* actually edit and execute SCons in-place. See the following -sections below for more information: - - MAKING CHANGES - How to edit and execute SCons in-place. - - DEBUGGING - Tips for debugging problems in SCons. - - TESTING - How to use the automated regression tests. - - DEVELOPMENT WORKFLOW - An example of how to put the edit/execute/test pieces - together in a reasonable development workflow. - - -LATEST VERSION -============== - -Before going further, you can check that this package you have is the -latest version at the SCons download page: - - http://www.scons.org/download.php - - -EXECUTION REQUIREMENTS -====================== - -Running SCons requires Python version 2.4 or later. There should be -no other dependencies or requirements to run SCons. - -The default SCons configuration assumes use of the Microsoft Visual C++ -compiler suite on WIN32 systems, and assumes a C compiler named 'cc', -a C++ compiler named 'c++', and a Fortran compiler named 'g77' (such -as found in the GNU C compiler suite) on any other type of system. -You may, of course, override these default values by appropriate -configuration of Environment construction variables. - -By default, SCons knows how to search for available programming tools -on various systems--see the SCons man page for details. You may, -of course, override the default SCons choices made by appropriate -configuration of Environment construction variables. - - -INSTALLATION REQUIREMENTS -========================= - -Nothing special. - - -EXECUTING SCONS WITHOUT INSTALLING -================================== - -You can execute the local SCons directly from the src/ subdirectory by -first setting the SCONS_LIB_DIR environment variable to the local -src/engine subdirectory, and then executing the local src/script/scons.py -script to populate the build/scons/ subdirectory. You would do this as -follows on a Linux or UNIX system (using sh or a derivative like bash or -ksh): - - $ setenv MYSCONS=`pwd`/src - $ setenv SCONS_LIB_DIR=$MYSCONS/engine - $ python $MYSCONS/script/scons.py [arguments] - -Or on Windows: - - C:\scons>set MYSCONS=%cd%\src - C:\scons>set SCONS_LIB_DIR=%MYSCONS%\engine - C:\scons>python %MYSCONS%\script\scons.py [arguments] - -An alternative approach is to skip the above and use: - - $ python bootstrap.py [arguments] - -bootstrap.py keeps the src/ subdirectory free of compiled Python (*.pyc or -*.pyo) files by copying the necessary SCons files to a local bootstrap/ -subdirectory and executing it from there. - -You can use the -C option to have SCons change directory to another -location where you already have a build configuration set up. - - $ python bootstrap.py -C /some/other/location [arguments] - -For simplicity in the following examples, we will only show the -bootstrap.py approach. - - -INSTALLATION -============ - - NOTE: You don't need to build SCons packages or install SCons if - you just want to work on developing a patch. See the sections - about MAKING CHANGES and TESTING below if you just want to submit - a bug fix or some new functionality. See the sections below about - BUILDING PACKAGES and TESTING PACKAGES if your enhancement involves - changing the way in which SCons is packaged and/or installed on an - end-user system. - -Assuming your system satisfies the installation requirements in the -previous section, install SCons from this package by first populating -the build/scons/ subdirectory. (For an easier way to install SCons, -without having to populate this directory, use the scons-{version}.tar.gz -or scons-{version}.zip package.) - -Populate build/scons/ using a pre-installed SCons -------------------------------------------------- - -If you already have an appropriate version of SCons installed on your -system, populate the build/scons/ directory by running: - - $ scons build/scons - -Populate build/scons/ using the SCons source --------------------------------------------- - -You can also use this version of SCons to populate its own build directory -by using a supplied bootstrap.py script (see the section above about -EXECUTING SCONS WITHOUT INSTALLING): - - $ python bootstrap.py build/scons - -Install the built SCons files ------------------------------ - -Any of the above commands will populate the build/scons/ directory with -the necessary files and directory structure to use the Python-standard -setup script as follows on Linux or UNIX: - - # cd build/scons - # python setup.py install - -Or on Windows: - - C:\scons\>cd build\scons - C:\scons\build\scons>python setup.py install - -By default, the above commands will do the following: - - -- Install the version-numbered "scons-2.0.0" and "sconsign-2.0.0" - scripts in the default system script directory (/usr/bin or - C:\Python*\Scripts, for example). This can be disabled by - specifying the "--no-version-script" option on the command - line. - - -- Install scripts named "scons" and "sconsign" scripts in the - default system script directory (/usr/bin or C:\Python*\Scripts, - for example). This can be disabled by specifying the - "--no-scons-script" option on the command line, which is useful - if you want to install and experiment with a new version before - making it the default on your system. - - On UNIX or Linux systems, you can have the "scons" and "sconsign" - scripts be hard links or symbolic links to the "scons-2.0.0" and - "sconsign-2.0.0" scripts by specifying the "--hardlink-scons" or - "--symlink-scons" options on the command line. - - -- Install "scons-2.0.0.bat" and "scons.bat" wrapper scripts in the - Python prefix directory on Windows (C:\Python*, for example). - This can be disabled by specifying the "--no-install-bat" option - on the command line. - - On UNIX or Linux systems, the "--install-bat" option may be - specified to have "scons-2.0.0.bat" and "scons.bat" files installed - in the default system script directory, which is useful if you - want to install SCons in a shared file system directory that can - be used to execute SCons from both UNIX/Linux and Windows systems. - - -- Install the SCons build engine (a Python module) in an - appropriate version-numbered SCons library directory - (/usr/lib/scons-2.0.0 or C:\Python*\scons-2.0.0, for example). - See below for more options related to installing the build - engine library. - - -- Install the troff-format man pages in an appropriate directory - on UNIX or Linux systems (/usr/share/man/man1 or /usr/man/man1, - for example). This can be disabled by specifying the - "--no-install-man" option on the command line. The man pages - can be installed on Windows systems by specifying the - "--install-man" option on the command line. - -Note that, by default, SCons does not install its build engine library -in the standard Python library directories. If you want to be able to -use the SCons library modules (the build engine) in other Python -scripts, specify the "--standard-lib" option on the command line, as -follows: - - # python setup.py install --standard-lib - -This will install the build engine in the standard Python library -directory (/usr/lib/python*/site-packages or -C:\Python*\Lib\site-packages). - -Alternatively, you can have SCons install its build engine library in a -hard-coded standalone library directory, instead of the default -version-numbered directory, by specifying the "--standalone-lib" option -on the command line, as follows: - - # python setup.py install --standalone-lib - -This is usually not recommended, however. - -Note that, to install SCons in any of the above system directories, -you should have system installation privileges (that is, "root" or -"Administrator") when running the setup.py script. If you don't have -system installation privileges, you can use the --prefix option to -specify an alternate installation location, such as your home directory: - - $ python setup.py install --prefix=$HOME - -This will install SCons in the appropriate locations relative to -$HOME--that is, the scons script itself $HOME/bin and the associated -library in $HOME/lib/scons, for example. - - -MAKING CHANGES -============== - -Because SCons is implemented in a scripting language, you don't need to -build it in order to make changes and test them. - -Virtually all of the SCons functionality exists in the "build engine," -the src/engine/SCons subdirectory hierarchy that contains all of the -modules that make up SCons. The src/script/scons.py wrapper script exists -mainly to find the appropriate build engine library and then execute it. - -In order to make your own changes locally and test them by hand, simply -edit modules in the local src/engine/SCons subdirectory tree and use the -local bootstrap.py script (see the section above about EXECUTING SCONS -WITHOUT INSTALLING): - - $ python bootstrap.py [arguments] - -If you want to be able to just execute your modified version of SCons from -the command line, you can make it executable and add its directory to your -$PATH like so: - - $ chmod 755 src/script/scons.py - $ export PATH=$PATH:`pwd`/src/script - -You should then be able to run this version of SCons by just typing -"scons.py" at your UNIX or Linux command line. - -Note that the regular SCons development process makes heavy use of -automated testing. See the TESTING and DEVELOPMENT WORKFLOW sections -below for more information about the automated regression tests and how -they can be used in a development cycle to validate that your changes -don't break existing functionality. - - -DEBUGGING -========= - -Python comes with a good interactive debugger. When debugging changes -by hand (i.e., when not using the automated tests), you can invoke SCons -under control of the Python debugger by specifying the --debug=pdb option: - - $ scons --debug=pdb [arguments] - > /home/knight/SCons/src/engine/SCons/Script/Main.py(927)_main() - -> default_warnings = [ SCons.Warnings.CorruptSConsignWarning, - (Pdb) - -Once in the debugger, you can set breakpoints at lines in files in the -build engine modules by providing the path name of the file relative to -the src/engine subdirectory (that is, including the SCons/ as the first -directory component): - - (Pdb) b SCons/Tool/msvc.py:158 - -The debugger also supports single stepping, stepping into functions, -printing variables, etc. - -Trying to debug problems found by running the automated tests (see the -TESTING section, below) is more difficult, because the test automation -harness re-invokes SCons and captures output. Consequently, there isn't an -easy way to invoke the Python debugger in a useful way on any particular -SCons call within a test script. - -The most effective technique for debugging problems that occur during an -automated test is to use the good old tried-and-true technique of adding -statements to print tracing information. But note that you can't just use -"print" statement, or even "sys.stdout.write()," because those change the -SCons output, and the automated tests usually look for matches of specific -output strings to decide if a given SCons invocations passes the test. - -To deal with this, SCons supports a Trace() function that (by default) -will print messages to your console screen ("/dev/tty" on UNIX or Linux, -"con" on Windows). By adding Trace() calls to the SCons source code: - - def sample_method(self, value): - from SCons.Debug import Trace - Trace('called sample_method(%s, %s)\n' % (self, value)) - -You can then run automated tests that print any arbitrary information -you wish about what's going on inside SCons, without interfering with -the test automation. - -The Trace() function can also redirect its output to a file, rather than -the screen: - - def sample_method(self, value): - from SCons.Debug import Trace - Trace('called sample_method(%s, %s)\n' % (self, value), - file='trace.out') - -Where the Trace() function sends its output is stateful: once you use the -"file=" argument, all subsequent calls to Trace() send their output to -the same file, until another call with a "file=" argument is reached. - - -TESTING -======= - -Tests are run by the runtest.py script in this directory. - -There are two types of tests in this package: - - Unit tests for individual SCons modules live underneath the - src/engine/ subdirectory and are the same base name as the module - with "Tests.py" appended--for example, the unit test for the - Builder.py module is the BuilderTests.py script. - - End-to-end tests of SCons live in the test/ subdirectory. - -You may specifically list one or more tests to be run: - - $ python runtest.py src/engine/SCons/BuilderTests.py - - $ python runtest.py test/option-j.py test/Program.py - -You also use the -f option to execute just the tests listed in a specified -text file: - - $ cat testlist.txt - test/option-j.py - test/Program.py - $ python runtest.py -f testlist.txt - -One test must be listed per line, and any lines that begin with '#' -will be ignored (allowing you, for example, to comment out tests that -are currently passing and then uncomment all of the tests in the file -for a final validation run). - -The runtest.py script also takes a -a option that searches the tree for -all of the tests and runs them: - - $ python runtest.py -a - -If more than one test is run, the runtest.py script prints a summary -of how many tests passed, failed, or yielded no result, and lists any -unsuccessful tests. - -The above invocations all test directly the files underneath the src/ -subdirectory, and do not require that a build be performed first. The -runtest.py script supports additional options to run tests against -unpacked packages in the build/test-*/ subdirectories. See the "TESTING -PACKAGES" section below. - - -DEVELOPMENT WORKFLOW -==================== - - CAVEAT: The point of this section isn't to describe one dogmatic - workflow. Just running the test suite can be time-consuming, and - getting a patch to pass all of the tests can be more so. If you're - genuinely blocked, it may make more sense to submit a patch with - a note about which tests still fail, and how. Someone else may be - able to take your "initial draft" and figure out how to improve it - to fix the rest of the tests. So there's plenty of room for use of - good judgement. - -The various techniques described in the above sections can be combined -to create simple and effective workflows that allow you to validate -that patches you submit to SCons don't break existing functionality and -have adequate testing, thereby increasing the speed with which they can -be integrated. - -For example, suppose your project's SCons configuration is blocked by -an SCons bug, and you decide you want to fix it and submit the patch. -Here's one possible way to go about doing that (using UNIX/Linux as the -development platform, Windows users can translate as appropriate)): - - -- Change to the top of your checked-out SCons tree. - - -- Confirm that the bug still exists in this version of SCons - by using the -C option to run the broken build: - - $ python bootstrap.py -C /home/me/broken_project . - - -- Fix the bug in SCons by editing appropriate module files - underneath src/engine/SCons. - - -- Confirm that you've fixed the bug affecting your project: - - $ python bootstrap.py -C /home/me/broken_project . - - -- Test to see if your fix had any unintended side effects - that break existing functionality: - - $ python runtest.py -a -o test.log - - Be patient, there are more than 700 test scripts in the - whole suite. If you are on UNIX/Linux, you can use: - - $ python runtest.py -a | tee test.log - - instead so you can monitor progress from your terminal. - - If any test scripts fail, they will be listed in a summary at - the end of the log file. Some test scripts may also report - NO RESULT because (for example) your local system is the wrong - type or doesn't have some installed utilities necessary to run - the script. In general, you can ignore the NO RESULT list. - - -- Cut-and-paste the list of failed tests into a file: - - $ cat > failed.txt - test/failed-test-1.py - test/failed-test-2.py - test/failed-test-3.py - ^D - $ - - -- Now debug the test failures and fix them, either by changing - SCons, or by making necessary changes to the tests (if, for - example, you have a strong reason to change functionality, or - if you find that the bug really is in the test script itself). - After each change, use the runtest.py -f option to examine the - effects of the change on the subset of tests that originally - failed: - - $ [edit] - $ python runtest.py -f failed.txt - - Repeat this until all of the tests that originally failed - now pass. - - -- Now you need to go back and validate that any changes you - made while getting the tests to pass didn't break the fix - you originally put in, and didn't introduce any *additional* - unintended side effects that broke other tests: - - $ python bootstrap.py -C /home/me/broken_project . - $ python runtest.py -a -o test.log - - If you find any newly-broken tests, add them to your "failed.txt" - file and go back to the previous step. - -Of course, the above is only one suggested workflow. In practice, there -is a lot of room for judgment and experience to make things go quicker. -For example, if you're making a change to just the Java support, you -might start looking for regressions by just running the test/Java/*.py -tests instead of running all of "runtest.py -a". - - -BUILDING PACKAGES -================= - -We use SCons (version 0.96.93 later) to build its own packages. If you -already have an appropriate version of SCons installed on your system, -you can build everything by simply running it: - - $ scons - -If you don't have SCons version 0.96.93 later already installed on your -system, you can use the supplied bootstrap.py script (see the section -above about EXECUTING SCONS WITHOUT INSTALLING): - - $ python bootstrap.py build/scons - -Depending on the utilities installed on your system, any or all of the -following packages will be built: - - build/dist/scons-2.0.0-1.noarch.rpm - build/dist/scons-2.0.0-1.src.rpm - build/dist/scons-2.0.0.linux-i686.tar.gz - build/dist/scons-2.1.0.alpha.yyyymmdd.tar.gz - build/dist/scons-2.1.0.alpha.yyyymmdd.win32.exe - build/dist/scons-2.1.0.alpha.yyyymmdd.zip - build/dist/scons-doc-2.1.0.alpha.yyyymmdd.tar.gz - build/dist/scons-local-2.1.0.alpha.yyyymmdd.tar.gz - build/dist/scons-local-2.1.0.alpha.yyyymmdd.zip - build/dist/scons-src-2.1.0.alpha.yyyymmdd.tar.gz - build/dist/scons-src-2.1.0.alpha.yyyymmdd.zip - build/dist/scons_1.3.0-1_all.deb - -The SConstruct file is supposed to be smart enough to avoid trying to -build packages for which you don't have the proper utilities installed. -For example, if you don't have Debian packaging tools installed, it -should just not build the .deb package, not fail the build. - -If you receive a build error, please report it to the scons-devel -mailing list and open a bug report on the SCons bug tracker. - -Note that in addition to creating the above packages, the default build -will also unpack one or more of the packages for testing. - - -TESTING PACKAGES -================ - -A full build will unpack and/or install any .deb, .rpm., .local.tar.gz, -.local.zip, .src.tar.gz, .src.zip, .tar.gz, and .zip packages into -separate build/test-*/ subdirectories. (Of course, if a package was -not built on your system, it should not try to install it.) The -runtest.py script supports a -p option that will run the specified tests -(individually or collectively via the -a option) against the unpacked -build/test-/* subdirectory: - - $ python runtest.py -p deb - - $ python runtest.py -p rpm - - $ python runtest.py -p local-tar-gz - - $ python runtest.py -p local-zip - - $ python runtest.py -p src-tar-gz - - $ python runtest.py -p src-zip - - $ python runtest.py -p tar-gz - - $ python runtest.py -p zip - -(The canonical invocation is to also use the runtest.py -a option so -that all tests are run against the specified package.) - - -CONTENTS OF THIS PACKAGE -======================== - -Not guaranteed to be up-to-date (but better than nothing): - -bench/ - A subdirectory for benchmarking scripts, used to perform timing - tests to decide what specific idioms are most efficient for - various parts of the code base. We check these in so they're - available in case we have to revisit any of these decisions in - the future. - -bin/ - Miscellaneous utilities used in SCons development. Right now, - some of the stuff here includes: - - -- a copy of the script we use to translate an Aegis change - into a CVS checkin - -- a script that runs pychecker on our source tree - -- a script that counts source and test files and numbers - of lines in each - -- a script for synchronizing the Aegis tree to SourceForge - -- a prototype script for capturing sample SCons output - in xml files - -- a script that can profile and time a packaging build of - SCons itself - -- a copy of xml_export, which can retrieve project data - from SourceForge - -- scripts and a Python module for translating the SCons - home-brew XML documentation tags into DocBook and - man page format - -bootstrap.py - Build script for running SCons from the current source code - checkout. This copies SCons files to bootstrap/ subdirectory, - and then executes SCons with the supplied command-line arguments. - -build/ - This doesn't exist yet if you're looking at a vanilla source - tree. This is generated as part of our build process, and it's - where, believe it or not, we *build* everything. - -config - The Aegis configuration, governing much of how we use Aegis to - build, test, control source, etc. - -debian/ - Files needed to construct a Debian package. The contents of this - directory are dictated by the Debian Policy Manual - (http://www.debian.org/doc/debian-policy). The package will not be - accepted into the Debian distribution unless the contents of this - directory satisfy the relevant Debian policies. - -doc/ - SCons documentation. A variety of things here, in various - stages of (in)completeness. - -gentoo/ - Stuff to generate files for Gentoo Linux. - -HOWTO/ - Documentation of SCons administrative procedures (making a - change, releasing a new version). Maybe other administrative - stuff in the future. - -LICENSE - A copy of the copyright and terms under which SCons is - distributed (the Open Source Initiative-approved MIT license). - -LICENSE-local - A copy of the copyright and terms under which SCons is - distributed for inclusion in the scons-local-{version} packages. - This is the same as LICENSE with a preamble that specifies - the licensing terms are for SCons itself, not any other - package that includes SCons. - -QMTest/ - The Python modules we use for testing, some generic modules - originating elsewhere and some specific to SCons. - -README - What you're looking at right now. - -README-local - A README file for inclusion in the scons-local-{version} - packages. Similar to this file, but stripped down and modified - for people looking at including SCons in their shipped software. - -review.py - Script for uploading changes for review to Rietveld installation - at http://codereview.appspot.com - -rpm/ - The .spec file for building our RPM packages. - -runtest.py - Script for running SCons tests. By default, this will run a - test against the code in the local src/ tree, so you don't - have to do a build before testing your changes. Aegis uses - it with an option that requires that you've done a build - (aeb) before running tests. - -SConstruct - The "Makefile" for the SCons distribution. - - (It has been pointed out that it's hard to find the SCons API - in this SConstruct file, and that it looks a lot more like a - pure Python script than a build configuration file. That's - mainly because all of the magick we have to perform to deal with - all of the different packaging formats requires a lot of pure - Python manipulation. In other words, don't look at this file - for an example of how easy it is to use SCons to build "normal" - software.) - -src/ - Where the actual source code is kept, of course. - -template/ - Template files, used by Aegis to give you a head start when you - aenf or aent a new file. - -test/ - End-to-end tests of the SCons utility itself. These are - separate from the individual module unit tests, which live - side-by-side with the modules under src/. - - -DOCUMENTATION -============= - -See the src/RELEASE.txt file for notes about this specific release, -including known problems. See the src/CHANGES.txt file for a list of -changes since the previous release. - -The doc/man/scons.1 man page is included in this package, and contains a -section of small examples for getting started using SCons. - -Additional documentation for SCons is available at: - - http://www.scons.org/documentation.php - - -LICENSING -========= - -SCons is distributed under the MIT license, a full copy of which is -available in the LICENSE file. - - -REPORTING BUGS -============== - -Please report bugs by following the detailed instructions on our Bug -Submission page: - - http://scons.tigris.org/bug-submission.html - -You can also send mail to the SCons developers' mailing list: - - dev@scons.tigris.org - -But even if you send email to the mailing list please make sure that you -ALSO submit a bug report to the project page bug tracker, because bug -reports in email often get overlooked in the general flood of messages. - - -MAILING LISTS -============= - -An active mailing list for developers of SCons is available. You may -send questions or comments to the list at: - - dev@scons.tigris.org - -You may request a subscription to the developer's mailing list by sending -email to: - - dev-subscribe@scons.tigris.org - -Subscription to the developer's mailing list is by approval. In practice, -no one is refused list membership, but we reserve the right to limit -membership in the future and/or weed out lurkers. - -There is also a low-volume mailing list available for announcements -about SCons. Subscribe by sending email to: - - announce-subscribe@scons.tigris.org - -There are other mailing lists available for SCons users, for notification -of SCons code changes, and for notification of updated bug reports and -project documents. Please see our mailing lists page for details. - - -DONATIONS -========= - -If you find SCons helpful, please consider making a donation (of cash, -software, or hardware) to support continued work on the project. -Information is available at: - - http://www.scons.org/donate.php - - -FOR MORE INFORMATION -==================== - -Check the SCons web site at: - - http://www.scons.org/ - - -AUTHOR INFO -=========== - -Steven Knight -knight at baldmt dot com -http://www.baldmt.com/~knight/ - -With plenty of help from the SCons Development team: - Chad Austin - Charles Crain - William Deegan - Steve Leblanc - Greg Noel - Gary Oberbrunner - Anthony Roach - Greg Spencer - Christoph Wiedemann - - -__COPYRIGHT__ diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..42dd381 --- /dev/null +++ b/README.rst @@ -0,0 +1,748 @@ +SCons - a software construction tool +#################################### + +Welcome to the SCons development tree. The real purpose of this tree is to +package SCons for production distribution in a variety of formats, not just to +hack SCons code. + +If all you want to do is install and run SCons, it will be easier for you to +download and install the scons-{version}.tar.gz or scons-{version}.zip package +rather than to work with the packaging logic in this tree. + +To the extent that this tree is about building SCons packages, the *full* +development cycle is not just to test the code directly, but to package SCons, +unpack the package, "install" SCons in a test subdirectory, and then to run +the tests against the unpacked and installed software. This helps eliminate +problems caused by, for example, failure to update the list of files to be +packaged. + +For just working on making an individual change to the SCons source, however, +you don't actually need to build or install SCons; you *can* actually edit and +execute SCons in-place. See the following sections below for more +information: + + `Making Changes`_ + How to edit and execute SCons in-place. + + `Debugging`_ + Tips for debugging problems in SCons. + + `Testing`_ + How to use the automated regression tests. + + `Development Workflow`_ + An example of how to put the edit/execute/test pieces + together in a reasonable development workflow. + + +Latest Version +============== + +Before going further, you can check that this package you have is the latest +version at the SCons download page: + + http://www.scons.org/download.php + + +Execution Requirements +====================== + +Running SCons requires Python version 2.4 or later. There should be no other +dependencies or requirements to run SCons. + +The default SCons configuration assumes use of the Microsoft Visual C++ +compiler suite on WIN32 systems, and assumes a C compiler named 'cc', a C++ +compiler named 'c++', and a Fortran compiler named 'g77' (such as found in the +GNU C compiler suite) on any other type of system. You may, of course, +override these default values by appropriate configuration of Environment +construction variables. + +By default, SCons knows how to search for available programming tools on +various systems--see the SCons man page for details. You may, of course, +override the default SCons choices made by appropriate configuration of +Environment construction variables. + + +Installation Requirements +========================= + +Nothing special. + + +Executing SCons Without Installing +================================== + +You can execute the local SCons directly from the src/ subdirectory by first +setting the SCONS_LIB_DIR environment variable to the local src/engine +subdirectory, and then executing the local src/script/scons.py script to +populate the build/scons/ subdirectory. You would do this as follows on a +Linux or UNIX system (using sh or a derivative like bash or ksh):: + + $ setenv MYSCONS=`pwd`/src + $ setenv SCONS_LIB_DIR=$MYSCONS/engine + $ python $MYSCONS/script/scons.py [arguments] + +Or on Windows:: + + C:\scons>set MYSCONS=%cd%\src + C:\scons>set SCONS_LIB_DIR=%MYSCONS%\engine + C:\scons>python %MYSCONS%\script\scons.py [arguments] + +An alternative approach is to skip the above and use:: + + $ python bootstrap.py [arguments] + +bootstrap.py keeps the src/ subdirectory free of compiled Python (\*.pyc or +\*.pyo) files by copying the necessary SCons files to a local bootstrap/ +subdirectory and executing it from there. + +You can use the -C option to have SCons change directory to another location +where you already have a build configuration set up:: + + $ python bootstrap.py -C /some/other/location [arguments] + +For simplicity in the following examples, we will only show the bootstrap.py +approach. + + +Installation +============ + + Note: You don't need to build SCons packages or install SCons if you just + want to work on developing a patch. See the sections about `Making + Changes`_ and `Testing`_ below if you just want to submit a bug fix or + some new functionality. See the sections below about `Building Packages`_ + and `Testing Packages`_ if your enhancement involves changing the way in + which SCons is packaged and/or installed on an end-user system. + +Assuming your system satisfies the installation requirements in the previous +section, install SCons from this package by first populating the build/scons/ +subdirectory. (For an easier way to install SCons, without having to populate +this directory, use the scons-{version}.tar.gz or scons-{version}.zip +package.) + +Populate build/scons/ using a pre-installed SCons +------------------------------------------------- + +If you already have an appropriate version of SCons installed on your system, +populate the build/scons/ directory by running:: + + $ scons build/scons + +Populate build/scons/ using the SCons source +-------------------------------------------- + +You can also use this version of SCons to populate its own build directory +by using a supplied bootstrap.py script (see the section above about +`Executing SCons Without Installing`_):: + + $ python bootstrap.py build/scons + +Install the built SCons files +----------------------------- + +Any of the above commands will populate the build/scons/ directory with the +necessary files and directory structure to use the Python-standard setup +script as follows on Linux or UNIX:: + + # cd build/scons + # python setup.py install + +Or on Windows:: + + C:\scons\>cd build\scons + C:\scons\build\scons>python setup.py install + +By default, the above commands will do the following: + +- Install the version-numbered "scons-2.0.0" and "sconsign-2.0.0" scripts in + the default system script directory (/usr/bin or C:\Python*\Scripts, for + example). This can be disabled by specifying the "--no-version-script" + option on the command line. + +- Install scripts named "scons" and "sconsign" scripts in the default system + script directory (/usr/bin or C:\Python*\Scripts, for example). This can be + disabled by specifying the "--no-scons-script" option on the command line, + which is useful if you want to install and experiment with a new version + before making it the default on your system. + + On UNIX or Linux systems, you can have the "scons" and "sconsign" scripts be + hard links or symbolic links to the "scons-2.0.0" and "sconsign-2.0.0" + scripts by specifying the "--hardlink-scons" or "--symlink-scons" options on + the command line. + +- Install "scons-2.0.0.bat" and "scons.bat" wrapper scripts in the Python + prefix directory on Windows (C:\Python*, for example). This can be disabled + by specifying the "--no-install-bat" option on the command line. + + On UNIX or Linux systems, the "--install-bat" option may be specified to + have "scons-2.0.0.bat" and "scons.bat" files installed in the default system + script directory, which is useful if you want to install SCons in a shared + file system directory that can be used to execute SCons from both UNIX/Linux + and Windows systems. + +- Install the SCons build engine (a Python module) in an appropriate + version-numbered SCons library directory (/usr/lib/scons-2.0.0 or + C:\Python*\scons-2.0.0, for example). See below for more options related to + installing the build engine library. + +- Install the troff-format man pages in an appropriate directory on UNIX or + Linux systems (/usr/share/man/man1 or /usr/man/man1, for example). This can + be disabled by specifying the "--no-install-man" option on the command line. + The man pages can be installed on Windows systems by specifying the + "--install-man" option on the command line. + +Note that, by default, SCons does not install its build engine library in the +standard Python library directories. If you want to be able to use the SCons +library modules (the build engine) in other Python scripts, specify the +"--standard-lib" option on the command line, as follows:: + + # python setup.py install --standard-lib + +This will install the build engine in the standard Python library directory +(/usr/lib/python*/site-packages or C:\Python*\Lib\site-packages). + +Alternatively, you can have SCons install its build engine library in a +hard-coded standalone library directory, instead of the default +version-numbered directory, by specifying the "--standalone-lib" option on the +command line, as follows:: + + # python setup.py install --standalone-lib + +This is usually not recommended, however. + +Note that, to install SCons in any of the above system directories, you should +have system installation privileges (that is, "root" or "Administrator") when +running the setup.py script. If you don't have system installation +privileges, you can use the --prefix option to specify an alternate +installation location, such as your home directory:: + + $ python setup.py install --prefix=$HOME + +This will install SCons in the appropriate locations relative to $HOME--that +is, the scons script itself $HOME/bin and the associated library in +$HOME/lib/scons, for example. + + +Making Changes +============== + +Because SCons is implemented in a scripting language, you don't need to build +it in order to make changes and test them. + +Virtually all of the SCons functionality exists in the "build engine," the +src/engine/SCons subdirectory hierarchy that contains all of the modules that +make up SCons. The src/script/scons.py wrapper script exists mainly to find +the appropriate build engine library and then execute it. + +In order to make your own changes locally and test them by hand, simply edit +modules in the local src/engine/SCons subdirectory tree and use the local +bootstrap.py script (see the section above about `Executing SCons Without +Installing`_):: + + $ python bootstrap.py [arguments] + +If you want to be able to just execute your modified version of SCons from the +command line, you can make it executable and add its directory to your $PATH +like so:: + + $ chmod 755 src/script/scons.py + $ export PATH=$PATH:`pwd`/src/script + +You should then be able to run this version of SCons by just typing "scons.py" +at your UNIX or Linux command line. + +Note that the regular SCons development process makes heavy use of automated +testing. See the `Testing`_ and `Development Workflow`_ sections below for more +information about the automated regression tests and how they can be used in a +development cycle to validate that your changes don't break existing +functionality. + + +Debugging +========= + +Python comes with a good interactive debugger. When debugging changes by hand +(i.e., when not using the automated tests), you can invoke SCons under control +of the Python debugger by specifying the --debug=pdb option:: + + $ scons --debug=pdb [arguments] + > /home/knight/SCons/src/engine/SCons/Script/Main.py(927)_main() + -> default_warnings = [ SCons.Warnings.CorruptSConsignWarning, + (Pdb) + +Once in the debugger, you can set breakpoints at lines in files in the build +engine modules by providing the path name of the file relative to the +src/engine subdirectory (that is, including the SCons/ as the first directory +component):: + + (Pdb) b SCons/Tool/msvc.py:158 + +The debugger also supports single stepping, stepping into functions, printing +variables, etc. + +Trying to debug problems found by running the automated tests (see the +`Testing`_ section, below) is more difficult, because the test automation +harness re-invokes SCons and captures output. Consequently, there isn't an +easy way to invoke the Python debugger in a useful way on any particular SCons +call within a test script. + +The most effective technique for debugging problems that occur during an +automated test is to use the good old tried-and-true technique of adding +statements to print tracing information. But note that you can't just use +"print" statement, or even "sys.stdout.write()" because those change the +SCons output, and the automated tests usually look for matches of specific +output strings to decide if a given SCons invocations passes the test. + +To deal with this, SCons supports a Trace() function that (by default) will +print messages to your console screen ("/dev/tty" on UNIX or Linux, "con" on +Windows). By adding Trace() calls to the SCons source code:: + + def sample_method(self, value): + from SCons.Debug import Trace + Trace('called sample_method(%s, %s)\n' % (self, value)) + +You can then run automated tests that print any arbitrary information you wish +about what's going on inside SCons, without interfering with the test +automation. + +The Trace() function can also redirect its output to a file, rather than the +screen:: + + def sample_method(self, value): + from SCons.Debug import Trace + Trace('called sample_method(%s, %s)\n' % (self, value), + file='trace.out') + +Where the Trace() function sends its output is stateful: once you use the +"file=" argument, all subsequent calls to Trace() send their output to the +same file, until another call with a "file=" argument is reached. + + +Testing +======= + +Tests are run by the runtest.py script in this directory. + +There are two types of tests in this package: + +1. Unit tests for individual SCons modules live underneath the src/engine/ + subdirectory and are the same base name as the module with "Tests.py" + appended--for example, the unit test for the Builder.py module is the + BuilderTests.py script. + +2. End-to-end tests of SCons live in the test/ subdirectory. + +You may specifically list one or more tests to be run:: + + $ python runtest.py src/engine/SCons/BuilderTests.py + + $ python runtest.py test/option-j.py test/Program.py + +You also use the -f option to execute just the tests listed in a specified +text file:: + + $ cat testlist.txt + test/option-j.py + test/Program.py + $ python runtest.py -f testlist.txt + +One test must be listed per line, and any lines that begin with '#' will be +ignored (allowing you, for example, to comment out tests that are currently +passing and then uncomment all of the tests in the file for a final validation +run). + +The runtest.py script also takes a -a option that searches the tree for all of +the tests and runs them:: + + $ python runtest.py -a + +If more than one test is run, the runtest.py script prints a summary of how +many tests passed, failed, or yielded no result, and lists any unsuccessful +tests. + +The above invocations all test directly the files underneath the src/ +subdirectory, and do not require that a build be performed first. The +runtest.py script supports additional options to run tests against unpacked +packages in the build/test-\*/ subdirectories. See the `Testing Packages`_ +section below. + + +Development Workflow +==================== + + Caveat: The point of this section isn't to describe one dogmatic workflow. + Just running the test suite can be time-consuming, and getting a patch to + pass all of the tests can be more so. If you're genuinely blocked, it may + make more sense to submit a patch with a note about which tests still + fail, and how. Someone else may be able to take your "initial draft" and + figure out how to improve it to fix the rest of the tests. So there's + plenty of room for use of good judgement. + +The various techniques described in the above sections can be combined to +create simple and effective workflows that allow you to validate that patches +you submit to SCons don't break existing functionality and have adequate +testing, thereby increasing the speed with which they can be integrated. + +For example, suppose your project's SCons configuration is blocked by an SCons +bug, and you decide you want to fix it and submit the patch. Here's one +possible way to go about doing that (using UNIX/Linux as the development +platform, Windows users can translate as appropriate)): + +- Change to the top of your checked-out SCons tree. + +- Confirm that the bug still exists in this version of SCons by using the -C + option to run the broken build:: + + $ python bootstrap.py -C /home/me/broken_project . + +- Fix the bug in SCons by editing appropriate module files underneath + src/engine/SCons. + +- Confirm that you've fixed the bug affecting your project:: + + $ python bootstrap.py -C /home/me/broken_project . + +- Test to see if your fix had any unintended side effects that break existing + functionality:: + + $ python runtest.py -a -o test.log + + Be patient, there are more than 700 test scripts in the whole suite. If you + are on UNIX/Linux, you can use:: + + $ python runtest.py -a | tee test.log + + instead so you can monitor progress from your terminal. + + If any test scripts fail, they will be listed in a summary at the end of the + log file. Some test scripts may also report NO RESULT because (for example) + your local system is the wrong type or doesn't have some installed utilities + necessary to run the script. In general, you can ignore the NO RESULT list. + +- Cut-and-paste the list of failed tests into a file:: + + $ cat > failed.txt + test/failed-test-1.py + test/failed-test-2.py + test/failed-test-3.py + ^D + $ + +- Now debug the test failures and fix them, either by changing SCons, or by + making necessary changes to the tests (if, for example, you have a strong + reason to change functionality, or if you find that the bug really is in the + test script itself). After each change, use the runtest.py -f option to + examine the effects of the change on the subset of tests that originally + failed:: + + $ [edit] + $ python runtest.py -f failed.txt + + Repeat this until all of the tests that originally failed now pass. + +- Now you need to go back and validate that any changes you made while getting + the tests to pass didn't break the fix you originally put in, and didn't + introduce any *additional* unintended side effects that broke other tests:: + + $ python bootstrap.py -C /home/me/broken_project . + $ python runtest.py -a -o test.log + + If you find any newly-broken tests, add them to your "failed.txt" file and + go back to the previous step. + +Of course, the above is only one suggested workflow. In practice, there is a +lot of room for judgment and experience to make things go quicker. For +example, if you're making a change to just the Java support, you might start +looking for regressions by just running the test/Java/\*.py tests instead of +running all of "runtest.py -a". + + +Building Packages +================= + +We use SCons (version 0.96.93 later) to build its own packages. If you +already have an appropriate version of SCons installed on your system, you can +build everything by simply running it:: + + $ scons + +If you don't have SCons version 0.96.93 later already installed on your +system, you can use the supplied bootstrap.py script (see the section above +about `Executing SCons Without Installing`_):: + + $ python bootstrap.py build/scons + +Depending on the utilities installed on your system, any or all of the +following packages will be built:: + + build/dist/scons-2.0.0-1.noarch.rpm + build/dist/scons-2.0.0-1.src.rpm + build/dist/scons-2.0.0.linux-i686.tar.gz + build/dist/scons-2.1.0.alpha.yyyymmdd.tar.gz + build/dist/scons-2.1.0.alpha.yyyymmdd.win32.exe + build/dist/scons-2.1.0.alpha.yyyymmdd.zip + build/dist/scons-doc-2.1.0.alpha.yyyymmdd.tar.gz + build/dist/scons-local-2.1.0.alpha.yyyymmdd.tar.gz + build/dist/scons-local-2.1.0.alpha.yyyymmdd.zip + build/dist/scons-src-2.1.0.alpha.yyyymmdd.tar.gz + build/dist/scons-src-2.1.0.alpha.yyyymmdd.zip + build/dist/scons_1.3.0-1_all.deb + +The SConstruct file is supposed to be smart enough to avoid trying to build +packages for which you don't have the proper utilities installed. For +example, if you don't have Debian packaging tools installed, it should just +not build the .deb package, not fail the build. + +If you receive a build error, please report it to the scons-devel mailing list +and open a bug report on the SCons bug tracker. + +Note that in addition to creating the above packages, the default build will +also unpack one or more of the packages for testing. + + +Testing Packages +================ + +A full build will unpack and/or install any .deb, .rpm., .local.tar.gz, +.local.zip, .src.tar.gz, .src.zip, .tar.gz, and .zip packages into separate +build/test-\*/ subdirectories. (Of course, if a package was not built on your +system, it should not try to install it.) The runtest.py script supports a -p +option that will run the specified tests (individually or collectively via +the -a option) against the unpacked build/test-/\* subdirectory:: + + $ python runtest.py -p deb + + $ python runtest.py -p rpm + + $ python runtest.py -p local-tar-gz + + $ python runtest.py -p local-zip + + $ python runtest.py -p src-tar-gz + + $ python runtest.py -p src-zip + + $ python runtest.py -p tar-gz + + $ python runtest.py -p zip + +(The canonical invocation is to also use the runtest.py -a option so that all +tests are run against the specified package.) + + +Contents of this Package +======================== + +Not guaranteed to be up-to-date (but better than nothing): + +bench/ + A subdirectory for benchmarking scripts, used to perform timing tests + to decide what specific idioms are most efficient for various parts of + the code base. We check these in so they're available in case we have + to revisit any of these decisions in the future. + +bin/ + Miscellaneous utilities used in SCons development. Right now, + some of the stuff here includes: + + - a script that runs pychecker on our source tree; + + - a script that counts source and test files and numbers of lines in each; + + - a prototype script for capturing sample SCons output in xml files; + + - a script that can profile and time a packaging build of SCons itself; + + - a copy of xml_export, which can retrieve project data from SourceForge; + and + + - scripts and a Python module for translating the SCons home-brew XML + documentation tags into DocBook and man page format + + +bootstrap.py + Build script for running SCons from the current source code checkout. This + copies SCons files to bootstrap/ subdirectory, and then executes SCons + with the supplied command-line arguments. + +build/ + This doesn't exist yet if you're looking at a vanilla source tree. This + is generated as part of our build process, and it's where, believe it or + not, we *build* everything. + +debian/ + Files needed to construct a Debian package. The contents of this directory + are dictated by the Debian Policy Manual + (http://www.debian.org/doc/debian-policy). The package will not be + accepted into the Debian distribution unless the contents of this + directory satisfy the relevant Debian policies. + +doc/ + SCons documentation. A variety of things here, in various stages of + (in)completeness. + +gentoo/ + Stuff to generate files for Gentoo Linux. + +HOWTO/ + Documentation of SCons administrative procedures (making a change, + releasing a new version). Maybe other administrative stuff in the future. + +LICENSE + A copy of the copyright and terms under which SCons is distributed (the + Open Source Initiative-approved MIT license). + +LICENSE-local + A copy of the copyright and terms under which SCons is distributed for + inclusion in the scons-local-{version} packages. This is the same as + LICENSE with a preamble that specifies the licensing terms are for SCons + itself, not any other package that includes SCons. + +QMTest/ + The Python modules we use for testing, some generic modules originating + elsewhere and some specific to SCons. + +README.rst + What you're looking at right now. + +README-local + A README file for inclusion in the scons-local-{version} packages. + Similar to this file, but stripped down and modified for people looking at + including SCons in their shipped software. + +review.py + Script for uploading changes for review to Rietveld installation at + http://codereview.appspot.com + +rpm/ + The .spec file for building our RPM packages. + +runtest.py + Script for running SCons tests. By default, this will run a test against + the code in the local src/ tree, so you don't have to do a build before + testing your changes. + +SConstruct + The file describing to SCons how to build the SCons distribution. + + (It has been pointed out that it's hard to find the SCons API in this + SConstruct file, and that it looks a lot more like a pure Python script + than a build configuration file. That's mainly because all of the magick + we have to perform to deal with all of the different packaging formats + requires a lot of pure Python manipulation. In other words, don't look at + this file for an example of how easy it is to use SCons to build "normal" + software.) + +src/ + Where the actual source code is kept, of course. + +test/ + End-to-end tests of the SCons utility itself. These are separate from the + individual module unit tests, which live side-by-side with the modules + under src/. + + +Documentation +============= + +See the src/RELEASE.txt file for notes about this specific release, including +known problems. See the src/CHANGES.txt file for a list of changes since the +previous release. + +The doc/man/scons.1 man page is included in this package, and contains a +section of small examples for getting started using SCons. + +Additional documentation for SCons is available at: + + http://www.scons.org/documentation.php + + +Licensing +========= + +SCons is distributed under the MIT license, a full copy of which is available +in the LICENSE file. + + +Reporting Bugs +============== + +Please report bugs by following the detailed instructions on our Bug +Submission page: + + http://scons.tigris.org/bug-submission.html + +You can also send mail to the SCons developers' mailing list: + + dev@scons.tigris.org + +But even if you send email to the mailing list please make sure that you ALSO +submit a bug report to the project page bug tracker, because bug reports in +email often get overlooked in the general flood of messages. + + +Mailing Lists +============= + +An active mailing list for developers of SCons is available. You may +send questions or comments to the list at: + + dev@scons.tigris.org + +You may request a subscription to the developer's mailing list by sending +email to: + + dev-subscribe@scons.tigris.org + +Subscription to the developer's mailing list is by approval. In practice, no +one is refused list membership, but we reserve the right to limit membership +in the future and/or weed out lurkers. + +There is also a low-volume mailing list available for announcements about +SCons. Subscribe by sending email to: + + announce-subscribe@scons.tigris.org + +There are other mailing lists available for SCons users, for notification of +SCons code changes, and for notification of updated bug reports and project +documents. Please see our mailing lists page for details. + + +Donations +========= + +If you find SCons helpful, please consider making a donation (of cash, +software, or hardware) to support continued work on the project. Information +is available at: + + http://www.scons.org/donate.php + + +For More Information +==================== + +Check the SCons web site at: + + http://www.scons.org/ + + +Author Info +=========== + +Steven Knight, knight at baldmt dot com, http://www.baldmt.com/~knight/ + +With plenty of help from the SCons Development team: + +- Chad Austin +- Charles Crain +- William Deegan +- Steve Leblanc +- Greg Noel +- Gary Oberbrunner +- Anthony Roach +- Greg Spencer +- Christoph Wiedemann + + +__COPYRIGHT__ -- cgit v0.12 From 96a2d225da6ac739b11c40b2391eadd32f09e985 Mon Sep 17 00:00:00 2001 From: Russel Winder Date: Sat, 13 Oct 2012 15:56:37 +0100 Subject: Update the changes file prior to creating a pull request. --- src/CHANGES.txt | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 023338f..5633eec 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -5,11 +5,11 @@ Change Log From Russel Winder: - - Changes made to the dmd tool to allow for various breaking changes - made in D 1.068 and 2.053 to do with the introduction of 64-bit - builds of DMD. NB D v.1 is now deprecated. + - Revamp of the D language support. Tools for DMD, GDC and LDC provided + and integrated with the C and C++ linking. NB This is only tested with + D v2, D v1 is now deprecated. -RELEASE 2.X.X - +RELEASE 2.X.X - From Alexey Klimkin: - Fix nested LIBPATH expansion by flattening sequences in subst_path. @@ -34,7 +34,7 @@ RELEASE 2.X.X - * provided a new module rpmutils.py, wrapping the RPM naming rules for target files and further hardware-dependent info (compatibility, compiler flags, ...), - * added new test methods must_exist_one_of() and + * added new test methods must_exist_one_of() and must_not_exist_any_of() and * removed Aegis support from runtest.py. (#2872) @@ -45,7 +45,7 @@ RELEASE 2.X.X - From Rob Managan: - Updated the TeX builder to support the \newglossary command in LaTeX's glossaries package and the files it creates. - - Improve support for new versions of biblatex in the TeX builder + - Improve support for new versions of biblatex in the TeX builder so biber is called automatically if biblatex requires it. RELEASE 2.2.0 - Mon, 05 Aug 2012 15:37:48 +0000 @@ -78,11 +78,11 @@ RELEASE 2.2.0 - Mon, 05 Aug 2012 15:37:48 +0000 From Alexey Petruchik: - Support for Microsoft Visual Studio 11 (both using it and generating MSVS11 solution files). - + From Alexey Klimkin: - Fixed the Taskmaster, curing spurious build failures in multi-threaded runs (#2720). - + From Dirk Baechle: - Improved documentation of command-line variables (#2809). - Fixed scons-doc.py to properly convert main XML files (#2812). @@ -136,18 +136,18 @@ RELEASE 2.1.0 - Mon, 09 Sep 2011 20:54:57 -0700 - Fix Intel compiler to sort versions >9 correctly (esp. on Linux) - Fix Install() when the source and target are directories and the target directory exists. - + From David Garcia Garzon: - Fix Delete to be able to delete broken symlinks and dir symlinks. - + From Robert Lehr: - Handle .output file generated by bison/yacc properly. Cleaning it when necessary. From Antoine Dechaume: - Handle SWIG file where there is whitespace after the module name - properly. Previously the generated files would include + properly. Previously the generated files would include the whitespace. From Dmitry R.: @@ -170,7 +170,7 @@ RELEASE 2.1.0 - Mon, 09 Sep 2011 20:54:57 -0700 From Evgeny Podjachev and Alexey Petruchick: - - Support generation of Microsoft Visual Studio 2008 (9.0) + - Support generation of Microsoft Visual Studio 2008 (9.0) and 2010 (10.0) project and solution files. From Ken Deeter: @@ -272,13 +272,13 @@ RELEASE 2.1.0 - Mon, 09 Sep 2011 20:54:57 -0700 - The TeX builders should now work with tex files that are generated by another program. Thanks to Hans-Martin von Gaudecker for isolating the cause of this bug. - + - Added support for INDEXSTYLE environment variable so makeindex can find style files. - Added support for the bibunits package so we call bibtex on all the bu*.aux files. - + - Add support of finding path information on OSX for TeX applications MacPorts and Fink paths need to be added by the user @@ -362,7 +362,7 @@ RELEASE 2.0.0.final.0 - Mon, 14 Jun 2010 22:01:37 -0700 - Fix "Ignoring corrupt sconsign entry" warnings when building in a tree with a pre-2.0 .sconsign file. - - Fix propagation from environment of VS*COMNTOOLS to resolve issues + - Fix propagation from environment of VS*COMNTOOLS to resolve issues initializing MSVC/MSVS/SDK issues. - Handle detecting Visual C++ on Python verions with upper-case -- cgit v0.12 From 1c207c1d7c9b7b339f5dd2ad772c7c22e600e61b Mon Sep 17 00:00:00 2001 From: Robert Managan Date: Sat, 13 Oct 2012 11:16:29 -0700 Subject: Fix test for presence of biber and in several tests make variable names consistent with what we are testing the presence of --- test/TEX/biber_biblatex.py | 2 +- test/TEX/biblatex.py | 4 ++-- test/TEX/clean.py | 4 ++-- test/TEX/lstinputlisting.py | 4 ++-- test/TEX/multibib.py | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/TEX/biber_biblatex.py b/test/TEX/biber_biblatex.py index 94b0a6a..a63fb3f 100755 --- a/test/TEX/biber_biblatex.py +++ b/test/TEX/biber_biblatex.py @@ -40,7 +40,7 @@ if not latex: test.skip_test("Could not find 'pdflatex'; skipping test.\n") biber = test.where_is('biber') -if not latex: +if not biber: test.skip_test("Could not find 'biber'; skipping test.\n") gloss = os.system('kpsewhich biblatex.sty') diff --git a/test/TEX/biblatex.py b/test/TEX/biblatex.py index a70e103..a6fbd48 100755 --- a/test/TEX/biblatex.py +++ b/test/TEX/biblatex.py @@ -39,8 +39,8 @@ latex = test.where_is('pdflatex') if not latex: test.skip_test("Could not find 'pdflatex'; skipping test.\n") -gloss = os.system('kpsewhich biblatex.sty') -if not gloss==0: +biblatex = os.system('kpsewhich biblatex.sty') +if not biblatex==0: test.skip_test("biblatex.sty not installed; skipping test(s).\n") diff --git a/test/TEX/clean.py b/test/TEX/clean.py index 9250e4e..b0e5ee4 100644 --- a/test/TEX/clean.py +++ b/test/TEX/clean.py @@ -38,8 +38,8 @@ latex = test.where_is('latex') if not latex: test.skip_test("Could not find tex or latex; skipping test(s).\n") -gloss = os.system('kpsewhich comment.sty') -if not gloss==0: +comment = os.system('kpsewhich comment.sty') +if not comment==0: test.skip_test("comment.sty not installed; skipping test(s).\n") # package hyperref generates foo.out diff --git a/test/TEX/lstinputlisting.py b/test/TEX/lstinputlisting.py index 66676ed..fcfe5a8 100644 --- a/test/TEX/lstinputlisting.py +++ b/test/TEX/lstinputlisting.py @@ -41,8 +41,8 @@ pdflatex = test.where_is('pdflatex') if not pdflatex: test.skip_test("Could not find pdflatex; skipping test(s).\n") -gloss = os.system('kpsewhich listings.sty') -if not gloss==0: +listings = os.system('kpsewhich listings.sty') +if not listings==0: test.skip_test("listings.sty not installed; skipping test(s).\n") test.write(['SConstruct'], """\ diff --git a/test/TEX/multibib.py b/test/TEX/multibib.py index a2ae4ec..cdb9b87 100644 --- a/test/TEX/multibib.py +++ b/test/TEX/multibib.py @@ -39,8 +39,8 @@ latex = test.where_is('latex') if not latex: test.skip_test("Could not find 'latex'; skipping test.\n") -gloss = os.system('kpsewhich multibib.sty') -if not gloss==0: +multibib = os.system('kpsewhich multibib.sty') +if not multibib==0: test.skip_test("multibib.sty not installed; skipping test(s).\n") test.subdir(['src']) -- cgit v0.12 From e798100c16996b00c8761891e9462b60fb2350ec Mon Sep 17 00:00:00 2001 From: Gary Oberbrunner Date: Sun, 14 Oct 2012 00:18:35 +0100 Subject: Backed out changeset 87e2f40b59e3 (merge of D support updates) --- src/CHANGES.txt | 29 ++-- src/engine/MANIFEST-xml.in | 2 - src/engine/MANIFEST.in | 3 - src/engine/SCons/Tool/DCommon.py | 87 ----------- src/engine/SCons/Tool/__init__.py | 8 +- src/engine/SCons/Tool/dmd.py | 162 ++++++++++++++++----- src/engine/SCons/Tool/dmd.xml | 3 +- src/engine/SCons/Tool/gdc.py | 132 ----------------- src/engine/SCons/Tool/gdc.xml | 52 ------- src/engine/SCons/Tool/ldc.py | 138 ------------------ src/engine/SCons/Tool/ldc.xml | 52 ------- test/D/CoreScanner/Image/SConstruct_template | 9 -- test/D/CoreScanner/Image/ignored.d | 3 - test/D/CoreScanner/Image/module1.d | 3 - test/D/CoreScanner/Image/module2.d | 3 - test/D/CoreScanner/Image/module3.di | 3 - test/D/CoreScanner/Image/p/ignored.d | 3 - test/D/CoreScanner/Image/p/submodule1.d | 3 - test/D/CoreScanner/Image/p/submodule2.d | 3 - test/D/CoreScanner/Image/test1.d | 9 -- test/D/CoreScanner/Image/test2.d | 11 -- test/D/CoreScanner/common.py | 99 ------------- test/D/CoreScanner/sconstest-dmd.py | 37 ----- test/D/CoreScanner/sconstest-gdc.py | 37 ----- test/D/CoreScanner/sconstest-ldc.py | 37 ----- test/D/DMD2.py | 64 -------- test/D/GDC.py | 64 -------- test/D/HSTeoh/LinkingProblem/SConstruct_template | 20 --- test/D/HSTeoh/LinkingProblem/cprog.c | 7 - test/D/HSTeoh/LinkingProblem/ncurs_impl.c | 13 -- test/D/HSTeoh/LinkingProblem/prog.d | 14 -- test/D/HSTeoh/README.txt | 1 - .../SConstruct_template | 16 -- .../SingleStringCannotBeMultipleOptions/cmod.c | 5 - .../SingleStringCannotBeMultipleOptions/mod1.d | 6 - .../SingleStringCannotBeMultipleOptions/proj.d | 13 -- test/D/HSTeoh/linkingProblem_common.py | 61 -------- test/D/HSTeoh/sconstest-linkingProblem_dmd.py | 37 ----- test/D/HSTeoh/sconstest-linkingProblem_gdc.py | 37 ----- test/D/HSTeoh/sconstest-linkingProblem_ldc.py | 37 ----- ...test-singleStringCannotBeMultipleOptions_dmd.py | 37 ----- ...test-singleStringCannotBeMultipleOptions_gdc.py | 37 ----- ...test-singleStringCannotBeMultipleOptions_ldc.py | 37 ----- .../singleStringCannotBeMultipleOptions_common.py | 66 --------- .../Image/SConstruct_template | 9 -- .../CompileAndLinkOneStep/Image/helloWorld.d | 6 - test/D/HelloWorld/CompileAndLinkOneStep/common.py | 68 --------- .../CompileAndLinkOneStep/sconstest-dmd.py | 37 ----- .../CompileAndLinkOneStep/sconstest-gdc.py | 37 ----- .../CompileAndLinkOneStep/sconstest-ldc.py | 37 ----- .../Image/SConstruct_template | 11 -- .../CompileThenLinkTwoSteps/Image/helloWorld.d | 6 - .../D/HelloWorld/CompileThenLinkTwoSteps/common.py | 68 --------- .../CompileThenLinkTwoSteps/sconstest-dmd.py | 37 ----- .../CompileThenLinkTwoSteps/sconstest-gdc.py | 37 ----- .../CompileThenLinkTwoSteps/sconstest-ldc.py | 37 ----- test/D/LDC.py | 71 --------- test/D/MixedDAndC/Image/SConstruct | 13 -- test/D/MixedDAndC/Image/cmod.c | 3 - test/D/MixedDAndC/Image/dmod.d | 6 - test/D/MixedDAndC/Image/proj.d | 12 -- test/D/MixedDAndC/sconstest-mixedcompile.py | 44 ------ test/D/Support/executablesSearch.py | 37 ----- test/D/Support/sconstest.skip | 0 64 files changed, 144 insertions(+), 1932 deletions(-) delete mode 100644 src/engine/SCons/Tool/DCommon.py delete mode 100644 src/engine/SCons/Tool/gdc.py delete mode 100644 src/engine/SCons/Tool/gdc.xml delete mode 100644 src/engine/SCons/Tool/ldc.py delete mode 100644 src/engine/SCons/Tool/ldc.xml delete mode 100644 test/D/CoreScanner/Image/SConstruct_template delete mode 100644 test/D/CoreScanner/Image/ignored.d delete mode 100644 test/D/CoreScanner/Image/module1.d delete mode 100644 test/D/CoreScanner/Image/module2.d delete mode 100644 test/D/CoreScanner/Image/module3.di delete mode 100644 test/D/CoreScanner/Image/p/ignored.d delete mode 100644 test/D/CoreScanner/Image/p/submodule1.d delete mode 100644 test/D/CoreScanner/Image/p/submodule2.d delete mode 100644 test/D/CoreScanner/Image/test1.d delete mode 100644 test/D/CoreScanner/Image/test2.d delete mode 100644 test/D/CoreScanner/common.py delete mode 100644 test/D/CoreScanner/sconstest-dmd.py delete mode 100644 test/D/CoreScanner/sconstest-gdc.py delete mode 100644 test/D/CoreScanner/sconstest-ldc.py delete mode 100644 test/D/DMD2.py delete mode 100644 test/D/GDC.py delete mode 100644 test/D/HSTeoh/LinkingProblem/SConstruct_template delete mode 100644 test/D/HSTeoh/LinkingProblem/cprog.c delete mode 100644 test/D/HSTeoh/LinkingProblem/ncurs_impl.c delete mode 100644 test/D/HSTeoh/LinkingProblem/prog.d delete mode 100644 test/D/HSTeoh/README.txt delete mode 100644 test/D/HSTeoh/SingleStringCannotBeMultipleOptions/SConstruct_template delete mode 100644 test/D/HSTeoh/SingleStringCannotBeMultipleOptions/cmod.c delete mode 100644 test/D/HSTeoh/SingleStringCannotBeMultipleOptions/mod1.d delete mode 100644 test/D/HSTeoh/SingleStringCannotBeMultipleOptions/proj.d delete mode 100644 test/D/HSTeoh/linkingProblem_common.py delete mode 100644 test/D/HSTeoh/sconstest-linkingProblem_dmd.py delete mode 100644 test/D/HSTeoh/sconstest-linkingProblem_gdc.py delete mode 100644 test/D/HSTeoh/sconstest-linkingProblem_ldc.py delete mode 100644 test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_dmd.py delete mode 100644 test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_gdc.py delete mode 100644 test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_ldc.py delete mode 100644 test/D/HSTeoh/singleStringCannotBeMultipleOptions_common.py delete mode 100644 test/D/HelloWorld/CompileAndLinkOneStep/Image/SConstruct_template delete mode 100644 test/D/HelloWorld/CompileAndLinkOneStep/Image/helloWorld.d delete mode 100644 test/D/HelloWorld/CompileAndLinkOneStep/common.py delete mode 100644 test/D/HelloWorld/CompileAndLinkOneStep/sconstest-dmd.py delete mode 100644 test/D/HelloWorld/CompileAndLinkOneStep/sconstest-gdc.py delete mode 100644 test/D/HelloWorld/CompileAndLinkOneStep/sconstest-ldc.py delete mode 100644 test/D/HelloWorld/CompileThenLinkTwoSteps/Image/SConstruct_template delete mode 100644 test/D/HelloWorld/CompileThenLinkTwoSteps/Image/helloWorld.d delete mode 100644 test/D/HelloWorld/CompileThenLinkTwoSteps/common.py delete mode 100644 test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-dmd.py delete mode 100644 test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-gdc.py delete mode 100644 test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-ldc.py delete mode 100644 test/D/LDC.py delete mode 100644 test/D/MixedDAndC/Image/SConstruct delete mode 100644 test/D/MixedDAndC/Image/cmod.c delete mode 100644 test/D/MixedDAndC/Image/dmod.d delete mode 100644 test/D/MixedDAndC/Image/proj.d delete mode 100644 test/D/MixedDAndC/sconstest-mixedcompile.py delete mode 100644 test/D/Support/executablesSearch.py delete mode 100644 test/D/Support/sconstest.skip diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 5633eec..29cb6a3 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -4,12 +4,7 @@ Change Log - From Russel Winder: - - Revamp of the D language support. Tools for DMD, GDC and LDC provided - and integrated with the C and C++ linking. NB This is only tested with - D v2, D v1 is now deprecated. - -RELEASE 2.X.X - +RELEASE 2.X.X - From Alexey Klimkin: - Fix nested LIBPATH expansion by flattening sequences in subst_path. @@ -34,7 +29,7 @@ RELEASE 2.X.X - * provided a new module rpmutils.py, wrapping the RPM naming rules for target files and further hardware-dependent info (compatibility, compiler flags, ...), - * added new test methods must_exist_one_of() and + * added new test methods must_exist_one_of() and must_not_exist_any_of() and * removed Aegis support from runtest.py. (#2872) @@ -45,7 +40,7 @@ RELEASE 2.X.X - From Rob Managan: - Updated the TeX builder to support the \newglossary command in LaTeX's glossaries package and the files it creates. - - Improve support for new versions of biblatex in the TeX builder + - Improve support for new versions of biblatex in the TeX builder so biber is called automatically if biblatex requires it. RELEASE 2.2.0 - Mon, 05 Aug 2012 15:37:48 +0000 @@ -78,11 +73,11 @@ RELEASE 2.2.0 - Mon, 05 Aug 2012 15:37:48 +0000 From Alexey Petruchik: - Support for Microsoft Visual Studio 11 (both using it and generating MSVS11 solution files). - + From Alexey Klimkin: - Fixed the Taskmaster, curing spurious build failures in multi-threaded runs (#2720). - + From Dirk Baechle: - Improved documentation of command-line variables (#2809). - Fixed scons-doc.py to properly convert main XML files (#2812). @@ -136,18 +131,18 @@ RELEASE 2.1.0 - Mon, 09 Sep 2011 20:54:57 -0700 - Fix Intel compiler to sort versions >9 correctly (esp. on Linux) - Fix Install() when the source and target are directories and the target directory exists. - + From David Garcia Garzon: - Fix Delete to be able to delete broken symlinks and dir symlinks. - + From Robert Lehr: - Handle .output file generated by bison/yacc properly. Cleaning it when necessary. From Antoine Dechaume: - Handle SWIG file where there is whitespace after the module name - properly. Previously the generated files would include + properly. Previously the generated files would include the whitespace. From Dmitry R.: @@ -170,7 +165,7 @@ RELEASE 2.1.0 - Mon, 09 Sep 2011 20:54:57 -0700 From Evgeny Podjachev and Alexey Petruchick: - - Support generation of Microsoft Visual Studio 2008 (9.0) + - Support generation of Microsoft Visual Studio 2008 (9.0) and 2010 (10.0) project and solution files. From Ken Deeter: @@ -272,13 +267,13 @@ RELEASE 2.1.0 - Mon, 09 Sep 2011 20:54:57 -0700 - The TeX builders should now work with tex files that are generated by another program. Thanks to Hans-Martin von Gaudecker for isolating the cause of this bug. - + - Added support for INDEXSTYLE environment variable so makeindex can find style files. - Added support for the bibunits package so we call bibtex on all the bu*.aux files. - + - Add support of finding path information on OSX for TeX applications MacPorts and Fink paths need to be added by the user @@ -362,7 +357,7 @@ RELEASE 2.0.0.final.0 - Mon, 14 Jun 2010 22:01:37 -0700 - Fix "Ignoring corrupt sconsign entry" warnings when building in a tree with a pre-2.0 .sconsign file. - - Fix propagation from environment of VS*COMNTOOLS to resolve issues + - Fix propagation from environment of VS*COMNTOOLS to resolve issues initializing MSVC/MSVS/SDK issues. - Handle detecting Visual C++ on Python verions with upper-case diff --git a/src/engine/MANIFEST-xml.in b/src/engine/MANIFEST-xml.in index 4a39c7d..d2df751 100644 --- a/src/engine/MANIFEST-xml.in +++ b/src/engine/MANIFEST-xml.in @@ -41,7 +41,6 @@ SCons/Tool/g++.xml SCons/Tool/g77.xml SCons/Tool/gas.xml SCons/Tool/gcc.xml -SCons/Tool/gdc.xml SCons/Tool/gfortran.xml SCons/Tool/gnulink.xml SCons/Tool/gs.xml @@ -60,7 +59,6 @@ SCons/Tool/jar.xml SCons/Tool/javac.xml SCons/Tool/javah.xml SCons/Tool/latex.xml -SCons/Tool/ldc.xml SCons/Tool/lex.xml SCons/Tool/link.xml SCons/Tool/linkloc.xml diff --git a/src/engine/MANIFEST.in b/src/engine/MANIFEST.in index e180332..b12848a 100644 --- a/src/engine/MANIFEST.in +++ b/src/engine/MANIFEST.in @@ -76,7 +76,6 @@ SCons/Tool/c++.py SCons/Tool/cc.py SCons/Tool/cvf.py SCons/Tool/CVS.py -SCons/Tool/DCommon.py SCons/Tool/default.py SCons/Tool/dmd.py SCons/Tool/dvi.py @@ -93,7 +92,6 @@ SCons/Tool/g++.py SCons/Tool/g77.py SCons/Tool/gas.py SCons/Tool/gcc.py -SCons/Tool/gdc.py SCons/Tool/gfortran.py SCons/Tool/gnulink.py SCons/Tool/gs.py @@ -114,7 +112,6 @@ SCons/Tool/JavaCommon.py SCons/Tool/javac.py SCons/Tool/javah.py SCons/Tool/latex.py -SCons/Tool/ldc.py SCons/Tool/lex.py SCons/Tool/link.py SCons/Tool/linkloc.py diff --git a/src/engine/SCons/Tool/DCommon.py b/src/engine/SCons/Tool/DCommon.py deleted file mode 100644 index 10baa1f..0000000 --- a/src/engine/SCons/Tool/DCommon.py +++ /dev/null @@ -1,87 +0,0 @@ -"""SCons.Tool.DCommon - -Common code for the various D tools. - -Coded by Russel Winder (russel@winder.org.uk) -2012-09-06 -""" -# -# __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__" - -import os.path - -def isD(source): - if not source: - return 0 - for s in source: - if s.sources: - ext = os.path.splitext(str(s.sources[0]))[1] - if ext == '.d': - return 1 - return 0 - -def addDPATHToEnv(env, executable): - dPath = env.WhereIs(executable) - if dPath: - phobosDir = dPath[:dPath.rindex(executable)] + '/../src/phobos' - if os.path.isdir(phobosDir): - env.Append(DPATH=[phobosDir]) - -def setSmartLink(env, smart_link, smart_lib): - linkcom = env.get('LINKCOM') - try: - env['SMART_LINKCOM'] = smart_link[linkcom] - except KeyError: - def _smartLink(source, target, env, for_signature, defaultLinker=linkcom): - if isD(source): - # TODO: I'm not sure how to add a $DLINKCOMSTR variable - # so that it works with this _smartLink() logic, - # and I don't have a D compiler/linker to try it out, - # so we'll leave it alone for now. - return '$DLINKCOM' - else: - return defaultLinker - env['SMART_LINKCOM'] = smart_link[linkcom] = _smartLink - - arcom = env.get('ARCOM') - try: - env['SMART_ARCOM'] = smart_lib[arcom] - except KeyError: - def _smartLib(source, target, env, for_signature, defaultLib=arcom): - if isD(source): - # TODO: I'm not sure how to add a $DLIBCOMSTR variable - # so that it works with this _smartLib() logic, and - # I don't have a D compiler/archiver to try it out, - # so we'll leave it alone for now. - return '$DLIBCOM' - else: - return defaultLib - env['SMART_ARCOM'] = smart_lib[arcom] = _smartLib - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py index 969733c..5357959 100644 --- a/src/engine/SCons/Tool/__init__.py +++ b/src/engine/SCons/Tool/__init__.py @@ -563,7 +563,7 @@ def tool_list(platform, env): assemblers = ['masm', 'nasm', 'gas', '386asm' ] fortran_compilers = ['gfortran', 'g77', 'ifl', 'cvf', 'f95', 'f90', 'fortran'] ars = ['mslib', 'ar', 'tlib'] - other_plat_tools = ['msvs', 'midl'] + other_plat_tools=['msvs','midl'] elif str(platform) == 'os2': "prefer IBM tools on OS/2" linkers = ['ilink', 'gnulink', ]#'mslink'] @@ -645,10 +645,8 @@ def tool_list(platform, env): fortran_compiler = FindTool(fortran_compilers, env) or fortran_compilers[0] ar = FindTool(ars, env) or ars[0] - d_compilers = ['dmd', 'gdc', 'ldc'] - d_compiler = FindTool(d_compilers, env) or d_compilers[0] - other_tools = FindAllTools(other_plat_tools + [ + 'dmd', #TODO: merge 'install' into 'filesystem' and # make 'filesystem' the default 'filesystem', @@ -671,7 +669,7 @@ def tool_list(platform, env): ], env) tools = ([linker, c_compiler, cxx_compiler, - fortran_compiler, assembler, ar, d_compiler] + fortran_compiler, assembler, ar] + other_tools) return [x for x in tools if x] diff --git a/src/engine/SCons/Tool/dmd.py b/src/engine/SCons/Tool/dmd.py index 8329696..a8faf5d 100644 --- a/src/engine/SCons/Tool/dmd.py +++ b/src/engine/SCons/Tool/dmd.py @@ -3,14 +3,14 @@ Tool-specific initialization for the Digital Mars D compiler. (http://digitalmars.com/d) -Originally coded by Andy Friesen (andy@ikagames.com) +Coded by Andy Friesen (andy@ikagames.com) 15 November 2003 -Evolved by Russel Winder (russel@winder.org.uk) -2010-02-07, 2010-11-17, 2011-02, 2011-05-14, 2012-05-08, 2012-09-02, 2012-09-06 +Amended by Russel Winder (russel@russel.org.uk) +2010-02-07 There are a number of problems with this script at this point in time. -The one that irritates the most is the Windows linker setup. The D +The one that irritates me the most is the Windows linker setup. The D linker doesn't have a way to add lib paths on the commandline, as far as I can see. You have to specify paths relative to the SConscript or use absolute paths. To hack around it, add '#/blah'. This will link @@ -60,7 +60,6 @@ Lib tool variables: __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os -import subprocess import SCons.Action import SCons.Builder @@ -68,12 +67,26 @@ import SCons.Defaults import SCons.Scanner.D import SCons.Tool -import SCons.Tool.DCommon +# Adapted from c++.py +def isD(source): + if not source: + return 0 + + for s in source: + if s.sources: + ext = os.path.splitext(str(s.sources[0]))[1] + if ext == '.d': + return 1 + return 0 smart_link = {} + smart_lib = {} def generate(env): + global smart_link + global smart_lib + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) DAction = SCons.Action.Action('$DCOM', '$DCOMSTR') @@ -97,7 +110,14 @@ def generate(env): env['DDEBUG'] = [] if dc: - SCons.Tool.DCommon.addDPATHToEnv(env, dc) + # Add the path to the standard library. + # This is merely for the convenience of the dependency scanner. + dmd_path = env.WhereIs(dc) + if dmd_path: + x = dmd_path.rindex(dc) + phobosDir = dmd_path[:x] + '/../src/phobos' + if os.path.isdir(phobosDir): + env.Append(DPATH = [phobosDir]) env['DINCPREFIX'] = '-I' env['DINCSUFFIX'] = '' @@ -109,34 +129,106 @@ def generate(env): env['DFLAGSUFFIX'] = '' env['DFILESUFFIX'] = '.d' - env['DLINK'] = '$DC' - env['DLINKCOM'] = '$DLINK -of$TARGET $SOURCES $DFLAGS $DLINKFLAGS $_DLINKLIBFLAGS' - env['DLIB'] = 'lib' - env['DLIBCOM'] = '$DLIB $_DLIBFLAGS -c $TARGET $SOURCES $_DLINKLIBFLAGS' - - env['_DLINKLIBFLAGS'] = '$( ${_concat(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' - env['_DLIBFLAGS'] = '$( ${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)} $)' - env['DLINKFLAGS'] = [] - env['DLIBLINKPREFIX'] = '' if env['PLATFORM'] == 'win32' else '-L-l' - env['DLIBLINKSUFFIX'] = '.lib' if env['PLATFORM'] == 'win32' else '' - env['DLIBFLAGPREFIX'] = '-' - env['DLIBFLAGSUFFIX'] = '' - env['DLINKFLAGPREFIX'] = '-' - env['DLINKFLAGSUFFIX'] = '' - - SCons.Tool.createStaticLibBuilder(env) - - # Basically, we hijack the link and ar builders with our own. - # these builders check for the presence of D source, and swap out - # the system's defaults for the Digital Mars tools. If there's no D - # source, then we silently return the previous settings. - SCons.Tool.DCommon.setSmartLink(env, smart_link, smart_lib) - - # It is worth noting that the final space in these strings is - # absolutely pivotal. SCons sees these as actions and not generators - # if it is not there. (very bad) - env['ARCOM'] = '$SMART_ARCOM ' - env['LINKCOM'] = '$SMART_LINKCOM ' + # Need to use the Digital Mars linker/lib on windows. + # *nix can just use GNU link. + if env['PLATFORM'] == 'win32': + env['DLINK'] = '$DC' + env['DLINKCOM'] = '$DLINK -of$TARGET $SOURCES $DFLAGS $DLINKFLAGS $_DLINKLIBFLAGS' + env['DLIB'] = 'lib' + env['DLIBCOM'] = '$DLIB $_DLIBFLAGS -c $TARGET $SOURCES $_DLINKLIBFLAGS' + + env['_DLINKLIBFLAGS'] = '$( ${_concat(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' + env['_DLIBFLAGS'] = '$( ${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)} $)' + env['DLINKFLAGS'] = [] + env['DLIBLINKPREFIX'] = '' + env['DLIBLINKSUFFIX'] = '.lib' + env['DLIBFLAGPREFIX'] = '-' + env['DLIBFLAGSUFFIX'] = '' + env['DLINKFLAGPREFIX'] = '-' + env['DLINKFLAGSUFFIX'] = '' + + SCons.Tool.createStaticLibBuilder(env) + + # Basically, we hijack the link and ar builders with our own. + # these builders check for the presence of D source, and swap out + # the system's defaults for the Digital Mars tools. If there's no D + # source, then we silently return the previous settings. + linkcom = env.get('LINKCOM') + try: + env['SMART_LINKCOM'] = smart_link[linkcom] + except KeyError: + def _smartLink(source, target, env, for_signature, + defaultLinker=linkcom): + if isD(source): + # XXX I'm not sure how to add a $DLINKCOMSTR variable + # so that it works with this _smartLink() logic, + # and I don't have a D compiler/linker to try it out, + # so we'll leave it alone for now. + return '$DLINKCOM' + else: + return defaultLinker + env['SMART_LINKCOM'] = smart_link[linkcom] = _smartLink + + arcom = env.get('ARCOM') + try: + env['SMART_ARCOM'] = smart_lib[arcom] + except KeyError: + def _smartLib(source, target, env, for_signature, + defaultLib=arcom): + if isD(source): + # XXX I'm not sure how to add a $DLIBCOMSTR variable + # so that it works with this _smartLib() logic, and + # I don't have a D compiler/archiver to try it out, + # so we'll leave it alone for now. + return '$DLIBCOM' + else: + return defaultLib + env['SMART_ARCOM'] = smart_lib[arcom] = _smartLib + + # It is worth noting that the final space in these strings is + # absolutely pivotal. SCons sees these as actions and not generators + # if it is not there. (very bad) + env['ARCOM'] = '$SMART_ARCOM ' + env['LINKCOM'] = '$SMART_LINKCOM ' + else: # assuming linux + linkcom = env.get('LINKCOM') + try: + env['SMART_LINKCOM'] = smart_link[linkcom] + except KeyError: + def _smartLink(source, target, env, for_signature, + defaultLinker=linkcom, dc=dc): + if isD(source): + try: + libs = env['LIBS'] + except KeyError: + libs = [] + if dc == 'dmd': + # TODO: This assumes that the dmd executable is in the + # bin directory and that the libraries are in a peer + # directory lib. This true of the Digital Mars + # distribution but . . . + import glob + dHome = env.WhereIs(dc).replace('/dmd' , '/..') + if glob.glob(dHome + '/lib/*phobos2*'): + if 'phobos2' not in libs: + env.Append(LIBPATH = [dHome + '/lib']) + env.Append(LIBS = ['phobos2']) + # TODO: Find out when there will be a + # 64-bit version of D. + env.Append(LINKFLAGS = ['-m32']) + else: + if 'phobos' not in libs: + env.Append(LIBS = ['phobos']) + elif dc is 'gdmd': + env.Append(LIBS = ['gphobos']) + if 'pthread' not in libs: + env.Append(LIBS = ['pthread']) + if 'm' not in libs: + env.Append(LIBS = ['m']) + return defaultLinker + env['SMART_LINKCOM'] = smart_link[linkcom] = _smartLink + + env['LINKCOM'] = '$SMART_LINKCOM ' def exists(env): return env.Detect(['dmd', 'gdmd']) diff --git a/src/engine/SCons/Tool/dmd.xml b/src/engine/SCons/Tool/dmd.xml index fd2a8c6..835a4eb 100644 --- a/src/engine/SCons/Tool/dmd.xml +++ b/src/engine/SCons/Tool/dmd.xml @@ -6,7 +6,8 @@ See its __doc__ string for a discussion of the format. --> -Sets construction variables for the D language compiler DMD or GDMD. +Sets construction variables for D language compilers +(the Digital Mars D compiler, or GDC). - - -Sets construction variables for the D language compiler GDC. - - - - - - - diff --git a/src/engine/SCons/Tool/ldc.py b/src/engine/SCons/Tool/ldc.py deleted file mode 100644 index cc197ab..0000000 --- a/src/engine/SCons/Tool/ldc.py +++ /dev/null @@ -1,138 +0,0 @@ -"""SCons.Tool.ldc - -Tool-specific initialization for the LDC compiler. -(http://www.dsource.org/projects/ldc) - -Coded by Russel Winder (russel@winder.org.uk) -2012-05-09, 2012-09-06 - -Compiler variables: - DC - The name of the D compiler to use. Defaults to ldc2. - DPATH - List of paths to search for import modules. - DVERSIONS - List of version tags to enable when compiling. - DDEBUG - List of debug tags to enable when compiling. - -Linker related variables: - LIBS - List of library files to link in. - DLINK - Name of the linker to use. Defaults to gcc. - DLINKFLAGS - List of linker flags. - -Lib tool variables: - DLIB - Name of the lib tool to use. Defaults to lib. - DLIBFLAGS - List of flags to pass to the lib tool. - LIBS - Same as for the linker. (libraries to pull into the .lib) -""" - -# -# __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__" - -import os -import subprocess - -import SCons.Action -import SCons.Builder -import SCons.Defaults -import SCons.Scanner.D -import SCons.Tool - -import SCons.Tool.DCommon - -smart_link = {} -smart_lib = {} - -def generate(env): - static_obj, shared_obj = SCons.Tool.createObjBuilders(env) - - DAction = SCons.Action.Action('$DCOM', '$DCOMSTR') - - static_obj.add_action('.d', DAction) - shared_obj.add_action('.d', DAction) - static_obj.add_emitter('.d', SCons.Defaults.StaticObjectEmitter) - shared_obj.add_emitter('.d', SCons.Defaults.SharedObjectEmitter) - - dc = env.Detect('ldc2') - env['DC'] = dc - env['DCOM'] = '$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -c -of=$TARGET $SOURCES' - env['_DINCFLAGS'] = '$( ${_concat(DINCPREFIX, DPATH, DINCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' - env['_DVERFLAGS'] = '$( ${_concat(DVERPREFIX, DVERSIONS, DVERSUFFIX, __env__)} $)' - env['_DDEBUGFLAGS'] = '$( ${_concat(DDEBUGPREFIX, DDEBUG, DDEBUGSUFFIX, __env__)} $)' - env['_DFLAGS'] = '$( ${_concat(DFLAGPREFIX, DFLAGS, DFLAGSUFFIX, __env__)} $)' - - env['DPATH'] = ['#/'] - env['DFLAGS'] = [] - env['DVERSIONS'] = [] - env['DDEBUG'] = [] - - if dc: - SCons.Tool.DCommon.addDPATHToEnv(env, dc) - - env['DINCPREFIX'] = '-I=' - env['DINCSUFFIX'] = '' - env['DVERPREFIX'] = '-version=' - env['DVERSUFFIX'] = '' - env['DDEBUGPREFIX'] = '-debug=' - env['DDEBUGSUFFIX'] = '' - env['DFLAGPREFIX'] = '-' - env['DFLAGSUFFIX'] = '' - env['DFILESUFFIX'] = '.d' - - env['DLINK'] = '$DC' - env['DLINKCOM'] = '$DLINK -of$TARGET $SOURCES $DFLAGS $DLINKFLAGS $_DLINKLIBFLAGS' - env['DLIB'] = 'lib' - env['DLIBCOM'] = '$DLIB $_DLIBFLAGS -c $TARGET $SOURCES $_DLINKLIBFLAGS' - - env['_DLINKLIBFLAGS'] = '$( ${_concat(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' - env['_DLIBFLAGS'] = '$( ${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)} $)' - env['DLINKFLAGS'] = [] - env['DLIBLINKPREFIX'] = '' if env['PLATFORM'] == 'win32' else '-L-l' - env['DLIBLINKSUFFIX'] = '.lib' if env['PLATFORM'] == 'win32' else '' - env['DLIBFLAGPREFIX'] = '-' - env['DLIBFLAGSUFFIX'] = '' - env['DLINKFLAGPREFIX'] = '-' - env['DLINKFLAGSUFFIX'] = '' - - SCons.Tool.createStaticLibBuilder(env) - - # Basically, we hijack the link and ar builders with our own. - # these builders check for the presence of D source, and swap out - # the system's defaults for the Digital Mars tools. If there's no D - # source, then we silently return the previous settings. - SCons.Tool.DCommon.setSmartLink(env, smart_link, smart_lib) - - # It is worth noting that the final space in these strings is - # absolutely pivotal. SCons sees these as actions and not generators - # if it is not there. (very bad) - env['ARCOM'] = '$SMART_ARCOM ' - env['LINKCOM'] = '$SMART_LINKCOM ' - - -def exists(env): - return env.Detect('ldc2') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/src/engine/SCons/Tool/ldc.xml b/src/engine/SCons/Tool/ldc.xml deleted file mode 100644 index 6785dad..0000000 --- a/src/engine/SCons/Tool/ldc.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - -Sets construction variables for the D language compiler LDC2. - - - - - - - diff --git a/test/D/CoreScanner/Image/SConstruct_template b/test/D/CoreScanner/Image/SConstruct_template deleted file mode 100644 index a128c67..0000000 --- a/test/D/CoreScanner/Image/SConstruct_template +++ /dev/null @@ -1,9 +0,0 @@ -# -*- mode:python; coding:utf-8; -*- - -import os - -environment = Environment( - ENV=os.environ, - tools=['link', '{}']) -environment.Program('test1.d') -environment.Program('test2.d') diff --git a/test/D/CoreScanner/Image/ignored.d b/test/D/CoreScanner/Image/ignored.d deleted file mode 100644 index 5b54a07..0000000 --- a/test/D/CoreScanner/Image/ignored.d +++ /dev/null @@ -1,3 +0,0 @@ -module ignored; - -int something; diff --git a/test/D/CoreScanner/Image/module1.d b/test/D/CoreScanner/Image/module1.d deleted file mode 100644 index 487c358..0000000 --- a/test/D/CoreScanner/Image/module1.d +++ /dev/null @@ -1,3 +0,0 @@ -module module1; - -int something; diff --git a/test/D/CoreScanner/Image/module2.d b/test/D/CoreScanner/Image/module2.d deleted file mode 100644 index 198fb74..0000000 --- a/test/D/CoreScanner/Image/module2.d +++ /dev/null @@ -1,3 +0,0 @@ -module module2; - -int something; diff --git a/test/D/CoreScanner/Image/module3.di b/test/D/CoreScanner/Image/module3.di deleted file mode 100644 index effd4eb..0000000 --- a/test/D/CoreScanner/Image/module3.di +++ /dev/null @@ -1,3 +0,0 @@ -module module3; - -int something; diff --git a/test/D/CoreScanner/Image/p/ignored.d b/test/D/CoreScanner/Image/p/ignored.d deleted file mode 100644 index 43d2bd8..0000000 --- a/test/D/CoreScanner/Image/p/ignored.d +++ /dev/null @@ -1,3 +0,0 @@ -module p.ignored; - -int something; diff --git a/test/D/CoreScanner/Image/p/submodule1.d b/test/D/CoreScanner/Image/p/submodule1.d deleted file mode 100644 index 1ec0369..0000000 --- a/test/D/CoreScanner/Image/p/submodule1.d +++ /dev/null @@ -1,3 +0,0 @@ -module p.submodule1; - -int something; diff --git a/test/D/CoreScanner/Image/p/submodule2.d b/test/D/CoreScanner/Image/p/submodule2.d deleted file mode 100644 index 57a2825..0000000 --- a/test/D/CoreScanner/Image/p/submodule2.d +++ /dev/null @@ -1,3 +0,0 @@ -module p.submodule2; - -int something; diff --git a/test/D/CoreScanner/Image/test1.d b/test/D/CoreScanner/Image/test1.d deleted file mode 100644 index d386d97..0000000 --- a/test/D/CoreScanner/Image/test1.d +++ /dev/null @@ -1,9 +0,0 @@ -import module1; -import module2; -import module3; -import p.submodule1; -import p.submodule2; - -int main() { - return 0; -} diff --git a/test/D/CoreScanner/Image/test2.d b/test/D/CoreScanner/Image/test2.d deleted file mode 100644 index f880d2f..0000000 --- a/test/D/CoreScanner/Image/test2.d +++ /dev/null @@ -1,11 +0,0 @@ -import - module1, - module2, - module3; -import - p.submodule1, - p.submodule2; - -int main() { - return 0; -} diff --git a/test/D/CoreScanner/common.py b/test/D/CoreScanner/common.py deleted file mode 100644 index 821e4df..0000000 --- a/test/D/CoreScanner/common.py +++ /dev/null @@ -1,99 +0,0 @@ -""" -Verify that the D scanner can return multiple modules imported by -a single statement. -""" - -# -# __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__" - -import TestSCons - -from os.path import abspath, dirname - -import sys -sys.path.insert(1, abspath(dirname(__file__) + '/../Support')) - -from executablesSearch import isExecutableOfToolAvailable - -def testForTool(tool): - - test = TestSCons.TestSCons() - - _obj = TestSCons._obj - - if not isExecutableOfToolAvailable(test, tool) : - test.skip_test("Required executable for tool '{}' not found, skipping test.\n".format(tool)) - - test.dir_fixture('Image') - test.write('SConstruct', open('SConstruct_template', 'r').read().format(tool)) - - arguments = 'test1%(_obj)s test2%(_obj)s' % locals() - - if tool == 'dmd': - # The gdmd executable in Debian Unstable as at 2012-05-12, version 4.6.3 puts out messages on stderr - # that cause inappropriate failure of the tests, so simply ignore them. - test.run(arguments=arguments, stderr=None) - else: - test.run(arguments=arguments) - - test.up_to_date(arguments=arguments) - - test.write(['module2.d'], """\ -module module2; - -int something_else; -""") - - if tool == 'dmd': - # The gdmd executable in Debian Unstable as at 2012-05-12, version 4.6.3 puts out messages on stderr - # that cause inappropriate failure of the tests, so simply ignore them. - test.not_up_to_date(arguments=arguments, stderr=None) - else: - test.not_up_to_date(arguments=arguments) - - test.up_to_date(arguments=arguments) - - test.write(['p', 'submodule2.d'], """\ -module p.submodule2; - -int something_else; -""") - - if tool == 'dmd': - # The gdmd executable in Debian Unstable as at 2012-05-12, version 4.6.3 puts out messages on stderr - # that cause inappropriate failure of the tests, so simply ignore them. - test.not_up_to_date(arguments=arguments, stderr=None) - else: - test.not_up_to_date(arguments=arguments) - - test.up_to_date(arguments=arguments) - - test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/CoreScanner/sconstest-dmd.py b/test/D/CoreScanner/sconstest-dmd.py deleted file mode 100644 index 7ee8955..0000000 --- a/test/D/CoreScanner/sconstest-dmd.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Test compiling and executing using the dmd tool. -""" - -# -# __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__" - -from common import testForTool -testForTool('dmd') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/CoreScanner/sconstest-gdc.py b/test/D/CoreScanner/sconstest-gdc.py deleted file mode 100644 index d6a7bee..0000000 --- a/test/D/CoreScanner/sconstest-gdc.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Test compiling and executing using the gdc tool. -""" - -# -# __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__" - -from common import testForTool -testForTool('gdc') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/CoreScanner/sconstest-ldc.py b/test/D/CoreScanner/sconstest-ldc.py deleted file mode 100644 index 4b90d07..0000000 --- a/test/D/CoreScanner/sconstest-ldc.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Test compiling and executing using the ldc tool. -""" - -# -# __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__" - -from common import testForTool -testForTool('ldc') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/DMD2.py b/test/D/DMD2.py deleted file mode 100644 index cc8ab93..0000000 --- a/test/D/DMD2.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/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. -# - -# Amended by Russel Winder 2010-05-05 - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -import TestSCons - -_exe = TestSCons._exe -test = TestSCons.TestSCons() - -if not test.where_is('dmd') and not test.where_is('gdmd'): - test.skip_test("Could not find 'dmd' or 'gdmd', skipping test.\n") - -test.write('SConstruct', """\ -import os -env = Environment(tools=['link', 'dmd'], ENV=os.environ) -if env['PLATFORM'] == 'cygwin': env['OBJSUFFIX'] = '.obj' # trick DMD -env.Program('foo', 'foo.d') -""") - -test.write('foo.d', """\ -import std.stdio; -int main(string[] args) { - printf("Hello!"); - return 0; -} -""") - -test.run() - -test.run(program=test.workpath('foo'+_exe)) - -test.fail_test(not test.stdout() == 'Hello!') - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/GDC.py b/test/D/GDC.py deleted file mode 100644 index e24ec43..0000000 --- a/test/D/GDC.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/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. -# - -# Amended by Russel Winder 2010-05-05 - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -import TestSCons - -_exe = TestSCons._exe -test = TestSCons.TestSCons() - -if not test.where_is('gdc'): - test.skip_test("Could not find 'gdc', skipping test.\n") - -test.write('SConstruct', """\ -import os -env = Environment(tools=['link', 'gdc'], ENV=os.environ) -if env['PLATFORM'] == 'cygwin': env['OBJSUFFIX'] = '.obj' # trick DMD -env.Program('foo', 'foo.d') -""") - -test.write('foo.d', """\ -import std.stdio; -int main(string[] args) { - printf("Hello!"); - return 0; -} -""") - -test.run() - -test.run(program=test.workpath('foo'+_exe)) - -test.fail_test(not test.stdout() == 'Hello!') - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HSTeoh/LinkingProblem/SConstruct_template b/test/D/HSTeoh/LinkingProblem/SConstruct_template deleted file mode 100644 index 6815cdf..0000000 --- a/test/D/HSTeoh/LinkingProblem/SConstruct_template +++ /dev/null @@ -1,20 +0,0 @@ -# -*- mode:python; coding=utf-8; -*- - -import os - -environment = Environment( - ENV=os.environ, - tools = ['cc', 'link' , '{}'], - LIBS = ['ncurses']) - -environment.Object('ncurs_impl.o', 'ncurs_impl.c') - -environment.Program('prog', Split(""" - prog.d - ncurs_impl.o -""")) - -environment.Program('cprog', Split(""" - cprog.c - ncurs_impl.o -""")) diff --git a/test/D/HSTeoh/LinkingProblem/cprog.c b/test/D/HSTeoh/LinkingProblem/cprog.c deleted file mode 100644 index 0871609..0000000 --- a/test/D/HSTeoh/LinkingProblem/cprog.c +++ /dev/null @@ -1,7 +0,0 @@ -extern int ncurs_init(); -extern int ncurs_cleanup(); - -int main() { - ncurs_init(); - ncurs_cleanup(); -} diff --git a/test/D/HSTeoh/LinkingProblem/ncurs_impl.c b/test/D/HSTeoh/LinkingProblem/ncurs_impl.c deleted file mode 100644 index 01b6acb..0000000 --- a/test/D/HSTeoh/LinkingProblem/ncurs_impl.c +++ /dev/null @@ -1,13 +0,0 @@ -/* Ncurses wrappers */ -#include - -int ncurs_init() { - initscr(); - cbreak(); - noecho(); - keypad(stdscr, TRUE); -} - -int ncurs_cleanup() { - endwin(); -} diff --git a/test/D/HSTeoh/LinkingProblem/prog.d b/test/D/HSTeoh/LinkingProblem/prog.d deleted file mode 100644 index a6b2c85..0000000 --- a/test/D/HSTeoh/LinkingProblem/prog.d +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Simple D program that links to ncurses via a C wrapping file. - */ - -extern(C) { - int ncurs_init(); - int ncurs_cleanup(); -} - -void main() { - ncurs_init(); - ncurs_cleanup(); -} - diff --git a/test/D/HSTeoh/README.txt b/test/D/HSTeoh/README.txt deleted file mode 100644 index cb18b88..0000000 --- a/test/D/HSTeoh/README.txt +++ /dev/null @@ -1 +0,0 @@ -The tests here are evolutions of test cases provided by H.S.Teoh via email. diff --git a/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/SConstruct_template b/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/SConstruct_template deleted file mode 100644 index 89c603b..0000000 --- a/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/SConstruct_template +++ /dev/null @@ -1,16 +0,0 @@ -# -*- mode:python; coding=utf-8; -*- - -import os - -environment = Environment( - ENV=os.environ, - tools=['link', '{}'], - # It might be thought that a single string can contain multiple options space separated. Actually this - # is deemed to be a single option, so leads to an error. - DFLAGS = '-m64 -O') - -environment.Program('proj', Split(""" -proj.d -mod1.d -cmod.c -""")) diff --git a/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/cmod.c b/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/cmod.c deleted file mode 100644 index 41c57f3..0000000 --- a/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/cmod.c +++ /dev/null @@ -1,5 +0,0 @@ -/* This is a sample C module. */ - -int csqr(int arg) { - return arg*arg; -} diff --git a/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/mod1.d b/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/mod1.d deleted file mode 100644 index 5f61802..0000000 --- a/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/mod1.d +++ /dev/null @@ -1,6 +0,0 @@ -module mod1; -import std.stdio; - -void print_msg() { - writeln("Hello, this is a test program for the new SCons D support"); -} diff --git a/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/proj.d b/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/proj.d deleted file mode 100644 index e97f9dd..0000000 --- a/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/proj.d +++ /dev/null @@ -1,13 +0,0 @@ -import std.stdio; -import mod1; - -extern(C) { - int csqr(int arg); -} - -void main() { - print_msg(); - - auto i = 17; - writefln("The square of %d is %d", i, csqr(i)); -} diff --git a/test/D/HSTeoh/linkingProblem_common.py b/test/D/HSTeoh/linkingProblem_common.py deleted file mode 100644 index cb012ac..0000000 --- a/test/D/HSTeoh/linkingProblem_common.py +++ /dev/null @@ -1,61 +0,0 @@ -""" -These tests check an issue with the LIBS environment variable. -""" - -# -# __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__" - -import TestSCons - -from os.path import abspath, dirname - -import sys -sys.path.insert(1, abspath(dirname(__file__) + '/../Support')) - -from executablesSearch import isExecutableOfToolAvailable - -def testForTool(tool): - - test = TestSCons.TestSCons() - - if not isExecutableOfToolAvailable(test, tool) : - test.skip_test("Required executable for tool '{}' not found, skipping test.\n".format(tool)) - - test.dir_fixture('LinkingProblem') - test.write('SConstruct', open('SConstruct_template', 'r').read().format(tool)) - - test.run() - - test.must_exist(test.workpath('ncurs_impl.o')) - test.must_exist(test.workpath('cprog')) - test.must_exist(test.workpath('prog')) - - test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HSTeoh/sconstest-linkingProblem_dmd.py b/test/D/HSTeoh/sconstest-linkingProblem_dmd.py deleted file mode 100644 index ba9608a..0000000 --- a/test/D/HSTeoh/sconstest-linkingProblem_dmd.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Test compiling and executing using the gdc tool. -""" - -# -# __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__" - -from linkingProblem_common import testForTool -testForTool('dmd') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HSTeoh/sconstest-linkingProblem_gdc.py b/test/D/HSTeoh/sconstest-linkingProblem_gdc.py deleted file mode 100644 index 94a9aa1..0000000 --- a/test/D/HSTeoh/sconstest-linkingProblem_gdc.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Test compiling and executing using the gdc tool. -""" - -# -# __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__" - -from linkingProblem_common import testForTool -testForTool('gdc') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HSTeoh/sconstest-linkingProblem_ldc.py b/test/D/HSTeoh/sconstest-linkingProblem_ldc.py deleted file mode 100644 index 28ee64d..0000000 --- a/test/D/HSTeoh/sconstest-linkingProblem_ldc.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Test compiling and executing using the ldc tool. -""" - -# -# __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__" - -from linkingProblem_common import testForTool -testForTool('ldc') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_dmd.py b/test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_dmd.py deleted file mode 100644 index 83fc3f2..0000000 --- a/test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_dmd.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Test compiling and executing using the dmd tool. -""" - -# -# __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__" - -from singleStringCannotBeMultipleOptions_common import testForTool -testForTool('dmd') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_gdc.py b/test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_gdc.py deleted file mode 100644 index 55008fe..0000000 --- a/test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_gdc.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Test compiling and executing using the gdc tool. -""" - -# -# __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__" - -from singleStringCannotBeMultipleOptions_common import testForTool -testForTool('gdc') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_ldc.py b/test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_ldc.py deleted file mode 100644 index 1912713..0000000 --- a/test/D/HSTeoh/sconstest-singleStringCannotBeMultipleOptions_ldc.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Test compiling and executing using the ldc tool. -""" - -# -# __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__" - -from singleStringCannotBeMultipleOptions_common import testForTool -testForTool('ldc') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HSTeoh/singleStringCannotBeMultipleOptions_common.py b/test/D/HSTeoh/singleStringCannotBeMultipleOptions_common.py deleted file mode 100644 index e01e2d6..0000000 --- a/test/D/HSTeoh/singleStringCannotBeMultipleOptions_common.py +++ /dev/null @@ -1,66 +0,0 @@ -""" -These tests verify that SCons fails appropriately where the user has tried to supply multiple command line -options via a single string rather than providing a list of strings, one string per option. -""" - -# -# __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__" - -import TestSCons - -from os.path import abspath, dirname - -import sys -sys.path.insert(1, abspath(dirname(__file__) + '/../Support')) - -from executablesSearch import isExecutableOfToolAvailable - -def testForTool(tool): - - test = TestSCons.TestSCons() - - if not isExecutableOfToolAvailable(test, tool) : - test.skip_test("Required executable for tool '{}' not found, skipping test.\n".format(tool)) - - test.dir_fixture('SingleStringCannotBeMultipleOptions') - test.write('SConstruct', open('SConstruct_template', 'r').read().format(tool)) - - test.run(status=2, stdout=None, stderr=None) - - result = { - 'dmd': ".*unrecognized switch '-m64 -O'.*", - 'gdc': ".*unrecognized command line option.*", - 'ldc': ".*Unknown command line argument '-m64 -O'.*", - }[tool] - - test.fail_test(not test.match_re_dotall(test.stderr(), result)) - - test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HelloWorld/CompileAndLinkOneStep/Image/SConstruct_template b/test/D/HelloWorld/CompileAndLinkOneStep/Image/SConstruct_template deleted file mode 100644 index c688ab7..0000000 --- a/test/D/HelloWorld/CompileAndLinkOneStep/Image/SConstruct_template +++ /dev/null @@ -1,9 +0,0 @@ -# -*- mode:python; coding:utf-8; -*- - -import os - -environment = Environment( - ENV=os.environ, - tools=['link', '{}']) - -environment.Program('helloWorld.d') diff --git a/test/D/HelloWorld/CompileAndLinkOneStep/Image/helloWorld.d b/test/D/HelloWorld/CompileAndLinkOneStep/Image/helloWorld.d deleted file mode 100644 index 4d95b24..0000000 --- a/test/D/HelloWorld/CompileAndLinkOneStep/Image/helloWorld.d +++ /dev/null @@ -1,6 +0,0 @@ -import std.stdio; - -int main(immutable string[] args) { - writeln("Hello World."); - return 0; -} diff --git a/test/D/HelloWorld/CompileAndLinkOneStep/common.py b/test/D/HelloWorld/CompileAndLinkOneStep/common.py deleted file mode 100644 index 9694ebb..0000000 --- a/test/D/HelloWorld/CompileAndLinkOneStep/common.py +++ /dev/null @@ -1,68 +0,0 @@ -""" -Support functions for all the tests. -""" - -# -# __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__" - -import TestSCons - -from os.path import abspath, dirname - -import sys -sys.path.insert(1, abspath(dirname(__file__) + '/../../Support')) - -from executablesSearch import isExecutableOfToolAvailable - -def testForTool(tool): - - test = TestSCons.TestSCons() - - if not isExecutableOfToolAvailable(test, tool) : - test.skip_test("Required executable for tool '{}' not found, skipping test.\n".format(tool)) - - test.dir_fixture('Image') - test.write('SConstruct', open('SConstruct_template', 'r').read().format(tool)) - - if tool == 'dmd': - # The gdmd executable in Debian Unstable as at 2012-05-12, version 4.6.3 puts out messages on stderr - # that cause inappropriate failure of the tests, so simply ignore them. - test.run(stderr=None) - else: - test.run() - - test.must_exist(test.workpath('helloWorld.o')) - test.must_exist(test.workpath('helloWorld')) - - test.run(program=test.workpath('helloWorld'+TestSCons._exe)) - test.fail_test(test.stdout() != 'Hello World.\n') - - test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HelloWorld/CompileAndLinkOneStep/sconstest-dmd.py b/test/D/HelloWorld/CompileAndLinkOneStep/sconstest-dmd.py deleted file mode 100644 index 7ee8955..0000000 --- a/test/D/HelloWorld/CompileAndLinkOneStep/sconstest-dmd.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Test compiling and executing using the dmd tool. -""" - -# -# __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__" - -from common import testForTool -testForTool('dmd') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HelloWorld/CompileAndLinkOneStep/sconstest-gdc.py b/test/D/HelloWorld/CompileAndLinkOneStep/sconstest-gdc.py deleted file mode 100644 index d6a7bee..0000000 --- a/test/D/HelloWorld/CompileAndLinkOneStep/sconstest-gdc.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Test compiling and executing using the gdc tool. -""" - -# -# __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__" - -from common import testForTool -testForTool('gdc') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HelloWorld/CompileAndLinkOneStep/sconstest-ldc.py b/test/D/HelloWorld/CompileAndLinkOneStep/sconstest-ldc.py deleted file mode 100644 index 4b90d07..0000000 --- a/test/D/HelloWorld/CompileAndLinkOneStep/sconstest-ldc.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Test compiling and executing using the ldc tool. -""" - -# -# __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__" - -from common import testForTool -testForTool('ldc') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/SConstruct_template b/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/SConstruct_template deleted file mode 100644 index 425970a..0000000 --- a/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/SConstruct_template +++ /dev/null @@ -1,11 +0,0 @@ -# -*- mode:python; coding:utf-8; -*- - -import os - -environment = Environment( - ENV=os.environ, - tools=['link', '{}']) - -objects = environment.Object('helloWorld.d') - -environment.Program('helloWorld', objects) diff --git a/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/helloWorld.d b/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/helloWorld.d deleted file mode 100644 index 4d95b24..0000000 --- a/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/helloWorld.d +++ /dev/null @@ -1,6 +0,0 @@ -import std.stdio; - -int main(immutable string[] args) { - writeln("Hello World."); - return 0; -} diff --git a/test/D/HelloWorld/CompileThenLinkTwoSteps/common.py b/test/D/HelloWorld/CompileThenLinkTwoSteps/common.py deleted file mode 100644 index 9694ebb..0000000 --- a/test/D/HelloWorld/CompileThenLinkTwoSteps/common.py +++ /dev/null @@ -1,68 +0,0 @@ -""" -Support functions for all the tests. -""" - -# -# __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__" - -import TestSCons - -from os.path import abspath, dirname - -import sys -sys.path.insert(1, abspath(dirname(__file__) + '/../../Support')) - -from executablesSearch import isExecutableOfToolAvailable - -def testForTool(tool): - - test = TestSCons.TestSCons() - - if not isExecutableOfToolAvailable(test, tool) : - test.skip_test("Required executable for tool '{}' not found, skipping test.\n".format(tool)) - - test.dir_fixture('Image') - test.write('SConstruct', open('SConstruct_template', 'r').read().format(tool)) - - if tool == 'dmd': - # The gdmd executable in Debian Unstable as at 2012-05-12, version 4.6.3 puts out messages on stderr - # that cause inappropriate failure of the tests, so simply ignore them. - test.run(stderr=None) - else: - test.run() - - test.must_exist(test.workpath('helloWorld.o')) - test.must_exist(test.workpath('helloWorld')) - - test.run(program=test.workpath('helloWorld'+TestSCons._exe)) - test.fail_test(test.stdout() != 'Hello World.\n') - - test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-dmd.py b/test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-dmd.py deleted file mode 100644 index 7ee8955..0000000 --- a/test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-dmd.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Test compiling and executing using the dmd tool. -""" - -# -# __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__" - -from common import testForTool -testForTool('dmd') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-gdc.py b/test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-gdc.py deleted file mode 100644 index e8a2b4b..0000000 --- a/test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-gdc.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Test compiling and executing using the gcd tool. -""" - -# -# __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__" - -from common import testForTool -testForTool('gdc') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-ldc.py b/test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-ldc.py deleted file mode 100644 index 4b90d07..0000000 --- a/test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-ldc.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Test compiling and executing using the ldc tool. -""" - -# -# __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__" - -from common import testForTool -testForTool('ldc') - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/LDC.py b/test/D/LDC.py deleted file mode 100644 index 94acf1c..0000000 --- a/test/D/LDC.py +++ /dev/null @@ -1,71 +0,0 @@ -#!/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. -# - -# Amended by Russel Winder 2010-05-05 - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -import TestSCons - -from os.path import abspath, dirname - -import sys -sys.path.insert(1, abspath(dirname(__file__) + '/Support')) - -from executablesSearch import isExecutableOfToolAvailable - -_exe = TestSCons._exe -test = TestSCons.TestSCons() - -if not isExecutableOfToolAvailable(test, 'ldc'): - test.skip_test("Could not find 'ldc', skipping test.\n") - -test.write('SConstruct', """\ -import os -env = Environment(tools=['link', 'ldc'], ENV=os.environ) -if env['PLATFORM'] == 'cygwin': env['OBJSUFFIX'] = '.obj' # trick DMD -env.Program('foo', 'foo.d') -""") - -test.write('foo.d', """\ -import std.stdio; -int main(string[] args) { - printf("Hello!"); - return 0; -} -""") - -test.run() - -test.run(program=test.workpath('foo'+_exe)) - -test.fail_test(not test.stdout() == 'Hello!') - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/MixedDAndC/Image/SConstruct b/test/D/MixedDAndC/Image/SConstruct deleted file mode 100644 index 47870d7..0000000 --- a/test/D/MixedDAndC/Image/SConstruct +++ /dev/null @@ -1,13 +0,0 @@ -# -*- codig:utf-8; -*- - -import os - -environment = Environment( - ENV=os.environ, - DFLAGS=['-m64', '-O']) - -environment.Program('proj', [ -'proj.d', -'dmod.d', -'cmod.c', -]) diff --git a/test/D/MixedDAndC/Image/cmod.c b/test/D/MixedDAndC/Image/cmod.c deleted file mode 100644 index 31be5e9..0000000 --- a/test/D/MixedDAndC/Image/cmod.c +++ /dev/null @@ -1,3 +0,0 @@ -int csqr(int arg) { - return arg*arg; -} diff --git a/test/D/MixedDAndC/Image/dmod.d b/test/D/MixedDAndC/Image/dmod.d deleted file mode 100644 index c609b9c..0000000 --- a/test/D/MixedDAndC/Image/dmod.d +++ /dev/null @@ -1,6 +0,0 @@ -module dmod; -import std.stdio; - -void print_msg() { - writeln("Hello, this is a test program for the new SCons D support"); -} diff --git a/test/D/MixedDAndC/Image/proj.d b/test/D/MixedDAndC/Image/proj.d deleted file mode 100644 index 3e0bf95..0000000 --- a/test/D/MixedDAndC/Image/proj.d +++ /dev/null @@ -1,12 +0,0 @@ -import std.stdio; -import dmod; - -extern (C) { - int csqr(int arg); -} - -void main() { - print_msg(); - auto i = 17; - writefln("The square of %d is %d", i, csqr(i)); -} diff --git a/test/D/MixedDAndC/sconstest-mixedcompile.py b/test/D/MixedDAndC/sconstest-mixedcompile.py deleted file mode 100644 index 0fd1a12..0000000 --- a/test/D/MixedDAndC/sconstest-mixedcompile.py +++ /dev/null @@ -1,44 +0,0 @@ -""" -Test compiling and executing a project with a C module. -""" - -# -# __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__" - -import TestSCons - -test = TestSCons.TestSCons() - -test.dir_fixture('Image') - -test.run() - -test.pass_test() - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/D/Support/executablesSearch.py b/test/D/Support/executablesSearch.py deleted file mode 100644 index ccb9fa5..0000000 --- a/test/D/Support/executablesSearch.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Support functions for all the tests. -""" - -# -# __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__" - -def isExecutableOfToolAvailable(test, tool): - for executable in { - 'dmd': ['dmd', 'gdmd'], - 'gdc': ['gdc'], - 'ldc': ['ldc2', 'ldc']}[tool]: - if test.where_is(executable): - return True - return False diff --git a/test/D/Support/sconstest.skip b/test/D/Support/sconstest.skip deleted file mode 100644 index e69de29..0000000 -- cgit v0.12