From 2e651cd5949d272da7b2b7b0f3f7c7dd2ad934b4 Mon Sep 17 00:00:00 2001 From: stevenknight Date: Wed, 13 Nov 2002 08:49:30 +0000 Subject: [PATCH] Win32 portability. git-svn-id: http://scons.tigris.org/svn/scons/trunk@498 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- SConstruct | 5 ++++- runtest.py | 2 +- src/engine/SCons/Action.py | 2 +- src/engine/SCons/Util.py | 12 ++++++++++-- test/ParseConfig.py | 8 ++++---- test/special-filenames.py | 2 +- 6 files changed, 21 insertions(+), 10 deletions(-) diff --git a/SConstruct b/SConstruct index 143f1a6b..866da6b5 100644 --- a/SConstruct +++ b/SConstruct @@ -725,7 +725,8 @@ for p in [ scons ]: # And, lastly, install the appropriate packages in the # appropriate subdirectory. # - env.Install(os.path.join('build', 'dist'), install_targets) + b_d_files = env.Install(os.path.join('build', 'dist'), install_targets) + Local(b_d_files) # # @@ -779,6 +780,8 @@ if change: src_tar_gz = os.path.join('build', 'dist', '%s.tar.gz' % psv) src_zip = os.path.join('build', 'dist', '%s.zip' % psv) + Local(src_tar_gz, src_zip) + for file in sfiles: env.SCons_revision(os.path.join(b_ps, file), file) diff --git a/runtest.py b/runtest.py index 158d5b6c..ebaf7588 100644 --- a/runtest.py +++ b/runtest.py @@ -312,7 +312,7 @@ if len(tests) != 1: sys.stdout.write("\nFailed the following test:\n") else: sys.stdout.write("\nFailed the following %d tests:\n" % len(fail)) - paths = map(lambda x: x.path, no_result) + paths = map(lambda x: x.path, fail) sys.stdout.write("\t" + string.join(paths, "\n\t") + "\n") if no_result: if len(no_result) == 1: diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py index 255f329b..8347195c 100644 --- a/src/engine/SCons/Action.py +++ b/src/engine/SCons/Action.py @@ -175,7 +175,7 @@ elif os.name == 'nt': return 127 else: try: - args = [cmd_interp, '/C', quote(string.join(args)) ] + args = [cmd_interp, '/C', escape_cmd(string.join(args)) ] ret = os.spawnve(os.P_WAIT, cmd_interp, args, env) except OSError, e: ret = exitvalmap[e[0]] diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index adba42af..62772ae1 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -204,7 +204,7 @@ def quote_spaces(arg): if ' ' in arg or '\t' in arg: return '"%s"' % arg else: - return arg + return str(arg) # Several functions below deal with Environment variable # substitution. Part of this process involves inserting @@ -290,7 +290,7 @@ class CmdStringHolder: in the string before passing it to the command interpreter.""" self.data = cmd - # Populate flatdata (the ting returned by str()) with the + # Populate flatdata (the thing returned by str()) with the # non-escaped string self.escape(lambda x: x, lambda x: x) @@ -298,6 +298,14 @@ class CmdStringHolder: """Return the string in its current state.""" return self.flatdata + def __len__(self): + """Return the length of the string in its current state.""" + return len(self.flatdata) + + def __getitem__(self, index): + """Return the index'th element of the string in its current state.""" + return self.flatdata[index] + def escape(self, escape_func, quote_func=quote_spaces): """Escape the string with the supplied function. The function is expected to take an arbitrary string, then diff --git a/test/ParseConfig.py b/test/ParseConfig.py index 1cf52ed8..eaf78029 100644 --- a/test/ParseConfig.py +++ b/test/ParseConfig.py @@ -39,8 +39,8 @@ print "-L/usr/fax -Lfoo -lxxx abc" """) test.write('SConstruct', """ -env = Environment() -static_libs = ParseConfig(env, ["%s", "%s", "--libs --cflags"]) +env = Environment(CPPPATH = [], LIBPATH = [], LIBS = [], CCFLAGS = '') +static_libs = ParseConfig(env, [r"%s", r"%s", "--libs --cflags"]) print env['CPPPATH'] print env['LIBPATH'] print env['LIBS'] @@ -49,8 +49,8 @@ print static_libs """ % (sys.executable, test_config)) test.write('SConstruct2', """ -env = Environment() -static_libs = ParseConfig(env, "%s %s --libs --cflags") +env = Environment(CPPPATH = [], LIBPATH = [], LIBS = [], CCFLAGS = '') +static_libs = ParseConfig(env, r"%s %s --libs --cflags") print env['CPPPATH'] print env['LIBPATH'] print env['LIBS'] diff --git a/test/special-filenames.py b/test/special-filenames.py index 88db6bb2..3f05fe3d 100644 --- a/test/special-filenames.py +++ b/test/special-filenames.py @@ -55,7 +55,7 @@ if os.name == 'nt': test.write("cat.py", """\ import sys -open(sys.argv[1], 'w').write(open(sys.argv[2], 'r').read()) +open(sys.argv[1], 'wb').write(open(sys.argv[2], 'rb').read()) """) for fn in file_names: -- 2.26.2