From 1bd8df569197d707188d798b0c06b164ff98495a Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Tue, 16 Mar 2004 07:16:02 +0000 Subject: Fix use of MSVS_IGNORE_IDE_PATHS. Win32 fixes for various tests. --- src/CHANGES.txt | 4 ++++ src/engine/SCons/Node/FSTests.py | 2 +- src/engine/SCons/Tool/msvc.py | 19 ++++++++++--------- test/Execute.py | 12 ++++++------ test/msvs.py | 5 ++++- 5 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index a95aab0..8eef6a7 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -24,6 +24,10 @@ RELEASE 0.96 - XXX - Support passing environment override keyword arguments to Command(). + - Fix use of $MSVS_IGNORE_IDE_PATHS, which was broken when we added + support for $MSVS_USE_MFC_DIRS last release. + + RELEASE 0.95 - Mon, 08 Mar 2004 06:43:20 -0600 diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py index 63ac29d..94280f7 100644 --- a/src/engine/SCons/Node/FSTests.py +++ b/src/engine/SCons/Node/FSTests.py @@ -1654,7 +1654,7 @@ class CacheDirTestCase(unittest.TestCase): raise OSError shutil.copy2 = copy2 save_mkdir = os.mkdir - def mkdir(dir): + def mkdir(dir, mode=0): pass os.mkdir = mkdir old_warn_exceptions = SCons.Warnings.warningAsException(1) diff --git a/src/engine/SCons/Tool/msvc.py b/src/engine/SCons/Tool/msvc.py index a916501..1a2cb1c 100644 --- a/src/engine/SCons/Tool/msvc.py +++ b/src/engine/SCons/Tool/msvc.py @@ -324,7 +324,7 @@ def get_msvc_paths(version=None, use_mfc_dirs=0): return (include_path, lib_path, exe_path) -def get_msvc_default_paths(version = None): +def get_msvc_default_paths(version=None, use_mfc_dirs=0): """Return a 3-tuple of (INCLUDE, LIB, PATH) as the values of those three environment variables that should be set in order to execute the MSVC tools properly. This will only return the default @@ -345,9 +345,9 @@ def get_msvc_default_paths(version = None): pass if float(version) >= 7.0: - return _get_msvc7_default_paths(version) + return _get_msvc7_default_paths(version, use_mfc_dirs) else: - return _get_msvc6_default_paths(version) + return _get_msvc6_default_paths(version, use_mfc_dirs) def validate_vars(env): """Validate the PDB, PCH, and PCHSTOP construction variables.""" @@ -456,13 +456,14 @@ def generate(env): try: version = SCons.Tool.msvs.get_default_visualstudio_version(env) - if env.has_key('MSVS_IGNORE_IDE_PATHS') and env['MSVS_IGNORE_IDE_PATHS']: - include_path, lib_path, exe_path = get_msvc_default_paths(version) + # By default, add the MFC directories, because this is what + # we've been doing for a long time. We may change this. + use_mfc_dirs = env.get('MSVS_USE_MFC_DIRS', 1) + if env.get('MSVS_IGNORE_IDE_PATHS', 0): + _get_paths = get_msvc_default_paths else: - # By default, add the MFC directories, because this is what - # we've been doing for a long time. We may change this. - use_mfc_dirs = env.get('MSVS_USE_MFC_DIRS', 1) - include_path, lib_path, exe_path = get_msvc_paths(version, use_mfc_dirs) + _get_paths = get_msvc_paths + include_path, lib_path, exe_path = _get_paths(version, use_mfc_dirs) # since other tools can set these, we just make sure that the # relevant stuff from MSVS is in there somewhere. diff --git a/test/Execute.py b/test/Execute.py index 6942617..2637a6a 100644 --- a/test/Execute.py +++ b/test/Execute.py @@ -34,7 +34,7 @@ python = TestSCons.python test = TestSCons.TestSCons() -test.write('copy.py', """\ +test.write('my_copy.py', """\ import sys open(sys.argv[2], 'wb').write(open(sys.argv[1], 'rb').read()) try: @@ -45,11 +45,11 @@ sys.exit(exitval) """) test.write('SConstruct', """\ -Execute("%s copy.py a.in a.out") -Execute(Action("%s copy.py b.in b.out")) -env = Environment(COPY = 'copy.py') -env.Execute("%s copy.py c.in c.out") -env.Execute(Action("%s copy.py d.in d.out")) +Execute("%s my_copy.py a.in a.out") +Execute(Action("%s my_copy.py b.in b.out")) +env = Environment(COPY = 'my_copy.py') +env.Execute("%s my_copy.py c.in c.out") +env.Execute(Action("%s my_copy.py d.in d.out")) v = env.Execute("%s $COPY e.in e.out") assert v == 0, v v = env.Execute(Action("%s $COPY f.in f.out")) diff --git a/test/msvs.py b/test/msvs.py index e447cb0..fb41905 100644 --- a/test/msvs.py +++ b/test/msvs.py @@ -274,7 +274,10 @@ test = TestSCons.TestSCons(match = TestCmd.match_re) if sys.platform != 'win32': test.pass_test() -exec_script_main = "from os.path import join; import sys; sys.path = [ join(sys.prefix, 'Lib', 'site-packages', 'scons-0.94'), join(sys.prefix, 'scons-0.94'), join(sys.prefix, 'Lib', 'site-packages', 'scons'), join(sys.prefix, 'scons') ] + sys.path; import SCons.Script; SCons.Script.main()" +test.run(arguments = '-q -Q -f -', stdin = "import SCons; print SCons.__version__") +version = test.stdout()[:-1] + +exec_script_main = "from os.path import join; import sys; sys.path = [ join(sys.prefix, 'Lib', 'site-packages', 'scons-%s'), join(sys.prefix, 'scons-%s'), join(sys.prefix, 'Lib', 'site-packages', 'scons'), join(sys.prefix, 'scons') ] + sys.path; import SCons.Script; SCons.Script.main()" % (version, version) exec_script_main_xml = string.replace(exec_script_main, "'", "'") def substitute(input, workpath=test.workpath(), python=sys.executable): -- cgit v0.12