From: stevenknight Date: Fri, 7 Jan 2005 00:42:01 +0000 (+0000) Subject: Finish the display-customization variables: , , , , , and . X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6905b920bf674539b6f58182ed60bc586c40fcf9;p=scons.git Finish the display-customization variables: , , , , , and . git-svn-id: http://scons.tigris.org/svn/scons/trunk@1208 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/doc/man/scons.1 b/doc/man/scons.1 index f195c62c..449eacec 100644 --- a/doc/man/scons.1 +++ b/doc/man/scons.1 @@ -6068,6 +6068,15 @@ dependencies for the PCH file. Example: env['PCH'] = 'StdAfx.pch' .EE +.IP PCHCOM +The command line used by the +.B PCH +builder to generated a precompiled header. + +.IP PCHCOMSTR +The string displayed when generating a precompiled header. +If this is not set, then $PCHCOM (the command line) is displayed. + .IP PCHSTOP This variable specifies how much of a source file is precompiled. This variable is ignored by tools other than Microsoft Visual C++, or when @@ -6267,9 +6276,17 @@ cpp file. .IP QT_MOCFROMCXXCOM Command to generate a moc file from a cpp file. +.IP QT_MOCFROMCXXCOMSTR +The string displayed when generating a moc file from a cpp file. +If this is not set, then $QT_MOCFROMCXXCOM (the command line) is displayed. + .IP QT_MOCFROMHCOM Command to generate a moc file from a header. +.IP QT_MOCFROMHCOMSTR +The string displayed when generating a moc file from a cpp file. +If this is not set, then $QT_MOCFROMHCOM (the command line) is displayed. + .IP QT_MOCFROMHFLAGS Default value is ''. These flags are passed to moc, when moccing a header file. @@ -6284,9 +6301,13 @@ a header. .IP QT_UIC Default value is '$QT_BINPATH/uic'. -.IP QT_UICDECLCOM +.IP QT_UICCOM Command to generate header files from .ui files. +.IP QT_UICCOMSTR +The string displayed when generating header files from .ui files. +If this is not set, then $QT_UICCOM (the command line) is displayed. + .IP QT_UICDECLFLAGS Default value is ''. These flags are passed to uic, when creating a a h file from a .ui file. @@ -6297,9 +6318,6 @@ Default value is ''. Prefix for uic generated header files. .IP QT_UICDECLSUFFIX Default value is '.h'. Suffix for uic generated header files. -.IP QT_UICIMPLCOM -Command to generate cxx files from .ui files. - .IP QT_UICIMPLFLAGS Default value is ''. These flags are passed to uic, when creating a cxx file from a .ui file. @@ -6326,6 +6344,10 @@ The resource compiler used by the RES builder. .IP RCCOM The command line used by the RES builder. +.IP RCCOMSTR +The string displayed when invoking the resource compiler. +If this is not set, then $RCCOM (the command line) is displayed. + .IP RCFLAGS The flags passed to the resource compiler by the RES builder. @@ -6354,6 +6376,21 @@ If this is not set, then $RCS_COCOM .IP RCS_COFLAGS Options that are passed to the $RCS_CO command. +.IP REGSVR +The program used to register DLLs on Windows systems. + +.IP REGSVRCOM +The command line used to register a newly-built DLL file +on Windows systems. +Invoked when the "register=1" +keyword argument is passed to the +.B SharedLibrary +Builder. + +.IP REGSVRCOMSTR +The string displayed when registering a newly-built DLL file. +If this is not set, then $REGSVRCOM (the command line) is displayed. + .IP RDirs A function that converts a file name into a list of Dir instances by searching the repositories. diff --git a/src/CHANGES.txt b/src/CHANGES.txt index c2801bde..11c8e624 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -141,11 +141,12 @@ RELEASE 0.97 - XXX $CVSCOMSTR, $CXXCOMSTR, $DCOMSTR, $DVIPDFCOMSTR, $F77COMSTR, $F90COMSTR, $F95COMSTR, $FORTRANCOMSTR, $GSCOMSTR, $JARCOMSTR, $JAVACCOMSTR, $JAVAHCOMSTR, $LATEXCOMSTR, $LEXCOMSTR, $LINKCOMSTR, - $M4COMSTR, $P4COMSTR, $PDFLATEXCOMSTR, $PDFTEXCOMSTR, $PSCOMSTR, - $RCSCOMSTR, $RMICCOMSTR, $SCCSCOMSTR, $SHCCCOMSTR, $SHCXXCOMSTR, - $SHF77COMSTR, $SHF90COMSTR, $SHF95COMSTR, $SHFORTRANCOMSTR, - $SHLINKCOMSTR, $SWIGCOMSTR, $TARCOMSTR, $TEXCOMSTR, $YACCCOMSTR - and $ZIPCOMSTR. + $M4COMSTR, $MIDLCOMSTR, $P4COMSTR, $PCHCOMSTR, $PDFLATEXCOMSTR, + $PDFTEXCOMSTR, $PSCOMSTR, $QT_MOCFROMCXXCOMSTR, $QT_MOCFROMHCOMSTR, + $QT_UICCOMSTR, $RCCOMSTR, $REGSVRCOMSTR, $RCS_COCOMSTR, $RMICCOMSTR, + $SCCSCOMSTR, $SHCCCOMSTR, $SHCXXCOMSTR, $SHF77COMSTR, $SHF90COMSTR, + $SHF95COMSTR, $SHFORTRANCOMSTR, $SHLINKCOMSTR, $SWIGCOMSTR, + $TARCOMSTR, $TEXCOMSTR, $YACCCOMSTR and $ZIPCOMSTR. - Add an optional "map" keyword argument to ListOption() that takes a dictionary to map user-specified values to legal values from the list diff --git a/src/engine/SCons/Tool/midl.py b/src/engine/SCons/Tool/midl.py index 6be91efd..67579e9a 100644 --- a/src/engine/SCons/Tool/midl.py +++ b/src/engine/SCons/Tool/midl.py @@ -33,6 +33,8 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" +import SCons.Action +import SCons.Builder import SCons.Defaults import SCons.Scanner.IDL import SCons.Util @@ -53,7 +55,9 @@ def midl_emitter(target, source, env): idl_scanner = SCons.Scanner.IDL.IDLScan() -midl_builder = SCons.Builder.Builder(action='$MIDLCOM', +midl_action = SCons.Action.Action('$MIDLCOM', '$MIDLCOMSTR') + +midl_builder = SCons.Builder.Builder(action = midl_action, src_suffix = '.idl', suffix='.tlb', emitter = midl_emitter, @@ -73,5 +77,3 @@ def exists(env): return 1 else: return env.Detect('midl') - - diff --git a/src/engine/SCons/Tool/mingw.py b/src/engine/SCons/Tool/mingw.py index debb873d..99a5574c 100644 --- a/src/engine/SCons/Tool/mingw.py +++ b/src/engine/SCons/Tool/mingw.py @@ -37,6 +37,8 @@ import os import os.path import string +import SCons.Action +import SCons.Builder import SCons.Tool import SCons.Util @@ -94,7 +96,9 @@ def shlib_emitter(target, source, env): shlib_action = SCons.Action.CommandGenerator(shlib_generator) -res_builder = SCons.Builder.Builder(action='$RCCOM', suffix='.o', +res_action = SCons.Action.Action('$RCCOM', '$RCCOMSTR') + +res_builder = SCons.Builder.Builder(action=res_action, suffix='.o', source_scanner=SCons.Defaults.ObjSourceScan) SCons.Defaults.ObjSourceScan.add_scanner('.rc', SCons.Defaults.CScan) diff --git a/src/engine/SCons/Tool/mslink.py b/src/engine/SCons/Tool/mslink.py index 0c7b7dcd..98258c23 100644 --- a/src/engine/SCons/Tool/mslink.py +++ b/src/engine/SCons/Tool/mslink.py @@ -124,7 +124,7 @@ def RegServerFunc(target, source, env): return ret return 0 -regServerAction = SCons.Action.Action("$REGSVRCOM") +regServerAction = SCons.Action.Action("$REGSVRCOM", "$REGSVRCOMSTR") regServerCheck = SCons.Action.Action(RegServerFunc, None) shlibLinkAction = SCons.Action.Action('${TEMPFILE("$SHLINK $SHLINKFLAGS $_SHLINK_TARGETS $( $_LIBDIRFLAGS $) $_LIBFLAGS $_PDB $_SHLINK_SOURCES")}') compositeLinkAction = shlibLinkAction + regServerCheck diff --git a/src/engine/SCons/Tool/msvc.py b/src/engine/SCons/Tool/msvc.py index 34a1b941..e0ed26d3 100644 --- a/src/engine/SCons/Tool/msvc.py +++ b/src/engine/SCons/Tool/msvc.py @@ -397,9 +397,12 @@ def shared_object_emitter(target, source, env): return object_emitter(target, source, env, SCons.Defaults.SharedObjectEmitter) -pch_builder = SCons.Builder.Builder(action='$PCHCOM', suffix='.pch', emitter=pch_emitter, +pch_action = SCons.Action.Action('$PCHCOM', '$PCHCOMSTR') +pch_builder = SCons.Builder.Builder(action=pch_action, suffix='.pch', + emitter=pch_emitter, source_scanner=SCons.Defaults.ObjSourceScan) -res_builder = SCons.Builder.Builder(action='$RCCOM', suffix='.res', +res_action = SCons.Action.Action('$RCCOM', '$RCCOMSTR') +res_builder = SCons.Builder.Builder(action=res_action, suffix='.res', source_scanner=SCons.Defaults.ObjSourceScan) SCons.Defaults.ObjSourceScan.add_scanner('.rc', SCons.Defaults.CScan) diff --git a/src/engine/SCons/Tool/qt.py b/src/engine/SCons/Tool/qt.py index 9bb04380..bc2d41b1 100644 --- a/src/engine/SCons/Tool/qt.py +++ b/src/engine/SCons/Tool/qt.py @@ -1,7 +1,7 @@ """SCons.Tool.qt -Tool-specific initialization for qt. +Tool-specific initialization for Qt. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() @@ -37,6 +37,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os.path import re +import SCons.Action +import SCons.Builder import SCons.Defaults import SCons.Scanner import SCons.Tool @@ -294,7 +296,7 @@ def generate(env): Action(checkMocIncluded,None)]) # ... and the corresponding builders - uicBld = Builder(action='$QT_UICCOM', + uicBld = Builder(action=SCons.Action.Action('$QT_UICCOM', '$QT_UICCOMSTR'), emitter=uicEmitter, src_suffix='$QT_UISUFFIX', suffix='$QT_UICDECLSUFFIX', @@ -302,11 +304,13 @@ def generate(env): source_scanner=uicScanner) mocBld = Builder(action={}, prefix={}, suffix={}) for h in header_extensions: - mocBld.add_action(h, '$QT_MOCFROMHCOM') + act = SCons.Action.Action('$QT_MOCFROMHCOM', '$QT_MOCFROMHCOMSTR') + mocBld.add_action(h, act) mocBld.prefix[h] = '$QT_MOCHPREFIX' mocBld.suffix[h] = '$QT_MOCHSUFFIX' for cxx in cxx_suffixes: - mocBld.add_action(cxx, '$QT_MOCFROMCXXCOM') + act = SCons.Action.Action('$QT_MOCFROMCXXCOM', '$QT_MOCFROMCXXCOMSTR') + mocBld.add_action(cxx, act) mocBld.prefix[cxx] = '$QT_MOCCXXPREFIX' mocBld.suffix[cxx] = '$QT_MOCCXXSUFFIX' diff --git a/test/GSFLAGS.py b/test/Ghostscript/GSFLAGS.py similarity index 100% rename from test/GSFLAGS.py rename to test/Ghostscript/GSFLAGS.py diff --git a/test/IDLSUFFIXES.py b/test/IDL/IDLSUFFIXES.py similarity index 100% rename from test/IDLSUFFIXES.py rename to test/IDL/IDLSUFFIXES.py diff --git a/test/IDL/MIDLCOM.py b/test/IDL/MIDLCOM.py new file mode 100644 index 00000000..d3f64200 --- /dev/null +++ b/test/IDL/MIDLCOM.py @@ -0,0 +1,63 @@ +#!/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 the ability to configure the $MIDLCOM construction variable. +""" + +import TestSCons + +python = TestSCons.python + +test = TestSCons.TestSCons() + + + +test.write('mymidl.py', """ +import sys +outfile = open(sys.argv[1], 'wb') +for f in sys.argv[2:]: + infile = open(f, 'rb') + for l in filter(lambda l: l != '/*midl*/\\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(tools=['default', 'midl'], + MIDLCOM = r'%s mymidl.py $TARGET $SOURCES') +env.TypeLibrary(target = 'aaa', source = 'aaa.idl') +""" % python) + +test.write('aaa.idl', "aaa.idl\n/*midl*/\n") + +test.run(arguments = '.') + +test.must_match('aaa.tlb', "aaa.idl\n") + + + +test.pass_test() diff --git a/test/IDL/MIDLCOMSTR.py b/test/IDL/MIDLCOMSTR.py new file mode 100644 index 00000000..89a6e250 --- /dev/null +++ b/test/IDL/MIDLCOMSTR.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test that the $MIDLCOMSTR construction variable allows you to customize +the displayed string when midl is called. +""" + +import TestSCons + +python = TestSCons.python + +test = TestSCons.TestSCons() + + + +test.write('mymidl.py', """ +import sys +outfile = open(sys.argv[1], 'wb') +for f in sys.argv[2:]: + infile = open(f, 'rb') + for l in filter(lambda l: l != '/*midl*/\\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(tools=['default', 'midl'], + MIDLCOM = r'%s mymidl.py $TARGET $SOURCES', + MIDLCOMSTR = 'MIDLing $TARGET from $SOURCE') +env.TypeLibrary(target = 'aaa', source = 'aaa.idl') +""" % python) + +test.write('aaa.idl', "aaa.idl\n/*midl*/\n") + +test.run(stdout = test.wrap_stdout("""\ +MIDLing aaa.tlb from aaa.idl +""")) + +test.must_match('aaa.tlb', "aaa.idl\n") + + + +test.pass_test() diff --git a/test/midl.py b/test/IDL/midl.py similarity index 100% rename from test/midl.py rename to test/IDL/midl.py diff --git a/test/MSVC/PCHCOM.py b/test/MSVC/PCHCOM.py new file mode 100644 index 00000000..593a1c14 --- /dev/null +++ b/test/MSVC/PCHCOM.py @@ -0,0 +1,63 @@ +#!/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 the ability to configure the $MIDLCOM construction variable. +""" + +import TestSCons + +python = TestSCons.python + +test = TestSCons.TestSCons() + + + +test.write('mypch.py', """ +import sys +outfile = open(sys.argv[1], 'wb') +for f in sys.argv[2:]: + infile = open(f, 'rb') + for l in filter(lambda l: l != '/*pch*/\\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(tools=['default', 'msvc'], + PCHCOM = r'%s mypch.py $TARGET $SOURCES') +env.PCH(target = 'aaa', source = 'aaa.h') +""" % python) + +test.write('aaa.h', "aaa.h\n/*pch*/\n") + +test.run(arguments = ".") + +test.must_match('aaa.pch', "aaa.h\n") + + + +test.pass_test() diff --git a/test/MSVC/PCHCOMSTR.py b/test/MSVC/PCHCOMSTR.py new file mode 100644 index 00000000..c5ab9f52 --- /dev/null +++ b/test/MSVC/PCHCOMSTR.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test that the $PCHCOMSTR construction variable allows you to customize +the displayed string when pch is called. +""" + +import TestSCons + +python = TestSCons.python + +test = TestSCons.TestSCons() + + + +test.write('mypch.py', """ +import sys +outfile = open(sys.argv[1], 'wb') +for f in sys.argv[2:]: + infile = open(f, 'rb') + for l in filter(lambda l: l != '/*pch*/\\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(tools=['default', 'msvc'], + PCHCOM = r'%s mypch.py $TARGET $SOURCES', + PCHCOMSTR = 'PCHing $TARGET from $SOURCE') +env.PCH(target = 'aaa', source = 'aaa.h') +""" % python) + +test.write('aaa.h', "aaa.h\n/*pch*/\n") + +test.run(stdout = test.wrap_stdout("""\ +PCHing aaa.pch from aaa.h +""")) + +test.must_match('aaa.pch', "aaa.h\n") + + + +test.pass_test() diff --git a/test/MSVC/RCCOM.py b/test/MSVC/RCCOM.py new file mode 100644 index 00000000..3262f0cf --- /dev/null +++ b/test/MSVC/RCCOM.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. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test the ability to configure the $RCCOM construction variable +when using MSVC. +""" + +import TestSCons + +python = TestSCons.python + +test = TestSCons.TestSCons() + + + +test.write('myrc.py', """ +import sys +outfile = open(sys.argv[1], 'wb') +for f in sys.argv[2:]: + infile = open(f, 'rb') + for l in filter(lambda l: l != '/*rc*/\\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(tools=['default', 'msvc'], + RCCOM = r'%(python)s myrc.py $TARGET $SOURCES') +env.RES(target = 'aaa', source = 'aaa.rc') +""" % locals()) + +test.write('aaa.rc', "aaa.rc\n/*rc*/\n") + +test.run(arguments = ".") + +test.must_match('aaa.res', "aaa.rc\n") + + + +test.pass_test() diff --git a/test/MSVC/RCCOMSTR.py b/test/MSVC/RCCOMSTR.py new file mode 100644 index 00000000..33e192b9 --- /dev/null +++ b/test/MSVC/RCCOMSTR.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test that the $RCCOMSTR construction variable allows you to customize +the displayed string when rc is called. +""" + +import TestSCons + +python = TestSCons.python + +test = TestSCons.TestSCons() + + + +test.write('myrc.py', """ +import sys +outfile = open(sys.argv[1], 'wb') +for f in sys.argv[2:]: + infile = open(f, 'rb') + for l in filter(lambda l: l != '/*rc*/\\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(tools=['default', 'msvc'], + RCCOM = r'%(python)s myrc.py $TARGET $SOURCES', + RCCOMSTR = 'RCing $TARGET from $SOURCE') +env.RES(target = 'aaa', source = 'aaa.rc') +""" % locals()) + +test.write('aaa.rc', "aaa.rc\n/*rc*/\n") + +test.run(stdout = test.wrap_stdout("""\ +RCing aaa.res from aaa.rc +""")) + +test.must_match('aaa.res', "aaa.rc\n") + + + +test.pass_test() diff --git a/test/msvc.py b/test/MSVC/msvc.py similarity index 100% rename from test/msvc.py rename to test/MSVC/msvc.py diff --git a/test/MinGW/RCCOM.py b/test/MinGW/RCCOM.py new file mode 100644 index 00000000..4ddcd91d --- /dev/null +++ b/test/MinGW/RCCOM.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. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test the ability to configure the $RCCOM construction variable +when using MinGW. +""" + +import TestSCons + +python = TestSCons.python + +test = TestSCons.TestSCons() + + + +test.write('myrc.py', """ +import sys +outfile = open(sys.argv[1], 'wb') +for f in sys.argv[2:]: + infile = open(f, 'rb') + for l in filter(lambda l: l != '/*rc*/\\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(tools=['default', 'mingw'], + RCCOM = r'%(python)s myrc.py $TARGET $SOURCES') +env.RES(target = 'aaa', source = 'aaa.rc') +""" % locals()) + +test.write('aaa.rc', "aaa.rc\n/*rc*/\n") + +test.run(arguments = ".") + +test.must_match('aaa.o', "aaa.rc\n") + + + +test.pass_test() diff --git a/test/MinGW/RCCOMSTR.py b/test/MinGW/RCCOMSTR.py new file mode 100644 index 00000000..e0958473 --- /dev/null +++ b/test/MinGW/RCCOMSTR.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test that the $RCCOMSTR construction variable allows you to customize +the displayed string when rc is called. +""" + +import TestSCons + +python = TestSCons.python + +test = TestSCons.TestSCons() + + + +test.write('myrc.py', """ +import sys +outfile = open(sys.argv[1], 'wb') +for f in sys.argv[2:]: + infile = open(f, 'rb') + for l in filter(lambda l: l != '/*rc*/\\n', infile.readlines()): + outfile.write(l) +sys.exit(0) +""") + +test.write('SConstruct', """ +env = Environment(tools=['default', 'mingw'], + RCCOM = r'%(python)s myrc.py $TARGET $SOURCES', + RCCOMSTR = 'RCing $TARGET from $SOURCE') +env.RES(target = 'aaa', source = 'aaa.rc') +""" % locals()) + +test.write('aaa.rc', "aaa.rc\n/*rc*/\n") + +test.run(stdout = test.wrap_stdout("""\ +RCing aaa.o from aaa.rc +""")) + +test.must_match('aaa.o', "aaa.rc\n") + + + +test.pass_test() diff --git a/test/QT.py b/test/QT/QT.py similarity index 100% rename from test/QT.py rename to test/QT/QT.py diff --git a/test/QTFLAGS.py b/test/QT/QTFLAGS.py similarity index 100% rename from test/QTFLAGS.py rename to test/QT/QTFLAGS.py diff --git a/test/rpcgen.py b/test/rpcgen.py deleted file mode 100644 index 7c9f8ec8..00000000 --- a/test/rpcgen.py +++ /dev/null @@ -1,99 +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. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -import os -import string -import sys -import TestSCons - -_exe = TestSCons._exe -test = TestSCons.TestSCons() - -rpcgen = test.where_is('rpcgen') -if not rpcgen: - print "rpcgen not found, skipping test" - test.pass_test(1) - -test.subdir('do_rpcgen') - -test.write('SConstruct', """\ -import os -env = Environment(ENV=os.environ) -env.Program('rpcclnt', ['rpcclnt.c', 'do_rpcgen/rpcif_clnt.c']) -env.RPCGenHeader('do_rpcgen/rpcif') -env.RPCGenClient('do_rpcgen/rpcif') -env.RPCGenService('do_rpcgen/rpcif') -env.RPCGenXDR('do_rpcgen/rpcif') -""") - -test.write(['do_rpcgen', 'rpcif.x'], """\ -program RPCTEST_IF -{ - version RPCTEST_IF_VERSION - { - int START(unsigned long) = 1; - int STOP(unsigned long) = 2; - int STATUS(unsigned long) = 3; - } = 1; /* version */ -} = 0xfeedf00d; /* portmap program ID */ -""") - -# Following test tries to make sure it can compile and link, but when -# it's run it doesn't actually invoke any rpc operations because that -# would have significant dependencies on network configuration, -# portmapper, etc. that aren't necessarily appropriate for an scons -# test. - -test.write('rpcclnt.c', """\ -#include -#include -#include "do_rpcgen/rpcif.h" - -int main(int argc, char **args) { - const char* const SERVER = "localhost"; - CLIENT *cl; - int *rslt; - unsigned long arg = 0; - if (argc > 2) { - cl = clnt_create( SERVER, RPCTEST_IF, RPCTEST_IF_VERSION, "udp" ); - if (cl == 0 ) { return 1; } - rslt = start_1(&arg, cl); - if (*rslt == 0) { clnt_perror( cl, SERVER ); return 1; } - clnt_destroy(cl); - } else - printf("Hello!\\n"); - return 0; -} -""") - - -test.run() - -test.run(program=test.workpath('rpcclnt'+_exe)) - -test.fail_test(not test.stdout() in ["Hello!\n", "Hello!\r\n"]) - -test.pass_test()