From bf075e2a9c29b35fe8908d1b91c470c4b2c823a8 Mon Sep 17 00:00:00 2001 From: Sye van der Veen Date: Thu, 30 Jan 2014 10:43:41 -0500 Subject: Add caching to MSCommon.script_env for builds that initialize the same MSVS/MSVC tool multiple times (in multiple environments, perhaps) --- src/engine/SCons/Tool/MSCommon/vc.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index c970118..b5491b1 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -298,8 +298,18 @@ def reset_installed_vcs(): """Make it try again to find VC. This is just for the tests.""" __INSTALLED_VCS_RUN = None +# Running these batch files isn't cheap: most of the time spent in +# msvs.generate() is due to vcvars*.bat. In a build that keeps separate +# environments for debug and release, or perhaps builds against multiple +# MSVS versions at once, we can save a lot of time by caching the output. +script_env_stdout_cache = {} def script_env(script, args=None): - stdout = common.get_output(script, args) + cache_key = (script, args) + stdout = script_env_stdout_cache.get(cache_key, None) + if stdout is None: + stdout = common.get_output(script, args) + script_env_stdout_cache[cache_key] = stdout + # Stupid batch files do not set return code: we take a look at the # beginning of the output for an error message instead olines = stdout.splitlines() @@ -416,7 +426,7 @@ def msvc_find_valid_batch_script(env,version): if not vc_script and sdk_script: debug('vc.py:msvc_find_valid_batch_script() use_script 4: trying sdk script: %s'%(sdk_script)) try: - d = script_env(sdk_script,args=[]) + d = script_env(sdk_script) except BatchFileExecutionError,e: debug('vc.py:msvc_find_valid_batch_script() use_script 5: failed running SDK script %s: Error:%s'%(repr(sdk_script),e)) continue -- cgit v0.12 From 6f7255096462195be3ea812b4dcf9dbee6d08ef0 Mon Sep 17 00:00:00 2001 From: Sye van der Veen Date: Sun, 16 Mar 2014 15:49:18 -0400 Subject: Update comments to clarify benefits of script_env memoization --- src/engine/SCons/Tool/MSCommon/vc.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index b5491b1..72e7c77 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -299,9 +299,12 @@ def reset_installed_vcs(): __INSTALLED_VCS_RUN = None # Running these batch files isn't cheap: most of the time spent in -# msvs.generate() is due to vcvars*.bat. In a build that keeps separate -# environments for debug and release, or perhaps builds against multiple -# MSVS versions at once, we can save a lot of time by caching the output. +# msvs.generate() is due to vcvars*.bat. In a build that uses "tools='msvs'" +# in multiple environments, for example: +# env1 = Environment(tools='msvs') +# env2 = Environment(tools='msvs') +# we can greatly improve the speed of the second and subsequent Environment +# (or Clone) calls by memoizing the environment variables set by vcvars*.bat. script_env_stdout_cache = {} def script_env(script, args=None): cache_key = (script, args) -- cgit v0.12 From 0ee2bd1435b955c1ffd1962ecb8ae32a4529171e Mon Sep 17 00:00:00 2001 From: ptomulik Date: Wed, 9 Apr 2014 15:30:56 +0200 Subject: added test case for the SConf.Streamer issue --- test/Configure/Streamer1.py | 85 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 test/Configure/Streamer1.py diff --git a/test/Configure/Streamer1.py b/test/Configure/Streamer1.py new file mode 100644 index 0000000..8f35308 --- /dev/null +++ b/test/Configure/Streamer1.py @@ -0,0 +1,85 @@ +#!/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 for BitBucket PR 126: + +SConf doesn't work well with 'io' module on pre-3.0 Python. This is because +io.StringIO (used by SCons.SConf.Streamer) accepts only unicode strings. +Non-unicode input causes it to raise an exception. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +test.write('SConstruct', """ +# SConstruct +# +# The CheckHello should return 'yes' if everything works fine. Otherwise it +# returns 'failed'. +# +def hello(target, source, env): + import traceback + try: + print 'hello!\\n' # this breaks the script + with open(env.subst('$TARGET', target = target),'w') as f: + f.write('yes') + except: + # write to file, as stdout/stderr is broken + traceback.print_exc(file=open('traceback','w')) + return 0 + +def CheckHello(context): + import sys + context.Display('Checking whether hello works... ') + stat,out = context.TryAction(hello,'','.in') + if stat and out: + context.Result(out) + else: + context.Result('failed') + return out + +env = Environment() +cfg = Configure(env) + +cfg.AddTest('CheckHello', CheckHello) +cfg.CheckHello() + +env = cfg.Finish() +""") + +test.run(arguments = '.') +test.must_contain_all_lines(test.stdout(), ['Checking whether hello works... yes']) +test.must_not_exist('traceback') + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: -- cgit v0.12 From 2fd80b075a4a8ddd9b18fff92ccc608db34db0d9 Mon Sep 17 00:00:00 2001 From: ptomulik Date: Wed, 9 Apr 2014 15:34:17 +0200 Subject: Fixed SConf.Streamer to work with non-unicode input on python 2.x --- src/engine/SCons/SConf.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/engine/SCons/SConf.py b/src/engine/SCons/SConf.py index 7a8a0c2..068af3a 100644 --- a/src/engine/SCons/SConf.py +++ b/src/engine/SCons/SConf.py @@ -180,7 +180,13 @@ class Streamer(object): def write(self, str): if self.orig: self.orig.write(str) - self.s.write(str) + try: + self.s.write(str) + except TypeError as e: + if e.message.startswith('unicode argument expected'): + self.s.write(str.decode()) + else: + raise def writelines(self, lines): for l in lines: -- cgit v0.12 From 00a5e7ac44f86b8717523dd49c5e064c11debf2e Mon Sep 17 00:00:00 2001 From: Mattias Date: Tue, 15 Apr 2014 12:20:15 +0200 Subject: adding support for detecting intel compiler suites version 13 and later by doing chained registry lookups for each installation instance --- src/engine/SCons/Tool/intelc.py | 62 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/src/engine/SCons/Tool/intelc.py b/src/engine/SCons/Tool/intelc.py index 42f8e74..57258f3 100644 --- a/src/engine/SCons/Tool/intelc.py +++ b/src/engine/SCons/Tool/intelc.py @@ -156,7 +156,43 @@ def get_intel_registry_value(valuename, version=None, abi=None): try: k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE, K) except SCons.Util.RegError: - raise MissingRegistryError("%s was not found in the registry, for Intel compiler version %s, abi='%s'"%(K, version,abi)) + # For version 13 and later, check UUID subkeys for valuename + if is_win64: + K = 'Software\\Wow6432Node\\Intel\\Suites\\' + version + "\\Defaults\\C++\\" + abi.upper() + else: + K = 'Software\\Intel\\Suites\\' + version + "\\Defaults\\C++\\" + abi.upper() + try: + k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE, K) + uuid = SCons.Util.RegQueryValueEx(k, 'SubKey')[0] + + if is_win64: + K = 'Software\\Wow6432Node\\Intel\\Suites\\' + version + "\\" + uuid + "\\C++" + else: + K = 'Software\\Intel\\Suites\\' + version + "\\" + uuid + "\\C++" + k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE, K) + + try: + v = SCons.Util.RegQueryValueEx(k, valuename)[0] + return v # or v.encode('iso-8859-1', 'replace') to remove unicode? + except SCons.Util.RegError: + if abi.upper() == 'EM64T': + abi = 'em64t_native' + if is_win64: + K = 'Software\\Wow6432Node\\Intel\\Suites\\' + version + "\\" + uuid + "\\C++\\" + abi.upper() + else: + K = 'Software\\Intel\\Suites\\' + version + "\\" + uuid + "\\C++\\" + abi.upper() + k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE, K) + + try: + v = SCons.Util.RegQueryValueEx(k, valuename)[0] + return v # or v.encode('iso-8859-1', 'replace') to remove unicode? + except SCons.Util.RegError: + raise MissingRegistryError("%s was not found in the registry, for Intel compiler version %s, abi='%s'"%(K, version,abi)) + + except SCons.Util.RegError: + raise MissingRegistryError("%s was not found in the registry, for Intel compiler version %s, abi='%s'"%(K, version,abi)) + except WindowsError: + raise MissingRegistryError("%s was not found in the registry, for Intel compiler version %s, abi='%s'"%(K, version,abi)) # Get the value: try: @@ -180,7 +216,16 @@ def get_all_compiler_versions(): k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE, keyname) except WindowsError: - return [] + # For version 13 or later, check for default instance UUID + if is_win64: + keyname = 'Software\\WoW6432Node\\Intel\\Suites' + else: + keyname = 'Software\\Intel\\Suites' + try: + k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE, + keyname) + except WindowsError: + return [] i = 0 versions = [] try: @@ -192,6 +237,9 @@ def get_all_compiler_versions(): # and then the install directory deleted or moved (rather # than uninstalling properly), so the registry values # are still there. + if subkey == 'Defaults': # Ignore default instances + i = i + 1 + continue ok = False for try_abi in ('IA32', 'IA32e', 'IA64', 'EM64T'): try: @@ -268,9 +316,17 @@ def get_intel_compiler_top(version, abi): if not SCons.Util.can_read_reg: raise NoRegistryModuleError("No Windows registry module was found") top = get_intel_registry_value('ProductDir', version, abi) + archdir={'x86_64': 'intel64', + 'amd64' : 'intel64', + 'em64t' : 'intel64', + 'x86' : 'ia32', + 'i386' : 'ia32', + 'ia32' : 'ia32' + }[abi] # for v11 and greater # pre-11, icl was in Bin. 11 and later, it's in Bin/ apparently. if not os.path.exists(os.path.join(top, "Bin", "icl.exe")) \ - and not os.path.exists(os.path.join(top, "Bin", abi, "icl.exe")): + and not os.path.exists(os.path.join(top, "Bin", abi, "icl.exe")) \ + and not os.path.exists(os.path.join(top, "Bin", archdir, "icl.exe")): raise MissingDirError("Can't find Intel compiler in %s"%(top)) elif is_mac or is_linux: def find_in_2008style_dir(version): -- cgit v0.12 From da72e009ae9e2f450a601d52f2530338efa6a377 Mon Sep 17 00:00:00 2001 From: Russel Winder Date: Wed, 16 Apr 2014 10:46:39 +0100 Subject: The changes to the D support evolved over the last many months packaged as a single changeset. --- src/CHANGES.txt | 5 + src/engine/MANIFEST.in | 3 + src/engine/SCons/Defaults.py | 11 +- src/engine/SCons/Tool/DCommon.py | 56 +++++++ src/engine/SCons/Tool/__init__.py | 8 +- src/engine/SCons/Tool/dmd.py | 178 +++++---------------- src/engine/SCons/Tool/dmd.xml | 9 +- src/engine/SCons/Tool/gdc.py | 123 ++++++++++++++ src/engine/SCons/Tool/gdc.xml | 72 +++++++++ src/engine/SCons/Tool/ldc.py | 128 +++++++++++++++ src/engine/SCons/Tool/ldc.xml | 52 ++++++ src/engine/SCons/Tool/link.py | 15 +- test/D/CoreScanner/Common/__init__.py | 0 test/D/CoreScanner/Common/common.py | 99 ++++++++++++ test/D/CoreScanner/Common/sconstest.skip | 0 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/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/DMD2_Alt.py | 64 ++++++++ test/D/GDC.py | 64 ++++++++ test/D/GDC_Alt.py | 64 ++++++++ test/D/HSTeoh/ArLibIssue/SConstruct_template | 3 + test/D/HSTeoh/ArLibIssue/a.d | 0 test/D/HSTeoh/ArLibIssue/b.d | 0 test/D/HSTeoh/Common/__init__.py | 0 test/D/HSTeoh/Common/arLibIssue.py | 63 ++++++++ test/D/HSTeoh/Common/libCompileOptions.py | 63 ++++++++ test/D/HSTeoh/Common/linkingProblem.py | 61 +++++++ test/D/HSTeoh/Common/sconstest.skip | 0 .../Common/singleStringCannotBeMultipleOptions.py | 66 ++++++++ .../D/HSTeoh/LibCompileOptions/SConstruct_template | 9 ++ test/D/HSTeoh/LibCompileOptions/mylib.d | 0 test/D/HSTeoh/LibCompileOptions/prog.d | 3 + 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 | 13 ++ test/D/HSTeoh/README.txt | 1 + .../SConstruct_template | 16 ++ .../SingleStringCannotBeMultipleOptions/cmod.c | 5 + .../SingleStringCannotBeMultipleOptions/mod1.d | 6 + .../SingleStringCannotBeMultipleOptions/proj.d | 13 ++ test/D/HSTeoh/sconstest-arLibIssue_dmd.py | 37 +++++ test/D/HSTeoh/sconstest-arLibIssue_gdc.py | 37 +++++ test/D/HSTeoh/sconstest-arLibIssue_ldc.py | 38 +++++ test/D/HSTeoh/sconstest-libCompileOptions_dmd.py | 37 +++++ test/D/HSTeoh/sconstest-libCompileOptions_gdc.py | 37 +++++ test/D/HSTeoh/sconstest-libCompileOptions_ldc.py | 38 +++++ test/D/HSTeoh/sconstest-linkingProblem_dmd.py | 37 +++++ test/D/HSTeoh/sconstest-linkingProblem_gdc.py | 37 +++++ test/D/HSTeoh/sconstest-linkingProblem_ldc.py | 38 +++++ ...test-singleStringCannotBeMultipleOptions_dmd.py | 37 +++++ ...test-singleStringCannotBeMultipleOptions_gdc.py | 37 +++++ ...test-singleStringCannotBeMultipleOptions_ldc.py | 37 +++++ .../CompileAndLinkOneStep/Common/__init__.py | 0 .../CompileAndLinkOneStep/Common/common.py | 68 ++++++++ .../CompileAndLinkOneStep/Common/sconstest.skip | 0 .../Image/SConstruct_template | 9 ++ .../CompileAndLinkOneStep/Image/helloWorld.d | 6 + .../CompileAndLinkOneStep/sconstest-dmd.py | 37 +++++ .../CompileAndLinkOneStep/sconstest-gdc.py | 37 +++++ .../CompileAndLinkOneStep/sconstest-ldc.py | 37 +++++ .../CompileThenLinkTwoSteps/Common/__init__.py | 0 .../CompileThenLinkTwoSteps/Common/common.py | 68 ++++++++ .../CompileThenLinkTwoSteps/Common/sconstest.skip | 0 .../Image/SConstruct_template | 11 ++ .../CompileThenLinkTwoSteps/Image/helloWorld.d | 6 + .../CompileThenLinkTwoSteps/sconstest-dmd.py | 37 +++++ .../CompileThenLinkTwoSteps/sconstest-gdc.py | 37 +++++ .../CompileThenLinkTwoSteps/sconstest-ldc.py | 37 +++++ test/D/LDC.py | 71 ++++++++ test/D/LDC_Alt.py | 71 ++++++++ test/D/MixedDAndC/Common/__init__.py | 0 test/D/MixedDAndC/Common/common.py | 56 +++++++ test/D/MixedDAndC/Common/sconstest.skip | 0 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-dmd.py | 37 +++++ test/D/MixedDAndC/sconstest-gdc.py | 37 +++++ test/D/MixedDAndC/sconstest-ldc.py | 37 +++++ test/D/Support/executablesSearch.py | 67 ++++++++ test/D/Support/sconstest.skip | 0 95 files changed, 2631 insertions(+), 154 deletions(-) create mode 100644 src/engine/SCons/Tool/DCommon.py create mode 100644 src/engine/SCons/Tool/gdc.py create mode 100644 src/engine/SCons/Tool/gdc.xml create mode 100644 src/engine/SCons/Tool/ldc.py create mode 100644 src/engine/SCons/Tool/ldc.xml create mode 100644 test/D/CoreScanner/Common/__init__.py create mode 100644 test/D/CoreScanner/Common/common.py create mode 100644 test/D/CoreScanner/Common/sconstest.skip 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/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/DMD2.py create mode 100644 test/D/DMD2_Alt.py create mode 100644 test/D/GDC.py create mode 100644 test/D/GDC_Alt.py create mode 100644 test/D/HSTeoh/ArLibIssue/SConstruct_template create mode 100644 test/D/HSTeoh/ArLibIssue/a.d create mode 100644 test/D/HSTeoh/ArLibIssue/b.d create mode 100644 test/D/HSTeoh/Common/__init__.py create mode 100644 test/D/HSTeoh/Common/arLibIssue.py create mode 100644 test/D/HSTeoh/Common/libCompileOptions.py create mode 100644 test/D/HSTeoh/Common/linkingProblem.py create mode 100644 test/D/HSTeoh/Common/sconstest.skip create mode 100644 test/D/HSTeoh/Common/singleStringCannotBeMultipleOptions.py create mode 100644 test/D/HSTeoh/LibCompileOptions/SConstruct_template create mode 100644 test/D/HSTeoh/LibCompileOptions/mylib.d create mode 100644 test/D/HSTeoh/LibCompileOptions/prog.d 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/sconstest-arLibIssue_dmd.py create mode 100644 test/D/HSTeoh/sconstest-arLibIssue_gdc.py create mode 100644 test/D/HSTeoh/sconstest-arLibIssue_ldc.py create mode 100644 test/D/HSTeoh/sconstest-libCompileOptions_dmd.py create mode 100644 test/D/HSTeoh/sconstest-libCompileOptions_gdc.py create mode 100644 test/D/HSTeoh/sconstest-libCompileOptions_ldc.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/HelloWorld/CompileAndLinkOneStep/Common/__init__.py create mode 100644 test/D/HelloWorld/CompileAndLinkOneStep/Common/common.py create mode 100644 test/D/HelloWorld/CompileAndLinkOneStep/Common/sconstest.skip 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/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/Common/__init__.py create mode 100644 test/D/HelloWorld/CompileThenLinkTwoSteps/Common/common.py create mode 100644 test/D/HelloWorld/CompileThenLinkTwoSteps/Common/sconstest.skip 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/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/LDC_Alt.py create mode 100644 test/D/MixedDAndC/Common/__init__.py create mode 100644 test/D/MixedDAndC/Common/common.py create mode 100644 test/D/MixedDAndC/Common/sconstest.skip 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-dmd.py create mode 100644 test/D/MixedDAndC/sconstest-gdc.py create mode 100644 test/D/MixedDAndC/sconstest-ldc.py create mode 100755 test/D/Support/executablesSearch.py create mode 100644 test/D/Support/sconstest.skip diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 5cea35f..e8ad66c 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -6,6 +6,11 @@ RELEASE 2.3.2.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE + 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. + From Gary Oberbrunner: - get default RPM architecture more robustly when building RPMs diff --git a/src/engine/MANIFEST.in b/src/engine/MANIFEST.in index 0afda50..f62d16e 100644 --- a/src/engine/MANIFEST.in +++ b/src/engine/MANIFEST.in @@ -65,6 +65,7 @@ SCons/Tool/cc.py SCons/Tool/cyglink.py SCons/Tool/cvf.py SCons/Tool/CVS.py +SCons/Tool/DCommon.py SCons/Tool/default.py SCons/Tool/dmd.py SCons/Tool/docbook/__init__.py @@ -82,6 +83,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 @@ -102,6 +104,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/Defaults.py b/src/engine/SCons/Defaults.py index a99bcc7..563e5a8 100644 --- a/src/engine/SCons/Defaults.py +++ b/src/engine/SCons/Defaults.py @@ -144,6 +144,9 @@ ShCAction = SCons.Action.Action("$SHCCCOM", "$SHCCCOMSTR") CXXAction = SCons.Action.Action("$CXXCOM", "$CXXCOMSTR") ShCXXAction = SCons.Action.Action("$SHCXXCOM", "$SHCXXCOMSTR") +DAction = SCons.Action.Action("$DCOM", "$DCOMSTR") +ShDAction = SCons.Action.Action("$SHDCOM", "$SHDCOMSTR") + ASAction = SCons.Action.Action("$ASCOM", "$ASCOMSTR") ASPPAction = SCons.Action.Action("$ASPPCOM", "$ASPPCOMSTR") @@ -321,7 +324,7 @@ def _stripixes(prefix, itms, suffix, stripprefixes, stripsuffixes, env, c=None): where it finds them. This is used by tools (like the GNU linker) that need to turn something like 'libfoo.a' into '-lfoo'. """ - + if not itms: return itms @@ -335,7 +338,7 @@ def _stripixes(prefix, itms, suffix, stripprefixes, stripsuffixes, env, c=None): c = env_c else: c = _concat_ixes - + stripprefixes = list(map(env.subst, SCons.Util.flatten(stripprefixes))) stripsuffixes = list(map(env.subst, SCons.Util.flatten(stripsuffixes))) @@ -413,7 +416,7 @@ def _defines(prefix, defs, suffix, env, c=_concat_ixes): """ return c(prefix, env.subst_path(processDefines(defs)), suffix, env) - + class NullCmdGenerator(object): """This is a callable class that can be used in place of other command generators if you don't want them to do anything. @@ -449,7 +452,7 @@ class Variable_Method_Caller(object): self.method = method def __call__(self, *args, **kw): try: 1//0 - except ZeroDivisionError: + except ZeroDivisionError: # Don't start iterating with the current stack-frame to # prevent creating reference cycles (f_back is safe). frame = sys.exc_info()[2].tb_frame.f_back diff --git a/src/engine/SCons/Tool/DCommon.py b/src/engine/SCons/Tool/DCommon.py new file mode 100644 index 0000000..02a5e73 --- /dev/null +++ b/src/engine/SCons/Tool/DCommon.py @@ -0,0 +1,56 @@ +"""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(env, 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]) + +# 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 c09f8e4..31e3d96 100644 --- a/src/engine/SCons/Tool/__init__.py +++ b/src/engine/SCons/Tool/__init__.py @@ -705,7 +705,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'] @@ -795,8 +795,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', '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', @@ -819,7 +821,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 a8faf5d..dafb5b9 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 +Evolved by Russel Winder (russel@winder.org.uk) +2010-02-07 onwards 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 @@ -18,14 +18,15 @@ blah.lib from the directory where SConstruct resides. Compiler variables: DC - The name of the D compiler to use. Defaults to dmd or gdmd, - whichever is found. + whichever is found. 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 dmd or gdmd. + DLINK - Name of the linker to use. Defaults to dmd or gdmd, + whichever is found. DLINKFLAGS - List of linker flags. Lib tool variables: @@ -60,6 +61,7 @@ Lib tool variables: __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os +import subprocess import SCons.Action import SCons.Builder @@ -67,57 +69,38 @@ import SCons.Defaults import SCons.Scanner.D import SCons.Tool -# Adapted from c++.py -def isD(source): - if not source: - return 0 +import SCons.Tool.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): - global smart_link - global smart_lib - 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_action('.d', SCons.Defaults.DAction) + shared_obj.add_action('.d', SCons.Defaults.ShDAction) static_obj.add_emitter('.d', SCons.Defaults.StaticObjectEmitter) shared_obj.add_emitter('.d', SCons.Defaults.SharedObjectEmitter) - dc = env.Detect(['dmd', 'gdmd']) - env['DC'] = dc + env['DC'] = env.Detect(['dmd', 'gdmd']) 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['SHDC'] = '$DC' + env['SHDCOM'] = '$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -c -fPIC -of$TARGET $SOURCES' + 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['SHOBJSUFFIX'] = '.os' + #env['OBJSUFFIX'] = '.o' + env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 0 + + if env['DC']: + SCons.Tool.DCommon.addDPATHToEnv(env, env['DC']) env['DINCPREFIX'] = '-I' env['DINCSUFFIX'] = '' @@ -129,106 +112,25 @@ def generate(env): env['DFLAGSUFFIX'] = '' env['DFILESUFFIX'] = '.d' - # 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 ' + env['DLINK'] = '$DC' + env['DLINKCOM'] = '$DLINK -of$TARGET $SOURCES $DFLAGS $DLINKFLAGS $_DLINKLIBFLAGS' + env['SHDLINKCOM'] = '$DLINK -shared -defaultlib=libphobos2.so -of$TARGET $SOURCES $DFLAGS $DLINKFLAGS $_DLINKLIBFLAGS' + + env['DLIB'] = 'lib' if env['PLATFORM'] == 'win32' else 'ar cr' + env['DLIBCOM'] = '$DLIB $_DLIBFLAGS {} $TARGET $SOURCES $_DLINKLIBFLAGS'.format('-c' if env['PLATFORM'] == 'win32' else '') + + env['_DLINKLIBFLAGS'] = '$( ${_concat(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' + env['_DLIBFLAGS'] = '$( ${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)} $)' + env['DLINKFLAGS'] = ['-L-L.'] + 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) + 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 d956894..7cda2a8 100644 --- a/src/engine/SCons/Tool/dmd.xml +++ b/src/engine/SCons/Tool/dmd.xml @@ -31,17 +31,19 @@ Sets construction variables for D language compilers - diff --git a/src/engine/SCons/Tool/gdc.py b/src/engine/SCons/Tool/gdc.py new file mode 100644 index 0000000..458b10e --- /dev/null +++ b/src/engine/SCons/Tool/gdc.py @@ -0,0 +1,123 @@ +"""SCons.Tool.gdc + +Tool-specific initialization for the GDC compiler. +(https://github.com/D-Programming-GDC/GDC) + +Developed by Russel Winder (russel@winder.org.uk) +2012-05-09 onwards + +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 gdc. + 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 + +import SCons.Tool.DCommon + + +def generate(env): + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + + static_obj.add_action('.d', SCons.Defaults.DAction) + shared_obj.add_action('.d', SCons.Defaults.ShDAction) + 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['SHDC'] = '$DC' + env['SHDCOM'] = '$SHDC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -fPIC -c -o $TARGET $SOURCES' + + env['DPATH'] = ['#/'] + env['DFLAGS'] = [] + env['DVERSIONS'] = [] + env['DDEBUG'] = [] + + env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 0 + + if env['DC']: + SCons.Tool.DCommon.addDPATHToEnv(env, 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 -o $TARGET $SOURCES $DFLAGS $DLINKFLAGS $_DLINKLIBFLAGS' + env['SHDLINKCOM'] = '$DLINK -o $TARGET $SOURCES $DFLAGS $DLINKFLAGS $_DLINKLIBFLAGS' + + env['DLIB'] = 'lib' if env['PLATFORM'] == 'win32' else 'ar cr' + env['DLIBCOM'] = '$DLIB $_DLIBFLAGS {} $TARGET $SOURCES $_DLINKLIBFLAGS'.format('-c' if env['PLATFORM'] == 'win32' else '') + + env['_DLINKLIBFLAGS'] = '$( ${_concat(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' + env['_DLIBFLAGS'] = '$( ${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)} $)' + env['DLINKFLAGS'] = ['-L.'] + 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) + + +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/src/engine/SCons/Tool/gdc.xml b/src/engine/SCons/Tool/gdc.xml new file mode 100644 index 0000000..1fd95df --- /dev/null +++ b/src/engine/SCons/Tool/gdc.xml @@ -0,0 +1,72 @@ + + + + +%scons; + +%builders-mod; + +%functions-mod; + +%tools-mod; + +%variables-mod; +]> + + + + + + +Sets construction variables for the D language compiler GDC. + + + +DC +DCOM +_DINCFLAGS +_DVERFLAGS +_DDEBUGFLAGS +_DFLAGS +SHDC +SHDCOM +DPATH +DFLAGS +DVERSIONS +DDEBUG +STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME +DINCPREFIX +DINCSUFFIX +DVERPREFIX +DVERSUFFIX +DDEBUGPREFIX +DDEBUGSUFFIX +DFLAGPREFIX +DFLAGSUFFIX +DFLESUFFIX +DLINK +DLINKCOM +SHDLINKCOM +DLIB +DLIBCOM +_DLINKLIBFLAGS +_DLIBFLAGS +DLINKFLAGS +DLIBLINKPREFIX +DLIBLINKSUFFIX +DLIBFLAGPREFIX +DLIBFLAGSUFFIX +DLINKFLAGPREFIX +DLINKFLAGSUFFIX + + + + diff --git a/src/engine/SCons/Tool/ldc.py b/src/engine/SCons/Tool/ldc.py new file mode 100644 index 0000000..aee6701 --- /dev/null +++ b/src/engine/SCons/Tool/ldc.py @@ -0,0 +1,128 @@ +"""SCons.Tool.ldc + +Tool-specific initialization for the LDC compiler. +(http://www.dsource.org/projects/ldc) + +Developed by Russel Winder (russel@winder.org.uk) +2012-05-09 onwards + +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 ldc2. + 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 + + +def generate(env): + static_obj, shared_obj = SCons.Tool.createObjBuilders(env) + + static_obj.add_action('.d', SCons.Defaults.DAction) + shared_obj.add_action('.d', SCons.Defaults.ShDAction) + static_obj.add_emitter('.d', SCons.Defaults.StaticObjectEmitter) + shared_obj.add_emitter('.d', SCons.Defaults.SharedObjectEmitter) + + env['DC'] = env.Detect('ldc2') + 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['SHDC'] = '$DC' + env['SHDCOM'] = '$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -c -relocation-model=pic -of=$TARGET $SOURCES' + + env['DPATH'] = ['#/'] + env['DFLAGS'] = [] + env['DVERSIONS'] = [] + env['DDEBUG'] = [] + + env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 0 + + if env['DC']: + SCons.Tool.DCommon.addDPATHToEnv(env, 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['SHDLINKCOM'] = '$DLINK -shared -of=$TARGET $SOURCES $DFLAGS $DLINKFLAGS $_DLINKLIBFLAGS' + + env['DLIB'] = 'lib' if env['PLATFORM'] == 'win32' else 'ar cr' + env['DLIBCOM'] = '$DLIB $_DLIBFLAGS {} $TARGET $SOURCES $_DLINKLIBFLAGS'.format('-c' if env['PLATFORM'] == 'win32' else '') + + env['_DLINKLIBFLAGS'] = '$( ${_concat(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' + env['_DLIBFLAGS'] = '$( ${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)} $)' + env['DLINKFLAGS'] = ['-L-L.'] + 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) + + +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 new file mode 100644 index 0000000..e8879f8 --- /dev/null +++ b/src/engine/SCons/Tool/ldc.xml @@ -0,0 +1,52 @@ + + + + +Sets construction variables for the D language compiler LDC2. + + +DC +DCOM +_DINCFLAGS +_DVERFLAGS +_DDEBUGFLAGS +_DFLAGS +SHDC +SHDCOM +DPATH +DFLAGS +DVERSIONS +DDEBUG +STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME +DINCPREFIX +DINCSUFFIX +DVERPREFIX +DVERSUFFIX +DDEBUGPREFIX +DDEBUGSUFFIX +DFLAGPREFIX +DFLAGSUFFIX +DFLESUFFIX +DLINK +DLINKCOM +SHDLINKCOM +DLIB +DLIBCOM +_DLINKLIBFLAGS +_DLIBFLAGS +DLINKFLAGS +DLIBLINKPREFIX +DLIBLINKSUFFIX +DLIBFLAGPREFIX +DLIBFLAGSUFFIX +DLINKFLAGPREFIX +DLINKFLAGSUFFIX + + + + diff --git a/src/engine/SCons/Tool/link.py b/src/engine/SCons/Tool/link.py index 3f20fe0..baa7407 100644 --- a/src/engine/SCons/Tool/link.py +++ b/src/engine/SCons/Tool/link.py @@ -42,6 +42,8 @@ import SCons.Warnings from SCons.Tool.FortranCommon import isfortran +from SCons.Tool.DCommon import isD + cplusplus = __import__('c++', globals(), locals(), []) issued_mixed_link_warning = False @@ -49,7 +51,8 @@ issued_mixed_link_warning = False def smart_link(source, target, env, for_signature): has_cplusplus = cplusplus.iscplusplus(source) has_fortran = isfortran(env, source) - if has_cplusplus and has_fortran: + has_d = isD(env, source) + if has_cplusplus and has_fortran and not has_d: global issued_mixed_link_warning if not issued_mixed_link_warning: msg = "Using $CXX to link Fortran and C++ code together.\n\t" + \ @@ -59,6 +62,10 @@ def smart_link(source, target, env, for_signature): msg % env.subst('$CXX')) issued_mixed_link_warning = True return '$CXX' + elif has_d: + env['LINKCOM'] = env['DLINKCOM'] + env['SHLINKCOM'] = env['SHDLINKCOM'] + return '$DC' elif has_fortran: return '$FORTRAN' elif has_cplusplus: @@ -138,7 +145,7 @@ def shlib_emitter_names(target, source, env): print "shlib_emitter_names: side effect: ", name # add version_name to list of names to be a Side effect version_names.append(version_name) - + except KeyError: version = None return version_names @@ -178,8 +185,8 @@ def generate(env): # don't set up the emitter, cause AppendUnique will generate a list # starting with None :-( env.Append(LDMODULEEMITTER='$SHLIBEMITTER') - env['LDMODULEPREFIX'] = '$SHLIBPREFIX' - env['LDMODULESUFFIX'] = '$SHLIBSUFFIX' + env['LDMODULEPREFIX'] = '$SHLIBPREFIX' + env['LDMODULESUFFIX'] = '$SHLIBSUFFIX' env['LDMODULEFLAGS'] = '$SHLINKFLAGS' env['LDMODULECOM'] = '$LDMODULE -o $TARGET $LDMODULEFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' diff --git a/test/D/CoreScanner/Common/__init__.py b/test/D/CoreScanner/Common/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test/D/CoreScanner/Common/common.py b/test/D/CoreScanner/Common/common.py new file mode 100644 index 0000000..657e83e --- /dev/null +++ b/test/D/CoreScanner/Common/common.py @@ -0,0 +1,99 @@ +""" +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/Common/sconstest.skip b/test/D/CoreScanner/Common/sconstest.skip new file mode 100644 index 0000000..e69de29 diff --git a/test/D/CoreScanner/Image/SConstruct_template b/test/D/CoreScanner/Image/SConstruct_template new file mode 100644 index 0000000..a128c67 --- /dev/null +++ b/test/D/CoreScanner/Image/SConstruct_template @@ -0,0 +1,9 @@ +# -*- 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 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/sconstest-dmd.py b/test/D/CoreScanner/sconstest-dmd.py new file mode 100644 index 0000000..df6ddeb --- /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.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..068f2c4 --- /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.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..f61efbc --- /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.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 new file mode 100644 index 0000000..cc8ab93 --- /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(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/DMD2_Alt.py b/test/D/DMD2_Alt.py new file mode 100644 index 0000000..fbe2f2b --- /dev/null +++ b/test/D/DMD2_Alt.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(tools=['dmd', 'link'], 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 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: diff --git a/test/D/GDC_Alt.py b/test/D/GDC_Alt.py new file mode 100644 index 0000000..cac7949 --- /dev/null +++ b/test/D/GDC_Alt.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=['gdc', 'link'], 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/ArLibIssue/SConstruct_template b/test/D/HSTeoh/ArLibIssue/SConstruct_template new file mode 100644 index 0000000..81f81f5 --- /dev/null +++ b/test/D/HSTeoh/ArLibIssue/SConstruct_template @@ -0,0 +1,3 @@ +env = Environment({}) + +env.StaticLibrary('mylib', ['a.d', 'b.d']) diff --git a/test/D/HSTeoh/ArLibIssue/a.d b/test/D/HSTeoh/ArLibIssue/a.d new file mode 100644 index 0000000..e69de29 diff --git a/test/D/HSTeoh/ArLibIssue/b.d b/test/D/HSTeoh/ArLibIssue/b.d new file mode 100644 index 0000000..e69de29 diff --git a/test/D/HSTeoh/Common/__init__.py b/test/D/HSTeoh/Common/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test/D/HSTeoh/Common/arLibIssue.py b/test/D/HSTeoh/Common/arLibIssue.py new file mode 100644 index 0000000..fe5902b --- /dev/null +++ b/test/D/HSTeoh/Common/arLibIssue.py @@ -0,0 +1,63 @@ +""" +These tests check a problem with the lib/ar setting. +""" + +# +# __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 SCons.Environment import Base + +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('ArLibIssue') + test.write('SConstruct', open('SConstruct_template', 'r').read().format('tools=["{}", "ar"]'.format(tool))) + + test.run() + + test.must_exist(test.workpath('a.o')) + test.must_exist(test.workpath('b.o')) + test.must_exist(test.workpath('mylib.a' if Base()['PLATFORM'] == 'win32' else 'libmylib.a')) + + 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/Common/libCompileOptions.py b/test/D/HSTeoh/Common/libCompileOptions.py new file mode 100644 index 0000000..dd95fc8 --- /dev/null +++ b/test/D/HSTeoh/Common/libCompileOptions.py @@ -0,0 +1,63 @@ +""" +These tests check a problem with the lib/ar setting. +""" + +# +# __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 SCons.Environment import Base + +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('LibCompileOptions') + test.write('SConstruct', open('SConstruct_template', 'r').read().format('tools=["{}", "link", "ar"]'.format(tool))) + + test.run() + + test.must_exist(test.workpath('mylib.o')) + test.must_exist(test.workpath('mylib.a' if Base()['PLATFORM'] == 'win32' else 'libmylib.a')) + 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/Common/linkingProblem.py b/test/D/HSTeoh/Common/linkingProblem.py new file mode 100644 index 0000000..59b409f --- /dev/null +++ b/test/D/HSTeoh/Common/linkingProblem.py @@ -0,0 +1,61 @@ +""" +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/Common/sconstest.skip b/test/D/HSTeoh/Common/sconstest.skip new file mode 100644 index 0000000..e69de29 diff --git a/test/D/HSTeoh/Common/singleStringCannotBeMultipleOptions.py b/test/D/HSTeoh/Common/singleStringCannotBeMultipleOptions.py new file mode 100644 index 0000000..4dabf7b --- /dev/null +++ b/test/D/HSTeoh/Common/singleStringCannotBeMultipleOptions.py @@ -0,0 +1,66 @@ +""" +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/HSTeoh/LibCompileOptions/SConstruct_template b/test/D/HSTeoh/LibCompileOptions/SConstruct_template new file mode 100644 index 0000000..7031f5c --- /dev/null +++ b/test/D/HSTeoh/LibCompileOptions/SConstruct_template @@ -0,0 +1,9 @@ +env = Environment({}) + +env.Library('mylib', 'mylib.d') + +prog_env = env.Clone( + LIBS = ['mylib'], + LIBPATH = '#' + ) +prog_env.Program('prog', 'prog.d') diff --git a/test/D/HSTeoh/LibCompileOptions/mylib.d b/test/D/HSTeoh/LibCompileOptions/mylib.d new file mode 100644 index 0000000..e69de29 diff --git a/test/D/HSTeoh/LibCompileOptions/prog.d b/test/D/HSTeoh/LibCompileOptions/prog.d new file mode 100644 index 0000000..33c14ce --- /dev/null +++ b/test/D/HSTeoh/LibCompileOptions/prog.d @@ -0,0 +1,3 @@ +int main() { + return 0; +} diff --git a/test/D/HSTeoh/LinkingProblem/SConstruct_template b/test/D/HSTeoh/LinkingProblem/SConstruct_template new file mode 100644 index 0000000..6815cdf --- /dev/null +++ b/test/D/HSTeoh/LinkingProblem/SConstruct_template @@ -0,0 +1,20 @@ +# -*- 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 new file mode 100644 index 0000000..674fd96 --- /dev/null +++ b/test/D/HSTeoh/LinkingProblem/cprog.c @@ -0,0 +1,7 @@ +extern void ncurs_init(); +extern void 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..3ca6dd3 --- /dev/null +++ b/test/D/HSTeoh/LinkingProblem/ncurs_impl.c @@ -0,0 +1,13 @@ +/* Ncurses wrappers */ +#include + +void ncurs_init() { + initscr(); + cbreak(); + noecho(); + keypad(stdscr, TRUE); +} + +void 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..1337210 --- /dev/null +++ b/test/D/HSTeoh/LinkingProblem/prog.d @@ -0,0 +1,13 @@ +/* + * Simple D program that links to ncurses via a C wrapping file. + */ + +extern(C) { + void ncurs_init(); + void 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..89c603b --- /dev/null +++ b/test/D/HSTeoh/SingleStringCannotBeMultipleOptions/SConstruct_template @@ -0,0 +1,16 @@ +# -*- 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 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/sconstest-arLibIssue_dmd.py b/test/D/HSTeoh/sconstest-arLibIssue_dmd.py new file mode 100644 index 0000000..0b872b4 --- /dev/null +++ b/test/D/HSTeoh/sconstest-arLibIssue_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.arLibIssue 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-arLibIssue_gdc.py b/test/D/HSTeoh/sconstest-arLibIssue_gdc.py new file mode 100644 index 0000000..45e1e36 --- /dev/null +++ b/test/D/HSTeoh/sconstest-arLibIssue_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.arLibIssue 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-arLibIssue_ldc.py b/test/D/HSTeoh/sconstest-arLibIssue_ldc.py new file mode 100644 index 0000000..7960d79 --- /dev/null +++ b/test/D/HSTeoh/sconstest-arLibIssue_ldc.py @@ -0,0 +1,38 @@ +""" +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.arLibIssue 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-libCompileOptions_dmd.py b/test/D/HSTeoh/sconstest-libCompileOptions_dmd.py new file mode 100644 index 0000000..14f2348 --- /dev/null +++ b/test/D/HSTeoh/sconstest-libCompileOptions_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.libCompileOptions 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-libCompileOptions_gdc.py b/test/D/HSTeoh/sconstest-libCompileOptions_gdc.py new file mode 100644 index 0000000..7b57546 --- /dev/null +++ b/test/D/HSTeoh/sconstest-libCompileOptions_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.libCompileOptions 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-libCompileOptions_ldc.py b/test/D/HSTeoh/sconstest-libCompileOptions_ldc.py new file mode 100644 index 0000000..7434350 --- /dev/null +++ b/test/D/HSTeoh/sconstest-libCompileOptions_ldc.py @@ -0,0 +1,38 @@ +""" +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.libCompileOptions 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-linkingProblem_dmd.py b/test/D/HSTeoh/sconstest-linkingProblem_dmd.py new file mode 100644 index 0000000..f4bac72 --- /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 Common.linkingProblem 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..7346b66 --- /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 Common.linkingProblem 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..72c19e4 --- /dev/null +++ b/test/D/HSTeoh/sconstest-linkingProblem_ldc.py @@ -0,0 +1,38 @@ +""" +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.linkingProblem 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..976f820 --- /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 Common.singleStringCannotBeMultipleOptions 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..d65495a --- /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 Common.singleStringCannotBeMultipleOptions 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..6718a88 --- /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 Common.singleStringCannotBeMultipleOptions 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/CompileAndLinkOneStep/Common/__init__.py b/test/D/HelloWorld/CompileAndLinkOneStep/Common/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test/D/HelloWorld/CompileAndLinkOneStep/Common/common.py b/test/D/HelloWorld/CompileAndLinkOneStep/Common/common.py new file mode 100644 index 0000000..618041b --- /dev/null +++ b/test/D/HelloWorld/CompileAndLinkOneStep/Common/common.py @@ -0,0 +1,68 @@ +""" +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/Common/sconstest.skip b/test/D/HelloWorld/CompileAndLinkOneStep/Common/sconstest.skip new file mode 100644 index 0000000..e69de29 diff --git a/test/D/HelloWorld/CompileAndLinkOneStep/Image/SConstruct_template b/test/D/HelloWorld/CompileAndLinkOneStep/Image/SConstruct_template new file mode 100644 index 0000000..c688ab7 --- /dev/null +++ b/test/D/HelloWorld/CompileAndLinkOneStep/Image/SConstruct_template @@ -0,0 +1,9 @@ +# -*- 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 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/sconstest-dmd.py b/test/D/HelloWorld/CompileAndLinkOneStep/sconstest-dmd.py new file mode 100644 index 0000000..df6ddeb --- /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.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..068f2c4 --- /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.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..f61efbc --- /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.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/Common/__init__.py b/test/D/HelloWorld/CompileThenLinkTwoSteps/Common/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test/D/HelloWorld/CompileThenLinkTwoSteps/Common/common.py b/test/D/HelloWorld/CompileThenLinkTwoSteps/Common/common.py new file mode 100644 index 0000000..618041b --- /dev/null +++ b/test/D/HelloWorld/CompileThenLinkTwoSteps/Common/common.py @@ -0,0 +1,68 @@ +""" +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/Common/sconstest.skip b/test/D/HelloWorld/CompileThenLinkTwoSteps/Common/sconstest.skip new file mode 100644 index 0000000..e69de29 diff --git a/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/SConstruct_template b/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/SConstruct_template new file mode 100644 index 0000000..425970a --- /dev/null +++ b/test/D/HelloWorld/CompileThenLinkTwoSteps/Image/SConstruct_template @@ -0,0 +1,11 @@ +# -*- 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 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/sconstest-dmd.py b/test/D/HelloWorld/CompileThenLinkTwoSteps/sconstest-dmd.py new file mode 100644 index 0000000..df6ddeb --- /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.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..43bb8eb --- /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.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..f61efbc --- /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.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..94acf1c --- /dev/null +++ b/test/D/LDC.py @@ -0,0 +1,71 @@ +#!/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/LDC_Alt.py b/test/D/LDC_Alt.py new file mode 100644 index 0000000..571b8f0 --- /dev/null +++ b/test/D/LDC_Alt.py @@ -0,0 +1,71 @@ +#!/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=['ldc', 'link'], 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/Common/__init__.py b/test/D/MixedDAndC/Common/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test/D/MixedDAndC/Common/common.py b/test/D/MixedDAndC/Common/common.py new file mode 100644 index 0000000..66c738f --- /dev/null +++ b/test/D/MixedDAndC/Common/common.py @@ -0,0 +1,56 @@ +""" +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 + +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.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/MixedDAndC/Common/sconstest.skip b/test/D/MixedDAndC/Common/sconstest.skip new file mode 100644 index 0000000..e69de29 diff --git a/test/D/MixedDAndC/Image/SConstruct b/test/D/MixedDAndC/Image/SConstruct new file mode 100644 index 0000000..47870d7 --- /dev/null +++ b/test/D/MixedDAndC/Image/SConstruct @@ -0,0 +1,13 @@ +# -*- 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 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-dmd.py b/test/D/MixedDAndC/sconstest-dmd.py new file mode 100644 index 0000000..df66255 --- /dev/null +++ b/test/D/MixedDAndC/sconstest-dmd.py @@ -0,0 +1,37 @@ +""" +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__" + +from Common.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/MixedDAndC/sconstest-gdc.py b/test/D/MixedDAndC/sconstest-gdc.py new file mode 100644 index 0000000..7ac95c0 --- /dev/null +++ b/test/D/MixedDAndC/sconstest-gdc.py @@ -0,0 +1,37 @@ +""" +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__" + +from Common.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/MixedDAndC/sconstest-ldc.py b/test/D/MixedDAndC/sconstest-ldc.py new file mode 100644 index 0000000..f9ab342 --- /dev/null +++ b/test/D/MixedDAndC/sconstest-ldc.py @@ -0,0 +1,37 @@ +""" +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__" + +from Common.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/Support/executablesSearch.py b/test/D/Support/executablesSearch.py new file mode 100755 index 0000000..e0487f6 --- /dev/null +++ b/test/D/Support/executablesSearch.py @@ -0,0 +1,67 @@ +#! /usr/bin/env python + +""" +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 + +if __name__ == '__main__': + import unittest + import sys + import os.path + sys.path.append(os.path.abspath('../../../QMTest')) + sys.path.append(os.path.abspath('../../../src/engine')) + import TestSCons + + class VariousTests(unittest.TestCase): + def setUp(self): + self.test = TestSCons.TestSCons() + def test_None_tool(self): + self.assertRaises(KeyError, isExecutableOfToolAvailable, self.test, None) + def test_dmd_tool(self): + self.assertEqual( + self.test.where_is('dmd') is not None or self.test.where_is('gdmd') is not None, + isExecutableOfToolAvailable(self.test, 'dmd')) + def test_gdc_tool(self): + self.assertEqual( + self.test.where_is('gdc') is not None, + isExecutableOfToolAvailable(self.test, 'gdc')) + def test_ldc_tool(self): + self.assertEqual( + self.test.where_is('ldc2') is not None or self.test.where_is('ldc') is not None, + isExecutableOfToolAvailable(self.test, 'ldc')) + + unittest.main() 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 9c715143bb543c30fda6546e6f1f74865534cfdc Mon Sep 17 00:00:00 2001 From: Gary Oberbrunner Date: Sat, 19 Apr 2014 12:39:12 -0400 Subject: Added changelog for PR#127 (fix SConf tests) --- src/CHANGES.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 5cea35f..3dcb279 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -6,6 +6,9 @@ RELEASE 2.3.2.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE + From Paweł Tomulik: + - Fix SConf tests that write output + From Gary Oberbrunner: - get default RPM architecture more robustly when building RPMs -- cgit v0.12 From 1da3ba42c01c41d85c33a5025068e09c4e97219c Mon Sep 17 00:00:00 2001 From: Russel Winder Date: Wed, 23 Apr 2014 19:00:51 +0100 Subject: Fix Issue 2939. --- src/engine/SCons/Tool/dmd.py | 29 ++++++---- src/engine/SCons/Tool/dmd.xml | 19 +++---- src/engine/SCons/Tool/gdc.py | 19 ++++--- src/engine/SCons/Tool/gdc.xml | 10 ++-- src/engine/SCons/Tool/ldc.py | 27 ++++++---- src/engine/SCons/Tool/ldc.xml | 40 +++++++++++--- test/D/Issues/2939_Ariovistus/Common/__init__.py | 0 .../2939_Ariovistus/Common/correctLinkOptions.py | 62 ++++++++++++++++++++++ .../D/Issues/2939_Ariovistus/Common/sconstest.skip | 0 .../2939_Ariovistus/Project/SConstruct_template | 9 ++++ .../2939_Ariovistus/Project/test/test1/SConscript | 14 +++++ .../2939_Ariovistus/Project/test/test1/stuff.cpp | 12 +++++ .../2939_Ariovistus/Project/test/test1/stuff.h | 10 ++++ .../2939_Ariovistus/Project/test/test1/test1.cpp | 5 ++ .../2939_Ariovistus/Project/test/test1/test2.d | 13 +++++ .../sconstest-correctLinkOptions_dmd.py | 37 +++++++++++++ .../sconstest-correctLinkOptions_gdc.py | 37 +++++++++++++ .../sconstest-correctLinkOptions_ldc.py | 37 +++++++++++++ 18 files changed, 333 insertions(+), 47 deletions(-) create mode 100644 test/D/Issues/2939_Ariovistus/Common/__init__.py create mode 100644 test/D/Issues/2939_Ariovistus/Common/correctLinkOptions.py create mode 100644 test/D/Issues/2939_Ariovistus/Common/sconstest.skip create mode 100644 test/D/Issues/2939_Ariovistus/Project/SConstruct_template create mode 100644 test/D/Issues/2939_Ariovistus/Project/test/test1/SConscript create mode 100644 test/D/Issues/2939_Ariovistus/Project/test/test1/stuff.cpp create mode 100644 test/D/Issues/2939_Ariovistus/Project/test/test1/stuff.h create mode 100644 test/D/Issues/2939_Ariovistus/Project/test/test1/test1.cpp create mode 100644 test/D/Issues/2939_Ariovistus/Project/test/test1/test2.d create mode 100644 test/D/Issues/2939_Ariovistus/sconstest-correctLinkOptions_dmd.py create mode 100644 test/D/Issues/2939_Ariovistus/sconstest-correctLinkOptions_gdc.py create mode 100644 test/D/Issues/2939_Ariovistus/sconstest-correctLinkOptions_ldc.py diff --git a/src/engine/SCons/Tool/dmd.py b/src/engine/SCons/Tool/dmd.py index dafb5b9..4279184 100644 --- a/src/engine/SCons/Tool/dmd.py +++ b/src/engine/SCons/Tool/dmd.py @@ -95,8 +95,6 @@ def generate(env): env['DVERSIONS'] = [] env['DDEBUG'] = [] - #env['SHOBJSUFFIX'] = '.os' - #env['OBJSUFFIX'] = '.o' env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 0 if env['DC']: @@ -113,21 +111,30 @@ def generate(env): env['DFILESUFFIX'] = '.d' env['DLINK'] = '$DC' - env['DLINKCOM'] = '$DLINK -of$TARGET $SOURCES $DFLAGS $DLINKFLAGS $_DLINKLIBFLAGS' - env['SHDLINKCOM'] = '$DLINK -shared -defaultlib=libphobos2.so -of$TARGET $SOURCES $DFLAGS $DLINKFLAGS $_DLINKLIBFLAGS' + env['DLINKFLAGS'] = SCons.Util.CLVar('') + env['DLINKCOM'] = '$DLINK -of$TARGET $DLINKFLAGS $__RPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS' - env['DLIB'] = 'lib' if env['PLATFORM'] == 'win32' else 'ar cr' - env['DLIBCOM'] = '$DLIB $_DLIBFLAGS {} $TARGET $SOURCES $_DLINKLIBFLAGS'.format('-c' if env['PLATFORM'] == 'win32' else '') + env['DSHLINK'] = '$DC' + env['DSHLINKFLAGS'] = SCons.Util.CLVar('$DLINKFLAGS -shared -defaultlib=libphobos2.so') + env['SHDLINKCOM'] = '$DLINK -of$TARGET $DSHLINKFLAGS $__RPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS' - env['_DLINKLIBFLAGS'] = '$( ${_concat(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' - env['_DLIBFLAGS'] = '$( ${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)} $)' - env['DLINKFLAGS'] = ['-L-L.'] env['DLIBLINKPREFIX'] = '' if env['PLATFORM'] == 'win32' else '-L-l' env['DLIBLINKSUFFIX'] = '.lib' if env['PLATFORM'] == 'win32' else '' + #env['_DLIBFLAGS'] = '$( ${_concat(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' + env['_DLIBFLAGS'] = '${_stripixes(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, LIBPREFIXES, LIBSUFFIXES, __env__)}' + + env['DLIBDIRPREFIX'] = '-L-L' + env['DLIBDIRSUFFIX'] = '' + env['_DLIBDIRFLAGS'] = '$( ${_concat(DLIBDIRPREFIX, LIBPATH, DLIBDIRSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' + + + env['DLIB'] = 'lib' if env['PLATFORM'] == 'win32' else 'ar cr' + env['DLIBCOM'] = '$DLIB $_DLIBFLAGS {} $TARGET $SOURCES $_DLIBFLAGS'.format('-c' if env['PLATFORM'] == 'win32' else '') + + #env['_DLIBFLAGS'] = '$( ${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)} $)' + env['DLIBFLAGPREFIX'] = '-' env['DLIBFLAGSUFFIX'] = '' - env['DLINKFLAGPREFIX'] = '-' - env['DLINKFLAGSUFFIX'] = '' SCons.Tool.createStaticLibBuilder(env) diff --git a/src/engine/SCons/Tool/dmd.xml b/src/engine/SCons/Tool/dmd.xml index 7cda2a8..b42791e 100644 --- a/src/engine/SCons/Tool/dmd.xml +++ b/src/engine/SCons/Tool/dmd.xml @@ -26,8 +26,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 D language compiler DMD. @@ -54,19 +53,21 @@ Sets construction variables for D language compilers DFLAGSUFFIX DFLESUFFIX DLINK +DLINKFLAGS DLINKCOM +SHDLINK +SHDLINKFLAGS SHDLINKCOM -DLIB -DLIBCOM -_DLINKLIBFLAGS -_DLIBFLAGS -DLINKFLAGS DLIBLINKPREFIX DLIBLINKSUFFIX +_DLIBFLAGS +DLIBDIRPREFIX +DLIBDIRSUFFIX +_DLIBDIRFLAGS +DLIB +DLIBCOM DLIBFLAGPREFIX DLIBFLAGSUFFIX -DLINKFLAGPREFIX -DLINKFLAGSUFFIX diff --git a/src/engine/SCons/Tool/gdc.py b/src/engine/SCons/Tool/gdc.py index 458b10e..7c8649b 100644 --- a/src/engine/SCons/Tool/gdc.py +++ b/src/engine/SCons/Tool/gdc.py @@ -94,22 +94,29 @@ def generate(env): env['DFILESUFFIX'] = '.d' env['DLINK'] = '$DC' - env['DLINKCOM'] = '$DLINK -o $TARGET $SOURCES $DFLAGS $DLINKFLAGS $_DLINKLIBFLAGS' - env['SHDLINKCOM'] = '$DLINK -o $TARGET $SOURCES $DFLAGS $DLINKFLAGS $_DLINKLIBFLAGS' + env['DLINKFLAGS'] = SCons.Util.CLVar('') + env['DLINKCOM'] = '$DLINK -o $TARGET $DLINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' + + env['SHDLINK'] = '$DC' + env['SHDLINKFLAGS'] = SCons.Util.CLVar('$DLINKFLAGS -shared') + env['SHDLINKCOM'] = '$DLINK -o $TARGET $DLINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' env['DLIB'] = 'lib' if env['PLATFORM'] == 'win32' else 'ar cr' env['DLIBCOM'] = '$DLIB $_DLIBFLAGS {} $TARGET $SOURCES $_DLINKLIBFLAGS'.format('-c' if env['PLATFORM'] == 'win32' else '') - env['_DLINKLIBFLAGS'] = '$( ${_concat(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' env['_DLIBFLAGS'] = '$( ${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)} $)' - env['DLINKFLAGS'] = ['-L.'] - env['DLIBLINKPREFIX'] = '' if env['PLATFORM'] == 'win32' else '-l' - env['DLIBLINKSUFFIX'] = '.lib' if env['PLATFORM'] == 'win32' else '' + env['DLIBFLAGPREFIX'] = '-' env['DLIBFLAGSUFFIX'] = '' env['DLINKFLAGPREFIX'] = '-' env['DLINKFLAGSUFFIX'] = '' + # __RPATH is set to $_RPATH in the platform specification if that + # platform supports it. + env['RPATHPREFIX'] = '-Wl,-rpath=' + env['RPATHSUFFIX'] = '' + env['_RPATH'] = '${_concat(RPATHPREFIX, RPATH, RPATHSUFFIX, __env__)}' + SCons.Tool.createStaticLibBuilder(env) diff --git a/src/engine/SCons/Tool/gdc.xml b/src/engine/SCons/Tool/gdc.xml index 1fd95df..818c7d2 100644 --- a/src/engine/SCons/Tool/gdc.xml +++ b/src/engine/SCons/Tool/gdc.xml @@ -53,19 +53,21 @@ Sets construction variables for the D language compiler GDC. DFLAGSUFFIX DFLESUFFIX DLINK +DLINKFLAGS DLINKCOM +SHDLINK +SHDLINKFLAGS SHDLINKCOM DLIB DLIBCOM -_DLINKLIBFLAGS _DLIBFLAGS -DLINKFLAGS -DLIBLINKPREFIX -DLIBLINKSUFFIX DLIBFLAGPREFIX DLIBFLAGSUFFIX DLINKFLAGPREFIX DLINKFLAGSUFFIX +RPATHPREFIX +RPATHSUFFIX +_RPATH diff --git a/src/engine/SCons/Tool/ldc.py b/src/engine/SCons/Tool/ldc.py index aee6701..2531064 100644 --- a/src/engine/SCons/Tool/ldc.py +++ b/src/engine/SCons/Tool/ldc.py @@ -99,21 +99,30 @@ def generate(env): env['DFILESUFFIX'] = '.d' env['DLINK'] = '$DC' - env['DLINKCOM'] = '$DLINK -of=$TARGET $SOURCES $DFLAGS $DLINKFLAGS $_DLINKLIBFLAGS' - env['SHDLINKCOM'] = '$DLINK -shared -of=$TARGET $SOURCES $DFLAGS $DLINKFLAGS $_DLINKLIBFLAGS' + env['DLINKFLAGS'] = SCons.Util.CLVar('') + env['DLINKCOM'] = '$DLINK -of=$TARGET $DLINKFLAGS $__RPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS' - env['DLIB'] = 'lib' if env['PLATFORM'] == 'win32' else 'ar cr' - env['DLIBCOM'] = '$DLIB $_DLIBFLAGS {} $TARGET $SOURCES $_DLINKLIBFLAGS'.format('-c' if env['PLATFORM'] == 'win32' else '') + env['DSHLINK'] = '$DC' + env['DSHLINKFLAGS'] = SCons.Util.CLVar('$DLINKFLAGS -shared') + env['SHDLINKCOM'] = '$DLINK -of=$TARGET $DSHLINKFLAGS $__RPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS' - env['_DLINKLIBFLAGS'] = '$( ${_concat(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' - env['_DLIBFLAGS'] = '$( ${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)} $)' - env['DLINKFLAGS'] = ['-L-L.'] env['DLIBLINKPREFIX'] = '' if env['PLATFORM'] == 'win32' else '-L-l' env['DLIBLINKSUFFIX'] = '.lib' if env['PLATFORM'] == 'win32' else '' + #env['_DLIBFLAGS'] = '$( ${_concat(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' + env['_DLIBFLAGS'] = '${_stripixes(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, LIBPREFIXES, LIBSUFFIXES, __env__)}' + + env['DLIBDIRPREFIX'] = '-L-L' + env['DLIBDIRSUFFIX'] = '' + env['_DLIBDIRFLAGS'] = '$( ${_concat(DLIBDIRPREFIX, LIBPATH, DLIBDIRSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' + + + env['DLIB'] = 'lib' if env['PLATFORM'] == 'win32' else 'ar cr' + env['DLIBCOM'] = '$DLIB $_DLIBFLAGS {} $TARGET $SOURCES $_DLIBFLAGS'.format('-c' if env['PLATFORM'] == 'win32' else '') + + #env['_DLIBFLAGS'] = '$( ${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)} $)' + env['DLIBFLAGPREFIX'] = '-' env['DLIBFLAGSUFFIX'] = '' - env['DLINKFLAGPREFIX'] = '-' - env['DLINKFLAGSUFFIX'] = '' SCons.Tool.createStaticLibBuilder(env) diff --git a/src/engine/SCons/Tool/ldc.xml b/src/engine/SCons/Tool/ldc.xml index e8879f8..cfa38a9 100644 --- a/src/engine/SCons/Tool/ldc.xml +++ b/src/engine/SCons/Tool/ldc.xml @@ -5,9 +5,29 @@ __COPYRIGHT__ This file is processed by the bin/SConsDoc.py module. See its __doc__ string for a discussion of the format. --> - + + +%scons; + +%builders-mod; + +%functions-mod; + +%tools-mod; + +%variables-mod; +]> + + + + + Sets construction variables for the D language compiler LDC2. + DC @@ -33,20 +53,24 @@ Sets construction variables for the D language compiler LDC2. DFLAGSUFFIX DFLESUFFIX DLINK +DLINKFLAGS DLINKCOM +SHDLINK +SHDLINKFLAGS SHDLINKCOM -DLIB -DLIBCOM -_DLINKLIBFLAGS -_DLIBFLAGS -DLINKFLAGS DLIBLINKPREFIX DLIBLINKSUFFIX +_DLIBFLAGS +DLIBDIRPREFIX +DLIBDIRSUFFIX +_DLIBDIRFLAGS +DLIB +DLIBCOM DLIBFLAGPREFIX DLIBFLAGSUFFIX -DLINKFLAGPREFIX -DLINKFLAGSUFFIX + + diff --git a/test/D/Issues/2939_Ariovistus/Common/__init__.py b/test/D/Issues/2939_Ariovistus/Common/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test/D/Issues/2939_Ariovistus/Common/correctLinkOptions.py b/test/D/Issues/2939_Ariovistus/Common/correctLinkOptions.py new file mode 100644 index 0000000..3b178b9 --- /dev/null +++ b/test/D/Issues/2939_Ariovistus/Common/correctLinkOptions.py @@ -0,0 +1,62 @@ +""" +These tests check a problem with the linker options setting. +""" + +# +# __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 SCons.Environment import Base + +from os.path import abspath, dirname, join + +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('Project') + test.write('SConstruct', open('SConstruct_template', 'r').read().format('tools=["{}", "link"]'.format(tool))) + + test.run() + + for f in ('libstuff.so', 'stuff.os', 'test1', 'test1.o', 'test2', 'test2.o'): + test.must_exist(test.workpath(join('test', 'test1', f))) + + 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/Issues/2939_Ariovistus/Common/sconstest.skip b/test/D/Issues/2939_Ariovistus/Common/sconstest.skip new file mode 100644 index 0000000..e69de29 diff --git a/test/D/Issues/2939_Ariovistus/Project/SConstruct_template b/test/D/Issues/2939_Ariovistus/Project/SConstruct_template new file mode 100644 index 0000000..55f02aa --- /dev/null +++ b/test/D/Issues/2939_Ariovistus/Project/SConstruct_template @@ -0,0 +1,9 @@ +from os.path import join + +environment = Environment({}) + +Export('environment') + +environment.SConscript([ + join("test","test1", "SConscript"), +]); diff --git a/test/D/Issues/2939_Ariovistus/Project/test/test1/SConscript b/test/D/Issues/2939_Ariovistus/Project/test/test1/SConscript new file mode 100644 index 0000000..53a1ca0 --- /dev/null +++ b/test/D/Issues/2939_Ariovistus/Project/test/test1/SConscript @@ -0,0 +1,14 @@ +Import('environment') + +env = Environment() +env.SharedLibrary(target='stuff', source=['stuff.cpp']) + +env = Environment() +env.Append(LIBPATH=['.']) +env.Append(LIBS=['stuff']) +env.Program(target='test1', source=['test1.cpp']) + +env = environment.Clone() +env.Append(LIBPATH=['.']) +env.Append(LIBS=['stuff']) +env.Program(target='test2', source=['test2.d']) diff --git a/test/D/Issues/2939_Ariovistus/Project/test/test1/stuff.cpp b/test/D/Issues/2939_Ariovistus/Project/test/test1/stuff.cpp new file mode 100644 index 0000000..2970549 --- /dev/null +++ b/test/D/Issues/2939_Ariovistus/Project/test/test1/stuff.cpp @@ -0,0 +1,12 @@ +#include "stuff.h" + +X::X() { + this->i = 1; +} +int X::y(){ + return this->i; +} + +X *SomeX() { + return new X(); +} diff --git a/test/D/Issues/2939_Ariovistus/Project/test/test1/stuff.h b/test/D/Issues/2939_Ariovistus/Project/test/test1/stuff.h new file mode 100644 index 0000000..863c330 --- /dev/null +++ b/test/D/Issues/2939_Ariovistus/Project/test/test1/stuff.h @@ -0,0 +1,10 @@ + +class X { + public: + int i; + + X(); + int y(); +}; + +X *SomeX(); diff --git a/test/D/Issues/2939_Ariovistus/Project/test/test1/test1.cpp b/test/D/Issues/2939_Ariovistus/Project/test/test1/test1.cpp new file mode 100644 index 0000000..f4d7208 --- /dev/null +++ b/test/D/Issues/2939_Ariovistus/Project/test/test1/test1.cpp @@ -0,0 +1,5 @@ +#include "stuff.h" + +int main() { + X *x = SomeX(); +} diff --git a/test/D/Issues/2939_Ariovistus/Project/test/test1/test2.d b/test/D/Issues/2939_Ariovistus/Project/test/test1/test2.d new file mode 100644 index 0000000..4fbfa4d --- /dev/null +++ b/test/D/Issues/2939_Ariovistus/Project/test/test1/test2.d @@ -0,0 +1,13 @@ +import std.stdio; + +struct X { +} + +extern(C) int _ZN1X1yEv(X* _this); +extern(C) X* _Z5SomeXv(); + +void main() { + X *x = _Z5SomeXv(); + int i = _ZN1X1yEv(x); + writeln("i: ", i); +} diff --git a/test/D/Issues/2939_Ariovistus/sconstest-correctLinkOptions_dmd.py b/test/D/Issues/2939_Ariovistus/sconstest-correctLinkOptions_dmd.py new file mode 100644 index 0000000..2446a28 --- /dev/null +++ b/test/D/Issues/2939_Ariovistus/sconstest-correctLinkOptions_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 Common.correctLinkOptions 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/Issues/2939_Ariovistus/sconstest-correctLinkOptions_gdc.py b/test/D/Issues/2939_Ariovistus/sconstest-correctLinkOptions_gdc.py new file mode 100644 index 0000000..baf2921 --- /dev/null +++ b/test/D/Issues/2939_Ariovistus/sconstest-correctLinkOptions_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.correctLinkOptions 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/Issues/2939_Ariovistus/sconstest-correctLinkOptions_ldc.py b/test/D/Issues/2939_Ariovistus/sconstest-correctLinkOptions_ldc.py new file mode 100644 index 0000000..a61a94b --- /dev/null +++ b/test/D/Issues/2939_Ariovistus/sconstest-correctLinkOptions_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 Common.correctLinkOptions import testForTool +testForTool('ldc') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: -- cgit v0.12 From 211c97c8a8b7ceaf2c4cbc76c429ca3d43220d89 Mon Sep 17 00:00:00 2001 From: Robert Managan Date: Wed, 23 Apr 2014 23:01:33 -0700 Subject: add name.synctex.gz to list of side effect files and those to be cleaned --- src/engine/SCons/Tool/tex.py | 5 ++- test/TEX/synctex.py | 89 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 test/TEX/synctex.py diff --git a/src/engine/SCons/Tool/tex.py b/src/engine/SCons/Tool/tex.py index 5f24df0..f51c7dc 100644 --- a/src/engine/SCons/Tool/tex.py +++ b/src/engine/SCons/Tool/tex.py @@ -684,15 +684,18 @@ def tex_emitter_core(target, source, env, graphics_extensions): auxfilename = targetbase + '.aux' logfilename = targetbase + '.log' flsfilename = targetbase + '.fls' + syncfilename = targetbase + '.synctex.gz' env.SideEffect(auxfilename,target[0]) env.SideEffect(logfilename,target[0]) env.SideEffect(flsfilename,target[0]) + env.SideEffect(syncfilename,target[0]) if Verbose: - print "side effect :",auxfilename,logfilename,flsfilename + print "side effect :",auxfilename,logfilename,flsfilename,syncfilename env.Clean(target[0],auxfilename) env.Clean(target[0],logfilename) env.Clean(target[0],flsfilename) + env.Clean(target[0],syncfilename) content = source[0].get_text_contents() diff --git a/test/TEX/synctex.py b/test/TEX/synctex.py new file mode 100644 index 0000000..867063a --- /dev/null +++ b/test/TEX/synctex.py @@ -0,0 +1,89 @@ +#!/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__" + +""" +Validate that use of -synctex command option causes SCons to +be aware of the created synctex.gz file. + +Test configuration contributed by Robert Managan. +""" + +import os +import TestSCons + +test = TestSCons.TestSCons() + +latex = test.where_is('latex') + +if not latex: + test.skip_test("Could not find latex; skipping test(s).\n") + +test.write('SConstruct', """\ +import os +env = Environment() +env.AppendUnique(PDFLATEXFLAGS = '-synctex=1') +env.PDF('mysync', 'mysync.tex') +""") + +test.write('mysync.tex', r""" +\documentclass{article} + +\begin{document} + +This is a simple test of the synctex.gz file. + +\end{document} +""") + +test.run(arguments = '.', stderr=None) + +test.must_exist(test.workpath('mysync.synctex.gz')) +test.must_exist(test.workpath('mysync.aux')) +test.must_exist(test.workpath('mysync.fls')) +test.must_exist(test.workpath('mysync.log')) +test.must_exist(test.workpath('mysync.pdf')) + +test.run(arguments = '-c .') + +x = "Could not remove 'mysync.aux': No such file or directory" +test.must_not_contain_any_line(test.stdout(), [x]) + +test.must_not_exist(test.workpath('mysync.synctex.gz')) +test.must_not_exist(test.workpath('mysync.aux')) +test.must_not_exist(test.workpath('mysync.fls')) +test.must_not_exist(test.workpath('mysync.log')) +test.must_not_exist(test.workpath('mysync.pdf')) + +test.pass_test() + + + + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: -- cgit v0.12 From 39ef5817b09766f7381cfa19d6775d05fbb5902f Mon Sep 17 00:00:00 2001 From: Russel Winder Date: Thu, 24 Apr 2014 12:16:44 +0100 Subject: Fix Issue 2940, generating the wrong rpath flags for DMD and LDC. --- src/engine/SCons/Platform/posix.py | 4 ++ src/engine/SCons/Tool/dmd.py | 11 ++-- src/engine/SCons/Tool/dmd.xml | 8 ++- src/engine/SCons/Tool/gdc.xml | 6 ++- src/engine/SCons/Tool/ldc.py | 10 +++- src/engine/SCons/Tool/ldc.xml | 10 +++- test/D/Issues/2940_Ariovistus/Common/__init__.py | 0 .../2940_Ariovistus/Common/correctLinkOptions.py | 62 ++++++++++++++++++++++ .../D/Issues/2940_Ariovistus/Common/sconstest.skip | 0 .../2940_Ariovistus/Project/SConstruct_template | 9 ++++ .../2940_Ariovistus/Project/test/test1/SConscript | 16 ++++++ .../2940_Ariovistus/Project/test/test1/stuff.cpp | 12 +++++ .../2940_Ariovistus/Project/test/test1/stuff.h | 10 ++++ .../2940_Ariovistus/Project/test/test1/test1.cpp | 5 ++ .../2940_Ariovistus/Project/test/test1/test2.d | 13 +++++ .../sconstest-correctLinkOptions_dmd.py | 37 +++++++++++++ .../sconstest-correctLinkOptions_gdc.py | 37 +++++++++++++ .../sconstest-correctLinkOptions_ldc.py | 37 +++++++++++++ 18 files changed, 276 insertions(+), 11 deletions(-) create mode 100644 test/D/Issues/2940_Ariovistus/Common/__init__.py create mode 100644 test/D/Issues/2940_Ariovistus/Common/correctLinkOptions.py create mode 100644 test/D/Issues/2940_Ariovistus/Common/sconstest.skip create mode 100644 test/D/Issues/2940_Ariovistus/Project/SConstruct_template create mode 100644 test/D/Issues/2940_Ariovistus/Project/test/test1/SConscript create mode 100644 test/D/Issues/2940_Ariovistus/Project/test/test1/stuff.cpp create mode 100644 test/D/Issues/2940_Ariovistus/Project/test/test1/stuff.h create mode 100644 test/D/Issues/2940_Ariovistus/Project/test/test1/test1.cpp create mode 100644 test/D/Issues/2940_Ariovistus/Project/test/test1/test2.d create mode 100644 test/D/Issues/2940_Ariovistus/sconstest-correctLinkOptions_dmd.py create mode 100644 test/D/Issues/2940_Ariovistus/sconstest-correctLinkOptions_gdc.py create mode 100644 test/D/Issues/2940_Ariovistus/sconstest-correctLinkOptions_ldc.py diff --git a/src/engine/SCons/Platform/posix.py b/src/engine/SCons/Platform/posix.py index 2e21e5a..7e69a7c 100644 --- a/src/engine/SCons/Platform/posix.py +++ b/src/engine/SCons/Platform/posix.py @@ -113,6 +113,10 @@ def generate(env): # This platform supports RPATH specifications. env['__RPATH'] = '$_RPATH' + # GDC is GCC family, but DMD and LDC have different options. + # Must be able to have GCC and DMD work in the same build, so: + env['__DRPATH'] = '$_DRPATH' + # Local Variables: # tab-width:4 # indent-tabs-mode:nil diff --git a/src/engine/SCons/Tool/dmd.py b/src/engine/SCons/Tool/dmd.py index 4279184..f1afc79 100644 --- a/src/engine/SCons/Tool/dmd.py +++ b/src/engine/SCons/Tool/dmd.py @@ -112,15 +112,14 @@ def generate(env): env['DLINK'] = '$DC' env['DLINKFLAGS'] = SCons.Util.CLVar('') - env['DLINKCOM'] = '$DLINK -of$TARGET $DLINKFLAGS $__RPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS' + env['DLINKCOM'] = '$DLINK -of$TARGET $DLINKFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS' env['DSHLINK'] = '$DC' env['DSHLINKFLAGS'] = SCons.Util.CLVar('$DLINKFLAGS -shared -defaultlib=libphobos2.so') - env['SHDLINKCOM'] = '$DLINK -of$TARGET $DSHLINKFLAGS $__RPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS' + env['SHDLINKCOM'] = '$DLINK -of$TARGET $DSHLINKFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS' env['DLIBLINKPREFIX'] = '' if env['PLATFORM'] == 'win32' else '-L-l' env['DLIBLINKSUFFIX'] = '.lib' if env['PLATFORM'] == 'win32' else '' - #env['_DLIBFLAGS'] = '$( ${_concat(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' env['_DLIBFLAGS'] = '${_stripixes(DLIBLINKPREFIX, LIBS, DLIBLINKSUFFIX, LIBPREFIXES, LIBSUFFIXES, __env__)}' env['DLIBDIRPREFIX'] = '-L-L' @@ -136,6 +135,12 @@ def generate(env): env['DLIBFLAGPREFIX'] = '-' env['DLIBFLAGSUFFIX'] = '' + # __RPATH is set to $_RPATH in the platform specification if that + # platform supports it. + env['DRPATHPREFIX'] = '-L-rpath=' + env['DRPATHSUFFIX'] = '' + env['_DRPATH'] = '${_concat(DRPATHPREFIX, RPATH, DRPATHSUFFIX, __env__)}' + SCons.Tool.createStaticLibBuilder(env) diff --git a/src/engine/SCons/Tool/dmd.xml b/src/engine/SCons/Tool/dmd.xml index b42791e..65ef75c 100644 --- a/src/engine/SCons/Tool/dmd.xml +++ b/src/engine/SCons/Tool/dmd.xml @@ -21,7 +21,7 @@ See its __doc__ string for a discussion of the format. + xsi:schemaLocation="http://www.scons.org/dbxsd/v1.0/scons.xsd"> @@ -51,7 +51,7 @@ Sets construction variables for D language compiler DMD. DDEBUGSUFFIX DFLAGPREFIX DFLAGSUFFIX -DFLESUFFIX +DFILESUFFIX DLINK DLINKFLAGS DLINKCOM @@ -66,8 +66,12 @@ Sets construction variables for D language compiler DMD. _DLIBDIRFLAGS DLIB DLIBCOM +_DLIBFLAGS DLIBFLAGPREFIX DLIBFLAGSUFFIX +RPATHPREFIX +RPATHSUFFIX +_RPATH diff --git a/src/engine/SCons/Tool/gdc.xml b/src/engine/SCons/Tool/gdc.xml index 818c7d2..df568b4 100644 --- a/src/engine/SCons/Tool/gdc.xml +++ b/src/engine/SCons/Tool/gdc.xml @@ -21,7 +21,7 @@ See its __doc__ string for a discussion of the format. + xsi:schemaLocation="http://www.scons.org/dbxsd/v1.0/scons.xsd"> @@ -51,7 +51,7 @@ Sets construction variables for the D language compiler GDC. DDEBUGSUFFIX DFLAGPREFIX DFLAGSUFFIX -DFLESUFFIX +DFILESUFFIX DLINK DLINKFLAGS DLINKCOM @@ -72,3 +72,5 @@ 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 2531064..ca873b5 100644 --- a/src/engine/SCons/Tool/ldc.py +++ b/src/engine/SCons/Tool/ldc.py @@ -100,11 +100,11 @@ def generate(env): env['DLINK'] = '$DC' env['DLINKFLAGS'] = SCons.Util.CLVar('') - env['DLINKCOM'] = '$DLINK -of=$TARGET $DLINKFLAGS $__RPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS' + env['DLINKCOM'] = '$DLINK -of=$TARGET $DLINKFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS' env['DSHLINK'] = '$DC' env['DSHLINKFLAGS'] = SCons.Util.CLVar('$DLINKFLAGS -shared') - env['SHDLINKCOM'] = '$DLINK -of=$TARGET $DSHLINKFLAGS $__RPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS' + env['SHDLINKCOM'] = '$DLINK -of=$TARGET $DSHLINKFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS' env['DLIBLINKPREFIX'] = '' if env['PLATFORM'] == 'win32' else '-L-l' env['DLIBLINKSUFFIX'] = '.lib' if env['PLATFORM'] == 'win32' else '' @@ -124,6 +124,12 @@ def generate(env): env['DLIBFLAGPREFIX'] = '-' env['DLIBFLAGSUFFIX'] = '' + # __RPATH is set to $_RPATH in the platform specification if that + # platform supports it. + env['DRPATHPREFIX'] = '-L-rpath=' + env['DRPATHSUFFIX'] = '' + env['_RPATH'] = '${_concat(DRPATHPREFIX, RPATH, DRPATHSUFFIX, __env__)}' + SCons.Tool.createStaticLibBuilder(env) diff --git a/src/engine/SCons/Tool/ldc.xml b/src/engine/SCons/Tool/ldc.xml index cfa38a9..18f676d 100644 --- a/src/engine/SCons/Tool/ldc.xml +++ b/src/engine/SCons/Tool/ldc.xml @@ -21,7 +21,7 @@ See its __doc__ string for a discussion of the format. + xsi:schemaLocation="http://www.scons.org/dbxsd/v1.0/scons.xsd"> @@ -51,7 +51,7 @@ Sets construction variables for the D language compiler LDC2. DDEBUGSUFFIX DFLAGPREFIX DFLAGSUFFIX -DFLESUFFIX +DFILESUFFIX DLINK DLINKFLAGS DLINKCOM @@ -66,8 +66,14 @@ Sets construction variables for the D language compiler LDC2. _DLIBDIRFLAGS DLIB DLIBCOM +_DLIBFLAGS DLIBFLAGPREFIX DLIBFLAGSUFFIX +DLINKFLAGPREFIX +DLINKFLAGSUFFIX +RPATHPREFIX +RPATHSUFFIX +_RPATH diff --git a/test/D/Issues/2940_Ariovistus/Common/__init__.py b/test/D/Issues/2940_Ariovistus/Common/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test/D/Issues/2940_Ariovistus/Common/correctLinkOptions.py b/test/D/Issues/2940_Ariovistus/Common/correctLinkOptions.py new file mode 100644 index 0000000..3b178b9 --- /dev/null +++ b/test/D/Issues/2940_Ariovistus/Common/correctLinkOptions.py @@ -0,0 +1,62 @@ +""" +These tests check a problem with the linker options setting. +""" + +# +# __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 SCons.Environment import Base + +from os.path import abspath, dirname, join + +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('Project') + test.write('SConstruct', open('SConstruct_template', 'r').read().format('tools=["{}", "link"]'.format(tool))) + + test.run() + + for f in ('libstuff.so', 'stuff.os', 'test1', 'test1.o', 'test2', 'test2.o'): + test.must_exist(test.workpath(join('test', 'test1', f))) + + 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/Issues/2940_Ariovistus/Common/sconstest.skip b/test/D/Issues/2940_Ariovistus/Common/sconstest.skip new file mode 100644 index 0000000..e69de29 diff --git a/test/D/Issues/2940_Ariovistus/Project/SConstruct_template b/test/D/Issues/2940_Ariovistus/Project/SConstruct_template new file mode 100644 index 0000000..55f02aa --- /dev/null +++ b/test/D/Issues/2940_Ariovistus/Project/SConstruct_template @@ -0,0 +1,9 @@ +from os.path import join + +environment = Environment({}) + +Export('environment') + +environment.SConscript([ + join("test","test1", "SConscript"), +]); diff --git a/test/D/Issues/2940_Ariovistus/Project/test/test1/SConscript b/test/D/Issues/2940_Ariovistus/Project/test/test1/SConscript new file mode 100644 index 0000000..45e517a --- /dev/null +++ b/test/D/Issues/2940_Ariovistus/Project/test/test1/SConscript @@ -0,0 +1,16 @@ +Import('environment') + +env = Environment() +env.SharedLibrary(target='stuff', source=['stuff.cpp']) + +env = Environment() +env.Append(LIBPATH=['.']) +env.Append(LIBS=['stuff']) +env.Append(RPATH=['.']) +env.Program(target='test1', source=['test1.cpp']) + +env = environment.Clone() +env.Append(LIBPATH=['.']) +env.Append(LIBS=['stuff']) +env.Append(RPATH=['.']) +env.Program(target='test2', source=['test2.d']) diff --git a/test/D/Issues/2940_Ariovistus/Project/test/test1/stuff.cpp b/test/D/Issues/2940_Ariovistus/Project/test/test1/stuff.cpp new file mode 100644 index 0000000..2970549 --- /dev/null +++ b/test/D/Issues/2940_Ariovistus/Project/test/test1/stuff.cpp @@ -0,0 +1,12 @@ +#include "stuff.h" + +X::X() { + this->i = 1; +} +int X::y(){ + return this->i; +} + +X *SomeX() { + return new X(); +} diff --git a/test/D/Issues/2940_Ariovistus/Project/test/test1/stuff.h b/test/D/Issues/2940_Ariovistus/Project/test/test1/stuff.h new file mode 100644 index 0000000..863c330 --- /dev/null +++ b/test/D/Issues/2940_Ariovistus/Project/test/test1/stuff.h @@ -0,0 +1,10 @@ + +class X { + public: + int i; + + X(); + int y(); +}; + +X *SomeX(); diff --git a/test/D/Issues/2940_Ariovistus/Project/test/test1/test1.cpp b/test/D/Issues/2940_Ariovistus/Project/test/test1/test1.cpp new file mode 100644 index 0000000..f4d7208 --- /dev/null +++ b/test/D/Issues/2940_Ariovistus/Project/test/test1/test1.cpp @@ -0,0 +1,5 @@ +#include "stuff.h" + +int main() { + X *x = SomeX(); +} diff --git a/test/D/Issues/2940_Ariovistus/Project/test/test1/test2.d b/test/D/Issues/2940_Ariovistus/Project/test/test1/test2.d new file mode 100644 index 0000000..4fbfa4d --- /dev/null +++ b/test/D/Issues/2940_Ariovistus/Project/test/test1/test2.d @@ -0,0 +1,13 @@ +import std.stdio; + +struct X { +} + +extern(C) int _ZN1X1yEv(X* _this); +extern(C) X* _Z5SomeXv(); + +void main() { + X *x = _Z5SomeXv(); + int i = _ZN1X1yEv(x); + writeln("i: ", i); +} diff --git a/test/D/Issues/2940_Ariovistus/sconstest-correctLinkOptions_dmd.py b/test/D/Issues/2940_Ariovistus/sconstest-correctLinkOptions_dmd.py new file mode 100644 index 0000000..2446a28 --- /dev/null +++ b/test/D/Issues/2940_Ariovistus/sconstest-correctLinkOptions_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 Common.correctLinkOptions 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/Issues/2940_Ariovistus/sconstest-correctLinkOptions_gdc.py b/test/D/Issues/2940_Ariovistus/sconstest-correctLinkOptions_gdc.py new file mode 100644 index 0000000..baf2921 --- /dev/null +++ b/test/D/Issues/2940_Ariovistus/sconstest-correctLinkOptions_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.correctLinkOptions 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/Issues/2940_Ariovistus/sconstest-correctLinkOptions_ldc.py b/test/D/Issues/2940_Ariovistus/sconstest-correctLinkOptions_ldc.py new file mode 100644 index 0000000..a61a94b --- /dev/null +++ b/test/D/Issues/2940_Ariovistus/sconstest-correctLinkOptions_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 Common.correctLinkOptions import testForTool +testForTool('ldc') + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: -- cgit v0.12 From 1a88d571ce37119d71e89dcab1d7099bc29b77ac Mon Sep 17 00:00:00 2001 From: Robert Managan Date: Thu, 24 Apr 2014 06:55:51 -0700 Subject: Update CHANGES file --- src/CHANGES.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 73b8f0c..8c5cd26 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -36,6 +36,10 @@ RELEASE 2.3.2.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE From Dirk Baechle: - Update XML doc editor configuration + From Rob Managan: + - Updated the TeX builder to support use of the -synctex=1 + option and the files it creates. + RELEASE 2.3.1 From Andrew Featherstone: -- cgit v0.12 From ee8f9bd107e7410cc20c7e7c5d5338cbfc0d376d Mon Sep 17 00:00:00 2001 From: Robert Managan Date: Thu, 24 Apr 2014 22:43:57 -0700 Subject: Improve support for biblatex package. Fix a case where we did not recognize that auxiliary files would be made and hence we did not clean them --- src/CHANGES.txt | 4 ++ src/engine/SCons/Tool/tex.py | 7 +++- test/TEX/biblatex_plain.py | 92 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 test/TEX/biblatex_plain.py diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 73b8f0c..342fa84 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -36,6 +36,10 @@ RELEASE 2.3.2.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE From Dirk Baechle: - Update XML doc editor configuration + From Rob Managan: + - Updated the TeX builder to correctly clean auxiliary files when + the biblatex package is used. + RELEASE 2.3.1 From Andrew Featherstone: diff --git a/src/engine/SCons/Tool/tex.py b/src/engine/SCons/Tool/tex.py index 5f24df0..e9bf694 100644 --- a/src/engine/SCons/Tool/tex.py +++ b/src/engine/SCons/Tool/tex.py @@ -102,6 +102,7 @@ makeacronyms_re = re.compile(r"^[^%\n]*\\makeglossaries", re.MULTILINE) beamer_re = re.compile(r"^[^%\n]*\\documentclass\{beamer\}", re.MULTILINE) regex = r'^[^%\n]*\\newglossary\s*\[([^\]]+)\]?\s*\{([^}]*)\}\s*\{([^}]*)\}\s*\{([^}]*)\}\s*\{([^}]*)\}' newglossary_re = re.compile(regex, re.MULTILINE) +biblatex_re = re.compile(r"^[^%\n]*\\usepackage.*\{biblatex\}", re.MULTILINE) newglossary_suffix = [] @@ -719,7 +720,8 @@ def tex_emitter_core(target, source, env, graphics_extensions): makeglossaries_re, makeacronyms_re, beamer_re, - newglossary_re ] + newglossary_re, + biblatex_re ] # set up list with the file suffixes that need emitting # when a feature is found file_tests_suff = [['.aux','aux_file'], @@ -737,7 +739,8 @@ def tex_emitter_core(target, source, env, graphics_extensions): ['.glo', '.gls', '.glg','glossaries'], ['.acn', '.acr', '.alg','acronyms'], ['.nav', '.snm', '.out', '.toc','beamer'], - ['newglossary',] ] + ['newglossary',], + ['.bcf', '.blg','biblatex'] ] # for newglossary the suffixes are added as we find the command # build the list of lists file_tests = [] diff --git a/test/TEX/biblatex_plain.py b/test/TEX/biblatex_plain.py new file mode 100644 index 0000000..740ec66 --- /dev/null +++ b/test/TEX/biblatex_plain.py @@ -0,0 +1,92 @@ +#!/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 + +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") + +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(target='biblatextest.pdf', source='biblatextest.tex') +""") + +test.write(['biblatextest.tex'],r""" +\documentclass{article} + +\usepackage{biblatex} + +\begin{document} + +Hello. This is boring. +And even more boring. + +\end{document} +""") + + +test.run() + + +# All (?) the files we expect will get created in the docs directory +files = [ + 'biblatextest.aux', + 'biblatextest.bcf', + 'biblatextest.blg', + 'biblatextest.fls', + 'biblatextest.log', + 'biblatextest.pdf', + 'biblatextest.run.xml', +] + +for f in files: + test.must_exist([ f]) + +test.run(arguments = '-c .') + +for f in files: + test.must_not_exist([ f]) + +test.pass_test() + -- cgit v0.12 From fac472aac964c9f8b1d9dabb0ca2073cde3c3689 Mon Sep 17 00:00:00 2001 From: Gary Oberbrunner Date: Sat, 26 Apr 2014 16:43:54 -0400 Subject: Updated author and copyright info. Also cleaned up a couple of doc typos. --- README.rst | 9 ++++++--- doc/man/scons.xml | 24 ++++++++++++------------ doc/python10/main.xml | 8 ++++---- doc/user/main.xml | 2 +- rpm/scons.spec.in | 4 ++-- 5 files changed, 25 insertions(+), 22 deletions(-) diff --git a/README.rst b/README.rst index a1025ca..b9e7d3b 100644 --- a/README.rst +++ b/README.rst @@ -731,9 +731,10 @@ Check the SCons web site at: Author Info =========== -Steven Knight, knight at baldmt dot com, http://www.baldmt.com/~knight/ - -With plenty of help from the SCons Development team: +SCons was originally written by Steven Knight, knight at baldmt dot com. +Since around 2010 it has been maintained by the SCons +development team, co-managed by Bill Deegan and Gary Oberbrunner, with +many contributors, including but not at all limited to: - Chad Austin - Dirk Baechle @@ -745,6 +746,8 @@ With plenty of help from the SCons Development team: - Gary Oberbrunner - Anthony Roach - Greg Spencer +- Tom Tanner +- Anatoly Techtonik - Christoph Wiedemann - Russel Winder diff --git a/doc/man/scons.xml b/doc/man/scons.xml index d726796..10d2509 100644 --- a/doc/man/scons.xml +++ b/doc/man/scons.xml @@ -52,19 +52,19 @@ Knight - Steven Knight + Steven Knight and the SCons Development Team - 2004, 2005, 2006, 2007, 2008, 2009, 2010 + 2004 - 2014 - 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Steven Knight + 2004 - 2014 + The SCons Foundation version &buildversion; - + - + SCons &buildversion; @@ -4936,7 +4936,7 @@ multi-stage builder. single_source Specifies that this builder expects exactly one source file per call. Giving -more than one source file without target files results in implicitely calling +more than one source file without target files results in implicitly calling the builder multiple times (once for each source given). Giving multiple source files together with target files results in a UserError exception. @@ -5118,7 +5118,7 @@ function will turn its action keyword argument into an appropriate internal Action object. -You can also explicity create Action objects +You can also explicitly create Action objects using the Action() global function, @@ -6125,7 +6125,7 @@ So in the following case: env['COND'] = 0 env.Command('foo.out', 'foo.in', - + '''echo ${COND==1 and 'FOO' or 'BAR'} > $TARGET''') the command executed will be either @@ -7095,9 +7095,9 @@ source code. AUTHORS -Steven Knight <knight@baldmt.com> - -Anthony Roach <aroach@electriceyeball.com> +Originally: Steven Knight <knight@baldmt.com> and Anthony Roach <aroach@electriceyeball.com>
+Since 2010: The SCons Development Team <scons-dev@scons.org> +
diff --git a/doc/python10/main.xml b/doc/python10/main.xml index 6093852..a7732da 100644 --- a/doc/python10/main.xml +++ b/doc/python10/main.xml @@ -10,7 +10,7 @@
- + - + SCons Design and Implementation @@ -46,8 +46,8 @@ 2001 - 2002 - Steven Knight + 2014 + The SCons Foundation 2002 diff --git a/doc/user/main.xml b/doc/user/main.xml index ae515fa..a165777 100644 --- a/doc/user/main.xml +++ b/doc/user/main.xml @@ -72,7 +72,7 @@ Knight - Steven Knight + Steven Knight and the SCons Development Team 2004 - 2014 diff --git a/rpm/scons.spec.in b/rpm/scons.spec.in index 312eb44..9b97a07 100644 --- a/rpm/scons.spec.in +++ b/rpm/scons.spec.in @@ -14,8 +14,8 @@ Group: Development/Tools BuildRoot: %{_tmppath}/%{name}-buildroot Prefix: %{_prefix} BuildArchitectures: noarch -Vendor: Steven Knight -Packager: Steven Knight +Vendor: The SCons Development Team +Packager: The SCons Development Team Requires: python >= 2.4 Url: http://www.scons.org/ -- cgit v0.12 From ab8fb9d71510defd160b850a1441d47ded9370d3 Mon Sep 17 00:00:00 2001 From: Dirk Baechle Date: Sun, 27 Apr 2014 21:47:33 +0200 Subject: - fixed NoClean for multi-target builders --- src/CHANGES.txt | 3 ++ src/engine/SCons/Script/Main.py | 54 +++++++++++++------------ test/NoClean.py | 90 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 122 insertions(+), 25 deletions(-) create mode 100644 test/NoClean.py diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 9c6f8ae..5f62c1d 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -6,6 +6,9 @@ RELEASE 2.3.2.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE + From Amir Szekely: + - Fixed NoClean() for multi-target builders (#2353). + 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 diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py index 93380fb..7abea3f 100644 --- a/src/engine/SCons/Script/Main.py +++ b/src/engine/SCons/Script/Main.py @@ -339,37 +339,41 @@ class CleanTask(SCons.Taskmaster.AlwaysTask): except (IOError, OSError), e: print "scons: Could not remove '%s':" % pathstr, e.strerror - def show(self): + def _get_files_to_clean(self): + result = [] target = self.targets[0] - if (target.has_builder() or target.side_effect) and not target.noclean: - for t in self.targets: - if not t.isdir(): - display("Removed " + str(t)) - if target in SCons.Environment.CleanTargets: - files = SCons.Environment.CleanTargets[target] - for f in files: - self.fs_delete(f.abspath, str(f), 0) + if target.has_builder() or target.side_effect: + result = [t for t in self.targets if not t.noclean] + return result - def remove(self): + def _clean_targets(self, remove): target = self.targets[0] - if (target.has_builder() or target.side_effect) and not target.noclean: - for t in self.targets: - try: - removed = t.remove() - except OSError, e: - # An OSError may indicate something like a permissions - # issue, an IOError would indicate something like - # the file not existing. In either case, print a - # message and keep going to try to remove as many - # targets aa possible. - print "scons: Could not remove '%s':" % str(t), e.strerror - else: - if removed: - display("Removed " + str(t)) if target in SCons.Environment.CleanTargets: files = SCons.Environment.CleanTargets[target] for f in files: - self.fs_delete(f.abspath, str(f)) + self.fs_delete(f.abspath, str(f), remove) + + def show(self): + for t in self._get_files_to_clean(): + if not t.isdir(): + display("Removed " + str(t)) + self._clean_targets(0) + + def remove(self): + for t in self._get_files_to_clean(): + try: + removed = t.remove() + except OSError, e: + # An OSError may indicate something like a permissions + # issue, an IOError would indicate something like + # the file not existing. In either case, print a + # message and keep going to try to remove as many + # targets aa possible. + print "scons: Could not remove '%s':" % str(t), e.strerror + else: + if removed: + display("Removed " + str(t)) + self._clean_targets(1) execute = remove diff --git a/test/NoClean.py b/test/NoClean.py new file mode 100644 index 0000000..01fe209 --- /dev/null +++ b/test/NoClean.py @@ -0,0 +1,90 @@ +#!/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__" + +# +# This test ensures that NoClean works correctly, even when it's applied to +# a single target in the return list of an multi-target Builder. +# +import TestSCons + +test = TestSCons.TestSCons() + +test.write('SConstruct', """ +def action(target, source, env): + for t in target: open(t.path, 'w') +Command('1.out', 'SConstruct', action) +NoClean('1.out') +""") + +test.write('SConstruct.force', """ +def action(target, source, env): + for t in target: open(t.path, 'w') + open('4.out', 'w') +res = Command('3.out', 'SConstruct.force', action) +Clean('4.out', res) +NoClean('4.out') +""") + +test.write('SConstruct.multi', """ +def action(target, source, env): + for t in target: open(t.path, 'w') +Command(['5.out', '6.out'], 'SConstruct.multi', action) +NoClean('6.out') +""") + +# +# Basic check: NoClean keeps files +# +test.run() +test.run(arguments='-c') + +test.must_exist('1.out') + +# +# Check: NoClean overrides Clean +# +test.run(arguments=['-f', 'SConstruct.force']) +test.run(arguments=['-f', 'SConstruct.force', '-c']) + +test.must_not_exist('3.out') +test.must_exist('4.out') + +# +# Check: NoClean works for multi-target Builders +# +test.run(arguments=['-f', 'SConstruct.multi']) +test.run(arguments=['-f', 'SConstruct.multi', '-c']) + +test.must_not_exist('5.out') +test.must_exist('6.out') + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: -- cgit v0.12 From 3e4d8c2be69d136d955b95075242e7bd76b8d3c1 Mon Sep 17 00:00:00 2001 From: Dirk Baechle Date: Mon, 28 Apr 2014 18:39:49 +0200 Subject: - switched argument type of fs_delete and _clean_targets to bool (was int before) --- src/engine/SCons/Script/Main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py index 7abea3f..fb58e9b 100644 --- a/src/engine/SCons/Script/Main.py +++ b/src/engine/SCons/Script/Main.py @@ -312,7 +312,7 @@ class BuildTask(SCons.Taskmaster.OutOfDateTask): class CleanTask(SCons.Taskmaster.AlwaysTask): """An SCons clean task.""" - def fs_delete(self, path, pathstr, remove=1): + def fs_delete(self, path, pathstr, remove=True): try: if os.path.lexists(path): if os.path.isfile(path) or os.path.islink(path): @@ -346,7 +346,7 @@ class CleanTask(SCons.Taskmaster.AlwaysTask): result = [t for t in self.targets if not t.noclean] return result - def _clean_targets(self, remove): + def _clean_targets(self, remove=True): target = self.targets[0] if target in SCons.Environment.CleanTargets: files = SCons.Environment.CleanTargets[target] @@ -357,7 +357,7 @@ class CleanTask(SCons.Taskmaster.AlwaysTask): for t in self._get_files_to_clean(): if not t.isdir(): display("Removed " + str(t)) - self._clean_targets(0) + self._clean_targets(remove=False) def remove(self): for t in self._get_files_to_clean(): @@ -373,7 +373,7 @@ class CleanTask(SCons.Taskmaster.AlwaysTask): else: if removed: display("Removed " + str(t)) - self._clean_targets(1) + self._clean_targets(remove=True) execute = remove -- cgit v0.12 From ba592fdf4a541d1adfbc251232c0eacbe986b490 Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Tue, 29 Apr 2014 01:16:58 +0300 Subject: Remove RPM and m4 from default tools on Windows to speed up SCons start. Note that BitKeeper, CVS, Perforce, RCS, SCCS will be removed from default tools on all platforms in future. --- src/CHANGES.txt | 5 +++++ src/engine/SCons/Tool/__init__.py | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index d11fd70..105269c 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -35,6 +35,11 @@ RELEASE 2.3.2.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE that were failing because of this extra line in the output * error message when SCons import fails now lists lookup paths - Remove support for QMTest harness from runtest.py + - Remove RPM and m4 from default tools on Windows + - BitKeeper, CVS, Perforce, RCS, SCCS are deprecated from default + tools and will be removed in future SCons versions to speed up + SCons initialization (it will still be possible to use these tools + explicitly) From Dirk Baechle: - Update XML doc editor configuration diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py index 31e3d96..55eb1d3 100644 --- a/src/engine/SCons/Tool/__init__.py +++ b/src/engine/SCons/Tool/__init__.py @@ -772,6 +772,9 @@ def tool_list(platform, env): fortran_compilers = ['gfortran', 'g77', 'ifort', 'ifl', 'f95', 'f90', 'f77'] ars = ['ar', 'mslib'] + if not str(platform) == 'win32': + other_plat_tools += ['m4', 'rpm'] + c_compiler = FindTool(c_compilers, env) or c_compilers[0] # XXX this logic about what tool provides what should somehow be @@ -802,7 +805,6 @@ def tool_list(platform, env): #TODO: merge 'install' into 'filesystem' and # make 'filesystem' the default 'filesystem', - 'm4', 'wix', #'midl', 'msvs', # Parser generators 'lex', 'yacc', @@ -814,7 +816,7 @@ def tool_list(platform, env): 'dvipdf', 'dvips', 'gs', 'tex', 'latex', 'pdflatex', 'pdftex', # Archivers - 'tar', 'zip', 'rpm', + 'tar', 'zip', # SourceCode factories 'BitKeeper', 'CVS', 'Perforce', 'RCS', 'SCCS', # 'Subversion', -- cgit v0.12 From 5036e8048daeb6aaa3e46065d04f80e49bce3ec1 Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Tue, 6 May 2014 21:47:02 +0300 Subject: CHANGES.txt: Simplify changelog for such barbarians as me --- src/CHANGES.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 5f62c1d..d11fd70 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -11,8 +11,8 @@ RELEASE 2.3.2.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE 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. + and integrated with the C and C++ linking. NOTE: This is only tested + with D v2. Support for D v1 is now deprecated. From Paweł Tomulik: - Fix SConf tests that write output -- cgit v0.12 From 80cdee0bb0319a9c14abd9c60b4123aee07f0274 Mon Sep 17 00:00:00 2001 From: Michael Haubenwallner Date: Thu, 15 May 2014 10:14:12 +0200 Subject: Add tests for scons.tigris.org issue#1723. Ensure CCVERSION/CXXVERSION detected actually is from CC/CXX used. --- test/CC/CCVERSION.py | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++ test/CXX/CXXVERSION.py | 81 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 163 insertions(+) create mode 100644 test/CC/CCVERSION.py create mode 100644 test/CXX/CXXVERSION.py diff --git a/test/CC/CCVERSION.py b/test/CC/CCVERSION.py new file mode 100644 index 0000000..ac28e38 --- /dev/null +++ b/test/CC/CCVERSION.py @@ -0,0 +1,82 @@ +#!/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 sys +import TestSCons + +_python_ = TestSCons._python_ +_exe = TestSCons._exe + +test = TestSCons.TestSCons() + + + +test.write("versioned.py", +"""import os +import sys +if '-dumpversion' in sys.argv: + print '3.9.9' + sys.exit(0) +if '--version' in sys.argv: + print 'this is version 2.9.9 wrapping', sys.argv[2] + sys.exit(0) +if sys.argv[1] not in [ '2.9.9', '3.9.9' ]: + print 'wrong version', sys.argv[1], 'when wrapping', sys.argv[2] + sys.exit(1) +os.system(" ".join(sys.argv[2:])) +""") + +test.write('SConstruct', """ +cc = Environment().Dictionary('CC') +foo = Environment(CC = r'%(_python_)s versioned.py "${CCVERSION}" ' + cc) +foo.Program(target = 'foo', source = 'foo.c') +""" % locals()) + +test.write('foo.c', r""" +#include +#include + +int +main(int argc, char *argv[]) +{ + argv[argc++] = "--"; + printf("foo.c\n"); + exit (0); +} +""") + +test.run(arguments = 'foo' + _exe) + +test.up_to_date(arguments = 'foo' + _exe) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/CXX/CXXVERSION.py b/test/CXX/CXXVERSION.py new file mode 100644 index 0000000..8433aa6 --- /dev/null +++ b/test/CXX/CXXVERSION.py @@ -0,0 +1,81 @@ +#!/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 sys +import TestSCons + +_python_ = TestSCons._python_ +_exe = TestSCons._exe + +test = TestSCons.TestSCons() + + + +test.write("versioned.py", +"""import os +import sys +if '-dumpversion' in sys.argv: + print '3.9.9' + sys.exit(0) +if '--version' in sys.argv: + print 'this is version 2.9.9 wrapping', sys.argv[2] + sys.exit(0) +if sys.argv[1] not in [ '2.9.9', '3.9.9' ]: + print 'wrong version', sys.argv[1], 'when wrapping', sys.argv[2] + sys.exit(1) +os.system(" ".join(sys.argv[2:])) +""") + +test.write('SConstruct', """ +cxx = Environment().Dictionary('CXX') +foo = Environment(CXX = r'%(_python_)s versioned.py "${CXXVERSION}" ' + cxx) +foo.Program(target = 'foo', source = 'foo.cpp') +""" % locals()) + +test.write('foo.cpp', r""" +#include +#include + +int +main(int argc, char *argv[]) +{ + printf("foo.c\n"); + exit (0); +} +""") + +test.run(arguments = 'foo' + _exe) + +test.up_to_date(arguments = 'foo' + _exe) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: -- cgit v0.12 From c82684ba964183647a1965589ef852eacd9e5447 Mon Sep 17 00:00:00 2001 From: Michael Haubenwallner Date: Thu, 15 May 2014 10:17:03 +0200 Subject: Respect preset CC/CXX values detecting cc/c++/gcc/g++ Tools. As the user-preset values for CC/CXX should rule always, also respect them in exists() and generate() methods of these Tools. As a result, the value for CCVERSION/CXXVERSION does match the CC/CXX compiler used (issue#1723). --- src/engine/SCons/Environment.py | 4 +-- src/engine/SCons/Tool/ToolTests.py | 2 ++ src/engine/SCons/Tool/c++.py | 5 ++-- src/engine/SCons/Tool/cc.py | 7 +++-- src/engine/SCons/Tool/g++.py | 30 +++++++------------- src/engine/SCons/Tool/gcc.py | 58 +++++++++++++++++++++++++------------- test/CC/CC.py | 7 +++-- test/CXX/CXX.py | 3 +- 8 files changed, 67 insertions(+), 49 deletions(-) diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 3e499b6..45c40c3 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -1803,8 +1803,8 @@ class Base(SubstitutionEnvironment): pass elif SCons.Util.is_String(pathext): pathext = self.subst(pathext) - prog = self.subst(prog) - path = SCons.Util.WhereIs(prog, path, pathext, reject) + prog = SCons.Util.CLVar(self.subst(prog)) # support "program --with-args" + path = SCons.Util.WhereIs(prog[0], path, pathext, reject) if path: return path return None diff --git a/src/engine/SCons/Tool/ToolTests.py b/src/engine/SCons/Tool/ToolTests.py index 3e6da5b..a4353b1 100644 --- a/src/engine/SCons/Tool/ToolTests.py +++ b/src/engine/SCons/Tool/ToolTests.py @@ -51,6 +51,8 @@ class ToolTestCase(unittest.TestCase): return self.dict.__contains__(key) def has_key(self, key): return key in self.dict + def subst(self, string, *args, **kwargs): + return string env = Environment() env['BUILDERS'] = {} env['ENV'] = {} diff --git a/src/engine/SCons/Tool/c++.py b/src/engine/SCons/Tool/c++.py index 82a19c5..430851c 100644 --- a/src/engine/SCons/Tool/c++.py +++ b/src/engine/SCons/Tool/c++.py @@ -72,7 +72,8 @@ def generate(env): SCons.Tool.cc.add_common_cc_variables(env) - env['CXX'] = 'c++' + if 'CXX' not in env: + env['CXX'] = env.Detect(compilers) or compilers[0] env['CXXFLAGS'] = SCons.Util.CLVar('') env['CXXCOM'] = '$CXX -o $TARGET -c $CXXFLAGS $CCFLAGS $_CCCOMCOM $SOURCES' env['SHCXX'] = '$CXX' @@ -90,7 +91,7 @@ def generate(env): env['CXXFILESUFFIX'] = '.cc' def exists(env): - return env.Detect(compilers) + return env.Detect(env.get('CXX', compilers)) # Local Variables: # tab-width:4 diff --git a/src/engine/SCons/Tool/cc.py b/src/engine/SCons/Tool/cc.py index 9b404b2..590ec5f 100644 --- a/src/engine/SCons/Tool/cc.py +++ b/src/engine/SCons/Tool/cc.py @@ -62,6 +62,8 @@ def add_common_cc_variables(env): if 'SHCCFLAGS' not in env: env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') +compilers = ['cc'] + def generate(env): """ Add Builders and construction variables for C compilers to an Environment. @@ -76,7 +78,8 @@ def generate(env): add_common_cc_variables(env) - env['CC'] = 'cc' + if 'CC' not in env: + env['CC'] = env.Detect(compilers) or compilers[0] env['CFLAGS'] = SCons.Util.CLVar('') env['CCCOM'] = '$CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES' env['SHCC'] = '$CC' @@ -93,7 +96,7 @@ def generate(env): env['CFILESUFFIX'] = '.c' def exists(env): - return env.Detect('cc') + return env.Detect(env.get('CC', compilers)) # Local Variables: # tab-width:4 diff --git a/src/engine/SCons/Tool/g++.py b/src/engine/SCons/Tool/g++.py index e4da5fe..5cf3827 100644 --- a/src/engine/SCons/Tool/g++.py +++ b/src/engine/SCons/Tool/g++.py @@ -40,6 +40,8 @@ import subprocess import SCons.Tool import SCons.Util +import gcc + cplusplus = __import__('c++', globals(), locals(), []) compilers = ['g++'] @@ -48,9 +50,10 @@ def generate(env): """Add Builders and construction variables for g++ to an Environment.""" static_obj, shared_obj = SCons.Tool.createObjBuilders(env) - cplusplus.generate(env) + if 'CXX' not in env: + env['CXX'] = env.Detect(compilers) or compilers[0] - env['CXX'] = env.Detect(compilers) + cplusplus.generate(env) # platform specific settings if env['PLATFORM'] == 'aix': @@ -62,26 +65,13 @@ def generate(env): elif env['PLATFORM'] == 'sunos': env['SHOBJSUFFIX'] = '.pic.o' # determine compiler version - if env['CXX']: - #pipe = SCons.Action._subproc(env, [env['CXX'], '-dumpversion'], - pipe = SCons.Action._subproc(env, [env['CXX'], '--version'], - stdin = 'devnull', - stderr = 'devnull', - stdout = subprocess.PIPE) - if pipe.wait() != 0: return - # -dumpversion was added in GCC 3.0. As long as we're supporting - # GCC versions older than that, we should use --version and a - # regular expression. - #line = pipe.stdout.read().strip() - #if line: - # env['CXXVERSION'] = line - line = pipe.stdout.readline() - match = re.search(r'[0-9]+(\.[0-9]+)+', line) - if match: - env['CXXVERSION'] = match.group(0) + version = gcc.detect_version(env, env['CXX']) + if version: + env['CXXVERSION'] = version def exists(env): - return env.Detect(compilers) + # is executable, and is a GNU compiler (or accepts '--version' at least) + return gcc.detect_version(env, env.Detect(env.get('CXX', compilers))) # Local Variables: # tab-width:4 diff --git a/src/engine/SCons/Tool/gcc.py b/src/engine/SCons/Tool/gcc.py index 71f60a3..df65647 100644 --- a/src/engine/SCons/Tool/gcc.py +++ b/src/engine/SCons/Tool/gcc.py @@ -44,34 +44,54 @@ compilers = ['gcc', 'cc'] def generate(env): """Add Builders and construction variables for gcc to an Environment.""" + + if 'CC' not in env: + env['CC'] = env.Detect(compilers) or compilers[0] + cc.generate(env) - env['CC'] = env.Detect(compilers) or 'gcc' if env['PLATFORM'] in ['cygwin', 'win32']: env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') else: env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS -fPIC') # determine compiler version - if env['CC']: - #pipe = SCons.Action._subproc(env, [env['CC'], '-dumpversion'], - pipe = SCons.Action._subproc(env, [env['CC'], '--version'], - stdin = 'devnull', - stderr = 'devnull', - stdout = subprocess.PIPE) - if pipe.wait() != 0: return - # -dumpversion was added in GCC 3.0. As long as we're supporting - # GCC versions older than that, we should use --version and a - # regular expression. - #line = pipe.stdout.read().strip() - #if line: - # env['CCVERSION'] = line - line = pipe.stdout.readline() - match = re.search(r'[0-9]+(\.[0-9]+)+', line) - if match: - env['CCVERSION'] = match.group(0) + version = detect_version(env, env['CC']) + if version: + env['CCVERSION'] = version def exists(env): - return env.Detect(compilers) + # is executable, and is a GNU compiler (or accepts '--version' at least) + return detect_version(env, env.Detect(env.get('CC', compilers))) + +def detect_version(env, cc): + """Return the version of the GNU compiler, or None if it is not a GNU compiler.""" + cc = env.subst(cc) + if not cc: + return None + version = None + #pipe = SCons.Action._subproc(env, SCons.Util.CLVar(cc) + ['-dumpversion'], + pipe = SCons.Action._subproc(env, SCons.Util.CLVar(cc) + ['--version'], + stdin = 'devnull', + stderr = 'devnull', + stdout = subprocess.PIPE) + # -dumpversion was added in GCC 3.0. As long as we're supporting + # GCC versions older than that, we should use --version and a + # regular expression. + #line = pipe.stdout.read().strip() + #if line: + # version = line + line = pipe.stdout.readline() + match = re.search(r'[0-9]+(\.[0-9]+)+', line) + if match: + version = match.group(0) + # Non-GNU compiler's output (like AIX xlc's) may exceed the stdout buffer: + # So continue with reading to let the child process actually terminate. + while pipe.stdout.readline(): + pass + ret = pipe.wait() + if ret != 0: + return None + return version # Local Variables: # tab-width:4 diff --git a/test/CC/CC.py b/test/CC/CC.py index 73dc4e6..9500088 100644 --- a/test/CC/CC.py +++ b/test/CC/CC.py @@ -156,7 +156,8 @@ env.Program(target = 'test2', source = 'test2.C') test.write("wrapper.py", """import os import sys -open('%s', 'wb').write("wrapper.py\\n") +if '--version' not in sys.argv and '-dumpversion' not in sys.argv: + open('%s', 'wb').write("wrapper.py\\n") os.system(" ".join(sys.argv[1:])) """ % test.workpath('wrapper.out').replace('\\', '\\\\')) @@ -197,13 +198,13 @@ main(int argc, char *argv[]) test.run(arguments = 'foo' + _exe) -test.fail_test(os.path.exists(test.workpath('wrapper.out'))) +test.must_not_exist(test.workpath('wrapper.out')) test.up_to_date(arguments = 'foo' + _exe) test.run(arguments = 'bar' + _exe) -test.fail_test(test.read('wrapper.out') != "wrapper.py\n") +test.must_match('wrapper.out', "wrapper.py\n") test.up_to_date(arguments = 'bar' + _exe) diff --git a/test/CXX/CXX.py b/test/CXX/CXX.py index cd354ae..79dbde4 100644 --- a/test/CXX/CXX.py +++ b/test/CXX/CXX.py @@ -186,7 +186,8 @@ env.Program(target = 'test6', source = 'test6.C') test.write("wrapper.py", """import os import sys -open('%s', 'wb').write("wrapper.py\\n") +if '--version' not in sys.argv and '-dumpversion' not in sys.argv: + open('%s', 'wb').write("wrapper.py\\n") os.system(" ".join(sys.argv[1:])) """ % test.workpath('wrapper.out').replace('\\', '\\\\')) -- cgit v0.12 From 67355d075084e82e1e36caa3dfbbdf81a7b4182e Mon Sep 17 00:00:00 2001 From: Michael Haubenwallner Date: Thu, 15 May 2014 10:36:33 +0200 Subject: Delegate linker Tool.exists() to CC/CXX Tool.exists(). Even for linking, need to respect CC/CXX specified by the user (issue#1723). And when CC is specified but not CXX, assume the user knows there is nothing to link with CXX, and delegate to CC Tool.exists() only. However, this somehow should be synchronized with link.smart_link() to choose the correct linker. --- src/engine/SCons/Tool/aixlink.py | 15 ++++++++------- src/engine/SCons/Tool/gnulink.py | 11 ++++++++--- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/engine/SCons/Tool/aixlink.py b/src/engine/SCons/Tool/aixlink.py index 3512522..4e9db21 100644 --- a/src/engine/SCons/Tool/aixlink.py +++ b/src/engine/SCons/Tool/aixlink.py @@ -37,7 +37,6 @@ import os.path import SCons.Util -import aixcc import link cplusplus = __import__('c++', globals(), locals(), []) @@ -62,12 +61,14 @@ def generate(env): env['SHLIBSUFFIX'] = '.a' def exists(env): - path, _cc, _shcc, version = aixcc.get_xlc(env) - if path and _cc: - xlc = os.path.join(path, _cc) - if os.path.exists(xlc): - return xlc - return None + # TODO: sync with link.smart_link() to choose a linker + linkers = { 'CXX': ['aixc++'], 'CC': ['aixcc'] } + alltools = [] + for langvar, linktools in linkers.items(): + if langvar in env: # use CC over CXX when user specified CC but not CXX + return SCons.Tool.FindTool(linktools, env) + alltools.extend(linktools) + return SCons.Tool.FindTool(alltools, env) # Local Variables: # tab-width:4 diff --git a/src/engine/SCons/Tool/gnulink.py b/src/engine/SCons/Tool/gnulink.py index bf71270..3dc8f51 100644 --- a/src/engine/SCons/Tool/gnulink.py +++ b/src/engine/SCons/Tool/gnulink.py @@ -37,8 +37,6 @@ import SCons.Util import link -linkers = ['g++', 'gcc'] - def generate(env): """Add Builders and construction variables for gnulink to an Environment.""" link.generate(env) @@ -53,7 +51,14 @@ def generate(env): env['_RPATH'] = '${_concat(RPATHPREFIX, RPATH, RPATHSUFFIX, __env__)}' def exists(env): - return env.Detect(linkers) + # TODO: sync with link.smart_link() to choose a linker + linkers = { 'CXX': ['g++'], 'CC': ['gcc'] } + alltools = [] + for langvar, linktools in linkers.items(): + if langvar in env: # use CC over CXX when user specified CC but not CXX + return SCons.Tool.FindTool(linktools, env) + alltools.extend(linktools) + return SCons.Tool.FindTool(alltools, env) # find CXX or CC # Local Variables: # tab-width:4 -- cgit v0.12 From 7f96f0f6c890a58a1a58c76b0e636024dec2628f Mon Sep 17 00:00:00 2001 From: Michael Haubenwallner Date: Thu, 15 May 2014 11:07:44 +0200 Subject: The _r in AIX xlc_r means reentrant, not relocatable. It does not make any sense to use 'xlc' for CC and 'xlc_r' for SHCC, as the '_r' does stand for 'reentrant' rather than 'relocatable' or similar. Avoid 'egrep' to parse the lslpp output, it's easy enough within python. Needs output streams of _subproc.dummyPopen to be iterable. --- src/engine/SCons/Action.py | 1 + src/engine/SCons/Platform/aix.py | 40 ++++++++++++++++++++++++++++------------ src/engine/SCons/Tool/aixc++.py | 19 +++++++++---------- src/engine/SCons/Tool/aixcc.py | 18 +++++++++--------- 4 files changed, 47 insertions(+), 31 deletions(-) diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py index 33d8790..16866b6 100644 --- a/src/engine/SCons/Action.py +++ b/src/engine/SCons/Action.py @@ -685,6 +685,7 @@ def _subproc(scons_env, cmd, error = 'ignore', **kw): class f(object): def read(self): return '' def readline(self): return '' + def __iter__(self): return iter(()) stdout = stderr = f() return dummyPopen(e) diff --git a/src/engine/SCons/Platform/aix.py b/src/engine/SCons/Platform/aix.py index 0229112..b6933a4 100644 --- a/src/engine/SCons/Platform/aix.py +++ b/src/engine/SCons/Platform/aix.py @@ -33,10 +33,14 @@ selection method. __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os +import subprocess import posix -def get_xlc(env, xlc=None, xlc_r=None, packages=[]): +import SCons.Util +import SCons.Action + +def get_xlc(env, xlc=None, packages=[]): # Use the AIX package installer tool lslpp to figure out where a # given xl* compiler is installed and what version it is. xlcPath = None @@ -44,18 +48,30 @@ def get_xlc(env, xlc=None, xlc_r=None, packages=[]): if xlc is None: xlc = env.get('CC', 'xlc') - if xlc_r is None: - xlc_r = xlc + '_r' + if SCons.Util.is_List(xlc): + xlc = xlc[0] for package in packages: - cmd = "lslpp -fc " + package + " 2>/dev/null | egrep '" + xlc + "([^-_a-zA-Z0-9].*)?$'" - line = os.popen(cmd).readline() - if line: - v, p = line.split(':')[1:3] - xlcVersion = v.split()[1] - xlcPath = p.split()[0] - xlcPath = xlcPath[:xlcPath.rindex('/')] - break - return (xlcPath, xlc, xlc_r, xlcVersion) + # find the installed filename, which may be a symlink as well + pipe = SCons.Action._subproc(env, ['lslpp', '-fc', package], + stdin = 'devnull', + stderr = 'devnull', + stdout = subprocess.PIPE) + # output of lslpp is something like this: + # #Path:Fileset:File + # /usr/lib/objrepos:vac.C 6.0.0.0:/usr/vac/exe/xlCcpp + # /usr/lib/objrepos:vac.C 6.0.0.0:/usr/vac/bin/xlc_r -> /usr/vac/bin/xlc + for line in pipe.stdout: + if xlcPath: + continue # read everything to let lslpp terminate + fileset, filename = line.split(':')[1:3] + filename = filename.split()[0] + if ('/' in xlc and filename == xlc) \ + or ('/' not in xlc and filename.endswith('/' + xlc)): + xlcVersion = fileset.split()[1] + xlcPath, sep, xlc = filename.rpartition('/') + pass + pass + return (xlcPath, xlc, xlcVersion) def generate(env): posix.generate(env) diff --git a/src/engine/SCons/Tool/aixc++.py b/src/engine/SCons/Tool/aixc++.py index 5aa1eeec..c86d530 100644 --- a/src/engine/SCons/Tool/aixc++.py +++ b/src/engine/SCons/Tool/aixc++.py @@ -43,8 +43,7 @@ packages = ['vacpp.cmp.core', 'vacpp.cmp.batch', 'vacpp.cmp.C', 'ibmcxx.cmp'] def get_xlc(env): xlc = env.get('CXX', 'xlC') - xlc_r = env.get('SHCXX', 'xlC_r') - return SCons.Platform.aix.get_xlc(env, xlc, xlc_r, packages) + return SCons.Platform.aix.get_xlc(env, xlc, packages) def smart_cxxflags(source, target, env, for_signature): build_dir = env.GetBuildPath() @@ -55,20 +54,20 @@ def smart_cxxflags(source, target, env, for_signature): def generate(env): """Add Builders and construction variables for xlC / Visual Age suite to an Environment.""" - path, _cxx, _shcxx, version = get_xlc(env) - if path: + path, _cxx, version = get_xlc(env) + if path and _cxx: _cxx = os.path.join(path, _cxx) - _shcxx = os.path.join(path, _shcxx) + + if 'CXX' not in env: + env['CXX'] = _cxx cplusplus.generate(env) - env['CXX'] = _cxx - env['SHCXX'] = _shcxx - env['CXXVERSION'] = version - env['SHOBJSUFFIX'] = '.pic.o' + if version: + env['CXXVERSION'] = version def exists(env): - path, _cxx, _shcxx, version = get_xlc(env) + path, _cxx, version = get_xlc(env) if path and _cxx: xlc = os.path.join(path, _cxx) if os.path.exists(xlc): diff --git a/src/engine/SCons/Tool/aixcc.py b/src/engine/SCons/Tool/aixcc.py index 9668f79..a89a97e 100644 --- a/src/engine/SCons/Tool/aixcc.py +++ b/src/engine/SCons/Tool/aixcc.py @@ -42,25 +42,25 @@ packages = ['vac.C', 'ibmcxx.cmp'] def get_xlc(env): xlc = env.get('CC', 'xlc') - xlc_r = env.get('SHCC', 'xlc_r') - return SCons.Platform.aix.get_xlc(env, xlc, xlc_r, packages) + return SCons.Platform.aix.get_xlc(env, xlc, packages) def generate(env): """Add Builders and construction variables for xlc / Visual Age suite to an Environment.""" - path, _cc, _shcc, version = get_xlc(env) - if path: + path, _cc, version = get_xlc(env) + if path and _cc: _cc = os.path.join(path, _cc) - _shcc = os.path.join(path, _shcc) + + if 'CC' not in env: + env['CC'] = _cc cc.generate(env) - env['CC'] = _cc - env['SHCC'] = _shcc - env['CCVERSION'] = version + if version: + env['CCVERSION'] = version def exists(env): - path, _cc, _shcc, version = get_xlc(env) + path, _cc, version = get_xlc(env) if path and _cc: xlc = os.path.join(path, _cc) if os.path.exists(xlc): -- cgit v0.12 From cc50023064473b73671b4589eb083832c6579f95 Mon Sep 17 00:00:00 2001 From: Dirk Baechle Date: Sun, 18 May 2014 17:47:30 +0200 Subject: - adding test for issue #2311, which appears to be fixed already --- test/path-change.py | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 test/path-change.py diff --git a/test/path-change.py b/test/path-change.py new file mode 100644 index 0000000..0ca070f --- /dev/null +++ b/test/path-change.py @@ -0,0 +1,77 @@ +#!/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__" + +""" +Make sure that changing the location - but not the name - of a +source file triggers a rebuild (issue #2311). +""" + +import TestSCons + +test = TestSCons.TestSCons() + +test.subdir('src1') +test.subdir('src2') + +test.write('SConstruct', """ + +vars = Variables() +vars.AddVariables( + PathVariable('SRCDIR', 'name the subdir to take the sources from', 'src1')) +env = Environment(variables = vars) +Export('env') + +env.Object(target='hello.o', source=['$SRCDIR/hello.c']) +env.Program(target = 'hello', source = ['hello.o']) +""") + +hello_text=r""" + +#include +#include +int +main() +{ + printf("%s\n"); + exit (0); +} + +""" + +test.write('src1/hello.c', hello_text % 'src1/hello') +test.write('src2/hello.c', hello_text % 'src2/hello') + +test.not_up_to_date(options='SRCDIR=src1') +test.up_to_date(options='SRCDIR=src1') +test.not_up_to_date(options='SRCDIR=src2') + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: -- cgit v0.12 -- cgit v0.12 -- cgit v0.12 From 6520bd13cc6ca45092cb51564d1e088757e8b83e Mon Sep 17 00:00:00 2001 From: Dirk Baechle Date: Mon, 19 May 2014 21:38:08 +0200 Subject: - removed superfluous method "smart_cxxflags" in AIX tool (fixes #2160) --- src/engine/SCons/Tool/aixc++.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/engine/SCons/Tool/aixc++.py b/src/engine/SCons/Tool/aixc++.py index c86d530..f03f763 100644 --- a/src/engine/SCons/Tool/aixc++.py +++ b/src/engine/SCons/Tool/aixc++.py @@ -45,12 +45,6 @@ def get_xlc(env): xlc = env.get('CXX', 'xlC') return SCons.Platform.aix.get_xlc(env, xlc, packages) -def smart_cxxflags(source, target, env, for_signature): - build_dir = env.GetBuildPath() - if build_dir: - return '-qtempinc=' + os.path.join(build_dir, 'tempinc') - return '' - def generate(env): """Add Builders and construction variables for xlC / Visual Age suite to an Environment.""" -- cgit v0.12 From c36de026dc80becfe5abbfa617203b17ab3c0c7a Mon Sep 17 00:00:00 2001 From: Dirk Baechle Date: Tue, 20 May 2014 19:28:50 +0200 Subject: - allow varlist to be specified as list of strings, fixes issue #2754 --- src/CHANGES.txt | 1 + src/engine/SCons/Action.py | 2 +- src/engine/SCons/ActionTests.py | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 20c9872..dca9901 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -47,6 +47,7 @@ RELEASE 2.3.2.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE From Dirk Baechle: - Update XML doc editor configuration + - Fix: Allow varlist to be specified as list of strings for Actions (#2754) From Rob Managan: - Updated the TeX builder to support use of the -synctex=1 diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py index 16866b6..1c746be 100644 --- a/src/engine/SCons/Action.py +++ b/src/engine/SCons/Action.py @@ -337,7 +337,7 @@ def _do_create_keywords(args, kw): 'You must either pass a string or a callback which ' 'accepts (target, source, env) as parameters.') if len(args) > 1: - kw['varlist'] = args[1:] + kw['varlist'] + kw['varlist'] = tuple(SCons.Util.flatten(args[1:])) + kw['varlist'] if kw.get('strfunction', _null) is not _null \ and kw.get('cmdstr', _null) is not _null: raise SCons.Errors.UserError( diff --git a/src/engine/SCons/ActionTests.py b/src/engine/SCons/ActionTests.py index 809e5ce..b46347d 100644 --- a/src/engine/SCons/ActionTests.py +++ b/src/engine/SCons/ActionTests.py @@ -211,6 +211,9 @@ def test_varlist(pos_call, str_call, cmd, cmdstrfunc, **kw): a = call_action((cmd, cmdstrfunc, 'a', 'b', 'c')) assert a.varlist == ('a', 'b', 'c'), a.varlist + a = call_action((cmd, cmdstrfunc, ['a', 'b', 'c'])) + assert a.varlist == ('a', 'b', 'c'), a.varlist + kw['varlist'] = 'foo' a = call_action((cmd, cmdstrfunc)) assert a.varlist == ('foo',), a.varlist -- cgit v0.12 From f954f0c9a47cff55a7828c335205ec33f8c0c8b6 Mon Sep 17 00:00:00 2001 From: Dirk Baechle Date: Tue, 27 May 2014 22:38:55 +0200 Subject: - Fix for docbook Tool: we now have to explicitly request the resolving of external entities when using the libxml2 binding. This is required after the security issue fix described in http://www.ubuntu.com/usn/usn-2214-1/ and people.canonical.com/~ubuntu-security/cve/2014/CVE-2014-0191.html . --- src/engine/SCons/Tool/docbook/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engine/SCons/Tool/docbook/__init__.py b/src/engine/SCons/Tool/docbook/__init__.py index aacc26d..26a1a95 100644 --- a/src/engine/SCons/Tool/docbook/__init__.py +++ b/src/engine/SCons/Tool/docbook/__init__.py @@ -242,7 +242,7 @@ def __xml_scan(node, env, path, arg): styledoc = libxml2.parseFile(xsl_file) style = libxslt.parseStylesheetDoc(styledoc) - doc = libxml2.parseFile(str(node)) + doc = libxml2.readFile(str(node), None, libxml2.XML_PARSE_NOENT) result = style.applyStylesheet(doc, None) depfiles = [] @@ -348,7 +348,7 @@ def __xinclude_libxml2(target, source, env): Resolving XIncludes, using the libxml2 module. """ doc = libxml2.readFile(str(source[0]), None, libxml2.XML_PARSE_NOENT) - doc.xincludeProcess() + doc.xincludeProcessFlags(libxml2.XML_PARSE_NOENT) doc.saveFile(str(target[0])) doc.freeDoc() -- cgit v0.12 From 7091a0d742d193c65a62ec044a34da6548a82d95 Mon Sep 17 00:00:00 2001 From: Dirk Baechle Date: Tue, 27 May 2014 23:39:42 +0200 Subject: - improved dependency handling for bootstrap process: the "doc" folder is now correctly linked to its counterpart in "build/doc" --- doc/SConscript | 80 ++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 47 insertions(+), 33 deletions(-) diff --git a/doc/SConscript b/doc/SConscript index d5cd01c..b82d63b 100644 --- a/doc/SConscript +++ b/doc/SConscript @@ -246,18 +246,32 @@ else: copy_dbfiles(env, toolpath, [], 'zip.py') # - # Each document will live in its own subdirectory. List them here - # by their subfolder names. Note, how the specifiers for each subdir - # have nothing to do with which formats get created...but which - # of the outputs get installed to the build folder and added to - # the different source and binary packages in the end. - # - docs = {'design' : ['chunked','pdf'], - #'python10' : ['chunked','html','pdf'], - 'reference' : ['chunked','html','pdf'], - #'developer' : ['chunked','html','pdf'], - 'user' : ['chunked','html','pdf','epub','text'], - 'man' : ['man','epub','text'] + # Each document will live in its own subdirectory "build/doc/xxx". + # List them here by their subfolder names. Note, how the specifiers + # for each subdir (=DOCTARGETS) have nothing to do with which + # formats get created...but which of the outputs get installed + # to the build folder and added to the different source and binary + # packages in the end. + # In addition to the list of target formats (DOCTARGETS), we also + # store some dependency information in this dict. The DOCDEPENDS + # list contains all files from each local "MANIFEST", after + # installing/copying them to the build directory. It basically + # links the original sources to the respective build folder, + # such that a simple 'python bootstrap.py' rebuilds the + # documentation when a file, like 'doc/user/depends.xml' + # for example, changes. + # Finally, in DOCNODES we store the created PDF and HTML files, + # such that we can then install them in the proper places for + # getting picked up by the archiving/packaging stages. + DOCTARGETS = 0 + DOCDEPENDS = 1 + DOCNODES = 2 + docs = {'design' : (['chunked','pdf'], [], []), + #'python10' : (['chunked','html','pdf'], [], []), + 'reference' : (['chunked','html','pdf'], [], []), + #'developer' : (['chunked','html','pdf'], [], []), + 'user' : (['chunked','html','pdf','epub','text'], [], []), + 'man' : (['man','epub','text'], [], []) } # The names of the target files for the MAN pages @@ -306,18 +320,18 @@ else: else: target_dir = os.path.join(build, doc) if ext in ['.fig', '.jpg', '.svg']: - buildsuite.extend(env.Command(build_s, doc_s, - Copy("$TARGET", "$SOURCE"))) + docs[doc][DOCDEPENDS].extend(env.Command(build_s, doc_s, + Copy("$TARGET", "$SOURCE"))) else: - revaction([env.File(build_s)], - [env.File(doc_s)], env) + btarget = env.File(build_s) + docs[doc][DOCDEPENDS].append(btarget) + revaction([btarget], [env.File(doc_s)], env) # # For each document, build the document itself in HTML, # and PDF formats. # - docnodes = {} for doc in docs: # @@ -328,16 +342,16 @@ else: cleanopt = ' -c' scdir = os.path.join(build, doc) sctargets = [] - if 'html' in docs[doc]: + if 'html' in docs[doc][DOCTARGETS]: sctargets.append(env.File(os.path.join(scdir, 'index.html'))) - if 'chunked' in docs[doc]: + if 'chunked' in docs[doc][DOCTARGETS]: sctargets.append(env.File(os.path.join(scdir, 'scons-%s' % doc, 'index.html'))) - if 'pdf' in docs[doc]: + if 'pdf' in docs[doc][DOCTARGETS]: sctargets.append(env.File(os.path.join(scdir, 'scons-%s.pdf' % doc))) - if 'epub' in docs[doc]: + if 'epub' in docs[doc][DOCTARGETS]: sctargets.append(env.File(os.path.join(scdir, 'scons-%s.epub' % doc))) - if 'man' in docs[doc]: + if 'man' in docs[doc][DOCTARGETS]: for m in man_page_list: sctargets.append(os.path.join(scdir, m)) man, _1 = os.path.splitext(m) @@ -345,8 +359,8 @@ else: sctargets.append(os.path.join(scdir, 'scons-%s.pdf' % man)) sctargets.append(os.path.join(scdir, 'scons-%s.html' % man)) - docnodes[doc] = env.Command(sctargets, buildsuite, - "cd %s && $PYTHON ${SCONS_PY.abspath}%s" % (scdir, cleanopt)) + docs[doc][DOCNODES].extend(env.Command(sctargets, buildsuite + docs[doc][DOCDEPENDS], + "cd %s && $PYTHON ${SCONS_PY.abspath}%s" % (scdir, cleanopt))) install_css = False for doc in docs: @@ -358,20 +372,20 @@ else: pdf = os.path.join(build, 'PDF', 'scons-%s.pdf' % doc) epub = os.path.join(build, 'EPUB', 'scons-%s.epub' % doc) text = os.path.join(build, 'TEXT', 'scons-%s.txt' % doc) - if 'chunked' in docs[doc]: + if 'chunked' in docs[doc][DOCTARGETS]: installed_chtml = env.ChunkedInstall(env.Dir(htmldir), os.path.join(build, doc,'scons-%s' % doc, 'index.html')) installed_chtml_css = env.Install(env.Dir(htmldir), os.path.join(build, doc, 'scons.css')) - env.Depends(installed_chtml, docnodes[doc]) - env.Depends(installed_chtml_css, docnodes[doc]) + env.Depends(installed_chtml, docs[doc][DOCNODES]) + env.Depends(installed_chtml_css, docs[doc][DOCNODES]) tar_deps.extend([htmlindex, installed_chtml_css]) tar_list.extend([htmldir]) Local(htmlindex) env.Ignore(htmlindex, version_xml) - if 'html' in docs[doc]: + if 'html' in docs[doc][DOCTARGETS]: env.InstallAs(env.File(html), env.File(os.path.join(build, doc,'index.html'))) tar_deps.extend([html]) tar_list.extend([html]) @@ -379,7 +393,7 @@ else: env.Ignore(html, version_xml) install_css = True - if 'pdf' in docs[doc]: + if 'pdf' in docs[doc][DOCTARGETS]: env.InstallAs(env.File(pdf), env.File(os.path.join(build, doc,'scons-%s.pdf' % doc))) Local(pdf) env.Ignore(pdf, version_xml) @@ -387,7 +401,7 @@ else: tar_deps.append(pdf) tar_list.append(pdf) - if 'epub' in docs[doc] and gs: + if 'epub' in docs[doc][DOCTARGETS] and gs: env.InstallAs(env.File(epub), env.File(os.path.join(build, doc,'scons-%s.epub' % doc))) Local(epub) env.Ignore(epub, version_xml) @@ -395,8 +409,8 @@ else: tar_deps.append(epub) tar_list.append(epub) - if ('text' in docs[doc] and lynx and - (('html' in docs[doc]) or (doc == 'man'))): + if ('text' in docs[doc][DOCTARGETS] and lynx and + (('html' in docs[doc][DOCTARGETS]) or (doc == 'man'))): texthtml = os.path.join(build, doc,'index.html') if doc == 'man': # Special handling for single MAN file @@ -411,7 +425,7 @@ else: tar_list.append(text) - if 'man' in docs[doc]: + if 'man' in docs[doc][DOCTARGETS]: # # Man page(s) # -- cgit v0.12 From 4655bd958070a5c37475f21ab51de62f557a816b Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Wed, 28 May 2014 10:23:35 +0300 Subject: Expand references to tigris.org bug tracker --- src/engine/SCons/Tool/JavaCommon.py | 3 ++- test/Depends/no-Builder.py | 2 +- test/ExecuteInvalidateCache.py | 3 ++- test/Fortran/USE-MODULE-CASEINSENS.py | 3 ++- test/Libs/SharedLibrary-update-deps.py | 2 +- test/Scanner/Dir.py | 2 +- test/VariantDir/include-subdir.py | 2 +- 7 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/engine/SCons/Tool/JavaCommon.py b/src/engine/SCons/Tool/JavaCommon.py index 156ef97..6dd6051 100644 --- a/src/engine/SCons/Tool/JavaCommon.py +++ b/src/engine/SCons/Tool/JavaCommon.py @@ -244,7 +244,8 @@ if java_parsing: return self # If that's an inner class which is declared in a method, it # requires an index prepended to the class-name, e.g. - # 'Foo$1Inner' (Tigris Issue 2087) + # 'Foo$1Inner' + # http://scons.tigris.org/issues/show_bug.cgi?id=2087 if self.outer_state.localClasses and \ self.outer_state.stackBrackets[-1] > \ self.outer_state.stackBrackets[-2]+1: diff --git a/test/Depends/no-Builder.py b/test/Depends/no-Builder.py index 2d49756..48ab724 100644 --- a/test/Depends/no-Builder.py +++ b/test/Depends/no-Builder.py @@ -40,7 +40,7 @@ file2 = File('file2') env.Depends(file1, [[file2, 'file3']]) # Verify that a "hidden" file created by another action causes the # action to run when an explicit Dependency is specified. -# See tigris.org issue 2647. +# See http://scons.tigris.org/issues/show_bug.cgi?id=2647 env.Depends('hidden', 'file4.out') env.Command('file4.out', 'file4.in', [Copy('$TARGET', '$SOURCE'), Touch('hidden')]) diff --git a/test/ExecuteInvalidateCache.py b/test/ExecuteInvalidateCache.py index 88ae393..a22c5ea 100644 --- a/test/ExecuteInvalidateCache.py +++ b/test/ExecuteInvalidateCache.py @@ -26,7 +26,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Test the Execute() functions clears the memoized values of affected target Nodes -when used with Delete(). Derived from Tigris issue 1307. +when used with Delete(). Derived from +http://scons.tigris.org/issues/show_bug.cgi?id=1307 """ import TestSCons diff --git a/test/Fortran/USE-MODULE-CASEINSENS.py b/test/Fortran/USE-MODULE-CASEINSENS.py index 79d5125..44c03fe 100644 --- a/test/Fortran/USE-MODULE-CASEINSENS.py +++ b/test/Fortran/USE-MODULE-CASEINSENS.py @@ -26,7 +26,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" # This test tests whether a file that defines a module "a" and # then uses it with a different case ("A") works. Pre-2.0, this -# gave a spurious dependency cycle error. See Tigris issue #2574. +# gave a spurious dependency cycle error. +# See http://scons.tigris.org/issues/show_bug.cgi?id=2574 import TestSCons diff --git a/test/Libs/SharedLibrary-update-deps.py b/test/Libs/SharedLibrary-update-deps.py index 5394bc7..076e3ad 100644 --- a/test/Libs/SharedLibrary-update-deps.py +++ b/test/Libs/SharedLibrary-update-deps.py @@ -26,7 +26,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Test that SharedLibrary() updates when a different lib is linked, even if it has the same md5. -This is Tigris bug #2903. +This is http://scons.tigris.org/issues/show_bug.cgi?id=2903 """ import sys diff --git a/test/Scanner/Dir.py b/test/Scanner/Dir.py index 120e08f..86b80e9 100644 --- a/test/Scanner/Dir.py +++ b/test/Scanner/Dir.py @@ -27,7 +27,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify that a simple scanner that returns Dir nodes works correctly. -Submitted as tigris.org issue #2534. +Submitted as http://scons.tigris.org/issues/show_bug.cgi?id=2534 """ import TestSCons diff --git a/test/VariantDir/include-subdir.py b/test/VariantDir/include-subdir.py index 5ddd623..d616bba 100644 --- a/test/VariantDir/include-subdir.py +++ b/test/VariantDir/include-subdir.py @@ -32,7 +32,7 @@ we have to make sure that the file gets copied to the variant dir. (This was not the case for 0.98.5 and earlier) Test case supplied by Jared Grubb, based on a minimal example supplied -by Ali Tofigh, filed as issue #2121 at tigris.org. +by Ali Tofigh, filed as http://scons.tigris.org/issues/show_bug.cgi?id=2121 """ import TestSCons -- cgit v0.12 From f920678b73f0e0a09cbbd8977a54f915c661279d Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Wed, 28 May 2014 11:36:26 +0300 Subject: Fix development mailing list with a new address @scons.org --- HOWTO/subrelease.txt | 2 +- QMTest/TestSCons.py | 2 +- README.rst | 9 ++++----- doc/scons.mod | 4 ++-- review.py | 2 +- src/Announce.txt | 2 +- src/README.txt | 6 +++--- src/engine/SCons/Environment.py | 2 +- src/engine/SCons/Script/Main.py | 2 +- src/engine/SCons/Tool/docbook/docs/manual.xml | 2 +- test/Deprecated/SourceCode/BitKeeper/BITKEEPERCOM.py | 2 +- test/Deprecated/SourceCode/BitKeeper/BITKEEPERCOMSTR.py | 2 +- test/Deprecated/SourceCode/BitKeeper/BitKeeper.py | 2 +- test/Deprecated/SourceCode/CVS/CVS.py | 2 +- test/Deprecated/SourceCode/CVS/CVSCOM.py | 2 +- test/Deprecated/SourceCode/CVS/CVSCOMSTR.py | 2 +- test/Deprecated/SourceCode/Perforce/P4COM.py | 2 +- test/Deprecated/SourceCode/Perforce/P4COMSTR.py | 2 +- test/Deprecated/SourceCode/Perforce/Perforce.py | 2 +- test/Deprecated/SourceCode/RCS/RCS_COCOM.py | 2 +- test/Deprecated/SourceCode/RCS/RCS_COCOMSTR.py | 2 +- test/Deprecated/SourceCode/RCS/changed.py | 2 +- test/Deprecated/SourceCode/RCS/explicit.py | 2 +- test/Deprecated/SourceCode/SCCS/SCCSCOM.py | 2 +- test/Deprecated/SourceCode/SCCS/SCCSCOMSTR.py | 2 +- test/Deprecated/SourceCode/SCCS/diskcheck.py | 2 +- test/Deprecated/SourceCode/SourceCode.py | 2 +- test/Deprecated/SourceCode/Subversion.py | 2 +- www/patch-submission.html | 4 ++-- 29 files changed, 36 insertions(+), 37 deletions(-) diff --git a/HOWTO/subrelease.txt b/HOWTO/subrelease.txt index ecfaa1f..06b757a 100644 --- a/HOWTO/subrelease.txt +++ b/HOWTO/subrelease.txt @@ -111,4 +111,4 @@ Things to do to release a new X.Y.Z version of SCons: - Announce to dev@scons.tigris.org. + Announce to scons-dev@scons.org diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py index 57b97f9..4b2b5a4 100644 --- a/QMTest/TestSCons.py +++ b/QMTest/TestSCons.py @@ -150,7 +150,7 @@ def deprecated_python_version(version=sys.version_info): if deprecated_python_version(): msg = r""" scons: warning: Support for pre-2.7.0 Python version (%s) is deprecated. - If this will cause hardship, contact dev@scons.tigris.org. + If this will cause hardship, contact scons-dev@scons.org """ deprecated_python_expr = re_escape(msg % python_version_string()) + file_expr diff --git a/README.rst b/README.rst index b9e7d3b..16a7123 100644 --- a/README.rst +++ b/README.rst @@ -676,7 +676,7 @@ Submission page: You can also send mail to the SCons developers' mailing list: - dev@scons.tigris.org + scons-dev@scons.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 @@ -689,12 +689,11 @@ 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 + scons-dev@scons.org -You may request a subscription to the developer's mailing list by sending -email to: +You may subscribe to the developer's mailing list using form on this page: - dev-subscribe@scons.tigris.org + http://two.pairlist.net/mailman/listinfo/scons-dev 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 diff --git a/doc/scons.mod b/doc/scons.mod index 01e9a6d..be2dc24 100644 --- a/doc/scons.mod +++ b/doc/scons.mod @@ -525,8 +525,8 @@ --> announce@scons.tigris.org"> -dev@scons.tigris.org"> -users@scons.tigris.org"> +scons-dev@scons.org"> +scons-users@scons.org"> %s" % response_body) - sys.exit(1) - - patches = dict() - [patches.setdefault(v, k) for k, v in patch_list] - for filename in patches.keys(): - base_content, new_content, is_binary, status = files[filename] - file_id_str = patches.get(filename) - if file_id_str.find("nobase") != -1: - base_content = None - file_id_str = file_id_str[file_id_str.rfind("_") + 1:] - file_id = int(file_id_str) - if base_content != None: - UploadFile(filename, file_id, base_content, is_binary, status, True) - if new_content != None: - UploadFile(filename, file_id, new_content, is_binary, status, False) - - def IsImage(self, filename): - """Returns true if the filename has an image extension.""" - mimetype = mimetypes.guess_type(filename)[0] - if not mimetype: - return False - return mimetype.startswith("image/") - - def IsBinary(self, filename): - """Returns true if the guessed mimetyped isnt't in text group.""" - mimetype = mimetypes.guess_type(filename)[0] - if not mimetype: - return False # e.g. README, "real" binaries usually have an extension - # special case for text files which don't start with text/ - if mimetype in TEXT_MIMETYPES: - return False - return not mimetype.startswith("text/") - - -class SubversionVCS(VersionControlSystem): - """Implementation of the VersionControlSystem interface for Subversion.""" - - def __init__(self, options): - super(SubversionVCS, self).__init__(options) - if self.options.revision: - match = re.match(r"(\d+)(:(\d+))?", self.options.revision) - if not match: - ErrorExit("Invalid Subversion revision %s." % self.options.revision) - self.rev_start = match.group(1) - self.rev_end = match.group(3) - else: - self.rev_start = self.rev_end = None - # Cache output from "svn list -r REVNO dirname". - # Keys: dirname, Values: 2-tuple (ouput for start rev and end rev). - self.svnls_cache = {} - # Base URL is required to fetch files deleted in an older revision. - # Result is cached to not guess it over and over again in GetBaseFile(). - required = self.options.download_base or self.options.revision is not None - self.svn_base = self._GuessBase(required) - - def GuessBase(self, required): - """Wrapper for _GuessBase.""" - return self.svn_base - - def _GuessBase(self, required): - """Returns base URL for current diff. - - Args: - required: If true, exits if the url can't be guessed, otherwise None is - returned. - """ - info = RunShell(["svn", "info"]) - for line in info.splitlines(): - if line.startswith("URL: "): - url = line.split()[1] - scheme, netloc, path, params, query, fragment = urlparse.urlparse(url) - guess = "" - if netloc == "svn.python.org" and scheme == "svn+ssh": - path = "projects" + path - scheme = "http" - guess = "Python " - elif netloc.endswith(".googlecode.com"): - scheme = "http" - guess = "Google Code " - path = path + "/" - base = urlparse.urlunparse((scheme, netloc, path, params, - query, fragment)) - logging.info("Guessed %sbase = %s", guess, base) - return base - if required: - ErrorExit("Can't find URL in output from svn info") - return None - - def GenerateDiff(self, args): - cmd = ["svn", "diff"] - if self.options.revision: - cmd += ["-r", self.options.revision] - cmd.extend(args) - data = RunShell(cmd) - count = 0 - for line in data.splitlines(): - if line.startswith("Index:") or line.startswith("Property changes on:"): - count += 1 - logging.info(line) - if not count: - ErrorExit("No valid patches found in output from svn diff") - return data - - def _CollapseKeywords(self, content, keyword_str): - """Collapses SVN keywords.""" - # svn cat translates keywords but svn diff doesn't. As a result of this - # behavior patching.PatchChunks() fails with a chunk mismatch error. - # This part was originally written by the Review Board development team - # who had the same problem (http://reviews.review-board.org/r/276/). - # Mapping of keywords to known aliases - svn_keywords = { - # Standard keywords - 'Date': ['Date', 'LastChangedDate'], - 'Revision': ['Revision', 'LastChangedRevision', 'Rev'], - 'Author': ['Author', 'LastChangedBy'], - 'HeadURL': ['HeadURL', 'URL'], - 'Id': ['Id'], - - # Aliases - 'LastChangedDate': ['LastChangedDate', 'Date'], - 'LastChangedRevision': ['LastChangedRevision', 'Rev', 'Revision'], - 'LastChangedBy': ['LastChangedBy', 'Author'], - 'URL': ['URL', 'HeadURL'], - } - - def repl(m): - if m.group(2): - return "$%s::%s$" % (m.group(1), " " * len(m.group(3))) - return "$%s$" % m.group(1) - keywords = [keyword - for name in keyword_str.split(" ") - for keyword in svn_keywords.get(name, [])] - return re.sub(r"\$(%s):(:?)([^\$]+)\$" % '|'.join(keywords), repl, content) - - def GetUnknownFiles(self): - status = RunShell(["svn", "status", "--ignore-externals"], silent_ok=True) - unknown_files = [] - for line in status.split("\n"): - if line and line[0] == "?": - unknown_files.append(line) - return unknown_files - - def ReadFile(self, filename): - """Returns the contents of a file.""" - file = open(filename, 'rb') - result = "" - try: - result = file.read() - finally: - file.close() - return result - - def GetStatus(self, filename): - """Returns the status of a file.""" - if not self.options.revision: - status = RunShell(["svn", "status", "--ignore-externals", filename]) - if not status: - ErrorExit("svn status returned no output for %s" % filename) - status_lines = status.splitlines() - # If file is in a cl, the output will begin with - # "\n--- Changelist 'cl_name':\n". See - # http://svn.collab.net/repos/svn/trunk/notes/changelist-design.txt - if (len(status_lines) == 3 and - not status_lines[0] and - status_lines[1].startswith("--- Changelist")): - status = status_lines[2] - else: - status = status_lines[0] - # If we have a revision to diff against we need to run "svn list" - # for the old and the new revision and compare the results to get - # the correct status for a file. - else: - dirname, relfilename = os.path.split(filename) - if dirname not in self.svnls_cache: - cmd = ["svn", "list", "-r", self.rev_start, dirname or "."] - out, err, returncode = RunShellWithReturnCodeAndStderr(cmd) - if returncode: - # Directory might not yet exist at start revison - # svn: Unable to find repository location for 'abc' in revision nnn - if re.match('^svn: Unable to find repository location for .+ in revision \d+', err): - old_files = () - else: - ErrorExit("Failed to get status for %s:\n%s" % (filename, err)) - else: - old_files = out.splitlines() - args = ["svn", "list"] - if self.rev_end: - args += ["-r", self.rev_end] - cmd = args + [dirname or "."] - out, returncode = RunShellWithReturnCode(cmd) - if returncode: - ErrorExit("Failed to run command %s" % cmd) - self.svnls_cache[dirname] = (old_files, out.splitlines()) - old_files, new_files = self.svnls_cache[dirname] - if relfilename in old_files and relfilename not in new_files: - status = "D " - elif relfilename in old_files and relfilename in new_files: - status = "M " - else: - status = "A " - return status - - def GetBaseFile(self, filename): - status = self.GetStatus(filename) - base_content = None - new_content = None - - # If a file is copied its status will be "A +", which signifies - # "addition-with-history". See "svn st" for more information. We need to - # upload the original file or else diff parsing will fail if the file was - # edited. - if status[0] == "A" and status[3] != "+": - # We'll need to upload the new content if we're adding a binary file - # since diff's output won't contain it. - mimetype = RunShell(["svn", "propget", "svn:mime-type", filename], - silent_ok=True) - base_content = "" - is_binary = bool(mimetype) and not mimetype.startswith("text/") - if is_binary and self.IsImage(filename): - new_content = self.ReadFile(filename) - elif (status[0] in ("M", "D", "R") or - (status[0] == "A" and status[3] == "+") or # Copied file. - (status[0] == " " and status[1] == "M")): # Property change. - args = [] - if self.options.revision: - url = "%s/%s@%s" % (self.svn_base, filename, self.rev_start) - else: - # Don't change filename, it's needed later. - url = filename - args += ["-r", "BASE"] - cmd = ["svn"] + args + ["propget", "svn:mime-type", url] - mimetype, returncode = RunShellWithReturnCode(cmd) - if returncode: - # File does not exist in the requested revision. - # Reset mimetype, it contains an error message. - mimetype = "" - else: - mimetype = mimetype.strip() - get_base = False - is_binary = (bool(mimetype) and - not mimetype.startswith("text/") and - not mimetype in TEXT_MIMETYPES) - if status[0] == " ": - # Empty base content just to force an upload. - base_content = "" - elif is_binary: - if self.IsImage(filename): - get_base = True - if status[0] == "M": - if not self.rev_end: - new_content = self.ReadFile(filename) - else: - url = "%s/%s@%s" % (self.svn_base, filename, self.rev_end) - new_content = RunShell(["svn", "cat", url], - universal_newlines=True, silent_ok=True) - else: - base_content = "" - else: - get_base = True - - if get_base: - if is_binary: - universal_newlines = False - else: - universal_newlines = True - if self.rev_start: - # "svn cat -r REV delete_file.txt" doesn't work. cat requires - # the full URL with "@REV" appended instead of using "-r" option. - url = "%s/%s@%s" % (self.svn_base, filename, self.rev_start) - base_content = RunShell(["svn", "cat", url], - universal_newlines=universal_newlines, - silent_ok=True) - else: - base_content, ret_code = RunShellWithReturnCode( - ["svn", "cat", filename], universal_newlines=universal_newlines) - if ret_code and status[0] == "R": - # It's a replaced file without local history (see issue208). - # The base file needs to be fetched from the server. - url = "%s/%s" % (self.svn_base, filename) - base_content = RunShell(["svn", "cat", url], - universal_newlines=universal_newlines, - silent_ok=True) - elif ret_code: - ErrorExit("Got error status from 'svn cat %s'" % filename) - if not is_binary: - args = [] - if self.rev_start: - url = "%s/%s@%s" % (self.svn_base, filename, self.rev_start) - else: - url = filename - args += ["-r", "BASE"] - cmd = ["svn"] + args + ["propget", "svn:keywords", url] - keywords, returncode = RunShellWithReturnCode(cmd) - if keywords and not returncode: - base_content = self._CollapseKeywords(base_content, keywords) - else: - StatusUpdate("svn status returned unexpected output: %s" % status) - sys.exit(1) - return base_content, new_content, is_binary, status[0:5] - - -class GitVCS(VersionControlSystem): - """Implementation of the VersionControlSystem interface for Git.""" - - def __init__(self, options): - super(GitVCS, self).__init__(options) - # Map of filename -> (hash before, hash after) of base file. - # Hashes for "no such file" are represented as None. - self.hashes = {} - # Map of new filename -> old filename for renames. - self.renames = {} - - def PostProcessDiff(self, gitdiff): - """Converts the diff output to include an svn-style "Index:" line as well - as record the hashes of the files, so we can upload them along with our - diff.""" - # Special used by git to indicate "no such content". - NULL_HASH = "0"*40 - - def IsFileNew(filename): - return filename in self.hashes and self.hashes[filename][0] is None - - def AddSubversionPropertyChange(filename): - """Add svn's property change information into the patch if given file is - new file. - - We use Subversion's auto-props setting to retrieve its property. - See http://svnbook.red-bean.com/en/1.1/ch07.html#svn-ch-7-sect-1.3.2 for - Subversion's [auto-props] setting. - """ - if self.options.emulate_svn_auto_props and IsFileNew(filename): - svnprops = GetSubversionPropertyChanges(filename) - if svnprops: - svndiff.append("\n" + svnprops + "\n") - - svndiff = [] - filecount = 0 - filename = None - for line in gitdiff.splitlines(): - match = re.match(r"diff --git a/(.*) b/(.*)$", line) - if match: - # Add auto property here for previously seen file. - if filename is not None: - AddSubversionPropertyChange(filename) - filecount += 1 - # Intentionally use the "after" filename so we can show renames. - filename = match.group(2) - svndiff.append("Index: %s\n" % filename) - if match.group(1) != match.group(2): - self.renames[match.group(2)] = match.group(1) - else: - # The "index" line in a git diff looks like this (long hashes elided): - # index 82c0d44..b2cee3f 100755 - # We want to save the left hash, as that identifies the base file. - match = re.match(r"index (\w+)\.\.(\w+)", line) - if match: - before, after = (match.group(1), match.group(2)) - if before == NULL_HASH: - before = None - if after == NULL_HASH: - after = None - self.hashes[filename] = (before, after) - svndiff.append(line + "\n") - if not filecount: - ErrorExit("No valid patches found in output from git diff") - # Add auto property for the last seen file. - assert filename is not None - AddSubversionPropertyChange(filename) - return "".join(svndiff) - - def GenerateDiff(self, extra_args): - extra_args = extra_args[:] - if self.options.revision: - if ":" in self.options.revision: - extra_args = self.options.revision.split(":", 1) + extra_args - else: - extra_args = [self.options.revision] + extra_args - - # --no-ext-diff is broken in some versions of Git, so try to work around - # this by overriding the environment (but there is still a problem if the - # git config key "diff.external" is used). - env = os.environ.copy() - if 'GIT_EXTERNAL_DIFF' in env: del env['GIT_EXTERNAL_DIFF'] - return RunShell(["git", "diff", "--no-ext-diff", "--full-index", "-M"] - + extra_args, env=env) - - def GetUnknownFiles(self): - status = RunShell(["git", "ls-files", "--exclude-standard", "--others"], - silent_ok=True) - return status.splitlines() - - def GetFileContent(self, file_hash, is_binary): - """Returns the content of a file identified by its git hash.""" - data, retcode = RunShellWithReturnCode(["git", "show", file_hash], - universal_newlines=not is_binary) - if retcode: - ErrorExit("Got error status from 'git show %s'" % file_hash) - return data - - def GetBaseFile(self, filename): - hash_before, hash_after = self.hashes.get(filename, (None,None)) - base_content = None - new_content = None - is_binary = self.IsBinary(filename) - status = None - - if filename in self.renames: - status = "A +" # Match svn attribute name for renames. - if filename not in self.hashes: - # If a rename doesn't change the content, we never get a hash. - base_content = RunShell(["git", "show", "HEAD:" + filename]) - elif not hash_before: - status = "A" - base_content = "" - elif not hash_after: - status = "D" - else: - status = "M" - - is_image = self.IsImage(filename) - - # Grab the before/after content if we need it. - # We should include file contents if it's text or it's an image. - if not is_binary or is_image: - # Grab the base content if we don't have it already. - if base_content is None and hash_before: - base_content = self.GetFileContent(hash_before, is_binary) - # Only include the "after" file if it's an image; otherwise it - # it is reconstructed from the diff. - if is_image and hash_after: - new_content = self.GetFileContent(hash_after, is_binary) - - return (base_content, new_content, is_binary, status) - - -class MercurialVCS(VersionControlSystem): - """Implementation of the VersionControlSystem interface for Mercurial.""" - - def __init__(self, options, repo_dir): - super(MercurialVCS, self).__init__(options) - # Absolute path to repository (we can be in a subdir) - self.repo_dir = os.path.normpath(repo_dir) - # Compute the subdir - cwd = os.path.normpath(os.getcwd()) - assert cwd.startswith(self.repo_dir) - self.subdir = cwd[len(self.repo_dir):].lstrip(r"\/") - if self.options.revision: - self.base_rev = self.options.revision - else: - self.base_rev = RunShell(["hg", "parent", "-q"]).split(':')[1].strip() - - def _GetRelPath(self, filename): - """Get relative path of a file according to the current directory, - given its logical path in the repo.""" - assert filename.startswith(self.subdir), (filename, self.subdir) - return filename[len(self.subdir):].lstrip(r"\/") - - def GenerateDiff(self, extra_args): - cmd = ["hg", "diff", "--git", "-r", self.base_rev] + extra_args - data = RunShell(cmd, silent_ok=True) - svndiff = [] - filecount = 0 - for line in data.splitlines(): - m = re.match("diff --git a/(\S+) b/(\S+)", line) - if m: - # Modify line to make it look like as it comes from svn diff. - # With this modification no changes on the server side are required - # to make upload.py work with Mercurial repos. - # NOTE: for proper handling of moved/copied files, we have to use - # the second filename. - filename = m.group(2) - svndiff.append("Index: %s" % filename) - svndiff.append("=" * 67) - filecount += 1 - logging.info(line) - else: - svndiff.append(line) - if not filecount: - ErrorExit("No valid patches found in output from hg diff") - return "\n".join(svndiff) + "\n" - - def GetUnknownFiles(self): - """Return a list of files unknown to the VCS.""" - args = [] - status = RunShell(["hg", "status", "--rev", self.base_rev, "-u", "."], - silent_ok=True) - unknown_files = [] - for line in status.splitlines(): - st, fn = line.split(" ", 1) - if st == "?": - unknown_files.append(fn) - return unknown_files - - def GetBaseFile(self, filename): - # "hg status" and "hg cat" both take a path relative to the current subdir - # rather than to the repo root, but "hg diff" has given us the full path - # to the repo root. - base_content = "" - new_content = None - is_binary = False - oldrelpath = relpath = self._GetRelPath(filename) - # "hg status -C" returns two lines for moved/copied files, one otherwise - out = RunShell(["hg", "status", "-C", "--rev", self.base_rev, relpath]) - out = out.splitlines() - # HACK: strip error message about missing file/directory if it isn't in - # the working copy - if out[0].startswith('%s: ' % relpath): - out = out[1:] - status, _ = out[0].split(' ', 1) - if len(out) > 1 and status == "A": - # Moved/copied => considered as modified, use old filename to - # retrieve base contents - oldrelpath = out[1].strip() - status = "M" - if ":" in self.base_rev: - base_rev = self.base_rev.split(":", 1)[0] - else: - base_rev = self.base_rev - if status != "A": - base_content = RunShell(["hg", "cat", "-r", base_rev, oldrelpath], - silent_ok=True) - is_binary = "\0" in base_content # Mercurial's heuristic - if status != "R": - new_content = open(relpath, "rb").read() - is_binary = is_binary or "\0" in new_content - if is_binary and base_content: - # Fetch again without converting newlines - base_content = RunShell(["hg", "cat", "-r", base_rev, oldrelpath], - silent_ok=True, universal_newlines=False) - if not is_binary or not self.IsImage(relpath): - new_content = None - return base_content, new_content, is_binary, status - - -# NOTE: The SplitPatch function is duplicated in engine.py, keep them in sync. -def SplitPatch(data): - """Splits a patch into separate pieces for each file. - - Args: - data: A string containing the output of svn diff. - - Returns: - A list of 2-tuple (filename, text) where text is the svn diff output - pertaining to filename. - """ - patches = [] - filename = None - diff = [] - for line in data.splitlines(True): - new_filename = None - if line.startswith('Index:'): - unused, new_filename = line.split(':', 1) - new_filename = new_filename.strip() - elif line.startswith('Property changes on:'): - unused, temp_filename = line.split(':', 1) - # When a file is modified, paths use '/' between directories, however - # when a property is modified '\' is used on Windows. Make them the same - # otherwise the file shows up twice. - temp_filename = temp_filename.strip().replace('\\', '/') - if temp_filename != filename: - # File has property changes but no modifications, create a new diff. - new_filename = temp_filename - if new_filename: - if filename and diff: - patches.append((filename, ''.join(diff))) - filename = new_filename - diff = [line] - continue - if diff is not None: - diff.append(line) - if filename and diff: - patches.append((filename, ''.join(diff))) - return patches - - -def UploadSeparatePatches(issue, rpc_server, patchset, data, options): - """Uploads a separate patch for each file in the diff output. - - Returns a list of [patch_key, filename] for each file. - """ - patches = SplitPatch(data) - rv = [] - for patch in patches: - if len(patch[1]) > MAX_UPLOAD_SIZE: - print ("Not uploading the patch for " + patch[0] + - " because the file is too large.") - continue - form_fields = [("filename", patch[0])] - if not options.download_base: - form_fields.append(("content_upload", "1")) - files = [("data", "data.diff", patch[1])] - ctype, body = EncodeMultipartFormData(form_fields, files) - url = "/%d/upload_patch/%d" % (int(issue), int(patchset)) - print "Uploading patch for " + patch[0] - response_body = rpc_server.Send(url, body, content_type=ctype) - lines = response_body.splitlines() - if not lines or lines[0] != "OK": - StatusUpdate(" --> %s" % response_body) - sys.exit(1) - rv.append([lines[1], patch[0]]) - return rv - - -def GuessVCSName(): - """Helper to guess the version control system. - - This examines the current directory, guesses which VersionControlSystem - we're using, and returns an string indicating which VCS is detected. - - Returns: - A pair (vcs, output). vcs is a string indicating which VCS was detected - and is one of VCS_GIT, VCS_MERCURIAL, VCS_SUBVERSION, or VCS_UNKNOWN. - output is a string containing any interesting output from the vcs - detection routine, or None if there is nothing interesting. - """ - def RunDetectCommand(vcs_type, command): - """Helper to detect VCS by executing command. - - Returns: - A pair (vcs, output) or None. Throws exception on error. - """ - try: - out, returncode = RunShellWithReturnCode(command) - if returncode == 0: - return (vcs_type, out.strip()) - except OSError, (errcode, message): - if errcode != errno.ENOENT: # command not found code - raise - - # Mercurial has a command to get the base directory of a repository - # Try running it, but don't die if we don't have hg installed. - # NOTE: we try Mercurial first as it can sit on top of an SVN working copy. - res = RunDetectCommand(VCS_MERCURIAL, ["hg", "root"]) - if res != None: - return res - - # Subversion has a .svn in all working directories. - if os.path.isdir('.svn'): - logging.info("Guessed VCS = Subversion") - return (VCS_SUBVERSION, None) - - # Git has a command to test if you're in a git tree. - # Try running it, but don't die if we don't have git installed. - res = RunDetectCommand(VCS_GIT, ["git", "rev-parse", - "--is-inside-work-tree"]) - if res != None: - return res - - return (VCS_UNKNOWN, None) - - -def GuessVCS(options): - """Helper to guess the version control system. - - This verifies any user-specified VersionControlSystem (by command line - or environment variable). If the user didn't specify one, this examines - the current directory, guesses which VersionControlSystem we're using, - and returns an instance of the appropriate class. Exit with an error - if we can't figure it out. - - Returns: - A VersionControlSystem instance. Exits if the VCS can't be guessed. - """ - vcs = options.vcs - if not vcs: - vcs = os.environ.get("CODEREVIEW_VCS") - if vcs: - v = VCS_ABBREVIATIONS.get(vcs.lower()) - if v is None: - ErrorExit("Unknown version control system %r specified." % vcs) - (vcs, extra_output) = (v, None) - else: - (vcs, extra_output) = GuessVCSName() - - if vcs == VCS_MERCURIAL: - if extra_output is None: - extra_output = RunShell(["hg", "root"]).strip() - return MercurialVCS(options, extra_output) - elif vcs == VCS_SUBVERSION: - return SubversionVCS(options) - elif vcs == VCS_GIT: - return GitVCS(options) - - ErrorExit(("Could not guess version control system. " - "Are you in a working copy directory?")) - - -def CheckReviewer(reviewer): - """Validate a reviewer -- either a nickname or an email addres. - - Args: - reviewer: A nickname or an email address. - - Calls ErrorExit() if it is an invalid email address. - """ - if "@" not in reviewer: - return # Assume nickname - parts = reviewer.split("@") - if len(parts) > 2: - ErrorExit("Invalid email address: %r" % reviewer) - assert len(parts) == 2 - if "." not in parts[1]: - ErrorExit("Invalid email address: %r" % reviewer) - - -def LoadSubversionAutoProperties(): - """Returns the content of [auto-props] section of Subversion's config file as - a dictionary. - - Returns: - A dictionary whose key-value pair corresponds the [auto-props] section's - key-value pair. - In following cases, returns empty dictionary: - - config file doesn't exist, or - - 'enable-auto-props' is not set to 'true-like-value' in [miscellany]. - """ - if os.name == 'nt': - subversion_config = os.environ.get("APPDATA") + "\\Subversion\\config" - else: - subversion_config = os.path.expanduser("~/.subversion/config") - if not os.path.exists(subversion_config): - return {} - config = ConfigParser.ConfigParser() - config.read(subversion_config) - if (config.has_section("miscellany") and - config.has_option("miscellany", "enable-auto-props") and - config.getboolean("miscellany", "enable-auto-props") and - config.has_section("auto-props")): - props = {} - for file_pattern in config.options("auto-props"): - props[file_pattern] = ParseSubversionPropertyValues( - config.get("auto-props", file_pattern)) - return props - else: - return {} - -def ParseSubversionPropertyValues(props): - """Parse the given property value which comes from [auto-props] section and - returns a list whose element is a (svn_prop_key, svn_prop_value) pair. - - See the following doctest for example. - - >>> ParseSubversionPropertyValues('svn:eol-style=LF') - [('svn:eol-style', 'LF')] - >>> ParseSubversionPropertyValues('svn:mime-type=image/jpeg') - [('svn:mime-type', 'image/jpeg')] - >>> ParseSubversionPropertyValues('svn:eol-style=LF;svn:executable') - [('svn:eol-style', 'LF'), ('svn:executable', '*')] - """ - key_value_pairs = [] - for prop in props.split(";"): - key_value = prop.split("=") - assert len(key_value) <= 2 - if len(key_value) == 1: - # If value is not given, use '*' as a Subversion's convention. - key_value_pairs.append((key_value[0], "*")) - else: - key_value_pairs.append((key_value[0], key_value[1])) - return key_value_pairs - - -def GetSubversionPropertyChanges(filename): - """Return a Subversion's 'Property changes on ...' string, which is used in - the patch file. - - Args: - filename: filename whose property might be set by [auto-props] config. - - Returns: - A string like 'Property changes on |filename| ...' if given |filename| - matches any entries in [auto-props] section. None, otherwise. - """ - global svn_auto_props_map - if svn_auto_props_map is None: - svn_auto_props_map = LoadSubversionAutoProperties() - - all_props = [] - for file_pattern, props in svn_auto_props_map.items(): - if fnmatch.fnmatch(filename, file_pattern): - all_props.extend(props) - if all_props: - return FormatSubversionPropertyChanges(filename, all_props) - return None - - -def FormatSubversionPropertyChanges(filename, props): - """Returns Subversion's 'Property changes on ...' strings using given filename - and properties. - - Args: - filename: filename - props: A list whose element is a (svn_prop_key, svn_prop_value) pair. - - Returns: - A string which can be used in the patch file for Subversion. - - See the following doctest for example. - - >>> print FormatSubversionPropertyChanges('foo.cc', [('svn:eol-style', 'LF')]) - Property changes on: foo.cc - ___________________________________________________________________ - Added: svn:eol-style - + LF - - """ - prop_changes_lines = [ - "Property changes on: %s" % filename, - "___________________________________________________________________"] - for key, value in props: - prop_changes_lines.append("Added: " + key) - prop_changes_lines.append(" + " + value) - return "\n".join(prop_changes_lines) + "\n" - - -def RealMain(argv, data=None): - """The real main function. - - Args: - argv: Command line arguments. - data: Diff contents. If None (default) the diff is generated by - the VersionControlSystem implementation returned by GuessVCS(). - - Returns: - A 2-tuple (issue id, patchset id). - The patchset id is None if the base files are not uploaded by this - script (applies only to SVN checkouts). - """ - options, args = parser.parse_args(argv[1:]) - global verbosity - verbosity = options.verbose - if verbosity >= 3: - logging.getLogger().setLevel(logging.DEBUG) - elif verbosity >= 2: - logging.getLogger().setLevel(logging.INFO) - - vcs = GuessVCS(options) - - base = options.base_url - if isinstance(vcs, SubversionVCS): - # Guessing the base field is only supported for Subversion. - # Note: Fetching base files may become deprecated in future releases. - guessed_base = vcs.GuessBase(options.download_base) - if base: - if guessed_base and base != guessed_base: - print "Using base URL \"%s\" from --base_url instead of \"%s\"" % \ - (base, guessed_base) - else: - base = guessed_base - - if not base and options.download_base: - options.download_base = True - logging.info("Enabled upload of base file") - if not options.assume_yes: - vcs.CheckForUnknownFiles() - if data is None: - data = vcs.GenerateDiff(args) - data = vcs.PostProcessDiff(data) - files = vcs.GetBaseFiles(data) - if verbosity >= 1: - print "Upload server:", options.server, "(change with -s/--server)" - if options.issue: - prompt = "Message describing this patch set: " - else: - prompt = "New issue subject: " - message = options.message or raw_input(prompt).strip() - if not message: - ErrorExit("A non-empty message is required") - rpc_server = GetRpcServer(options.server, - options.email, - options.host, - options.save_cookies, - options.account_type) - form_fields = [("subject", message)] - if base: - b = urlparse.urlparse(base) - username, netloc = urllib.splituser(b.netloc) - if username: - logging.info("Removed username from base URL") - base = urlparse.urlunparse((b.scheme, netloc, b.path, b.params, - b.query, b.fragment)) - form_fields.append(("base", base)) - if options.issue: - form_fields.append(("issue", str(options.issue))) - if options.email: - form_fields.append(("user", options.email)) - if options.reviewers: - for reviewer in options.reviewers.split(','): - CheckReviewer(reviewer) - form_fields.append(("reviewers", options.reviewers)) - if options.cc: - for cc in options.cc.split(','): - CheckReviewer(cc) - form_fields.append(("cc", options.cc)) - description = options.description - if options.description_file: - if options.description: - ErrorExit("Can't specify description and description_file") - file = open(options.description_file, 'r') - description = file.read() - file.close() - if description: - form_fields.append(("description", description)) - # Send a hash of all the base file so the server can determine if a copy - # already exists in an earlier patchset. - base_hashes = "" - for file, info in files.iteritems(): - if not info[0] is None: - checksum = md5(info[0]).hexdigest() - if base_hashes: - base_hashes += "|" - base_hashes += checksum + ":" + file - form_fields.append(("base_hashes", base_hashes)) - if options.private: - if options.issue: - print "Warning: Private flag ignored when updating an existing issue." - else: - form_fields.append(("private", "1")) - # If we're uploading base files, don't send the email before the uploads, so - # that it contains the file status. - if options.send_mail and options.download_base: - form_fields.append(("send_mail", "1")) - if not options.download_base: - form_fields.append(("content_upload", "1")) - if len(data) > MAX_UPLOAD_SIZE: - print "Patch is large, so uploading file patches separately." - uploaded_diff_file = [] - form_fields.append(("separate_patches", "1")) - else: - uploaded_diff_file = [("data", "data.diff", data)] - ctype, body = EncodeMultipartFormData(form_fields, uploaded_diff_file) - response_body = rpc_server.Send("/upload", body, content_type=ctype) - patchset = None - if not options.download_base or not uploaded_diff_file: - lines = response_body.splitlines() - if len(lines) >= 2: - msg = lines[0] - patchset = lines[1].strip() - patches = [x.split(" ", 1) for x in lines[2:]] - else: - msg = response_body - else: - msg = response_body - StatusUpdate(msg) - if not response_body.startswith("Issue created.") and \ - not response_body.startswith("Issue updated."): - sys.exit(0) - issue = msg[msg.rfind("/")+1:] - - if not uploaded_diff_file: - result = UploadSeparatePatches(issue, rpc_server, patchset, data, options) - if not options.download_base: - patches = result - - if not options.download_base: - vcs.UploadBaseFiles(issue, rpc_server, patches, patchset, options, files) - if options.send_mail: - rpc_server.Send("/" + issue + "/mail", payload="") - return issue, patchset - - -def main(): - try: - logging.basicConfig(format=("%(asctime).19s %(levelname)s %(filename)s:" - "%(lineno)s %(message)s ")) - os.environ['LC_ALL'] = 'C' - RealMain(sys.argv) - except KeyboardInterrupt: - print - StatusUpdate("Interrupted.") - sys.exit(1) - - -if __name__ == "__main__": - main() - -- cgit v0.12 From d8f294851e83c691df90373ec45dad97b28000c5 Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Sat, 5 Jul 2014 12:56:20 +0300 Subject: doc: Update revised SConf description --- src/engine/SCons/SConf.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/engine/SCons/SConf.py b/src/engine/SCons/SConf.py index dd93269..d6a70ec 100644 --- a/src/engine/SCons/SConf.py +++ b/src/engine/SCons/SConf.py @@ -2,14 +2,13 @@ Autoconf-like configuration support. -In other words, this package allows to run series of tests to detect -capabilities of current system and generate config files (header files -in C/C++) that turn on system-specific options and optimizations. - -For example, it is possible to detect if optional libraries are present -on current system and generate config that makes compiler include them. -C compilers do not have ability to catch ImportError if some library is -not found, so these checks should be done externally. +In other words, SConf allows to run tests on the build machine to detect +capabilities of system and do some things based on result: generate config +files, header files for C/C++, update variables in environment. + +Tests on the build system can detect if compiler sees header files, if +libraries are installed, if some command line options are supported etc. + """ # -- cgit v0.12 From cb8f0c951de062e5fd3251246ceacdc3d259de89 Mon Sep 17 00:00:00 2001 From: Gary Oberbrunner Date: Sat, 5 Jul 2014 10:16:53 -0400 Subject: Regenerated docs for 2.3.2 release. --- doc/generated/builders.gen | 25 +- doc/generated/examples/caching_ex-random_1.xml | 4 +- doc/generated/examples/commandline_Default4_1.xml | 1 + doc/generated/examples/troubleshoot_Dump_1.xml | 3 +- doc/generated/examples/troubleshoot_Dump_2.xml | 4 +- doc/generated/examples/troubleshoot_explain1_3.xml | 2 +- .../examples/troubleshoot_stacktrace_2.xml | 6 +- doc/generated/tools.gen | 33 +- doc/generated/tools.mod | 8 +- doc/generated/variables.gen | 383 +++++++++++++++++++-- doc/generated/variables.mod | 80 +++++ 11 files changed, 493 insertions(+), 56 deletions(-) diff --git a/doc/generated/builders.gen b/doc/generated/builders.gen index 7621945..3d534b0 100644 --- a/doc/generated/builders.gen +++ b/doc/generated/builders.gen @@ -2137,11 +2137,10 @@ below, for more information. -The Substfile builder generates a single text file -by concatenating the source files. -Nested lists of sources are flattened. -$LINESEPARATOR is used to separate the source files; -see the description of Textfile for details. +The Substfile builder creates a single text file from another file or set of +files by concatenating them with $LINESEPARATOR and replacing text +using the $SUBST_DICT construction variable. Nested lists of source files +are flattened. See also Textfile. @@ -2159,20 +2158,18 @@ are automatically added to the target if they are not already present. If a construction variable named $SUBST_DICT is present, it may be either a Python dictionary or a sequence of (key,value) tuples. -If the former, -the dictionary is converted into a list of tuples in an arbitrary order, +If it is a dictionary it is converted into a list of tuples in an arbitrary order, so if one key is a prefix of another key or if one substitution could be further expanded by another subsitition, -it is unpredictible whether the expansion will occur. +it is unpredictable whether the expansion will occur. -Any occurences in the source of a key +Any occurrences of a key in the source are replaced by the corresponding value, which may be a Python callable function or a string. -If a value is a function, -it is first called (with no arguments) to produce a string. -The string is subst-expanded +If the value is a callable, it is called with no arguments to get a string. +Strings are subst-expanded and the result replaces the key. @@ -2278,7 +2275,7 @@ env.Tar('foo') The Textfile builder generates a single text file. The source strings constitute the lines; -nested lists of sources are flattened. +nested lists of sources are flattened. $LINESEPARATOR is used to separate the strings. @@ -2306,7 +2303,7 @@ env.Textfile(target = 'bar', LINESEPARATOR='|*') # nested lists are flattened automatically -env.Textfile(target = 'blob', +env.Textfile(target = 'blob', source = ['lalala', ['Goethe', 42 'Schiller'], 'tanteratei']) # files may be used as input by wraping them in File() diff --git a/doc/generated/examples/caching_ex-random_1.xml b/doc/generated/examples/caching_ex-random_1.xml index cfa55a1..2ed1a8f 100644 --- a/doc/generated/examples/caching_ex-random_1.xml +++ b/doc/generated/examples/caching_ex-random_1.xml @@ -1,9 +1,9 @@ % scons -Q +cc -o f1.o -c f1.c cc -o f2.o -c f2.c +cc -o f3.o -c f3.c cc -o f5.o -c f5.c cc -o f4.o -c f4.c -cc -o f3.o -c f3.c -cc -o f1.o -c f1.c cc -o prog f1.o f2.o f3.o f4.o f5.o diff --git a/doc/generated/examples/commandline_Default4_1.xml b/doc/generated/examples/commandline_Default4_1.xml index 61d449e..35e0b10 100644 --- a/doc/generated/examples/commandline_Default4_1.xml +++ b/doc/generated/examples/commandline_Default4_1.xml @@ -1,6 +1,7 @@ % scons -Q scons: *** No targets specified and no Default() targets found. Stop. +Found nothing to build % scons -Q . cc -o prog1.o -c prog1.c cc -o prog1 prog1.o diff --git a/doc/generated/examples/troubleshoot_Dump_1.xml b/doc/generated/examples/troubleshoot_Dump_1.xml index 5b39280..248e85c 100644 --- a/doc/generated/examples/troubleshoot_Dump_1.xml +++ b/doc/generated/examples/troubleshoot_Dump_1.xml @@ -53,7 +53,7 @@ scons: Reading SConscript files ... 'SHLIBSUFFIX': '.so', 'SHOBJPREFIX': '$OBJPREFIX', 'SHOBJSUFFIX': '$OBJSUFFIX', - 'SPAWN': <function spawnvpe_spawn at 0x700000&gt;, + 'SPAWN': <function subprocess_spawn at 0x700000&gt;, 'TARGET_ARCH': None, 'TARGET_OS': None, 'TEMPFILE': <class 'SCons.Platform.TempFileMunge'>, @@ -63,6 +63,7 @@ scons: Reading SConscript files ... '_CPPINCFLAGS': '$( ${_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)', '_LIBDIRFLAGS': '$( ${_concat(LIBDIRPREFIX, LIBPATH, LIBDIRSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)', '_LIBFLAGS': '${_concat(LIBLINKPREFIX, LIBS, LIBLINKSUFFIX, __env__)}', + '__DRPATH': '$_DRPATH', '__RPATH': '$_RPATH', '_concat': <function _concat at 0x700000&gt;, '_defines': <function _defines at 0x700000&gt;, diff --git a/doc/generated/examples/troubleshoot_Dump_2.xml b/doc/generated/examples/troubleshoot_Dump_2.xml index a6515b0..17c9de5 100644 --- a/doc/generated/examples/troubleshoot_Dump_2.xml +++ b/doc/generated/examples/troubleshoot_Dump_2.xml @@ -86,8 +86,8 @@ scons: Reading SConscript files ... 'SHOBJSUFFIX': '$OBJSUFFIX', 'SPAWN': <function spawn at 0x700000&gt;, 'STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME': 1, - 'TARGET_ARCH': '', - 'TARGET_OS': 'win32', + 'TARGET_ARCH': None, + 'TARGET_OS': None, 'TEMPFILE': <class 'SCons.Platform.TempFileMunge'>, 'TEMPFILEPREFIX': '@', 'TOOLS': ['msvc', 'install', 'install'], diff --git a/doc/generated/examples/troubleshoot_explain1_3.xml b/doc/generated/examples/troubleshoot_explain1_3.xml index 0879b11..0bdaace 100644 --- a/doc/generated/examples/troubleshoot_explain1_3.xml +++ b/doc/generated/examples/troubleshoot_explain1_3.xml @@ -1,7 +1,7 @@ % scons -Q --warn=target-not-built -scons: building `file.out' because it doesn't exist cp file.in file.oout scons: warning: Cannot find target file.out after building +File "/home/garyo/src/scons-scons/bootstrap/src/script/scons.py", line 199, in <module> diff --git a/doc/generated/examples/troubleshoot_stacktrace_2.xml b/doc/generated/examples/troubleshoot_stacktrace_2.xml index 6286d45..1ab65ee 100644 --- a/doc/generated/examples/troubleshoot_stacktrace_2.xml +++ b/doc/generated/examples/troubleshoot_stacktrace_2.xml @@ -4,10 +4,10 @@ scons: *** [prog.o] Source `prog.c' not found, needed by target `prog.o'. scons: internal stack trace: File "bootstrap/src/engine/SCons/Job.py", line 199, in start task.prepare() - File "bootstrap/src/engine/SCons/Script/Main.py", line 168, in prepare + File "bootstrap/src/engine/SCons/Script/Main.py", line 173, in prepare return SCons.Taskmaster.OutOfDateTask.prepare(self) - File "bootstrap/src/engine/SCons/Taskmaster.py", line 189, in prepare + File "bootstrap/src/engine/SCons/Taskmaster.py", line 191, in prepare executor.prepare() - File "bootstrap/src/engine/SCons/Executor.py", line 392, in prepare + File "bootstrap/src/engine/SCons/Executor.py", line 396, in prepare raise SCons.Errors.StopError(msg % (s, self.batches[0].targets[0])) diff --git a/doc/generated/tools.gen b/doc/generated/tools.gen index 02349b8..5e4c8bd 100644 --- a/doc/generated/tools.gen +++ b/doc/generated/tools.gen @@ -142,10 +142,9 @@ for the platform on which SCons is running. dmd -Sets construction variables for D language compilers -(the Digital Mars D compiler, or GDC). +Sets construction variables for D language compiler DMD. - +Sets: &cv-link-DC;, &cv-link-DCOM;, &cv-link-DDEBUG;, &cv-link-DDEBUGPREFIX;, &cv-link-DDEBUGSUFFIX;, &cv-link-DFILESUFFIX;, &cv-link-DFLAGPREFIX;, &cv-link-DFLAGS;, &cv-link-DFLAGSUFFIX;, &cv-link-DINCPREFIX;, &cv-link-DINCSUFFIX;, &cv-link-DLIB;, &cv-link-DLIBCOM;, &cv-link-DLIBDIRPREFIX;, &cv-link-DLIBDIRSUFFIX;, &cv-link-DLIBFLAGPREFIX;, &cv-link-DLIBFLAGSUFFIX;, &cv-link-DLIBLINKPREFIX;, &cv-link-DLIBLINKSUFFIX;, &cv-link-DLINK;, &cv-link-DLINKCOM;, &cv-link-DLINKFLAGS;, &cv-link-DPATH;, &cv-link-DVERPREFIX;, &cv-link-DVERSIONS;, &cv-link-DVERSUFFIX;, &cv-link-RPATHPREFIX;, &cv-link-RPATHSUFFIX;, &cv-link-SHDC;, &cv-link-SHDCOM;, &cv-link-SHDLINK;, &cv-link-SHDLINKCOM;, &cv-link-SHDLINKFLAGS;, &cv-link-STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME;, &cv-link-_DDEBUGFLAGS;, &cv-link-_DFLAGS;, &cv-link-_DINCFLAGS;, &cv-link-_DLIBDIRFLAGS;, &cv-link-_DLIBFLAGS;, &cv-link-_DLIBFLAGS;, &cv-link-_DVERFLAGS;, &cv-link-_RPATH;. docbook @@ -375,6 +374,14 @@ Set construction variables for the + gdc + + +Sets construction variables for the D language compiler GDC. + +Sets: &cv-link-DC;, &cv-link-DCOM;, &cv-link-DDEBUG;, &cv-link-DDEBUGPREFIX;, &cv-link-DDEBUGSUFFIX;, &cv-link-DFILESUFFIX;, &cv-link-DFLAGPREFIX;, &cv-link-DFLAGS;, &cv-link-DFLAGSUFFIX;, &cv-link-DINCPREFIX;, &cv-link-DINCSUFFIX;, &cv-link-DLIB;, &cv-link-DLIBCOM;, &cv-link-DLIBFLAGPREFIX;, &cv-link-DLIBFLAGSUFFIX;, &cv-link-DLINK;, &cv-link-DLINKCOM;, &cv-link-DLINKFLAGPREFIX;, &cv-link-DLINKFLAGS;, &cv-link-DLINKFLAGSUFFIX;, &cv-link-DPATH;, &cv-link-DVERPREFIX;, &cv-link-DVERSIONS;, &cv-link-DVERSUFFIX;, &cv-link-RPATHPREFIX;, &cv-link-RPATHSUFFIX;, &cv-link-SHDC;, &cv-link-SHDCOM;, &cv-link-SHDLINK;, &cv-link-SHDLINKCOM;, &cv-link-SHDLINKFLAGS;, &cv-link-STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME;, &cv-link-_DDEBUGFLAGS;, &cv-link-_DFLAGS;, &cv-link-_DINCFLAGS;, &cv-link-_DLIBFLAGS;, &cv-link-_DVERFLAGS;, &cv-link-_RPATH;. + gettext @@ -586,6 +593,14 @@ Sets construction variables for the + ldc + + +Sets construction variables for the D language compiler LDC2. + +Sets: &cv-link-DC;, &cv-link-DCOM;, &cv-link-DDEBUG;, &cv-link-DDEBUGPREFIX;, &cv-link-DDEBUGSUFFIX;, &cv-link-DFILESUFFIX;, &cv-link-DFLAGPREFIX;, &cv-link-DFLAGS;, &cv-link-DFLAGSUFFIX;, &cv-link-DINCPREFIX;, &cv-link-DINCSUFFIX;, &cv-link-DLIB;, &cv-link-DLIBCOM;, &cv-link-DLIBDIRPREFIX;, &cv-link-DLIBDIRSUFFIX;, &cv-link-DLIBFLAGPREFIX;, &cv-link-DLIBFLAGSUFFIX;, &cv-link-DLIBLINKPREFIX;, &cv-link-DLIBLINKSUFFIX;, &cv-link-DLINK;, &cv-link-DLINKCOM;, &cv-link-DLINKFLAGPREFIX;, &cv-link-DLINKFLAGS;, &cv-link-DLINKFLAGSUFFIX;, &cv-link-DPATH;, &cv-link-DVERPREFIX;, &cv-link-DVERSIONS;, &cv-link-DVERSUFFIX;, &cv-link-RPATHPREFIX;, &cv-link-RPATHSUFFIX;, &cv-link-SHDC;, &cv-link-SHDCOM;, &cv-link-SHDLINK;, &cv-link-SHDLINKCOM;, &cv-link-SHDLINKFLAGS;, &cv-link-STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME;, &cv-link-_DDEBUGFLAGS;, &cv-link-_DFLAGS;, &cv-link-_DINCFLAGS;, &cv-link-_DLIBDIRFLAGS;, &cv-link-_DLIBFLAGS;, &cv-link-_DLIBFLAGS;, &cv-link-_DVERFLAGS;, &cv-link-_RPATH;. + lex @@ -752,19 +767,19 @@ Sets construction variables for the Sets: &cv-link-AS;, &cv-link-ASCOM;, &cv-link-ASFLAGS;, &cv-link-ASPPCOM;, &cv-link-ASPPFLAGS;.Uses: &cv-link-ASCOMSTR;, &cv-link-ASPPCOMSTR;. - - packaging + + Packaging -A framework for building binary and source packages. +Sets construction variables for the Package Builder. - - Packaging + + packaging -Sets construction variables for the Package Builder. +A framework for building binary and source packages. diff --git a/doc/generated/tools.mod b/doc/generated/tools.mod index 0a746b0..13072bf 100644 --- a/doc/generated/tools.mod +++ b/doc/generated/tools.mod @@ -37,6 +37,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. g77"> gas"> gcc"> +gdc"> gettext"> gfortran"> gnulink"> @@ -56,6 +57,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. javac"> javah"> latex"> +ldc"> lex"> link"> linkloc"> @@ -74,8 +76,8 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. mwcc"> mwld"> nasm"> -packaging"> Packaging"> +packaging"> pdf"> pdflatex"> pdftex"> @@ -144,6 +146,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. g77"> gas"> gcc"> +gdc"> gettext"> gfortran"> gnulink"> @@ -163,6 +166,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. javac"> javah"> latex"> +ldc"> lex"> link"> linkloc"> @@ -181,8 +185,8 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. mwcc"> mwld"> nasm"> -packaging"> Packaging"> +packaging"> pdf"> pdflatex"> pdftex"> diff --git a/doc/generated/variables.gen b/doc/generated/variables.gen index 832c4a3..34b9017 100644 --- a/doc/generated/variables.gen +++ b/doc/generated/variables.gen @@ -863,6 +863,54 @@ depending on the specific C++ compiler being used. + + DC + + +DC. + + + + + DCOM + + +DCOM. + + + + + DDEBUG + + +DDEBUG. + + + + + _DDEBUGFLAGS + + +_DDEBUGFLAGS. + + + + + DDEBUGPREFIX + + +DDEBUGPREFIX. + + + + + DDEBUGSUFFIX + + +DDEBUGSUFFIX. + + + DESCRIPTION @@ -886,6 +934,70 @@ section of an RPM + + DFILESUFFIX + + +DFILESUFFIX. + + + + + DFLAGPREFIX + + +DFLAGPREFIX. + + + + + _DFLAGS + + +_DFLAGS. + + + + + DFLAGS + + +DFLAGS. + + + + + DFLAGSUFFIX + + +DFLAGSUFFIX. + + + + + _DINCFLAGS + + +_DINCFLAGS. + + + + + DINCPREFIX + + +DINCPREFIX. + + + + + DINCSUFFIX + + +DINCSUFFIX. + + + Dir @@ -909,6 +1021,126 @@ into a list of Dir instances relative to the target being built. + + DLIB + + +DLIB. + + + + + DLIBCOM + + +DLIBCOM. + + + + + _DLIBDIRFLAGS + + +_DLIBDIRFLAGS. + + + + + DLIBDIRPREFIX + + +DLIBDIRPREFIX. + + + + + DLIBDIRSUFFIX + + +DLIBDIRSUFFIX. + + + + + DLIBFLAGPREFIX + + +DLIBFLAGPREFIX. + + + + + _DLIBFLAGS + + +_DLIBFLAGS. + + + + + DLIBFLAGSUFFIX + + +DLIBFLAGSUFFIX. + + + + + DLIBLINKPREFIX + + +DLIBLINKPREFIX. + + + + + DLIBLINKSUFFIX + + +DLIBLINKSUFFIX. + + + + + DLINK + + +DLINK. + + + + + DLINKCOM + + +DLINKCOM. + + + + + DLINKFLAGPREFIX + + +DLINKFLAGPREFIX. + + + + + DLINKFLAGS + + +DLINKFLAGS. + + + + + DLINKFLAGSUFFIX + + +DLINKFLAGSUFFIX. + + + DOCBOOK_DEFAULT_XSL_EPUB @@ -1106,6 +1338,14 @@ for saxon and saxon-xslt, respectively. + + DPATH + + +DPATH. + + + DSUFFIXES @@ -1120,6 +1360,38 @@ The default list is: + + _DVERFLAGS + + +_DVERFLAGS. + + + + + DVERPREFIX + + +DVERPREFIX. + + + + + DVERSIONS + + +DVERSIONS. + + + + + DVERSUFFIX + + +DVERSUFFIX. + + + DVIPDF @@ -2370,6 +2642,15 @@ is -dNOPAUSE -dBATCH -sDEVICE=pdfwrite HOST_ARCH + The name of the host hardware architecture used to create the Environment. + If a platform is specified when creating the Environment, then + that Platform's logic will handle setting this value. + This value is immutable, and should not be changed by the user after + the Environment is initialized. + Currently only set for Win32. + + + Sets the host architecture for Visual Studio compiler. If not set, default to the detected host architecture: note that this may depend on the python you are using. @@ -2385,16 +2666,7 @@ Valid values are the same as for This is currently only used on Windows, but in the future it will be used on other OSes as well. - - - The name of the host hardware architecture used to create the Environment. - If a platform is specified when creating the Environment, then - that Platform's logic will handle setting this value. - This value is immutable, and should not be changed by the user after - the Environment is initialized. - Currently only set for Win32. - - + HOST_OS @@ -2590,7 +2862,7 @@ The command line used to call the Java archive tool. The string displayed when the Java archive tool is called -If this is not set, then $JARCOM (the command line) is displayed. +If this is not set, then $JARCOM (the command line) is displayed. @@ -2600,7 +2872,7 @@ env = Environment(JARCOMSTR = "JARchiving $SOURCES into $TARGET") The string displayed when the Java archive tool is called -If this is not set, then $JARCOM (the command line) is displayed. +If this is not set, then $JARCOM (the command line) is displayed. @@ -3680,9 +3952,28 @@ If $MSVC_VERSION is not s latest version of Visual C/C++ installed on your system. If the specified version isn't installed, tool initialization will fail. This variable must be passed as an argument to the Environment() -constructor; setting it later has no effect. Set it to an unexpected -value (e.g. "XXX") to see the valid values on your system. +constructor; setting it later has no effect. + + + +Valid values for Windows are +12.0, +12.0Exp, +11.0, +11.0Exp, +10.0, +10.0Exp, +9.0, +9.0Exp, +8.0, +8.0Exp, +7.1, +7.0, +and 6.0. +Versions ending in Exp refer to "Express" or +"Express for Desktop" editions. + @@ -5489,6 +5780,46 @@ to generate shared-library objects. + + SHDC + + +SHDC. + + + + + SHDCOM + + +SHDCOM. + + + + + SHDLINK + + +SHDLINK. + + + + + SHDLINKCOM + + +SHDLINKCOM. + + + + + SHDLINKFLAGS + + +SHDLINKFLAGS. + + + SHELL @@ -6061,6 +6392,14 @@ in which the command should be executed. + + STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME + + + When this variable is true, static objects and shared objects are assumed to be the same; that is, SCons does not check for linking static objects into a shared library. + + + SUBST_DICT @@ -6374,6 +6713,13 @@ that may not be set or used in a construction environment. TARGET_ARCH + The name of the target hardware architecture for the compiled objects + created by this Environment. + This defaults to the value of HOST_ARCH, and the user can override it. + Currently only set for Win32. + + + Sets the target architecture for Visual Studio compiler (i.e. the arch of the binaries generated by the compiler). If not set, default to $HOST_ARCH, or, if that is unset, to the architecture of the @@ -6398,14 +6744,7 @@ and ia64 (Itanium). For example, if you want to compile 64-bit binaries, you would set TARGET_ARCH='x86_64' in your SCons environment. - - - The name of the target hardware architecture for the compiled objects - created by this Environment. - This defaults to the value of HOST_ARCH, and the user can override it. - Currently only set for Win32. - - + TARGET_OS diff --git a/doc/generated/variables.mod b/doc/generated/variables.mod index b55b218..473c8a2 100644 --- a/doc/generated/variables.mod +++ b/doc/generated/variables.mod @@ -66,10 +66,39 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. $CXXFILESUFFIX"> $CXXFLAGS"> $CXXVERSION"> +$DC"> +$DCOM"> +$DDEBUG"> +$_DDEBUGFLAGS"> +$DDEBUGPREFIX"> +$DDEBUGSUFFIX"> $DESCRIPTION"> $DESCRIPTION_lang"> +$DFILESUFFIX"> +$DFLAGPREFIX"> +$_DFLAGS"> +$DFLAGS"> +$DFLAGSUFFIX"> +$_DINCFLAGS"> +$DINCPREFIX"> +$DINCSUFFIX"> $Dir"> $Dirs"> +$DLIB"> +$DLIBCOM"> +$_DLIBDIRFLAGS"> +$DLIBDIRPREFIX"> +$DLIBDIRSUFFIX"> +$DLIBFLAGPREFIX"> +$_DLIBFLAGS"> +$DLIBFLAGSUFFIX"> +$DLIBLINKPREFIX"> +$DLIBLINKSUFFIX"> +$DLINK"> +$DLINKCOM"> +$DLINKFLAGPREFIX"> +$DLINKFLAGS"> +$DLINKFLAGSUFFIX"> $DOCBOOK_DEFAULT_XSL_EPUB"> $DOCBOOK_DEFAULT_XSL_HTML"> $DOCBOOK_DEFAULT_XSL_HTMLCHUNKED"> @@ -91,7 +120,12 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. $DOCBOOK_XSLTPROCCOMSTR"> $DOCBOOK_XSLTPROCFLAGS"> $DOCBOOK_XSLTPROCPARAMS"> +$DPATH"> $DSUFFIXES"> +$_DVERFLAGS"> +$DVERPREFIX"> +$DVERSIONS"> +$DVERSUFFIX"> $DVIPDF"> $DVIPDFCOM"> $DVIPDFCOMSTR"> @@ -418,6 +452,11 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. $SHCXXCOM"> $SHCXXCOMSTR"> $SHCXXFLAGS"> +$SHDC"> +$SHDCOM"> +$SHDLINK"> +$SHDLINKCOM"> +$SHDLINKFLAGS"> $SHELL"> $SHF03"> $SHF03COM"> @@ -463,6 +502,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. $SOURCE_URL"> $SOURCES"> $SPAWN"> +$STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME"> $SUBST_DICT"> $SUBSTFILEPREFIX"> $SUBSTFILESUFFIX"> @@ -648,10 +688,39 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. $CXXFILESUFFIX"> $CXXFLAGS"> $CXXVERSION"> +$DC"> +$DCOM"> +$DDEBUG"> +$_DDEBUGFLAGS"> +$DDEBUGPREFIX"> +$DDEBUGSUFFIX"> $DESCRIPTION"> $DESCRIPTION_lang"> +$DFILESUFFIX"> +$DFLAGPREFIX"> +$_DFLAGS"> +$DFLAGS"> +$DFLAGSUFFIX"> +$_DINCFLAGS"> +$DINCPREFIX"> +$DINCSUFFIX"> $Dir"> $Dirs"> +$DLIB"> +$DLIBCOM"> +$_DLIBDIRFLAGS"> +$DLIBDIRPREFIX"> +$DLIBDIRSUFFIX"> +$DLIBFLAGPREFIX"> +$_DLIBFLAGS"> +$DLIBFLAGSUFFIX"> +$DLIBLINKPREFIX"> +$DLIBLINKSUFFIX"> +$DLINK"> +$DLINKCOM"> +$DLINKFLAGPREFIX"> +$DLINKFLAGS"> +$DLINKFLAGSUFFIX"> $DOCBOOK_DEFAULT_XSL_EPUB"> $DOCBOOK_DEFAULT_XSL_HTML"> $DOCBOOK_DEFAULT_XSL_HTMLCHUNKED"> @@ -673,7 +742,12 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. $DOCBOOK_XSLTPROCCOMSTR"> $DOCBOOK_XSLTPROCFLAGS"> $DOCBOOK_XSLTPROCPARAMS"> +$DPATH"> $DSUFFIXES"> +$_DVERFLAGS"> +$DVERPREFIX"> +$DVERSIONS"> +$DVERSUFFIX"> $DVIPDF"> $DVIPDFCOM"> $DVIPDFCOMSTR"> @@ -1000,6 +1074,11 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. $SHCXXCOM"> $SHCXXCOMSTR"> $SHCXXFLAGS"> +$SHDC"> +$SHDCOM"> +$SHDLINK"> +$SHDLINKCOM"> +$SHDLINKFLAGS"> $SHELL"> $SHF03"> $SHF03COM"> @@ -1045,6 +1124,7 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. $SOURCE_URL"> $SOURCES"> $SPAWN"> +$STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME"> $SUBST_DICT"> $SUBSTFILEPREFIX"> $SUBSTFILESUFFIX"> -- cgit v0.12 From 6ddc06eafa74e448a870dbb65461405709bef1ba Mon Sep 17 00:00:00 2001 From: William Blevins Date: Sat, 12 Jul 2014 13:14:28 -0400 Subject: Added a high-level test for issue 1771/2931. Shows that Java emitter for derived-sources is broken regardless of the source generation method. --- test/Java/DerivedSourceTest.py | 97 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 test/Java/DerivedSourceTest.py diff --git a/test/Java/DerivedSourceTest.py b/test/Java/DerivedSourceTest.py new file mode 100644 index 0000000..b700e1e --- /dev/null +++ b/test/Java/DerivedSourceTest.py @@ -0,0 +1,97 @@ +#!/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 of javac.py when building java code from derived sources. + +Original issue definition: +Java emitter for derived sources outputs bogus class files. + +Repeatable with any N-tier, with N > 1, Java derived-source builds where +any of the following conditions are meet: +1. The java class does not belong to the root package. +2. A java source (*.java) creates N targets (*.class) where N > 1. + +@author William Blevins +@version 2 March 2014 +""" + +import os +import TestSCons +import SCons.Node.FS + +test = TestSCons.TestSCons() + +test.write( + ['Sample.java'], +""" +// Condition 1: class does not exist in the root package. +package org.sample; + +public class Sample { + // Condition 2: inner class definition causes javac to create + // a second class file. + enum InnerEnum { + stuff, + and, + things + } +} +""" +) + +test.write( + ['SConstruct'], +""" +import os + +env = Environment( + tools = [ + 'javac', + 'jar', + ] +) + +env.Command( + os.path.join( 'org', 'sample', 'Sample.java' ), + 'Sample.java', + Copy( + '$TARGET', + '$SOURCE' + ) +) + +# Copy operation makes the *.java file(s) under org derived-source. +env.Java( + 'build', + 'org' +) +""" +) + +test.run( arguments = '.' ) + +test.up_to_date(arguments = '.') -- cgit v0.12 From 3030945eeb2121acbccab9db8fdf72926bf90510 Mon Sep 17 00:00:00 2001 From: William Blevins Date: Sun, 13 Jul 2014 13:23:51 -0400 Subject: Set default toolchain. Other updates per code review. --- test/Java/DerivedSourceTest.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/Java/DerivedSourceTest.py b/test/Java/DerivedSourceTest.py index b700e1e..7478a1e 100644 --- a/test/Java/DerivedSourceTest.py +++ b/test/Java/DerivedSourceTest.py @@ -34,14 +34,14 @@ Repeatable with any N-tier, with N > 1, Java derived-source builds where any of the following conditions are meet: 1. The java class does not belong to the root package. 2. A java source (*.java) creates N targets (*.class) where N > 1. - -@author William Blevins -@version 2 March 2014 """ import os import TestSCons import SCons.Node.FS +import SCons.Defaults + +SCons.Defaults.DefaultEnvironment(tools = []) test = TestSCons.TestSCons() -- cgit v0.12 From 5e3450b0552434281ba82e68ddd150f5d86e85d5 Mon Sep 17 00:00:00 2001 From: William Blevins Date: Sun, 13 Jul 2014 21:45:07 -0400 Subject: Issue 2395: Copy Symlink soft-copy enhancement. --- src/engine/SCons/Defaults.py | 20 ++++-- test/Copy-Symlinks.py | 149 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 164 insertions(+), 5 deletions(-) create mode 100644 test/Copy-Symlinks.py diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py index 563e5a8..b91a685 100644 --- a/src/engine/SCons/Defaults.py +++ b/src/engine/SCons/Defaults.py @@ -181,20 +181,30 @@ def chmod_strfunc(dest, mode): Chmod = ActionFactory(chmod_func, chmod_strfunc) -def copy_func(dest, src): +def copy_func(dest, src, symlinks=True): + dest = str(dest) + src = str(src) + SCons.Node.FS.invalidate_node_memos(dest) if SCons.Util.is_List(src) and os.path.isdir(dest): for file in src: shutil.copy2(file, dest) return 0 + elif os.path.islink(src): + linkto = os.readlink(src) + if symlinks: + return os.symlink(linkto, dest) + else: + return copy_func(dest, linkto, symlinks) elif os.path.isfile(src): return shutil.copy2(src, dest) else: - return shutil.copytree(src, dest, 1) + return shutil.copytree(src, dest, symlinks) -Copy = ActionFactory(copy_func, - lambda dest, src: 'Copy("%s", "%s")' % (dest, src), - convert=str) +Copy = ActionFactory( + copy_func, + lambda dest, src, symlinks=True: 'Copy("%s", "%s")' % (dest, src) +) def delete_func(dest, must_exist=0): SCons.Node.FS.invalidate_node_memos(dest) diff --git a/test/Copy-Symlinks.py b/test/Copy-Symlinks.py new file mode 100644 index 0000000..b2455c4 --- /dev/null +++ b/test/Copy-Symlinks.py @@ -0,0 +1,149 @@ +#!/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__" + +""" +Verify that the Copy() Action symlink soft-copy support works. +""" + +import os +import stat +import sys +import TestSCons + +import SCons.Defaults +SCons.Defaults.DefaultEnvironment( tools = [] ) + +test = TestSCons.TestSCons() + +filelinkToCopy = 'filelinkToCopy' +fileToLink = 'file.in' +fileContents = 'stuff n things\n' +dirToLink = 'dir' +dirlinkToCopy = 'dirlinkToCopy' +treeToLink = 'tree' +treelinkToCopy = 'treelinkToCopy' + +try: + test.symlink( fileToLink, filelinkToCopy ) + test.symlink( dirToLink, dirlinkToCopy ) + test.symlink( treeToLink, treelinkToCopy ) +except: + test.no_result() + +test.write( fileToLink, fileContents ) +test.subdir( treeToLink ) +test.write( os.path.join( treeToLink, fileToLink ), fileContents ) + +test.write('SConstruct', +"""\ +import SCons.Defaults +SCons.Defaults.DefaultEnvironment( tools = [] ) + +Execute( Copy( 'F1', '%(filelinkToCopy)s', False ) ) +Execute( Copy( 'L1', '%(filelinkToCopy)s' ) ) +Execute( Copy( 'L2', '%(filelinkToCopy)s', True ) ) + +Execute( Mkdir( '%(dirToLink)s' ) ) +Execute( Copy( 'D1', '%(dirlinkToCopy)s', False ) ) +Execute( Copy( 'L3', '%(dirlinkToCopy)s' ) ) +Execute( Copy( 'L4', '%(dirlinkToCopy)s', True ) ) + +Execute( Copy( 'T1', '%(treelinkToCopy)s', False ) ) +Execute( Copy( 'L5', '%(treelinkToCopy)s' ) ) +Execute( Copy( 'L6', '%(treelinkToCopy)s', True ) ) +""" +% locals() +) + +test.must_exist( 'SConstruct' ) +test.must_exist( fileToLink ) +test.must_exist( filelinkToCopy ) +test.must_exist( dirlinkToCopy ) +test.must_exist( treelinkToCopy ) + +expect = test.wrap_stdout( +read_str = +'''\ +Copy("F1", "%(filelinkToCopy)s") +Copy("L1", "%(filelinkToCopy)s") +Copy("L2", "%(filelinkToCopy)s") +Mkdir("%(dirToLink)s") +Copy("D1", "%(dirlinkToCopy)s") +Copy("L3", "%(dirlinkToCopy)s") +Copy("L4", "%(dirlinkToCopy)s") +Copy("T1", "%(treelinkToCopy)s") +Copy("L5", "%(treelinkToCopy)s") +Copy("L6", "%(treelinkToCopy)s") +''' % locals(), +build_str = +'''\ +scons: `.' is up to date. +''' +) + +test.run( stdout = expect ) + +test.must_exist('D1') +test.must_exist('F1') +test.must_exist('L2') +test.must_exist('L3') +test.must_exist('L4') +test.must_exist('L5') +test.must_exist('L6') +test.must_exist('T1') + +test.must_match( fileToLink, fileContents ) +test.must_match( 'F1', fileContents ) +test.must_match( 'L1', fileContents ) +test.must_match( 'L2', fileContents ) +test.must_match( os.path.join( treeToLink, fileToLink ), fileContents ) + +test.fail_test( condition=os.path.islink('D1') ) +test.fail_test( condition=os.path.islink('F1') ) +test.fail_test( condition=os.path.islink('T1') ) +test.fail_test( condition=(not os.path.isdir('D1')) ) +test.fail_test( condition=(not os.path.isfile('F1')) ) +test.fail_test( condition=(not os.path.isdir('T1')) ) +test.fail_test( condition=(not os.path.islink('L1')) ) +test.fail_test( condition=(not os.path.islink('L2')) ) +test.fail_test( condition=(not os.path.islink('L3')) ) +test.fail_test( condition=(not os.path.islink('L4')) ) +test.fail_test( condition=(not os.path.islink('L5')) ) +test.fail_test( condition=(not os.path.islink('L6')) ) +test.fail_test( condition=(os.readlink(filelinkToCopy) != os.readlink('L1')) ) +test.fail_test( condition=(os.readlink(filelinkToCopy) != os.readlink('L2')) ) +test.fail_test( condition=(os.readlink(dirlinkToCopy) != os.readlink('L3')) ) +test.fail_test( condition=(os.readlink(dirlinkToCopy) != os.readlink('L4')) ) +test.fail_test( condition=(os.readlink(treelinkToCopy) != os.readlink('L5')) ) +test.fail_test( condition=(os.readlink(treelinkToCopy) != os.readlink('L6')) ) + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: -- cgit v0.12 From 2f2f54f3e743e6b81b768f392ea1f25fadf5fda9 Mon Sep 17 00:00:00 2001 From: Dirk Baechle Date: Tue, 15 Jul 2014 18:58:06 +0200 Subject: - fix for issue #2963, "Split broken" (= format() in D tools is incompatible with Python 2.6) --- src/engine/SCons/Tool/dmd.py | 2 +- src/engine/SCons/Tool/gdc.py | 2 +- src/engine/SCons/Tool/ldc.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/engine/SCons/Tool/dmd.py b/src/engine/SCons/Tool/dmd.py index f1afc79..5989d77 100644 --- a/src/engine/SCons/Tool/dmd.py +++ b/src/engine/SCons/Tool/dmd.py @@ -128,7 +128,7 @@ def generate(env): env['DLIB'] = 'lib' if env['PLATFORM'] == 'win32' else 'ar cr' - env['DLIBCOM'] = '$DLIB $_DLIBFLAGS {} $TARGET $SOURCES $_DLIBFLAGS'.format('-c' if env['PLATFORM'] == 'win32' else '') + env['DLIBCOM'] = '$DLIB $_DLIBFLAGS {0}$TARGET $SOURCES $_DLIBFLAGS'.format('-c ' if env['PLATFORM'] == 'win32' else '') #env['_DLIBFLAGS'] = '$( ${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)} $)' diff --git a/src/engine/SCons/Tool/gdc.py b/src/engine/SCons/Tool/gdc.py index 7c8649b..239278b 100644 --- a/src/engine/SCons/Tool/gdc.py +++ b/src/engine/SCons/Tool/gdc.py @@ -102,7 +102,7 @@ def generate(env): env['SHDLINKCOM'] = '$DLINK -o $TARGET $DLINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS' env['DLIB'] = 'lib' if env['PLATFORM'] == 'win32' else 'ar cr' - env['DLIBCOM'] = '$DLIB $_DLIBFLAGS {} $TARGET $SOURCES $_DLINKLIBFLAGS'.format('-c' if env['PLATFORM'] == 'win32' else '') + env['DLIBCOM'] = '$DLIB $_DLIBFLAGS {0}$TARGET $SOURCES $_DLINKLIBFLAGS'.format('-c ' if env['PLATFORM'] == 'win32' else '') env['_DLIBFLAGS'] = '$( ${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)} $)' diff --git a/src/engine/SCons/Tool/ldc.py b/src/engine/SCons/Tool/ldc.py index ca873b5..c855586 100644 --- a/src/engine/SCons/Tool/ldc.py +++ b/src/engine/SCons/Tool/ldc.py @@ -117,7 +117,7 @@ def generate(env): env['DLIB'] = 'lib' if env['PLATFORM'] == 'win32' else 'ar cr' - env['DLIBCOM'] = '$DLIB $_DLIBFLAGS {} $TARGET $SOURCES $_DLIBFLAGS'.format('-c' if env['PLATFORM'] == 'win32' else '') + env['DLIBCOM'] = '$DLIB $_DLIBFLAGS {0}$TARGET $SOURCES $_DLIBFLAGS'.format('-c ' if env['PLATFORM'] == 'win32' else '') #env['_DLIBFLAGS'] = '$( ${_concat(DLIBFLAGPREFIX, DLIBFLAGS, DLIBFLAGSUFFIX, __env__)} $)' -- cgit v0.12 From 318ee47c833cfc53af622608b96dfaa79a9349b5 Mon Sep 17 00:00:00 2001 From: Gary Oberbrunner Date: Tue, 15 Jul 2014 19:53:54 -0400 Subject: Put Announce.txt and CHANGES.txt back into develop mode, post 2.3.2 --- src/Announce.txt | 2 +- src/CHANGES.txt | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Announce.txt b/src/Announce.txt index 38e517f..83fe421 100644 --- a/src/Announce.txt +++ b/src/Announce.txt @@ -19,7 +19,7 @@ effectively, please go to http://scons.org/lists.php#users to sign up for the scons-users mailing list. -RELEASE 2.3.2 +RELEASE 2.3.2.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE Please consult the RELEASE.txt file for a summary of changes since the last release and consult the CHANGES.txt file for complete a list of changes diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 4821e40..f20fd32 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -6,6 +6,9 @@ RELEASE 2.3.2.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE + +RELEASE 2.3.2 + From veon on bitbucket: - Fixed handling of nested ifs in CPP scanner PreProcessor class. -- cgit v0.12 From 01e5931750f54b3ed0e7d18e05f868d81c8ebed6 Mon Sep 17 00:00:00 2001 From: William Blevins Date: Tue, 15 Jul 2014 22:02:56 -0400 Subject: Updated DerivedSourceTest.py to test against a dependency tree. This was a best guess for the output. --- test/Java/DerivedSourceTest.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/test/Java/DerivedSourceTest.py b/test/Java/DerivedSourceTest.py index 7478a1e..5cf4af7 100644 --- a/test/Java/DerivedSourceTest.py +++ b/test/Java/DerivedSourceTest.py @@ -92,6 +92,25 @@ env.Java( """ ) -test.run( arguments = '.' ) +expected = test.wrap_stdout( +build_str = +'''\ +Copy("org/sample/Sample.java", "Sample.java") +javac -d build -sourcepath org/sample org/sample/Sample.java ++-. + +-build + | +-build/org + | +-build/org/sample + | +-build/org/sample/Sample$InnerEnum.class + | +-org/sample/Sample.java + | +-build/org/sample/Sample.class + | +-org/sample/Sample.java + +-org + +-org/sample + +-org/sample/Sample.java +'''.replace( '/', os.sep ) +) + +test.run( arguments = '--tree=derived', stdout = expected ) test.up_to_date(arguments = '.') -- cgit v0.12 From 40b656483bc892ef47ff4751aef1e43c4449042d Mon Sep 17 00:00:00 2001 From: William Blevins Date: Tue, 15 Jul 2014 22:21:03 -0400 Subject: Added Issue 1771 test to CHANGES.TXT --- src/CHANGES.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index f20fd32..8ff593d 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -6,6 +6,8 @@ RELEASE 2.3.2.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE + From William Blevins: + - Added test for Java derived-source dependency tree generation. RELEASE 2.3.2 -- cgit v0.12 From 5298a7b408e87b9fbfb0a4c5193b36698913a47c Mon Sep 17 00:00:00 2001 From: William Blevins Date: Tue, 15 Jul 2014 23:22:15 -0400 Subject: Added Issue 2395 information to CHANGES.txt --- src/CHANGES.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index f20fd32..6145e63 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -6,6 +6,8 @@ RELEASE 2.3.2.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE + From William Blevins: + - Added Copy Action symlink soft-copy support (#2395). RELEASE 2.3.2 -- cgit v0.12 From c8baceb1525e31f4411249908a8e5c916f2f8a13 Mon Sep 17 00:00:00 2001 From: William Blevins Date: Fri, 18 Jul 2014 01:33:06 -0400 Subject: Issue 1771/2931: Added no_result check for tools to validate initial test conditions. --- test/Java/DerivedSourceTest.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/Java/DerivedSourceTest.py b/test/Java/DerivedSourceTest.py index 5cf4af7..f5ba95c 100644 --- a/test/Java/DerivedSourceTest.py +++ b/test/Java/DerivedSourceTest.py @@ -45,6 +45,10 @@ SCons.Defaults.DefaultEnvironment(tools = []) test = TestSCons.TestSCons() +# No result if tools not available +test.no_result( condition=(test.where_is( 'javac' ) is None) ) +test.no_result( condition=(test.where_is( 'jar' ) is None) ) + test.write( ['Sample.java'], """ -- cgit v0.12 From 84a2d823537b9257b7e4b4a5daacb8fc0b962d16 Mon Sep 17 00:00:00 2001 From: William Blevins Date: Sat, 19 Jul 2014 21:19:44 -0400 Subject: Issue 2395: Added doc comment for symlink parameter usage. --- src/engine/SCons/Defaults.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py index b91a685..3f60bc0 100644 --- a/src/engine/SCons/Defaults.py +++ b/src/engine/SCons/Defaults.py @@ -182,6 +182,13 @@ def chmod_strfunc(dest, mode): Chmod = ActionFactory(chmod_func, chmod_strfunc) def copy_func(dest, src, symlinks=True): + """ + If symlinks (is true), then a symbolic link will be + shallow copied and recreated as a symbolic link; otherwise, copying + a symbolic link will be equivalent to copying the symbolic link's + final target regardless of symbolic link depth. + """ + dest = str(dest) src = str(src) -- cgit v0.12 From 78dde7017bdd278f24ea885514fbbf0e6c600711 Mon Sep 17 00:00:00 2001 From: William Blevins Date: Sun, 20 Jul 2014 13:01:59 -0400 Subject: Issue 2395: Added tests from copying broken symlinks. --- test/Copy-Symlinks.py | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/test/Copy-Symlinks.py b/test/Copy-Symlinks.py index b2455c4..f8f92d7 100644 --- a/test/Copy-Symlinks.py +++ b/test/Copy-Symlinks.py @@ -45,15 +45,19 @@ dirToLink = 'dir' dirlinkToCopy = 'dirlinkToCopy' treeToLink = 'tree' treelinkToCopy = 'treelinkToCopy' +badToLink = 'None' # do not write this item +badlinkToCopy = 'badlinkToCopy' try: test.symlink( fileToLink, filelinkToCopy ) test.symlink( dirToLink, dirlinkToCopy ) test.symlink( treeToLink, treelinkToCopy ) + test.symlink( badToLink, badlinkToCopy ) except: test.no_result() test.write( fileToLink, fileContents ) +test.subdir( dirToLink ) test.subdir( treeToLink ) test.write( os.path.join( treeToLink, fileToLink ), fileContents ) @@ -66,7 +70,6 @@ Execute( Copy( 'F1', '%(filelinkToCopy)s', False ) ) Execute( Copy( 'L1', '%(filelinkToCopy)s' ) ) Execute( Copy( 'L2', '%(filelinkToCopy)s', True ) ) -Execute( Mkdir( '%(dirToLink)s' ) ) Execute( Copy( 'D1', '%(dirlinkToCopy)s', False ) ) Execute( Copy( 'L3', '%(dirlinkToCopy)s' ) ) Execute( Copy( 'L4', '%(dirlinkToCopy)s', True ) ) @@ -74,6 +77,10 @@ Execute( Copy( 'L4', '%(dirlinkToCopy)s', True ) ) Execute( Copy( 'T1', '%(treelinkToCopy)s', False ) ) Execute( Copy( 'L5', '%(treelinkToCopy)s' ) ) Execute( Copy( 'L6', '%(treelinkToCopy)s', True ) ) + +Execute( Copy( 'Fails', '%(badlinkToCopy)s', False ) ) +Execute( Copy( 'L7', '%(badlinkToCopy)s' ) ) +Execute( Copy( 'L8', '%(badlinkToCopy)s', True ) ) """ % locals() ) @@ -83,20 +90,24 @@ test.must_exist( fileToLink ) test.must_exist( filelinkToCopy ) test.must_exist( dirlinkToCopy ) test.must_exist( treelinkToCopy ) +test.must_not_exist( badToLink ) +test.must_exist( badlinkToCopy ) -expect = test.wrap_stdout( +expectStdout = test.wrap_stdout( read_str = '''\ Copy("F1", "%(filelinkToCopy)s") Copy("L1", "%(filelinkToCopy)s") Copy("L2", "%(filelinkToCopy)s") -Mkdir("%(dirToLink)s") Copy("D1", "%(dirlinkToCopy)s") Copy("L3", "%(dirlinkToCopy)s") Copy("L4", "%(dirlinkToCopy)s") Copy("T1", "%(treelinkToCopy)s") Copy("L5", "%(treelinkToCopy)s") Copy("L6", "%(treelinkToCopy)s") +Copy("Fails", "badlinkToCopy") +Copy("L7", "%(badlinkToCopy)s") +Copy("L8", "%(badlinkToCopy)s") ''' % locals(), build_str = '''\ @@ -104,7 +115,12 @@ scons: `.' is up to date. ''' ) -test.run( stdout = expect ) +expectStderr = \ +'''\ +scons: *** None: No such file or directory +''' + +test.run( stdout = expectStdout, stderr = expectStderr, status = None ) test.must_exist('D1') test.must_exist('F1') @@ -113,7 +129,10 @@ test.must_exist('L3') test.must_exist('L4') test.must_exist('L5') test.must_exist('L6') +test.must_exist('L7') +test.must_exist('L8') test.must_exist('T1') +test.must_not_exist( 'Fails' ) test.must_match( fileToLink, fileContents ) test.must_match( 'F1', fileContents ) @@ -133,12 +152,18 @@ test.fail_test( condition=(not os.path.islink('L3')) ) test.fail_test( condition=(not os.path.islink('L4')) ) test.fail_test( condition=(not os.path.islink('L5')) ) test.fail_test( condition=(not os.path.islink('L6')) ) +test.fail_test( condition=(not os.path.islink('L7')) ) +test.fail_test( condition=(not os.path.islink('L8')) ) +test.fail_test( condition=(os.path.exists('L7')) ) +test.fail_test( condition=(os.path.exists('L8')) ) test.fail_test( condition=(os.readlink(filelinkToCopy) != os.readlink('L1')) ) test.fail_test( condition=(os.readlink(filelinkToCopy) != os.readlink('L2')) ) test.fail_test( condition=(os.readlink(dirlinkToCopy) != os.readlink('L3')) ) test.fail_test( condition=(os.readlink(dirlinkToCopy) != os.readlink('L4')) ) test.fail_test( condition=(os.readlink(treelinkToCopy) != os.readlink('L5')) ) test.fail_test( condition=(os.readlink(treelinkToCopy) != os.readlink('L6')) ) +test.fail_test( condition=(os.readlink(badlinkToCopy) != os.readlink('L7')) ) +test.fail_test( condition=(os.readlink(badlinkToCopy) != os.readlink('L8')) ) test.pass_test() -- cgit v0.12 From f7384a54a0d60838d10130f70790b4a16584c746 Mon Sep 17 00:00:00 2001 From: William Blevins Date: Sun, 20 Jul 2014 15:16:12 -0400 Subject: Issue 2395: Added user guide details for Copy symbolic link support. --- doc/user/factories.xml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/doc/user/factories.xml b/doc/user/factories.xml index 08f20e6..815efe3 100644 --- a/doc/user/factories.xml +++ b/doc/user/factories.xml @@ -176,6 +176,27 @@ touch $* scons -Q + + The &Copy; factory supports symbolic link copying behavior + which is controlled by a third optional argument. + + + + Symbolic links shallow copied as new symbolic links: + + + + Command("LinkIn", "LinkOut1", Copy("$TARGET", "$SOURCE"[, True])) + + + + Symbolic link deep copied as file target file or directory: + + + + Command("LinkIn", "FileOut", Copy("$TARGET", "$SOURCE", False)) + +
-- cgit v0.12 From a3b104e286e7d7bb3ab73e2943fe4faa5f0d43b7 Mon Sep 17 00:00:00 2001 From: Gary Oberbrunner Date: Sun, 20 Jul 2014 15:25:01 -0400 Subject: Skipping Java DerivedSourceTest for now until underlying issue is fixed. --- test/Java/DerivedSourceTest.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/Java/DerivedSourceTest.py b/test/Java/DerivedSourceTest.py index b4715a5..c749cf3 100644 --- a/test/Java/DerivedSourceTest.py +++ b/test/Java/DerivedSourceTest.py @@ -49,6 +49,10 @@ test = TestSCons.TestSCons() test.no_result( condition=(test.where_is( 'javac' ) is None) ) test.no_result( condition=(test.where_is( 'jar' ) is None) ) +# This test is known to fail as of July 2014; see Tigris issue 1771 and issue 2931. +# Once the underlying issue is corrected, this test should be re-enabled. +test.skip_test('Skipping derived-source test until issue 1771 is fixed.\n') + test.write( ['Sample.java'], """ -- cgit v0.12 From bfb98081c448458cd05a7870eab45e654eac0a92 Mon Sep 17 00:00:00 2001 From: Andrew Featherstone Date: Mon, 21 Jul 2014 23:36:03 +0100 Subject: Adds basic documentation of the CheckTypeSize method. --- doc/scons.mod | 1 + doc/user/sconf.xml | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/doc/scons.mod b/doc/scons.mod index be2dc24..72dc7ff 100644 --- a/doc/scons.mod +++ b/doc/scons.mod @@ -277,6 +277,7 @@ CheckLib"> CheckLibWithHeader"> CheckType"> +CheckTypeSize"> TryAction"> TryBuild"> TryCompile"> diff --git a/doc/user/sconf.xml b/doc/user/sconf.xml index ff39b6b..214569d 100644 --- a/doc/user/sconf.xml +++ b/doc/user/sconf.xml @@ -282,6 +282,26 @@ env = conf.Finish()
+
+ Checking the size of a datatype + + Check the size of a datatype by using the &CheckTypeSize; method: + + + +env = Environment() +conf = Configure(env) +int_size = conf.CheckTypeSize('unsigned int') +print 'sizeof unsigned int is', int_size +env = conf.Finish() + + + +% scons -Q +sizeof unsigned int is 4 +scons: `.' is up to date. + +
Adding Your Own Custom Checks -- cgit v0.12 From 23123e60138a162556cdbb54c3c347f7553342ab Mon Sep 17 00:00:00 2001 From: Manuel Francisco Naranjo Date: Mon, 21 Jul 2014 20:26:29 -0300 Subject: Adding a unit-test for pull-request #150 A unit-test for pull-request #150 has been create to make sure no regressions are introduced as part of the bugfix. It is kind of salvage it just removes BUILDERS from the dict and check everything can keep going --- src/engine/SCons/EnvironmentTests.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index 5235342..b9ef3f2 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -1892,6 +1892,11 @@ def generate(env): env = env.Clone(KEY_THAT_I_WANT=6, tools=[my_tool]) assert env['KEY_THAT_I_WANT'] == real_value[0], env['KEY_THAT_I_WANT'] + # test for pull request #150 + env = self.TestEnvironment() + env._dict.pop('BUILDERS') + assert env.has_key('BUILDERS') is False + env2 = env.Clone() def test_Copy(self): """Test copying using the old env.Copy() method""" -- cgit v0.12 From c83fbe751e3a3d0f8e44eb97f9584f518b3a2b66 Mon Sep 17 00:00:00 2001 From: Manuel Francisco Naranjo Date: Mon, 21 Jul 2014 20:26:40 -0300 Subject: Prevent non defined named non defined exception In a project I'm running I hitted a case where BUILDERS is not part of _dict which leads to variable builders not defined, making the core of SCons crash --- src/engine/SCons/Environment.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index d178f49..7789855 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -1378,10 +1378,8 @@ class Base(SubstitutionEnvironment): (like a function). There are no references to any mutable objects in the original Environment. """ - try: - builders = self._dict['BUILDERS'] - except KeyError: - pass + + builders = self._dict.get('BUILDERS', {}) clone = copy.copy(self) # BUILDERS is not safe to do a simple copy -- cgit v0.12 From a87e52da2c63ce89dbc645570b05ff3b23978997 Mon Sep 17 00:00:00 2001 From: Dirk Baechle Date: Mon, 28 Jul 2014 22:24:15 +0200 Subject: - updated CHANGES.txt - updated generated doc files --- doc/generated/tools.gen | 12 +++++------ doc/generated/tools.mod | 4 ++-- doc/generated/variables.gen | 52 ++++++++++++++++++++++----------------------- doc/generated/variables.mod | 4 ++-- src/CHANGES.txt | 3 +++ 5 files changed, 39 insertions(+), 36 deletions(-) diff --git a/doc/generated/tools.gen b/doc/generated/tools.gen index 5e4c8bd..a4c4a3b 100644 --- a/doc/generated/tools.gen +++ b/doc/generated/tools.gen @@ -767,19 +767,19 @@ Sets construction variables for the Sets: &cv-link-AS;, &cv-link-ASCOM;, &cv-link-ASFLAGS;, &cv-link-ASPPCOM;, &cv-link-ASPPFLAGS;.Uses: &cv-link-ASCOMSTR;, &cv-link-ASPPCOMSTR;. - - Packaging + + packaging -Sets construction variables for the Package Builder. +A framework for building binary and source packages. - - packaging + + Packaging -A framework for building binary and source packages. +Sets construction variables for the Package Builder. diff --git a/doc/generated/tools.mod b/doc/generated/tools.mod index 13072bf..3c6f71c 100644 --- a/doc/generated/tools.mod +++ b/doc/generated/tools.mod @@ -76,8 +76,8 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. mwcc"> mwld"> nasm"> -Packaging"> packaging"> +Packaging"> pdf"> pdflatex"> pdftex"> @@ -185,8 +185,8 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. mwcc"> mwld"> nasm"> -Packaging"> packaging"> +Packaging"> pdf"> pdflatex"> pdftex"> diff --git a/doc/generated/variables.gen b/doc/generated/variables.gen index 34b9017..d21b417 100644 --- a/doc/generated/variables.gen +++ b/doc/generated/variables.gen @@ -950,19 +950,19 @@ DFLAGPREFIX. - - _DFLAGS + + DFLAGS -_DFLAGS. +DFLAGS. - - DFLAGS + + _DFLAGS -DFLAGS. +_DFLAGS. @@ -2642,15 +2642,6 @@ is -dNOPAUSE -dBATCH -sDEVICE=pdfwrite HOST_ARCH - The name of the host hardware architecture used to create the Environment. - If a platform is specified when creating the Environment, then - that Platform's logic will handle setting this value. - This value is immutable, and should not be changed by the user after - the Environment is initialized. - Currently only set for Win32. - - - Sets the host architecture for Visual Studio compiler. If not set, default to the detected host architecture: note that this may depend on the python you are using. @@ -2666,7 +2657,16 @@ Valid values are the same as for This is currently only used on Windows, but in the future it will be used on other OSes as well. - + + + The name of the host hardware architecture used to create the Environment. + If a platform is specified when creating the Environment, then + that Platform's logic will handle setting this value. + This value is immutable, and should not be changed by the user after + the Environment is initialized. + Currently only set for Win32. + + HOST_OS @@ -2862,7 +2862,7 @@ The command line used to call the Java archive tool. The string displayed when the Java archive tool is called -If this is not set, then $JARCOM (the command line) is displayed. +If this is not set, then $JARCOM (the command line) is displayed. @@ -2872,7 +2872,7 @@ env = Environment(JARCOMSTR = "JARchiving $SOURCES into $TARGET") The string displayed when the Java archive tool is called -If this is not set, then $JARCOM (the command line) is displayed. +If this is not set, then $JARCOM (the command line) is displayed. @@ -6713,13 +6713,6 @@ that may not be set or used in a construction environment. TARGET_ARCH - The name of the target hardware architecture for the compiled objects - created by this Environment. - This defaults to the value of HOST_ARCH, and the user can override it. - Currently only set for Win32. - - - Sets the target architecture for Visual Studio compiler (i.e. the arch of the binaries generated by the compiler). If not set, default to $HOST_ARCH, or, if that is unset, to the architecture of the @@ -6744,7 +6737,14 @@ and ia64 (Itanium). For example, if you want to compile 64-bit binaries, you would set TARGET_ARCH='x86_64' in your SCons environment. - + + + The name of the target hardware architecture for the compiled objects + created by this Environment. + This defaults to the value of HOST_ARCH, and the user can override it. + Currently only set for Win32. + + TARGET_OS diff --git a/doc/generated/variables.mod b/doc/generated/variables.mod index 473c8a2..0a59605 100644 --- a/doc/generated/variables.mod +++ b/doc/generated/variables.mod @@ -76,8 +76,8 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. $DESCRIPTION_lang"> $DFILESUFFIX"> $DFLAGPREFIX"> -$_DFLAGS"> $DFLAGS"> +$_DFLAGS"> $DFLAGSUFFIX"> $_DINCFLAGS"> $DINCPREFIX"> @@ -698,8 +698,8 @@ THIS IS AN AUTOMATICALLY-GENERATED FILE. DO NOT EDIT. $DESCRIPTION_lang"> $DFILESUFFIX"> $DFLAGPREFIX"> -$_DFLAGS"> $DFLAGS"> +$_DFLAGS"> $DFLAGSUFFIX"> $_DINCFLAGS"> $DINCPREFIX"> diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 1081d6f..17ee975 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -6,6 +6,9 @@ RELEASE 2.3.2.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE + From Andrew Featherstone: + - Added description of CheckTypeSize method (#1991). + From William Blevins: - Added test for Java derived-source dependency tree generation. - Added Copy Action symlink soft-copy support (#2395). -- cgit v0.12 From 28a2ad02e39ea773ae56aee9c3f855261303ebfe Mon Sep 17 00:00:00 2001 From: Andrew Featherstone Date: Tue, 29 Jul 2014 22:05:47 +0100 Subject: Corrects handling of appending dictionaries to CPPDEFINES. Amended a test case to demonstrate the issue. --- src/engine/SCons/Environment.py | 35 ++++++++++++++++--- test/CPPDEFINES/append.py | 75 ++++++++++++++++++++--------------------- 2 files changed, 68 insertions(+), 42 deletions(-) diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index d178f49..6c665df 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -1206,7 +1206,13 @@ class Base(SubstitutionEnvironment): # based on what we think the value looks like. if SCons.Util.is_List(val): if key == 'CPPDEFINES': - orig = orig.items() + tmp = [] + for (k, v) in orig.iteritems(): + if v is not None: + tmp.append((k, v)) + else: + tmp.append((k,)) + orig = tmp orig += val self._dict[key] = orig else: @@ -1286,8 +1292,15 @@ class Base(SubstitutionEnvironment): else: tmp.append((i,)) val = tmp + # Construct a list of (key, value) tuples. if SCons.Util.is_Dict(dk): - dk = dk.items() + tmp = [] + for (k, v) in dk.iteritems(): + if v is not None: + tmp.append((k, v)) + else: + tmp.append((k,)) + dk = tmp elif SCons.Util.is_String(dk): dk = [(dk,)] else: @@ -1327,8 +1340,15 @@ class Base(SubstitutionEnvironment): else: tmp.append((i,)) dk = tmp + # Construct a list of (key, value) tuples. if SCons.Util.is_Dict(val): - val = val.items() + tmp = [] + for (k, v) in val.iteritems(): + if v is not None: + tmp.append((k, v)) + else: + tmp.append((k,)) + val = tmp elif SCons.Util.is_String(val): val = [(val,)] if delete_existing: @@ -1351,7 +1371,14 @@ class Base(SubstitutionEnvironment): if SCons.Util.is_String(dk): dk = [dk] elif SCons.Util.is_Dict(dk): - dk = dk.items() + tmp = [] + for (k, v) in dk.iteritems(): + if v is not None: + tmp.append((k, v)) + else: + tmp.append((k,)) + dk = tmp + #dk = dk.items() if SCons.Util.is_String(val): if val in dk: val = [] diff --git a/test/CPPDEFINES/append.py b/test/CPPDEFINES/append.py index 2dacd8a..6e69d09 100644 --- a/test/CPPDEFINES/append.py +++ b/test/CPPDEFINES/append.py @@ -47,18 +47,17 @@ print env_1738_2.subst('$_CPPDEFFLAGS') env_2300_1 = Environment(CPPDEFINES = 'foo', CPPDEFPREFIX='-D') env_2300_1.Append(CPPDEFINES='bar') print env_2300_1.subst('$_CPPDEFFLAGS') -#env_2300_1.Object('test_2300_1', 'main.c') env_2300_2 = Environment(CPPDEFINES = ['foo'], CPPDEFPREFIX='-D') # note the list env_2300_2.Append(CPPDEFINES='bar') print env_2300_2.subst('$_CPPDEFFLAGS') -#env_2300_2.Object('test_2300_2', 'main.c') # http://scons.tigris.org/issues/show_bug.cgi?id=1152 +# http://scons.tigris.org/issues/show_bug.cgi?id=2900 cases=[('string', 'FOO'), ('list', ['NAME1', 'NAME2']), ('list-of-2lists', [('NAME1','VAL1'), ['NAME2','VAL2']]), - ('dict', {'NAME1' : 'VAL1', 'NAME2' : 'VAL2'}) + ('dict', {'NAME1' : 'VAL1', 'NAME2' : 'VAL2', 'NAME3' : None}) ] for (t1, c1) in cases: @@ -107,13 +106,13 @@ AppendUnique: result=[('FOO',), ('NAME1', 'VAL1'), ('NAME2', 'VAL2')] final=-DFOO -DNAME1=VAL1 -DNAME2=VAL2 ==== Testing CPPDEFINES, appending a dict to a string - orig = FOO, append = {'NAME2': 'VAL2', 'NAME1': 'VAL1'} + orig = FOO, append = {'NAME2': 'VAL2', 'NAME3': None, 'NAME1': 'VAL1'} Append: - result=['FOO', {'NAME2': 'VAL2', 'NAME1': 'VAL1'}] - final=-DFOO -DNAME2=VAL2 -DNAME1=VAL1 + result=['FOO', {'NAME2': 'VAL2', 'NAME3': None, 'NAME1': 'VAL1'}] + final=-DFOO -DNAME2=VAL2 -DNAME3 -DNAME1=VAL1 AppendUnique: - result=['FOO', ('NAME2', 'VAL2'), ('NAME1', 'VAL1')] - final=-DFOO -DNAME2=VAL2 -DNAME1=VAL1 + result=['FOO', ('NAME2', 'VAL2'), 'NAME3', ('NAME1', 'VAL1')] + final=-DFOO -DNAME2=VAL2 -DNAME3 -DNAME1=VAL1 ==== Testing CPPDEFINES, appending a string to a list orig = ['NAME1', 'NAME2'], append = FOO Append: @@ -139,13 +138,13 @@ AppendUnique: result=[('NAME1',), ('NAME2',), ('NAME1', 'VAL1'), ('NAME2', 'VAL2')] final=-DNAME1 -DNAME2 -DNAME1=VAL1 -DNAME2=VAL2 ==== Testing CPPDEFINES, appending a dict to a list - orig = ['NAME1', 'NAME2'], append = {'NAME2': 'VAL2', 'NAME1': 'VAL1'} + orig = ['NAME1', 'NAME2'], append = {'NAME2': 'VAL2', 'NAME3': None, 'NAME1': 'VAL1'} Append: - result=['NAME1', 'NAME2', {'NAME2': 'VAL2', 'NAME1': 'VAL1'}] - final=-DNAME1 -DNAME2 -DNAME2=VAL2 -DNAME1=VAL1 + result=['NAME1', 'NAME2', {'NAME2': 'VAL2', 'NAME3': None, 'NAME1': 'VAL1'}] + final=-DNAME1 -DNAME2 -DNAME2=VAL2 -DNAME3 -DNAME1=VAL1 AppendUnique: - result=[('NAME1',), ('NAME2',), ('NAME2', 'VAL2'), ('NAME1', 'VAL1')] - final=-DNAME1 -DNAME2 -DNAME2=VAL2 -DNAME1=VAL1 + result=[('NAME1',), ('NAME2',), ('NAME2', 'VAL2'), ('NAME3',), ('NAME1', 'VAL1')] + final=-DNAME1 -DNAME2 -DNAME2=VAL2 -DNAME3 -DNAME1=VAL1 ==== Testing CPPDEFINES, appending a string to a list-of-2lists orig = [('NAME1', 'VAL1'), ['NAME2', 'VAL2']], append = FOO Append: @@ -171,45 +170,45 @@ AppendUnique: result=[('NAME1', 'VAL1'), ('NAME2', 'VAL2')] final=-DNAME1=VAL1 -DNAME2=VAL2 ==== Testing CPPDEFINES, appending a dict to a list-of-2lists - orig = [('NAME1', 'VAL1'), ['NAME2', 'VAL2']], append = {'NAME2': 'VAL2', 'NAME1': 'VAL1'} + orig = [('NAME1', 'VAL1'), ['NAME2', 'VAL2']], append = {'NAME2': 'VAL2', 'NAME3': None, 'NAME1': 'VAL1'} Append: - result=[('NAME1', 'VAL1'), ['NAME2', 'VAL2'], {'NAME2': 'VAL2', 'NAME1': 'VAL1'}] - final=-DNAME1=VAL1 -DNAME2=VAL2 -DNAME2=VAL2 -DNAME1=VAL1 + result=[('NAME1', 'VAL1'), ['NAME2', 'VAL2'], {'NAME2': 'VAL2', 'NAME3': None, 'NAME1': 'VAL1'}] + final=-DNAME1=VAL1 -DNAME2=VAL2 -DNAME2=VAL2 -DNAME3 -DNAME1=VAL1 AppendUnique: - result=[('NAME2', 'VAL2'), ('NAME1', 'VAL1')] - final=-DNAME2=VAL2 -DNAME1=VAL1 + result=[('NAME2', 'VAL2'), ('NAME3',), ('NAME1', 'VAL1')] + final=-DNAME2=VAL2 -DNAME3 -DNAME1=VAL1 ==== Testing CPPDEFINES, appending a string to a dict - orig = {'NAME2': 'VAL2', 'NAME1': 'VAL1'}, append = FOO + orig = {'NAME2': 'VAL2', 'NAME3': None, 'NAME1': 'VAL1'}, append = FOO Append: - result={'FOO': None, 'NAME2': 'VAL2', 'NAME1': 'VAL1'} - final=-DFOO -DNAME1=VAL1 -DNAME2=VAL2 + result={'FOO': None, 'NAME2': 'VAL2', 'NAME3': None, 'NAME1': 'VAL1'} + final=-DFOO -DNAME1=VAL1 -DNAME2=VAL2 -DNAME3 AppendUnique: - result=[('NAME2', 'VAL2'), ('NAME1', 'VAL1'), 'FOO'] - final=-DNAME2=VAL2 -DNAME1=VAL1 -DFOO + result=[('NAME2', 'VAL2'), ('NAME3',), ('NAME1', 'VAL1'), 'FOO'] + final=-DNAME2=VAL2 -DNAME3 -DNAME1=VAL1 -DFOO ==== Testing CPPDEFINES, appending a list to a dict - orig = {'NAME2': 'VAL2', 'NAME1': 'VAL1'}, append = ['NAME1', 'NAME2'] + orig = {'NAME2': 'VAL2', 'NAME3': None, 'NAME1': 'VAL1'}, append = ['NAME1', 'NAME2'] Append: - result=[('NAME2', 'VAL2'), ('NAME1', 'VAL1'), 'NAME1', 'NAME2'] - final=-DNAME2=VAL2 -DNAME1=VAL1 -DNAME1 -DNAME2 + result=[('NAME2', 'VAL2'), ('NAME3',), ('NAME1', 'VAL1'), 'NAME1', 'NAME2'] + final=-DNAME2=VAL2 -DNAME3 -DNAME1=VAL1 -DNAME1 -DNAME2 AppendUnique: - result=[('NAME2', 'VAL2'), ('NAME1', 'VAL1'), ('NAME1',), ('NAME2',)] - final=-DNAME2=VAL2 -DNAME1=VAL1 -DNAME1 -DNAME2 + result=[('NAME2', 'VAL2'), ('NAME3',), ('NAME1', 'VAL1'), ('NAME1',), ('NAME2',)] + final=-DNAME2=VAL2 -DNAME3 -DNAME1=VAL1 -DNAME1 -DNAME2 ==== Testing CPPDEFINES, appending a list-of-2lists to a dict - orig = {'NAME2': 'VAL2', 'NAME1': 'VAL1'}, append = [('NAME1', 'VAL1'), ['NAME2', 'VAL2']] + orig = {'NAME2': 'VAL2', 'NAME3': None, 'NAME1': 'VAL1'}, append = [('NAME1', 'VAL1'), ['NAME2', 'VAL2']] Append: - result=[('NAME2', 'VAL2'), ('NAME1', 'VAL1'), ('NAME1', 'VAL1'), ['NAME2', 'VAL2']] - final=-DNAME2=VAL2 -DNAME1=VAL1 -DNAME1=VAL1 -DNAME2=VAL2 + result=[('NAME2', 'VAL2'), ('NAME3',), ('NAME1', 'VAL1'), ('NAME1', 'VAL1'), ['NAME2', 'VAL2']] + final=-DNAME2=VAL2 -DNAME3 -DNAME1=VAL1 -DNAME1=VAL1 -DNAME2=VAL2 AppendUnique: - result=[('NAME2', 'VAL2'), ('NAME1', 'VAL1')] - final=-DNAME2=VAL2 -DNAME1=VAL1 + result=[('NAME2', 'VAL2'), ('NAME3',), ('NAME1', 'VAL1')] + final=-DNAME2=VAL2 -DNAME3 -DNAME1=VAL1 ==== Testing CPPDEFINES, appending a dict to a dict - orig = {'NAME2': 'VAL2', 'NAME1': 'VAL1'}, append = {'NAME2': 'VAL2', 'NAME1': 'VAL1'} + orig = {'NAME2': 'VAL2', 'NAME3': None, 'NAME1': 'VAL1'}, append = {'NAME2': 'VAL2', 'NAME3': None, 'NAME1': 'VAL1'} Append: - result={'NAME2': 'VAL2', 'NAME1': 'VAL1'} - final=-DNAME1=VAL1 -DNAME2=VAL2 + result={'NAME2': 'VAL2', 'NAME3': None, 'NAME1': 'VAL1'} + final=-DNAME1=VAL1 -DNAME2=VAL2 -DNAME3 AppendUnique: - result={'NAME2': 'VAL2', 'NAME1': 'VAL1'} - final=-DNAME1=VAL1 -DNAME2=VAL2 + result={'NAME2': 'VAL2', 'NAME3': None, 'NAME1': 'VAL1'} + final=-DNAME1=VAL1 -DNAME2=VAL2 -DNAME3 """ build_output="scons: `.' is up to date.\n" -- cgit v0.12 From 31b8874144cf5df3b7a7fa296579534a628db8f8 Mon Sep 17 00:00:00 2001 From: Andrew Featherstone Date: Tue, 29 Jul 2014 22:18:52 +0100 Subject: Remove commented out code. --- src/engine/SCons/Environment.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 6c665df..9a54501 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -1378,7 +1378,6 @@ class Base(SubstitutionEnvironment): else: tmp.append((k,)) dk = tmp - #dk = dk.items() if SCons.Util.is_String(val): if val in dk: val = [] -- cgit v0.12 From dfaf4c269aeb774c933fd9ed7e9a3b5aaa6d191a Mon Sep 17 00:00:00 2001 From: William Deegan Date: Tue, 29 Jul 2014 14:38:17 -0700 Subject: fix test which was referring to tigris mailing list instead of current scons.or mailing list --- test/Deprecated/SourceCode/SourceCode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Deprecated/SourceCode/SourceCode.py b/test/Deprecated/SourceCode/SourceCode.py index 2bf990f..b5c0ba9 100644 --- a/test/Deprecated/SourceCode/SourceCode.py +++ b/test/Deprecated/SourceCode/SourceCode.py @@ -38,7 +38,7 @@ SourceCode('.', None) """) msg = """SourceCode() has been deprecated and there is no replacement. -\tIf you need this function, please contact scons-dev@tigris.org""" +\tIf you need this function, please contact scons-dev@scons.org""" warning = test.deprecated_warning('deprecated-source-code', msg) test.subdir('sub', 'sub2') -- cgit v0.12 From 1e7356e2a4f660c6f1cd42b92aec0c47233c1a2d Mon Sep 17 00:00:00 2001 From: Dirk Baechle Date: Thu, 7 Aug 2014 21:40:42 +0200 Subject: - several smaller fixes to get the Linux buildslaves green again --- src/engine/SCons/Tool/JavaCommon.py | 4 +- src/engine/SCons/Tool/docbook/docs/manual.xml | 2 +- src/engine/SCons/Tool/packaging/rpm.py | 2 +- test/Java/RMIC.py | 89 ++++++++++++++++----------- test/TEX/biblatex_plain.py | 1 - 5 files changed, 57 insertions(+), 41 deletions(-) diff --git a/src/engine/SCons/Tool/JavaCommon.py b/src/engine/SCons/Tool/JavaCommon.py index 6dd6051..8b13f9f 100644 --- a/src/engine/SCons/Tool/JavaCommon.py +++ b/src/engine/SCons/Tool/JavaCommon.py @@ -65,7 +65,7 @@ if java_parsing: def __init__(self, version=default_java_version): if not version in ('1.1', '1.2', '1.3','1.4', '1.5', '1.6', '1.7', - '5', '6'): + '1.8', '5', '6'): msg = "Java version %s not supported" % version raise NotImplementedError(msg) @@ -171,7 +171,7 @@ if java_parsing: if self.version in ('1.1', '1.2', '1.3', '1.4'): clazz = self.listClasses[0] self.listOutputs.append('%s$%d' % (clazz, self.nextAnon)) - elif self.version in ('1.5', '1.6', '1.7', '5', '6'): + elif self.version in ('1.5', '1.6', '1.7', '1.8', '5', '6'): self.stackAnonClassBrackets.append(self.brackets) className = [] className.extend(self.listClasses) diff --git a/src/engine/SCons/Tool/docbook/docs/manual.xml b/src/engine/SCons/Tool/docbook/docs/manual.xml index 60e94bc..c129753 100644 --- a/src/engine/SCons/Tool/docbook/docs/manual.xml +++ b/src/engine/SCons/Tool/docbook/docs/manual.xml @@ -263,7 +263,7 @@ with large input files may occur. There will definitely arise the need for adding features, or a variable. Let us know if you can think of a nice improvement or have worked on a bugfix/patch with success. Enter your issues at the Launchpad bug tracker for the Docbook Tool, or write to the User General Discussion -list of SCons at scons-users@tigris.org. +list of SCons at scons-users@scons.org.
diff --git a/src/engine/SCons/Tool/packaging/rpm.py b/src/engine/SCons/Tool/packaging/rpm.py index 07857d1..2bc3063 100644 --- a/src/engine/SCons/Tool/packaging/rpm.py +++ b/src/engine/SCons/Tool/packaging/rpm.py @@ -182,7 +182,7 @@ def build_specfile_sections(spec): spec['X_RPM_PREP'] = '[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT"' + '\n%setup -q' if 'X_RPM_BUILD' not in spec: - spec['X_RPM_BUILD'] = 'mkdir "$RPM_BUILD_ROOT"' + spec['X_RPM_BUILD'] = '[ ! -e "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && mkdir "$RPM_BUILD_ROOT"' if 'X_RPM_INSTALL' not in spec: spec['X_RPM_INSTALL'] = 'scons --install-sandbox="$RPM_BUILD_ROOT" "$RPM_BUILD_ROOT"' diff --git a/test/Java/RMIC.py b/test/Java/RMIC.py index f88dd14..876ed80 100644 --- a/test/Java/RMIC.py +++ b/test/Java/RMIC.py @@ -94,14 +94,31 @@ line 3 where_javac, java_version = test.java_where_javac() where_rmic = test.java_where_rmic() -test.write("wrapper.py", """\ +# Try to get the major/minor Java version +curver = (1, 0) +if java_version.count('.') == 1: + # Check Java version + major, minor = java_version.split('.') + try: + curver = (int(major), int(minor)) + except: + pass + +# Check the version of the found Java compiler. +# If it's 1.8 or higher, we skip the further RMIC test +# because we'll get warnings about the deprecated API... +# it's just not state-of-the-art anymore. +# Note, how we allow simple version strings like "5" and +# "6" to successfully pass this test. +if curver < (1, 8): + test.write("wrapper.py", """\ import os import sys open('%s', 'ab').write("wrapper.py %%s\\n" %% " ".join(sys.argv[1:])) os.system(" ".join(sys.argv[1:])) """ % test.workpath('wrapper.out').replace('\\', '\\\\')) -test.write('SConstruct', """ + test.write('SConstruct', """ foo = Environment(tools = ['javac', 'rmic'], JAVAC = r'%(where_javac)s', RMIC = r'%(where_rmic)s') @@ -121,15 +138,15 @@ bar_classes = [c for c in bar_classes if str(c).find('Hello') == -1] bar.RMIC(target = Dir('outdir2'), source = bar_classes) """ % locals() ) -test.subdir('com', - ['com', 'other'], - ['com', 'sub'], - ['com', 'sub', 'foo'], - ['com', 'sub', 'bar'], - 'src3a', - 'src3b') - -test.write(['com', 'sub', 'foo', 'Hello.java'], """\ + test.subdir('com', + ['com', 'other'], + ['com', 'sub'], + ['com', 'sub', 'foo'], + ['com', 'sub', 'bar'], + 'src3a', + 'src3b') + + test.write(['com', 'sub', 'foo', 'Hello.java'], """\ package com.sub.foo; import java.rmi.Remote; @@ -140,7 +157,7 @@ public interface Hello extends Remote { } """) -test.write(['com', 'sub', 'foo', 'Example1.java'], """\ + test.write(['com', 'sub', 'foo', 'Example1.java'], """\ package com.sub.foo; import java.rmi.Naming; @@ -179,7 +196,7 @@ public class Example1 extends UnicastRemoteObject implements Hello { } """) -test.write(['com', 'sub', 'foo', 'Example2.java'], """\ + test.write(['com', 'sub', 'foo', 'Example2.java'], """\ package com.sub.foo; import java.rmi.Naming; @@ -218,7 +235,7 @@ public class Example2 extends UnicastRemoteObject implements Hello { } """) -test.write(['com', 'sub', 'bar', 'Hello.java'], """\ + test.write(['com', 'sub', 'bar', 'Hello.java'], """\ package com.sub.bar; import java.rmi.Remote; @@ -229,7 +246,7 @@ public interface Hello extends Remote { } """) -test.write(['com', 'sub', 'bar', 'Example3.java'], """\ + test.write(['com', 'sub', 'bar', 'Example3.java'], """\ package com.sub.bar; import java.rmi.Naming; @@ -268,7 +285,7 @@ public class Example3 extends UnicastRemoteObject implements Hello { } """) -test.write(['com', 'sub', 'bar', 'Example4.java'], """\ + test.write(['com', 'sub', 'bar', 'Example4.java'], """\ package com.sub.bar; import java.rmi.Naming; @@ -307,26 +324,26 @@ public class Example4 extends UnicastRemoteObject implements Hello { } """) -test.run(arguments = '.') - -test.fail_test(test.read('wrapper.out') != "wrapper.py %s -d outdir2 -classpath class2 com.sub.bar.Example3 com.sub.bar.Example4\n" % where_rmic) - -test.must_exist(test.workpath('outdir1', 'com', 'sub', 'foo', 'Example1_Stub.class')) -test.must_exist(test.workpath('outdir1', 'com', 'sub', 'foo', 'Example2_Stub.class')) -test.must_exist(test.workpath('outdir2', 'com', 'sub', 'bar', 'Example3_Stub.class')) -test.must_exist(test.workpath('outdir2', 'com', 'sub', 'bar', 'Example4_Stub.class')) - -# We used to check for _Skel.class files as well, but they're not -# generated by default starting with Java 1.5, and they apparently -# haven't been needed for a while. Don't bother looking, even if we're -# running Java 1.4. If we think they're needed but they don't exist -# the test.up_to_date() call below will detect it. -#test.must_exist(test.workpath('outdir1', 'com', 'sub', 'foo', 'Example1_Skel.class')) -#test.must_exist(test.workpath('outdir1', 'com', 'sub', 'foo', 'Example2_Skel.class')) -#test.must_exist(test.workpath('outdir2', 'com', 'sub', 'bar', 'Example3_Skel.class')) -#test.must_exist(test.workpath('outdir2', 'com', 'sub', 'bar', 'Example4_Skel.class')) - -test.up_to_date(arguments = '.') + test.run(arguments = '.') + + test.fail_test(test.read('wrapper.out') != "wrapper.py %s -d outdir2 -classpath class2 com.sub.bar.Example3 com.sub.bar.Example4\n" % where_rmic) + + test.must_exist(test.workpath('outdir1', 'com', 'sub', 'foo', 'Example1_Stub.class')) + test.must_exist(test.workpath('outdir1', 'com', 'sub', 'foo', 'Example2_Stub.class')) + test.must_exist(test.workpath('outdir2', 'com', 'sub', 'bar', 'Example3_Stub.class')) + test.must_exist(test.workpath('outdir2', 'com', 'sub', 'bar', 'Example4_Stub.class')) + + # We used to check for _Skel.class files as well, but they're not + # generated by default starting with Java 1.5, and they apparently + # haven't been needed for a while. Don't bother looking, even if we're + # running Java 1.4. If we think they're needed but they don't exist + # the test.up_to_date() call below will detect it. + #test.must_exist(test.workpath('outdir1', 'com', 'sub', 'foo', 'Example1_Skel.class')) + #test.must_exist(test.workpath('outdir1', 'com', 'sub', 'foo', 'Example2_Skel.class')) + #test.must_exist(test.workpath('outdir2', 'com', 'sub', 'bar', 'Example3_Skel.class')) + #test.must_exist(test.workpath('outdir2', 'com', 'sub', 'bar', 'Example4_Skel.class')) + + test.up_to_date(arguments = '.') test.pass_test() diff --git a/test/TEX/biblatex_plain.py b/test/TEX/biblatex_plain.py index 740ec66..68f7cc3 100644 --- a/test/TEX/biblatex_plain.py +++ b/test/TEX/biblatex_plain.py @@ -72,7 +72,6 @@ test.run() # All (?) the files we expect will get created in the docs directory files = [ 'biblatextest.aux', - 'biblatextest.bcf', 'biblatextest.blg', 'biblatextest.fls', 'biblatextest.log', -- cgit v0.12 From 4178bd7ace4291eaffc3aad45e5503a7645e05d3 Mon Sep 17 00:00:00 2001 From: Dirk Baechle Date: Fri, 8 Aug 2014 19:32:48 +0200 Subject: - added javac version sentinel to another test that would fail with v1.8 and higher --- test/Repository/RMIC.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/Repository/RMIC.py b/test/Repository/RMIC.py index b214b4b..886ccdb 100644 --- a/test/Repository/RMIC.py +++ b/test/Repository/RMIC.py @@ -35,6 +35,27 @@ python = TestSCons.python test = TestSCons.TestSCons() where_javac, java_version = test.java_where_javac() + +# Try to get the major/minor Java version +curver = (1, 0) +if java_version.count('.') == 1: + # Check Java version + major, minor = java_version.split('.') + try: + curver = (int(major), int(minor)) + except: + pass + +# Check the version of the found Java compiler. +# If it's 1.8 or higher, we skip the further RMIC test +# because we'll get warnings about the deprecated API... +# it's just not state-of-the-art anymore. +# Note, how we allow simple version strings like "5" and +# "6" to successfully pass this test. +if curver >= (1, 8): + test.skip_test('The found version of javac is higher than 1.7, skipping test.\n') + + where_java = test.java_where_java() where_rmic = test.java_where_rmic() -- cgit v0.12 From 06e9b9b05ff1b7708fd0acbb4b276ff839da931d Mon Sep 17 00:00:00 2001 From: William Blevins Date: Sat, 9 Aug 2014 13:37:09 -0400 Subject: Updated Issue 2395 documentation per request. --- doc/user/factories.xml | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/doc/user/factories.xml b/doc/user/factories.xml index 815efe3..c8480db 100644 --- a/doc/user/factories.xml +++ b/doc/user/factories.xml @@ -177,25 +177,22 @@ touch $* - The &Copy; factory supports symbolic link copying behavior - which is controlled by a third optional argument. + The &Copy; factory has a third optional argument which controls + how symlinks are copied. - Symbolic links shallow copied as new symbolic links: - - Command("LinkIn", "LinkOut1", Copy("$TARGET", "$SOURCE"[, True])) - + + +# Symbolic link shallow copied as a new symbolic link: +Command("LinkIn", "LinkOut", Copy("$TARGET", "$SOURCE"[, True])) - - Symbolic link deep copied as file target file or directory: - - - - Command("LinkIn", "FileOut", Copy("$TARGET", "$SOURCE", False)) - +# Symbolic link target copied as a file or directory: +Command("LinkIn", "FileOrDirectoryOut", Copy("$TARGET", "$SOURCE", False)) + + -- cgit v0.12 From 032c4d44d99c4ea306f2541cafa9150e57024c21 Mon Sep 17 00:00:00 2001 From: Russel Winder Date: Sat, 9 Aug 2014 18:52:08 +0100 Subject: Remove setting of STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME from the D tools. --- src/engine/SCons/Tool/dmd.py | 2 -- src/engine/SCons/Tool/dmd.xml | 1 - src/engine/SCons/Tool/gdc.py | 2 -- src/engine/SCons/Tool/gdc.xml | 1 - src/engine/SCons/Tool/ldc.py | 2 -- src/engine/SCons/Tool/ldc.xml | 1 - 6 files changed, 9 deletions(-) diff --git a/src/engine/SCons/Tool/dmd.py b/src/engine/SCons/Tool/dmd.py index f1afc79..437720f 100644 --- a/src/engine/SCons/Tool/dmd.py +++ b/src/engine/SCons/Tool/dmd.py @@ -95,8 +95,6 @@ def generate(env): env['DVERSIONS'] = [] env['DDEBUG'] = [] - env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 0 - if env['DC']: SCons.Tool.DCommon.addDPATHToEnv(env, env['DC']) diff --git a/src/engine/SCons/Tool/dmd.xml b/src/engine/SCons/Tool/dmd.xml index 65ef75c..f8936c1 100644 --- a/src/engine/SCons/Tool/dmd.xml +++ b/src/engine/SCons/Tool/dmd.xml @@ -42,7 +42,6 @@ Sets construction variables for D language compiler DMD. DFLAGS DVERSIONS DDEBUG -STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME DINCPREFIX DINCSUFFIX DVERPREFIX diff --git a/src/engine/SCons/Tool/gdc.py b/src/engine/SCons/Tool/gdc.py index 7c8649b..fb8fea8 100644 --- a/src/engine/SCons/Tool/gdc.py +++ b/src/engine/SCons/Tool/gdc.py @@ -78,8 +78,6 @@ def generate(env): env['DVERSIONS'] = [] env['DDEBUG'] = [] - env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 0 - if env['DC']: SCons.Tool.DCommon.addDPATHToEnv(env, env['DC']) diff --git a/src/engine/SCons/Tool/gdc.xml b/src/engine/SCons/Tool/gdc.xml index 99b0603..20544b0 100644 --- a/src/engine/SCons/Tool/gdc.xml +++ b/src/engine/SCons/Tool/gdc.xml @@ -42,7 +42,6 @@ Sets construction variables for the D language compiler GDC. DFLAGS DVERSIONS DDEBUG -STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME DINCPREFIX DINCSUFFIX DVERPREFIX diff --git a/src/engine/SCons/Tool/ldc.py b/src/engine/SCons/Tool/ldc.py index ca873b5..13844e8 100644 --- a/src/engine/SCons/Tool/ldc.py +++ b/src/engine/SCons/Tool/ldc.py @@ -83,8 +83,6 @@ def generate(env): env['DVERSIONS'] = [] env['DDEBUG'] = [] - env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 0 - if env['DC']: SCons.Tool.DCommon.addDPATHToEnv(env, env['DC']) diff --git a/src/engine/SCons/Tool/ldc.xml b/src/engine/SCons/Tool/ldc.xml index 18f676d..f07144b 100644 --- a/src/engine/SCons/Tool/ldc.xml +++ b/src/engine/SCons/Tool/ldc.xml @@ -42,7 +42,6 @@ Sets construction variables for the D language compiler LDC2. DFLAGS DVERSIONS DDEBUG -STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME DINCPREFIX DINCSUFFIX DVERPREFIX -- cgit v0.12 From 78544743c31e3afb22378ca65c28a7518ae004b9 Mon Sep 17 00:00:00 2001 From: William Blevins Date: Sat, 9 Aug 2014 14:58:29 -0400 Subject: Updated hgignore for scons-user generated docs. --- .hgignore | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.hgignore b/.hgignore index 053e916..27c728a 100644 --- a/.hgignore +++ b/.hgignore @@ -9,3 +9,10 @@ syntax:glob *~ *.xcodeproj *.orig + +doc/user/scons-user +doc/user/scons_db.xml +doc/user/scons_ex.xml +doc/user/scons_exi.xml +doc/user/scons_xi.xml +doc/user/index.html -- cgit v0.12 From 1e802a0856670237facf60687409b37b32cfa4b4 Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Mon, 11 Aug 2014 14:53:44 +0300 Subject: Do not fail on EnsureSConsVersion when running from checkout --- src/CHANGES.txt | 3 +++ src/engine/SCons/Script/SConscript.py | 4 ++++ src/engine/SCons/Warnings.py | 3 +++ 3 files changed, 10 insertions(+) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 05e326e..cf4264a 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -6,6 +6,9 @@ RELEASE 2.3.2.alpha.yyyymmdd - NEW DATE WILL BE INSERTED HERE + From Anatoly Techtonik: + - Do not fail on EnsureSConsVersion when running from checkout + From Kendrick Boyd and Rob Managan: - Fixed the newglossary action to work with VariantDir (LaTeX). diff --git a/src/engine/SCons/Script/SConscript.py b/src/engine/SCons/Script/SConscript.py index bd515d2..111d091 100644 --- a/src/engine/SCons/Script/SConscript.py +++ b/src/engine/SCons/Script/SConscript.py @@ -461,6 +461,10 @@ class SConsEnvironment(SCons.Environment.Base): def EnsureSConsVersion(self, major, minor, revision=0): """Exit abnormally if the SCons version is not late enough.""" + if SCons.__version__ == '__VERSION__': + SCons.Warnings.warn(SCons.Warnings.DevelopmentVersionWarning, + "EnsureSConsVersion is ignored for development version") + return scons_ver = self._get_major_minor_revision(SCons.__version__) if scons_ver < (major, minor, revision): if revision: diff --git a/src/engine/SCons/Warnings.py b/src/engine/SCons/Warnings.py index ca6acee..5c27825 100644 --- a/src/engine/SCons/Warnings.py +++ b/src/engine/SCons/Warnings.py @@ -54,6 +54,9 @@ class CorruptSConsignWarning(WarningOnByDefault): class DependencyWarning(Warning): pass +class DevelopmentVersionWarning(WarningOnByDefault): + pass + class DuplicateEnvironmentWarning(WarningOnByDefault): pass -- cgit v0.12 From 2a473e4acba325f4c881c84ccab489fdbb0b45ad Mon Sep 17 00:00:00 2001 From: Robert Managan Date: Mon, 11 Aug 2014 21:51:00 -0700 Subject: Fix the newglossary action to work with variantDir --- src/engine/SCons/Tool/tex.py | 2 +- test/TEX/variant_dir_newglossary.py | 109 ++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+), 1 deletion(-) create mode 100644 test/TEX/variant_dir_newglossary.py diff --git a/src/engine/SCons/Tool/tex.py b/src/engine/SCons/Tool/tex.py index 4c10731..053d85d 100644 --- a/src/engine/SCons/Tool/tex.py +++ b/src/engine/SCons/Tool/tex.py @@ -431,7 +431,7 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None if Verbose: print "Need to run makeindex for newglossary" newglfile = suffix_nodes[newglossary_suffix[ig][2]] - MakeNewGlossaryAction = SCons.Action.Action("$MAKENEWGLOSSARY ${SOURCE.filebase}%s -s ${SOURCE.filebase}.ist -t ${SOURCE.filebase}%s -o ${SOURCE.filebase}%s" % (newglossary_suffix[ig][2],newglossary_suffix[ig][0],newglossary_suffix[ig][1]), "$MAKENEWGLOSSARYCOMSTR") + MakeNewGlossaryAction = SCons.Action.Action("$MAKENEWGLOSSARYCOM ${SOURCE.filebase}%s -s ${SOURCE.filebase}.ist -t ${SOURCE.filebase}%s -o ${SOURCE.filebase}%s" % (newglossary_suffix[ig][2],newglossary_suffix[ig][0],newglossary_suffix[ig][1]), "$MAKENEWGLOSSARYCOMSTR") result = MakeNewGlossaryAction(newglfile, newglfile, env) if result != 0: diff --git a/test/TEX/variant_dir_newglossary.py b/test/TEX/variant_dir_newglossary.py new file mode 100644 index 0000000..954724d --- /dev/null +++ b/test/TEX/variant_dir_newglossary.py @@ -0,0 +1,109 @@ +#!/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__" + +""" +Validate the use of \newglossary in TeX source files in conjuction +with variant_dir. + +Test configuration contributed by Kendrick Boyd. +""" + +import os +import TestSCons + +test = TestSCons.TestSCons() + +latex = test.where_is('latex') + +if not latex: + test.skip_test("Could not find latex; skipping test(s).\n") + +gloss = os.system('kpsewhich glossaries.sty') +if not gloss==0: + test.skip_test("glossaries.sty not installed; skipping test(s).\n") + + +test.subdir(['src']) + +test.write(['SConstruct'], r""" +import os + +env = Environment(TOOLS = ['tex', 'latex']) +Export(['env']) + +SConscript(os.path.join('src','SConscript'), variant_dir='build/', duplicate=1) +""") + +test.write(['src', 'SConscript'], r""" +Import('env') + +test_pdf = env.PDF(source='test.tex') + +""") + +test.write(['src', 'test.tex'], r""" +\documentclass{report} + +\usepackage{glossaries} + +\newglossary[ntg]{notation}{nts}{nto}{List of Notation} + +\makeglossary + +\newglossaryentry{pi}{type=notation, name={$\pi$}, description={ratio + of circumference to diameter of a circle}} + +\begin{document} + +\glsaddall + +\printglossary[type=notation, style=list] + +\end{document} +""") + +test.run(arguments = '.', stderr = None) + +files = [ + 'test.aux', + 'test.fls', + 'test.glg', + 'test.glo', + 'test.gls', + 'test.ist', + 'test.log', + 'test.ntg', + 'test.nto', + 'test.nts', + 'test.pdf', +] + +for f in files: + test.must_exist(['build',f]) + test.must_not_exist(['src',f]) + + +test.pass_test() -- cgit v0.12 From 49f21760c735826423490992c449caae4ccffb94 Mon Sep 17 00:00:00 2001 From: Robert Managan Date: Sun, 17 Aug 2014 22:32:45 -0700 Subject: Improve logic test syntax --- test/TEX/variant_dir_newglossary.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/TEX/variant_dir_newglossary.py b/test/TEX/variant_dir_newglossary.py index 954724d..8604270 100644 --- a/test/TEX/variant_dir_newglossary.py +++ b/test/TEX/variant_dir_newglossary.py @@ -42,7 +42,7 @@ if not latex: test.skip_test("Could not find latex; skipping test(s).\n") gloss = os.system('kpsewhich glossaries.sty') -if not gloss==0: +if gloss!=0: test.skip_test("glossaries.sty not installed; skipping test(s).\n") -- cgit v0.12 From 1ed0796cf633eac961ae6f457b0187ab25c25b82 Mon Sep 17 00:00:00 2001 From: Dirk Baechle Date: Wed, 20 Aug 2014 00:21:41 +0200 Subject: - fixes for some test, making them work on newer Linux distros --- test/Fortran/F95FLAGS.py | 6 ++++++ test/Fortran/SHF95FLAGS.py | 7 +++++++ test/YACC/live.py | 2 -- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/test/Fortran/F95FLAGS.py b/test/Fortran/F95FLAGS.py index de18858..8c3ce09 100644 --- a/test/Fortran/F95FLAGS.py +++ b/test/Fortran/F95FLAGS.py @@ -104,6 +104,12 @@ g95 = test.detect_tool(fc) if g95: + test.subdir('x') + + test.write(['x','dummy.i'], +""" +# Exists only such that -Ix finds the directory... +""") test.write("wrapper.py", """import os diff --git a/test/Fortran/SHF95FLAGS.py b/test/Fortran/SHF95FLAGS.py index b945bac..8e75878 100644 --- a/test/Fortran/SHF95FLAGS.py +++ b/test/Fortran/SHF95FLAGS.py @@ -103,6 +103,13 @@ g95 = test.detect_tool(fc) if g95: + test.subdir('x') + + test.write(['x','dummy.i'], +""" +# Exists only such that -Ix finds the directory... +""") + test.write("wrapper.py", """import os import sys diff --git a/test/YACC/live.py b/test/YACC/live.py index 28e2186..d567ec3 100644 --- a/test/YACC/live.py +++ b/test/YACC/live.py @@ -91,8 +91,6 @@ newline: '\n'; test.write("file.yy", """\ %token GRAPH_T NODE_T EDGE_T DIGRAPH_T EDGEOP_T SUBGRAPH_T -%pure_parser - %% graph: GRAPH_T ; -- cgit v0.12 From 678c769bc6189b5b7c301fbecfb37496725f6aee Mon Sep 17 00:00:00 2001 From: Gary Oberbrunner Date: Wed, 20 Aug 2014 21:52:38 -0400 Subject: SWIG: improve tool detection, and update SWIG tests to run on Windows. The tool detection is improved by checking for swig in env['SWIG'], where it is commonly set, as well as env['ENV']['PATH']. The tests mostly didn't work on Windows. I updated them all. Mostly to build 32-bit extensions when using 32-bit python on Windows, and use .pyd as the python extension on Windows. --- QMTest/TestSCons.py | 17 ++++++++++++++--- src/engine/SCons/Tool/swig.py | 3 ++- test/SWIG/SWIGFLAGS.py | 6 ++++-- test/SWIG/SWIGOUTDIR-python.py | 14 +++++++++++--- test/SWIG/SWIGPATH.py | 1 + test/SWIG/build-dir.py | 12 +++++++++--- test/SWIG/generated_swigfile.py | 14 +++++++------- test/SWIG/implicit-dependencies.py | 2 +- test/SWIG/live.py | 11 +++++++++-- test/SWIG/module-deduced-name.py | 8 ++++++++ test/SWIG/module-parens.py | 20 ++++++++++++++++++-- test/SWIG/module-quoted.py | 18 +++++++++++++++++- test/SWIG/module-spaces.py | 20 ++++++++++++++++++-- test/SWIG/remove-modules.py | 6 ++++++ test/SWIG/subdir.py | 11 +++++++++-- 15 files changed, 134 insertions(+), 29 deletions(-) diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py index 4b2b5a4..ae6e9c5 100644 --- a/QMTest/TestSCons.py +++ b/QMTest/TestSCons.py @@ -1129,14 +1129,25 @@ SConscript( sconscript ) self.run(program = python, stdin = """\ import os, sys try: - py_ver = 'python%d.%d' % sys.version_info[:2] + if sys.platform == 'win32': + py_ver = 'python%d%d' % sys.version_info[:2] + else: + py_ver = 'python%d.%d' % sys.version_info[:2] except AttributeError: py_ver = 'python' + sys.version[:3] -print os.path.join(sys.prefix, 'include', py_ver) -print os.path.join(sys.prefix, 'lib', py_ver, 'config') +# print include and lib path +try: + import distutils.sysconfig + exec_prefix = distutils.sysconfig.EXEC_PREFIX + print distutils.sysconfig.get_python_inc() + print os.path.join(exec_prefix, 'libs') +except: + print os.path.join(sys.prefix, 'include', py_ver) + print os.path.join(sys.prefix, 'lib', py_ver, 'config') print py_ver """) + # print "get_platform_python_info(): "+self.stdout() return [python] + self.stdout().strip().split('\n') def start(self, *args, **kw): diff --git a/src/engine/SCons/Tool/swig.py b/src/engine/SCons/Tool/swig.py index d51a386..f166174 100644 --- a/src/engine/SCons/Tool/swig.py +++ b/src/engine/SCons/Tool/swig.py @@ -174,7 +174,8 @@ def generate(env): env.Append(SCANNERS = scanner) def exists(env): - return env.Detect(['swig']) + swig = env.get('SWIG') or env.Detect(['swig']) + return swig # Local Variables: # tab-width:4 diff --git a/test/SWIG/SWIGFLAGS.py b/test/SWIG/SWIGFLAGS.py index 88f5184..cb91699 100644 --- a/test/SWIG/SWIGFLAGS.py +++ b/test/SWIG/SWIGFLAGS.py @@ -28,6 +28,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" Verify that we can use ${SOURCE} expansions in $SWIGFLAGS. """ +import sys import TestSCons test = TestSCons.TestSCons() @@ -54,9 +55,10 @@ test.write(['src', 'bar.i'], """\ test.write('SConstruct', """ # Note that setting the -I option in $SWIGFLAGS is not good and the # documentation says to use $SWIGPATH. This is just for testing. -env = Environment(SWIGFLAGS='-python -I${SOURCE.dir}') +env = Environment(SWIGFLAGS='-python -I${SOURCE.dir}', + SWIG=r'%(swig)s') env.CFile(target = 'foo', source = ['src/foo.i']) -""") +""" % locals()) test.run() diff --git a/test/SWIG/SWIGOUTDIR-python.py b/test/SWIG/SWIGOUTDIR-python.py index c94e509..db0cc95 100644 --- a/test/SWIG/SWIGOUTDIR-python.py +++ b/test/SWIG/SWIGOUTDIR-python.py @@ -31,6 +31,7 @@ that Python files are created in the specified output directory. import TestSCons import os +import sys test = TestSCons.TestSCons() @@ -44,8 +45,15 @@ Python_h = os.path.join(python_include, 'Python.h') if not os.path.exists(Python_h): test.skip_test('Can not find %s, skipping test.\n' % Python_h) +# On Windows, build a 32-bit exe if on 32-bit python. +if sys.platform == 'win32' and sys.maxsize <= 2**32: + swig_arch_var="TARGET_ARCH='x86'," +else: + swig_arch_var="" + test.write(['SConstruct'], """\ env = Environment(SWIGFLAGS = '-python -c++', + %(swig_arch_var)s CPPPATH=[r"%(python_include)s"], SWIG=[r'%(swig)s'], SWIGOUTDIR='python/build dir', @@ -64,17 +72,17 @@ test.write('python_foo_interface.i', """\ # subdirectory to hold the generated .py files. test.run(arguments = '.') -test.must_exist('python/build dir/foopack.py') +test.must_exist('python/build dir/foopack.py') # SCons should remove the built .py files. test.run(arguments = '-c') -test.must_not_exist('python/build dir/foopack.py') +test.must_not_exist('python/build dir/foopack.py') # SCons should realize it needs to rebuild the removed .py files. test.not_up_to_date(arguments = '.') -test.must_exist('python/build dir/foopack.py') +test.must_exist('python/build dir/foopack.py') test.pass_test() diff --git a/test/SWIG/SWIGPATH.py b/test/SWIG/SWIGPATH.py index 30426da..55e8d7e 100644 --- a/test/SWIG/SWIGPATH.py +++ b/test/SWIG/SWIGPATH.py @@ -55,6 +55,7 @@ test.write("dependent.i", """\ test.write('SConstruct', """ foo = Environment(SWIGFLAGS='-python', + SWIG='%(swig)s', SWIGPATH=['inc1', 'inc2']) swig = foo.Dictionary('SWIG') bar = foo.Clone(SWIG = [r'%(python)s', 'wrapper.py', swig]) diff --git a/test/SWIG/build-dir.py b/test/SWIG/build-dir.py index 4e5bfe9..304932f 100644 --- a/test/SWIG/build-dir.py +++ b/test/SWIG/build-dir.py @@ -45,7 +45,7 @@ if not swig: if sys.platform == 'win32': _dll = '.dll' else: - _dll = '.so' + _dll = '.so' test.subdir(['source']) @@ -55,11 +55,17 @@ Python_h = os.path.join(python_include, 'Python.h') if not os.path.exists(Python_h): test.skip_test('Can not find %s, skipping test.\n' % Python_h) +if sys.platform == 'win32' and sys.maxsize <= 2**32: + swig_arch_var="TARGET_ARCH='x86'," +else: + swig_arch_var="" + test.write(['SConstruct'], """\ # # Create the build environment. # env = Environment(CPPPATH = [".", r'%(python_include)s'], + %(swig_arch_var)s CPPDEFINES = "NDEBUG", SWIG = [r'%(swig)s'], SWIGFLAGS = ["-python", "-c++"], @@ -123,11 +129,11 @@ class Vector public: Vector(int n = 0); ~Vector(); - + %extend { const char* __str__() { return "linalg.Vector()"; } - + %pythoncode %{ def __iter__(self): for i in range(len(self)): diff --git a/test/SWIG/generated_swigfile.py b/test/SWIG/generated_swigfile.py index 1187df2..d09b473 100644 --- a/test/SWIG/generated_swigfile.py +++ b/test/SWIG/generated_swigfile.py @@ -39,14 +39,14 @@ import TestSCons if sys.platform == 'win32': _dll = '.dll' else: - _dll = '.so' + _dll = '.so' # swig-python expects specific filenames. # the platform specific suffix won't necessarily work. if sys.platform == 'win32': _dll = '.dll' else: - _dll = '.so' + _dll = '.so' test = TestSCons.TestSCons() @@ -69,17 +69,17 @@ foo = Environment(CPPPATH=[r'%(python_include)s'], SWIG=[r'%(swig)s'], LIBPATH=[r'%(python_libpath)s'], ) -python_interface = foo.Command( 'test_py_swig.i', Value(1), "echo '%%module test_py_swig' > test_py_swig.i" ) +python_interface = foo.Command( 'test_py_swig.i', Value(1), 'echo %%module test_py_swig > test_py_swig.i' ) python_c_file = foo.CFile( target='python_swig_test',source=python_interface, SWIGFLAGS = '-python -c++' ) -java_interface = foo.Command( 'test_java_swig.i', Value(1),"echo '%%module test_java_swig' > test_java_swig.i" ) -java_c_file = foo.CFile( target='java_swig_test' ,source=java_interface, SWIGFLAGS = '-java -c++' ) +java_interface = foo.Command( 'test_java_swig.i', Value(1),'echo %%module test_java_swig > test_java_swig.i' ) +java_c_file = foo.CFile( target='java_swig_test' ,source=java_interface, SWIGFLAGS = '-java -c++' ) """ % locals()) expected_stdout = """\ -echo '%%module test_java_swig' > test_java_swig.i +echo %%module test_java_swig > test_java_swig.i %(swig)s -o java_swig_test_wrap.cc -java -c++ test_java_swig.i -echo '%%module test_py_swig' > test_py_swig.i +echo %%module test_py_swig > test_py_swig.i %(swig)s -o python_swig_test_wrap.cc -python -c++ test_py_swig.i """ % locals() test.run(arguments = '.',stdout=test.wrap_stdout(expected_stdout)) diff --git a/test/SWIG/implicit-dependencies.py b/test/SWIG/implicit-dependencies.py index 6d40216..465a0d6 100644 --- a/test/SWIG/implicit-dependencies.py +++ b/test/SWIG/implicit-dependencies.py @@ -52,7 +52,7 @@ test.write("dependent.i", """\ """) test.write('SConstruct', """ -foo = Environment(SWIGFLAGS='-python') +foo = Environment(SWIGFLAGS='-python', SWIG='%(swig)s') swig = foo.Dictionary('SWIG') bar = foo.Clone(SWIG = [r'%(python)s', r'wrapper.py', swig]) foo.CFile(target = 'dependent', source = ['dependent.i']) diff --git a/test/SWIG/live.py b/test/SWIG/live.py index 4d4369e..7d79bae 100644 --- a/test/SWIG/live.py +++ b/test/SWIG/live.py @@ -36,7 +36,7 @@ import TestSCons # swig-python expects specific filenames. # the platform specific suffix won't necessarily work. if sys.platform == 'win32': - _dll = '.dll' + _dll = '.pyd' else: _dll = '.so' @@ -55,6 +55,12 @@ if not os.path.exists(Python_h): # handle testing on other platforms: ldmodule_prefix = '_' +# On Windows, build a 32-bit exe if on 32-bit python. +if sys.platform == 'win32' and sys.maxsize <= 2**32: + swig_arch_var="TARGET_ARCH='x86'," +else: + swig_arch_var="" + test.write("wrapper.py", """import os import sys @@ -64,11 +70,12 @@ os.system(" ".join(sys.argv[1:])) test.write('SConstruct', """\ foo = Environment(SWIGFLAGS='-python', + LIBPATH=[r'%(python_libpath)s'], CPPPATH=[r'%(python_include)s'], LDMODULEPREFIX='%(ldmodule_prefix)s', LDMODULESUFFIX='%(_dll)s', SWIG=[r'%(swig)s'], - LIBPATH=[r'%(python_libpath)s'], + %(swig_arch_var)s LIBS='%(python_lib)s', ) diff --git a/test/SWIG/module-deduced-name.py b/test/SWIG/module-deduced-name.py index 733b6c1..bdaef4f 100644 --- a/test/SWIG/module-deduced-name.py +++ b/test/SWIG/module-deduced-name.py @@ -32,6 +32,7 @@ emitter should return the basename of the module only. import TestSCons import os +import sys test = TestSCons.TestSCons() @@ -45,8 +46,15 @@ Python_h = os.path.join(python_include, 'Python.h') if not os.path.exists(Python_h): test.skip_test('Cannot find %s, skipping test.\n' % Python_h) +# On Windows, build a 32-bit exe if on 32-bit python. +if sys.platform == 'win32' and sys.maxsize <= 2**32: + swig_arch_var="TARGET_ARCH='x86'," +else: + swig_arch_var="" + test.write(['SConstruct'], """\ env = Environment(SWIGFLAGS = '-python -c++', + %(swig_arch_var)s CPPPATH=[r"%(python_include)s"], SWIG=[r'%(swig)s'], SWIGOUTDIR='python/build dir', diff --git a/test/SWIG/module-parens.py b/test/SWIG/module-parens.py index 6ae4924..d8c1744 100644 --- a/test/SWIG/module-parens.py +++ b/test/SWIG/module-parens.py @@ -30,6 +30,7 @@ without white space before the opening parenthesis. """ import os.path +import sys import TestSCons test = TestSCons.TestSCons() @@ -44,16 +45,31 @@ Python_h = os.path.join(python_include, 'Python.h') if not os.path.exists(Python_h): test.skip_test('Can not find %s, skipping test.\n' % Python_h) +# swig-python expects specific filenames. +# the platform specific suffix won't necessarily work. +if sys.platform == 'win32': + _dll = '.pyd' +else: + _dll = '.so' + +# On Windows, build a 32-bit exe if on 32-bit python. +if sys.platform == 'win32' and sys.maxsize <= 2**32: + swig_arch_var="TARGET_ARCH='x86'," +else: + swig_arch_var="" + test.write(['SConstruct'], """\ env = Environment(SWIGFLAGS = '-python -c++', + %(swig_arch_var)s CPPPATH=[r'%(python_include)s'], SWIG=[r'%(swig)s'], LIBPATH=[r'%(python_libpath)s'], LIBS='%(python_lib)s', + LDMODULESUFFIX='%(_dll)s', ) -env.LoadableModule('test1.so', ['test1.i', 'test1.cc']) -env.LoadableModule('test2.so', ['test2.i', 'test2.cc']) +env.LoadableModule('test1', ['test1.i', 'test1.cc']) +env.LoadableModule('test2', ['test2.i', 'test2.cc']) """ % locals()) test.write(['test1.cc'], """\ diff --git a/test/SWIG/module-quoted.py b/test/SWIG/module-quoted.py index ec7a132..6f4b891 100644 --- a/test/SWIG/module-quoted.py +++ b/test/SWIG/module-quoted.py @@ -30,6 +30,7 @@ Verify that we correctly parse quoted module names; e.g. %module "test" """ import os.path +import sys import TestSCons test = TestSCons.TestSCons() @@ -44,15 +45,30 @@ Python_h = os.path.join(python_include, 'Python.h') if not os.path.exists(Python_h): test.skip_test('Can not find %s, skipping test.\n' % Python_h) +# swig-python expects specific filenames. +# the platform specific suffix won't necessarily work. +if sys.platform == 'win32': + _dll = '.pyd' +else: + _dll = '.so' + +# On Windows, build a 32-bit exe if on 32-bit python. +if sys.platform == 'win32' and sys.maxsize <= 2**32: + swig_arch_var="TARGET_ARCH='x86'," +else: + swig_arch_var="" + test.write(['SConstruct'], """\ env = Environment(SWIGFLAGS = '-python -c++', + %(swig_arch_var)s CPPPATH=[r'%(python_include)s'], SWIG=[r'%(swig)s'], LIBPATH=[r'%(python_libpath)s'], LIBS='%(python_lib)s', + LDMODULESUFFIX='%(_dll)s', ) -env.LoadableModule('test1.so', ['test1.i', 'test1.cc']) +env.LoadableModule('test1', ['test1.i', 'test1.cc']) """ % locals()) test.write(['test1.cc'], """\ diff --git a/test/SWIG/module-spaces.py b/test/SWIG/module-spaces.py index a0056f0..2833dff 100644 --- a/test/SWIG/module-spaces.py +++ b/test/SWIG/module-spaces.py @@ -30,6 +30,7 @@ the module name ; e.g. "%module test " """ import os.path +import sys import TestSCons test = TestSCons.TestSCons() @@ -44,15 +45,30 @@ Python_h = os.path.join(python_include, 'Python.h') if not os.path.exists(Python_h): test.skip_test('Can not find %s, skipping test.\n' % Python_h) +# swig-python expects specific filenames. +# the platform specific suffix won't necessarily work. +if sys.platform == 'win32': + _dll = '.pyd' +else: + _dll = '.so' + +# On Windows, build a 32-bit exe if on 32-bit python. +if sys.platform == 'win32' and sys.maxsize <= 2**32: + swig_arch_var="TARGET_ARCH='x86'," +else: + swig_arch_var="" + test.write(['SConstruct'], """\ env = Environment(SWIGFLAGS = '-python -c++', + %(swig_arch_var)s CPPPATH=[r'%(python_include)s'], SWIG=[r'%(swig)s'], LIBPATH=[r'%(python_libpath)s'], LIBS='%(python_lib)s', + LDMODULESUFFIX='%(_dll)s', ) -env.LoadableModule('test1.so', ['test1.i', 'test1.cc']) +env.LoadableModule('test1', ['test1.i', 'test1.cc']) """ % locals()) test.write(['test1.cc'], """\ @@ -67,7 +83,7 @@ int test1func(); """) test.write(['test1.i'], """\ -%module test1 +%module test1 %{ #include "test1.h" diff --git a/test/SWIG/remove-modules.py b/test/SWIG/remove-modules.py index 964970b..f5ce60d 100644 --- a/test/SWIG/remove-modules.py +++ b/test/SWIG/remove-modules.py @@ -56,6 +56,11 @@ if not os.path.exists(Python_h): # handle testing on other platforms: ldmodule_prefix = '_' +# On Windows, build a 32-bit exe if on 32-bit python. +if sys.platform == 'win32' and sys.maxsize <= 2**32: + swig_arch_var="TARGET_ARCH='x86'," +else: + swig_arch_var="" test.write("module.i", """\ %module modulename @@ -63,6 +68,7 @@ test.write("module.i", """\ test.write('SConstruct', """ foo = Environment(SWIGFLAGS='-python', + %(swig_arch_var)s CPPPATH=['%(python_include)s'], LDMODULEPREFIX='%(ldmodule_prefix)s', LDMODULESUFFIX='%(_dll)s', diff --git a/test/SWIG/subdir.py b/test/SWIG/subdir.py index 0b9f24d..e23b858 100644 --- a/test/SWIG/subdir.py +++ b/test/SWIG/subdir.py @@ -39,7 +39,7 @@ import TestSCons if sys.platform == 'win32': _dll = '.dll' else: - _dll = '.so' + _dll = '.so' test = TestSCons.TestSCons() @@ -58,14 +58,21 @@ if not os.path.exists(Python_h): # handle testing on other platforms: ldmodule_prefix = '_' +# On Windows, build a 32-bit exe if on 32-bit python. +if sys.platform == 'win32' and sys.maxsize <= 2**32: + swig_arch_var="TARGET_ARCH='x86'," +else: + swig_arch_var="" + test.write('SConstruct', """ env = Environment(SWIGFLAGS='-python', + %(swig_arch_var)s CPPPATH=['%(python_include)s/'], LDMODULEPREFIX='%(ldmodule_prefix)s', LDMODULESUFFIX='%(_dll)s', SWIG=r'%(swig)s', LIBPATH=[r'%(python_libpath)s'], - LIBS='%(python_lib)s', + LIBS='%(python_lib)s' ) env.LoadableModule('sub/_foo', -- cgit v0.12 From 4d4029a77e986d64153b3de0ece5177dbaed5cd9 Mon Sep 17 00:00:00 2001 From: Gary Oberbrunner Date: Thu, 21 Aug 2014 06:41:26 -0400 Subject: Remove extra print stmt in TestSCons.py, per review. --- QMTest/TestSCons.py | 1 - 1 file changed, 1 deletion(-) diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py index ae6e9c5..9434bb1 100644 --- a/QMTest/TestSCons.py +++ b/QMTest/TestSCons.py @@ -1147,7 +1147,6 @@ except: print py_ver """) - # print "get_platform_python_info(): "+self.stdout() return [python] + self.stdout().strip().split('\n') def start(self, *args, **kw): -- cgit v0.12