summaryrefslogtreecommitdiff
path: root/engine/SCons/Tool
diff options
context:
space:
mode:
Diffstat (limited to 'engine/SCons/Tool')
-rw-r--r--engine/SCons/Tool/386asm.py2
-rw-r--r--engine/SCons/Tool/BitKeeper.py4
-rw-r--r--engine/SCons/Tool/CVS.py6
-rw-r--r--engine/SCons/Tool/FortranCommon.py17
-rw-r--r--engine/SCons/Tool/JavaCommon.py23
-rw-r--r--engine/SCons/Tool/MSCommon/__init__.py2
-rw-r--r--engine/SCons/Tool/MSCommon/arch.py4
-rw-r--r--engine/SCons/Tool/MSCommon/common.py62
-rw-r--r--engine/SCons/Tool/MSCommon/netframework.py10
-rw-r--r--engine/SCons/Tool/MSCommon/sdk.py22
-rw-r--r--engine/SCons/Tool/MSCommon/vc.py182
-rw-r--r--engine/SCons/Tool/MSCommon/vs.py36
-rw-r--r--engine/SCons/Tool/Perforce.py7
-rw-r--r--engine/SCons/Tool/PharLapCommon.py15
-rw-r--r--engine/SCons/Tool/RCS.py6
-rw-r--r--engine/SCons/Tool/SCCS.py6
-rw-r--r--engine/SCons/Tool/Subversion.py6
-rw-r--r--engine/SCons/Tool/__init__.py68
-rw-r--r--engine/SCons/Tool/aixc++.py2
-rw-r--r--engine/SCons/Tool/aixcc.py2
-rw-r--r--engine/SCons/Tool/aixf77.py2
-rw-r--r--engine/SCons/Tool/aixlink.py2
-rw-r--r--engine/SCons/Tool/applelink.py2
-rw-r--r--engine/SCons/Tool/ar.py2
-rw-r--r--engine/SCons/Tool/as.py2
-rw-r--r--engine/SCons/Tool/bcc32.py3
-rw-r--r--engine/SCons/Tool/c++.py2
-rw-r--r--engine/SCons/Tool/cc.py20
-rw-r--r--engine/SCons/Tool/cvf.py2
-rw-r--r--engine/SCons/Tool/default.py2
-rw-r--r--engine/SCons/Tool/dmd.py5
-rw-r--r--engine/SCons/Tool/dvi.py2
-rw-r--r--engine/SCons/Tool/dvipdf.py5
-rw-r--r--engine/SCons/Tool/dvips.py2
-rw-r--r--engine/SCons/Tool/f77.py2
-rw-r--r--engine/SCons/Tool/f90.py2
-rw-r--r--engine/SCons/Tool/f95.py2
-rw-r--r--engine/SCons/Tool/filesystem.py6
-rw-r--r--engine/SCons/Tool/fortran.py3
-rw-r--r--engine/SCons/Tool/g++.py2
-rw-r--r--engine/SCons/Tool/g77.py2
-rw-r--r--engine/SCons/Tool/gas.py2
-rw-r--r--engine/SCons/Tool/gcc.py2
-rw-r--r--engine/SCons/Tool/gfortran.py2
-rw-r--r--engine/SCons/Tool/gnulink.py2
-rw-r--r--engine/SCons/Tool/gs.py4
-rw-r--r--engine/SCons/Tool/hpc++.py7
-rw-r--r--engine/SCons/Tool/hpcc.py2
-rw-r--r--engine/SCons/Tool/hplink.py2
-rw-r--r--engine/SCons/Tool/icc.py2
-rw-r--r--engine/SCons/Tool/icl.py6
-rw-r--r--engine/SCons/Tool/ifl.py6
-rw-r--r--engine/SCons/Tool/ifort.py10
-rw-r--r--engine/SCons/Tool/ilink.py2
-rw-r--r--engine/SCons/Tool/ilink32.py2
-rw-r--r--engine/SCons/Tool/install.py16
-rw-r--r--engine/SCons/Tool/intelc.py42
-rw-r--r--engine/SCons/Tool/ipkg.py10
-rw-r--r--engine/SCons/Tool/jar.py2
-rw-r--r--engine/SCons/Tool/javac.py36
-rw-r--r--engine/SCons/Tool/javah.py7
-rw-r--r--engine/SCons/Tool/latex.py4
-rw-r--r--engine/SCons/Tool/lex.py6
-rw-r--r--engine/SCons/Tool/link.py2
-rw-r--r--engine/SCons/Tool/linkloc.py4
-rw-r--r--engine/SCons/Tool/m4.py2
-rw-r--r--engine/SCons/Tool/masm.py2
-rw-r--r--engine/SCons/Tool/midl.py8
-rw-r--r--engine/SCons/Tool/mingw.py5
-rw-r--r--engine/SCons/Tool/mslib.py2
-rw-r--r--engine/SCons/Tool/mslink.py14
-rw-r--r--engine/SCons/Tool/mssdk.py2
-rw-r--r--engine/SCons/Tool/msvc.py17
-rw-r--r--engine/SCons/Tool/msvs.py233
-rw-r--r--engine/SCons/Tool/mwcc.py11
-rw-r--r--engine/SCons/Tool/mwld.py4
-rw-r--r--engine/SCons/Tool/nasm.py2
-rw-r--r--engine/SCons/Tool/packaging/__init__.py32
-rw-r--r--engine/SCons/Tool/packaging/ipk.py12
-rw-r--r--engine/SCons/Tool/packaging/msi.py27
-rw-r--r--engine/SCons/Tool/packaging/rpm.py48
-rw-r--r--engine/SCons/Tool/packaging/src_tarbz2.py2
-rw-r--r--engine/SCons/Tool/packaging/src_targz.py2
-rw-r--r--engine/SCons/Tool/packaging/src_zip.py2
-rw-r--r--engine/SCons/Tool/packaging/tarbz2.py2
-rw-r--r--engine/SCons/Tool/packaging/targz.py2
-rw-r--r--engine/SCons/Tool/packaging/zip.py2
-rw-r--r--engine/SCons/Tool/pdf.py2
-rw-r--r--engine/SCons/Tool/pdflatex.py4
-rw-r--r--engine/SCons/Tool/pdftex.py6
-rw-r--r--engine/SCons/Tool/qt.py4
-rw-r--r--engine/SCons/Tool/rmic.py5
-rw-r--r--engine/SCons/Tool/rpcgen.py2
-rw-r--r--engine/SCons/Tool/rpm.py2
-rw-r--r--engine/SCons/Tool/sgiar.py2
-rw-r--r--engine/SCons/Tool/sgic++.py2
-rw-r--r--engine/SCons/Tool/sgicc.py2
-rw-r--r--engine/SCons/Tool/sgilink.py2
-rw-r--r--engine/SCons/Tool/sunar.py2
-rw-r--r--engine/SCons/Tool/sunc++.py2
-rw-r--r--engine/SCons/Tool/suncc.py2
-rw-r--r--engine/SCons/Tool/sunf77.py2
-rw-r--r--engine/SCons/Tool/sunf90.py2
-rw-r--r--engine/SCons/Tool/sunf95.py2
-rw-r--r--engine/SCons/Tool/sunlink.py2
-rw-r--r--engine/SCons/Tool/swig.py20
-rw-r--r--engine/SCons/Tool/tar.py2
-rw-r--r--engine/SCons/Tool/tex.py38
-rw-r--r--engine/SCons/Tool/textfile.py6
-rw-r--r--engine/SCons/Tool/tlib.py2
-rw-r--r--engine/SCons/Tool/wix.py5
-rw-r--r--engine/SCons/Tool/yacc.py5
-rw-r--r--engine/SCons/Tool/zip.py13
113 files changed, 640 insertions, 665 deletions
diff --git a/engine/SCons/Tool/386asm.py b/engine/SCons/Tool/386asm.py
index 0891e96..5b8c8cb 100644
--- a/engine/SCons/Tool/386asm.py
+++ b/engine/SCons/Tool/386asm.py
@@ -32,7 +32,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/386asm.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/386asm.py 5023 2010/06/14 22:05:46 scons"
from SCons.Tool.PharLapCommon import addPharLapPaths
import SCons.Util
diff --git a/engine/SCons/Tool/BitKeeper.py b/engine/SCons/Tool/BitKeeper.py
index 121f579..a155a42 100644
--- a/engine/SCons/Tool/BitKeeper.py
+++ b/engine/SCons/Tool/BitKeeper.py
@@ -32,7 +32,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/BitKeeper.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/BitKeeper.py 5023 2010/06/14 22:05:46 scons"
import SCons.Action
import SCons.Builder
@@ -44,6 +44,8 @@ def generate(env):
def BitKeeperFactory(env=env):
""" """
+ import SCons.Warnings as W
+ W.warn(W.DeprecatedSourceCodeWarning, """The BitKeeper() factory is deprecated and there is no replacement.""")
act = SCons.Action.Action("$BITKEEPERCOM", "$BITKEEPERCOMSTR")
return SCons.Builder.Builder(action = act, env = env)
diff --git a/engine/SCons/Tool/CVS.py b/engine/SCons/Tool/CVS.py
index b30c319..bb9f956 100644
--- a/engine/SCons/Tool/CVS.py
+++ b/engine/SCons/Tool/CVS.py
@@ -8,7 +8,6 @@ selection method.
"""
-#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
@@ -29,9 +28,8 @@ selection method.
# 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__ = "src/engine/SCons/Tool/CVS.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/CVS.py 5023 2010/06/14 22:05:46 scons"
import SCons.Action
import SCons.Builder
@@ -43,6 +41,8 @@ def generate(env):
def CVSFactory(repos, module='', env=env):
""" """
+ import SCons.Warnings as W
+ W.warn(W.DeprecatedSourceCodeWarning, """The CVS() factory is deprecated and there is no replacement.""")
# fail if repos is not an absolute path name?
if module != '':
# Don't use os.path.join() because the name we fetch might
diff --git a/engine/SCons/Tool/FortranCommon.py b/engine/SCons/Tool/FortranCommon.py
index 53c48e4..db89f96 100644
--- a/engine/SCons/Tool/FortranCommon.py
+++ b/engine/SCons/Tool/FortranCommon.py
@@ -27,10 +27,9 @@ Stuff for processing Fortran, common to all fortran dialects.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/FortranCommon.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/FortranCommon.py 5023 2010/06/14 22:05:46 scons"
import re
-import string
import os.path
import SCons.Action
@@ -73,7 +72,7 @@ def _fortranEmitter(target, source, env):
# Convert module name to a .mod filename
suffix = env.subst('$FORTRANMODSUFFIX', target=target, source=source)
moddir = env.subst('$FORTRANMODDIR', target=target, source=source)
- modules = map(lambda x, s=suffix: string.lower(x) + s, modules)
+ modules = [x.lower() + suffix for x in modules]
for m in modules:
target.append(env.fs.File(m, moddir))
return (target, source)
@@ -91,8 +90,8 @@ def ComputeFortranSuffixes(suffixes, ppsuffixes):
pre-processed. Both should be sequences, not strings."""
assert len(suffixes) > 0
s = suffixes[0]
- sup = string.upper(s)
- upper_suffixes = map(string.upper, suffixes)
+ sup = s.upper()
+ upper_suffixes = [_.upper() for _ in suffixes]
if SCons.Util.case_sensitive_suffixes(s, sup):
ppsuffixes.extend(upper_suffixes)
else:
@@ -135,17 +134,17 @@ def DialectAddToEnv(env, dialect, suffixes, ppsuffixes, support_module = 0):
static_obj.add_emitter(suffix, FortranEmitter)
shared_obj.add_emitter(suffix, ShFortranEmitter)
- if not env.has_key('%sFLAGS' % dialect):
+ if '%sFLAGS' % dialect not in env:
env['%sFLAGS' % dialect] = SCons.Util.CLVar('')
- if not env.has_key('SH%sFLAGS' % dialect):
+ if 'SH%sFLAGS' % dialect not in env:
env['SH%sFLAGS' % dialect] = SCons.Util.CLVar('$%sFLAGS' % dialect)
# If a tool does not define fortran prefix/suffix for include path, use C ones
- if not env.has_key('INC%sPREFIX' % dialect):
+ if 'INC%sPREFIX' % dialect not in env:
env['INC%sPREFIX' % dialect] = '$INCPREFIX'
- if not env.has_key('INC%sSUFFIX' % dialect):
+ if 'INC%sSUFFIX' % dialect not in env:
env['INC%sSUFFIX' % dialect] = '$INCSUFFIX'
env['_%sINCFLAGS' % dialect] = '$( ${_concat(INC%sPREFIX, %sPATH, INC%sSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' % (dialect, dialect, dialect)
diff --git a/engine/SCons/Tool/JavaCommon.py b/engine/SCons/Tool/JavaCommon.py
index 635659a..bd6a30b 100644
--- a/engine/SCons/Tool/JavaCommon.py
+++ b/engine/SCons/Tool/JavaCommon.py
@@ -27,12 +27,11 @@ Stuff for processing Java.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/JavaCommon.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/JavaCommon.py 5023 2010/06/14 22:05:46 scons"
import os
import os.path
import re
-import string
java_parsing = 1
@@ -60,7 +59,7 @@ if java_parsing:
r'\d*\.\d*|[A-Za-z_][\w\$\.]*|<[A-Za-z_]\w+>|' +
r'/\*|\*/|\[\])')
- class OuterState:
+ class OuterState(object):
"""The initial state for parsing a Java file for classes,
interfaces, and anonymous inner classes."""
def __init__(self, version=default_java_version):
@@ -68,7 +67,7 @@ if java_parsing:
if not version in ('1.1', '1.2', '1.3','1.4', '1.5', '1.6',
'5', '6'):
msg = "Java version %s not supported" % version
- raise NotImplementedError, msg
+ raise NotImplementedError(msg)
self.version = version
self.listClasses = []
@@ -127,7 +126,7 @@ if java_parsing:
self.brackets = self.brackets - 1
if len(self.stackBrackets) and \
self.brackets == self.stackBrackets[-1]:
- self.listOutputs.append(string.join(self.listClasses, '$'))
+ self.listOutputs.append('$'.join(self.listClasses))
self.localClasses.pop()
self.listClasses.pop()
self.anonStacksStack.pop()
@@ -179,7 +178,7 @@ if java_parsing:
self.__getAnonStack()[-1] = self.__getAnonStack()[-1] + 1
for anon in self.__getAnonStack():
className.append(str(anon))
- self.listOutputs.append(string.join(className, '$'))
+ self.listOutputs.append('$'.join(className))
self.nextAnon = self.nextAnon + 1
self.__getAnonStack().append(0)
@@ -187,7 +186,7 @@ if java_parsing:
def setPackage(self, package):
self.package = package
- class AnonClassState:
+ class AnonClassState(object):
"""A state that looks for anonymous inner classes."""
def __init__(self, old_state):
# outer_state is always an instance of OuterState
@@ -222,7 +221,7 @@ if java_parsing:
self.outer_state.addAnonClass()
return self.old_state.parseToken(token)
- class SkipState:
+ class SkipState(object):
"""A state that will skip a specified number of tokens before
reverting to the previous state."""
def __init__(self, tokens_to_skip, old_state):
@@ -234,7 +233,7 @@ if java_parsing:
return self.old_state
return self
- class ClassState:
+ class ClassState(object):
"""A state we go into when we hit a class or interface keyword."""
def __init__(self, outer_state):
# outer_state is always an instance of OuterState
@@ -261,7 +260,7 @@ if java_parsing:
self.outer_state.anonStacksStack.append([0])
return self.outer_state
- class IgnoreState:
+ class IgnoreState(object):
"""A state that will ignore all tokens until it gets to a
specified token."""
def __init__(self, ignore_until, old_state):
@@ -272,7 +271,7 @@ if java_parsing:
return self.old_state
return self
- class PackageState:
+ class PackageState(object):
"""The state we enter when we encounter the package keyword.
We assume the next token will be the package name."""
def __init__(self, outer_state):
@@ -298,7 +297,7 @@ if java_parsing:
currstate = currstate.parseToken(token)
if trace: trace(token, currstate)
if initial.package:
- package = string.replace(initial.package, '.', os.sep)
+ package = initial.package.replace('.', os.sep)
return (package, initial.listOutputs)
else:
diff --git a/engine/SCons/Tool/MSCommon/__init__.py b/engine/SCons/Tool/MSCommon/__init__.py
index a612d9b..6389078 100644
--- a/engine/SCons/Tool/MSCommon/__init__.py
+++ b/engine/SCons/Tool/MSCommon/__init__.py
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/MSCommon/__init__.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/MSCommon/__init__.py 5023 2010/06/14 22:05:46 scons"
__doc__ = """
Common functions for Microsoft Visual Studio and Visual C/C++.
diff --git a/engine/SCons/Tool/MSCommon/arch.py b/engine/SCons/Tool/MSCommon/arch.py
index 34de46c..ba6d2d6 100644
--- a/engine/SCons/Tool/MSCommon/arch.py
+++ b/engine/SCons/Tool/MSCommon/arch.py
@@ -21,14 +21,14 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/MSCommon/arch.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/MSCommon/arch.py 5023 2010/06/14 22:05:46 scons"
__doc__ = """Module to define supported Windows chip architectures.
"""
import os
-class ArchDefinition:
+class ArchDefinition(object):
"""
A class for defining architecture-specific settings and logic.
"""
diff --git a/engine/SCons/Tool/MSCommon/common.py b/engine/SCons/Tool/MSCommon/common.py
index 2303d2b..ef1aae9 100644
--- a/engine/SCons/Tool/MSCommon/common.py
+++ b/engine/SCons/Tool/MSCommon/common.py
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/MSCommon/common.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/MSCommon/common.py 5023 2010/06/14 22:05:46 scons"
__doc__ = """
Common helper functions for working with the Microsoft tool chain.
@@ -99,46 +99,78 @@ def has_reg(value):
# Functions for fetching environment variable settings from batch files.
-def normalize_env(env, keys):
+def normalize_env(env, keys, force=False):
"""Given a dictionary representing a shell environment, add the variables
from os.environ needed for the processing of .bat files; the keys are
controlled by the keys argument.
It also makes sure the environment values are correctly encoded.
- Note: the environment is copied"""
+ If force=True, then all of the key values that exist are copied
+ into the returned dictionary. If force=false, values are only
+ copied if the key does not already exist in the copied dictionary.
+
+ Note: the environment is copied."""
normenv = {}
if env:
for k in env.keys():
normenv[k] = copy.deepcopy(env[k]).encode('mbcs')
for k in keys:
- if os.environ.has_key(k):
+ if k in os.environ and (force or not k in normenv):
normenv[k] = os.environ[k].encode('mbcs')
return normenv
def get_output(vcbat, args = None, env = None):
"""Parse the output of given bat file, with given args."""
+
+ if env is None:
+ # Create a blank environment, for use in launching the tools
+ env = SCons.Environment.Environment(tools=[])
+
+ # TODO: This is a hard-coded list of the variables that (may) need
+ # to be imported from os.environ[] for v[sc]*vars*.bat file
+ # execution to work. This list should really be either directly
+ # controlled by vc.py, or else derived from the common_tools_var
+ # settings in vs.py.
+ vars = [
+ 'COMSPEC',
+ 'VS90COMNTOOLS',
+ 'VS80COMNTOOLS',
+ 'VS71COMNTOOLS',
+ 'VS70COMNTOOLS',
+ 'VS60COMNTOOLS',
+ ]
+ env['ENV'] = normalize_env(env['ENV'], vars, force=False)
+
if args:
debug("Calling '%s %s'" % (vcbat, args))
- popen = subprocess.Popen('"%s" %s & set' % (vcbat, args),
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
- env=env)
+ popen = SCons.Action._subproc(env,
+ '"%s" %s & set' % (vcbat, args),
+ stdin = 'devnull',
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
else:
debug("Calling '%s'" % vcbat)
- popen = subprocess.Popen('"%s" & set' % vcbat,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
- env=env)
+ popen = SCons.Action._subproc(env,
+ '"%s" & set' % vcbat,
+ stdin = 'devnull',
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
# Use the .stdout and .stderr attributes directly because the
# .communicate() method uses the threading module on Windows
# and won't work under Pythons not built with threading.
stdout = popen.stdout.read()
+ stderr = popen.stderr.read()
+ if stderr:
+ # TODO: find something better to do with stderr;
+ # this at least prevents errors from getting swallowed.
+ import sys
+ sys.stderr.write(stderr)
if popen.wait() != 0:
- raise IOError(popen.stderr.read().decode("mbcs"))
+ raise IOError(stderr.decode("mbcs"))
output = stdout.decode("mbcs")
return output
@@ -147,9 +179,7 @@ def parse_output(output, keep = ("INCLUDE", "LIB", "LIBPATH", "PATH")):
# dkeep is a dict associating key: path_list, where key is one item from
# keep, and pat_list the associated list of paths
- # TODO(1.5): replace with the following list comprehension:
- #dkeep = dict([(i, []) for i in keep])
- dkeep = dict(map(lambda i: (i, []), keep))
+ dkeep = dict([(i, []) for i in keep])
# rdk will keep the regex to match the .bat file output line starts
rdk = {}
diff --git a/engine/SCons/Tool/MSCommon/netframework.py b/engine/SCons/Tool/MSCommon/netframework.py
index bd123dc..30be811 100644
--- a/engine/SCons/Tool/MSCommon/netframework.py
+++ b/engine/SCons/Tool/MSCommon/netframework.py
@@ -19,16 +19,14 @@
# 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__ = "src/engine/SCons/Tool/MSCommon/netframework.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/MSCommon/netframework.py 5023 2010/06/14 22:05:46 scons"
__doc__ = """
"""
import os
import re
-import string
from common import read_reg, debug
@@ -58,14 +56,14 @@ def query_versions():
contents = os.listdir(froot)
l = re.compile('v[0-9]+.*')
- versions = filter(lambda e, l=l: l.match(e), contents)
+ versions = [e for e in contents if l.match(e)]
def versrt(a,b):
# since version numbers aren't really floats...
aa = a[1:]
bb = b[1:]
- aal = string.split(aa, '.')
- bbl = string.split(bb, '.')
+ aal = aa.split('.')
+ bbl = bb.split('.')
# sequence comparison in python is lexicographical
# which is exactly what we want.
# Note we sort backwards so the highest version is first.
diff --git a/engine/SCons/Tool/MSCommon/sdk.py b/engine/SCons/Tool/MSCommon/sdk.py
index 54be8ca..6debeb6 100644
--- a/engine/SCons/Tool/MSCommon/sdk.py
+++ b/engine/SCons/Tool/MSCommon/sdk.py
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/MSCommon/sdk.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/MSCommon/sdk.py 5023 2010/06/14 22:05:46 scons"
__doc__ = """Module to detect the Platform/Windows SDK
@@ -58,7 +58,7 @@ _CURINSTALLED_SDK_HKEY_ROOT = \
r"Software\Microsoft\Microsoft SDKs\Windows\CurrentInstallFolder"
-class SDKDefinition:
+class SDKDefinition(object):
"""
An abstract base class for trying to find installed SDK directories.
"""
@@ -131,7 +131,7 @@ class WindowsSDK(SDKDefinition):
"""
HKEY_FMT = r'Software\Microsoft\Microsoft SDKs\Windows\v%s\InstallationFolder'
def __init__(self, *args, **kw):
- apply(SDKDefinition.__init__, (self,)+args, kw)
+ SDKDefinition.__init__(self, *args, **kw)
self.hkey_data = self.version
class PlatformSDK(SDKDefinition):
@@ -140,7 +140,7 @@ class PlatformSDK(SDKDefinition):
"""
HKEY_FMT = r'Software\Microsoft\MicrosoftSDK\InstalledSDKS\%s\Install Dir'
def __init__(self, *args, **kw):
- apply(SDKDefinition.__init__, (self,)+args, kw)
+ SDKDefinition.__init__(self, *args, **kw)
self.hkey_data = self.uuid
#
@@ -310,9 +310,9 @@ def get_cur_sdk_dir_from_reg():
return val
def get_sdk_by_version(mssdk):
- if not SupportedSDKMap.has_key(mssdk):
+ if mssdk not in SupportedSDKMap:
msg = "SDK version %s is not supported" % repr(mssdk)
- raise SCons.Errors.UserError, msg
+ raise SCons.Errors.UserError(msg)
get_installed_sdks()
return InstalledSDKMap.get(mssdk)
@@ -328,22 +328,22 @@ def get_default_sdk():
def mssdk_setup_env(env):
debug('sdk.py:mssdk_setup_env()')
- if env.has_key('MSSDK_DIR'):
+ if 'MSSDK_DIR' in env:
sdk_dir = env['MSSDK_DIR']
if sdk_dir is None:
return
sdk_dir = env.subst(sdk_dir)
debug('sdk.py:mssdk_setup_env: Using MSSDK_DIR:%s'%sdk_dir)
- elif env.has_key('MSSDK_VERSION'):
+ elif 'MSSDK_VERSION' in env:
sdk_version = env['MSSDK_VERSION']
if sdk_version is None:
msg = "SDK version %s is not installed" % repr(mssdk)
- raise SCons.Errors.UserError, msg
+ raise SCons.Errors.UserError(msg)
sdk_version = env.subst(sdk_version)
mssdk = get_sdk_by_version(sdk_version)
sdk_dir = mssdk.get_sdk_dir()
debug('sdk.py:mssdk_setup_env: Using MSSDK_VERSION:%s'%sdk_dir)
- elif env.has_key('MSVS_VERSION'):
+ elif 'MSVS_VERSION' in env:
msvs_version = env['MSVS_VERSION']
debug('sdk.py:mssdk_setup_env:Getting MSVS_VERSION from env:%s'%msvs_version)
if msvs_version is None:
@@ -382,7 +382,7 @@ def mssdk_exists(version=None):
sdks = get_installed_sdks()
if version is None:
return len(sdks) > 0
- return sdks.has_key(version)
+ return version in sdks
# Local Variables:
# tab-width:4
diff --git a/engine/SCons/Tool/MSCommon/vc.py b/engine/SCons/Tool/MSCommon/vc.py
index 5ea5a53..f07f34c 100644
--- a/engine/SCons/Tool/MSCommon/vc.py
+++ b/engine/SCons/Tool/MSCommon/vc.py
@@ -30,15 +30,15 @@
# * test on 64 bits XP + VS 2005 (and VS 6 if possible)
# * SDK
# * Assembly
-__revision__ = "src/engine/SCons/Tool/MSCommon/vc.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/MSCommon/vc.py 5023 2010/06/14 22:05:46 scons"
__doc__ = """Module for Visual C/C++ detection and configuration.
"""
import SCons.compat
-import string
import os
import platform
+from string import digits as string_digits
import SCons.Warnings
@@ -71,13 +71,16 @@ class BatchFileExecutionError(VisualCException):
# Dict to 'canonalize' the arch
_ARCH_TO_CANONICAL = {
- "x86": "x86",
- "amd64": "amd64",
- "i386": "x86",
- "emt64": "amd64",
- "x86_64": "amd64",
- "itanium": "ia64",
- "ia64": "ia64",
+ "amd64" : "amd64",
+ "emt64" : "amd64",
+ "i386" : "x86",
+ "i486" : "x86",
+ "i586" : "x86",
+ "i686" : "x86",
+ "ia64" : "ia64",
+ "itanium" : "ia64",
+ "x86" : "x86",
+ "x86_64" : "amd64",
}
# Given a (host, target) tuple, return the argument for the bat file. Both host
@@ -91,6 +94,8 @@ _HOST_TARGET_ARCH_TO_BAT_ARCH = {
}
def get_host_target(env):
+ debug('vc.py:get_host_target()')
+
host_platform = env.get('HOST_ARCH')
if not host_platform:
host_platform = platform.machine()
@@ -99,22 +104,29 @@ def get_host_target(env):
# PROCESSOR_ARCHITECTURE.
if not host_platform:
host_platform = os.environ.get('PROCESSOR_ARCHITECTURE', '')
- target_platform = env.get('TARGET_ARCH')
- if not target_platform:
+
+ # Retain user requested TARGET_ARCH
+ req_target_platform = env.get('TARGET_ARCH')
+ debug('vc.py:get_host_target() req_target_platform:%s'%req_target_platform)
+
+ if req_target_platform:
+ # If user requested a specific platform then only try that one.
+ target_platform = req_target_platform
+ else:
target_platform = host_platform
-
+
try:
- host = _ARCH_TO_CANONICAL[host_platform]
+ host = _ARCH_TO_CANONICAL[host_platform.lower()]
except KeyError, e:
msg = "Unrecognized host architecture %s"
raise ValueError(msg % repr(host_platform))
try:
- target = _ARCH_TO_CANONICAL[target_platform]
+ target = _ARCH_TO_CANONICAL[target_platform.lower()]
except KeyError, e:
raise ValueError("Unrecognized target architecture %s" % target_platform)
- return (host, target)
+ return (host, target,req_target_platform)
_VCVER = ["10.0", "9.0", "9.0Exp","8.0", "8.0Exp","7.1", "7.0", "6.0"]
@@ -136,17 +148,19 @@ _VCVER_TO_PRODUCT_DIR = {
'6.0': [
r'Microsoft\VisualStudio\6.0\Setup\Microsoft Visual C++\ProductDir']
}
-
+
def msvc_version_to_maj_min(msvc_version):
- t = msvc_version.split(".")
- if not len(t) == 2:
- raise ValueError("Unrecognized version %s" % msvc_version)
- try:
- maj = int(t[0])
- min = int(t[1])
- return maj, min
- except ValueError, e:
- raise ValueError("Unrecognized version %s" % msvc_version)
+ msvc_version_numeric = ''.join([x for x in msvc_version if x in string_digits + '.'])
+
+ t = msvc_version_numeric.split(".")
+ if not len(t) == 2:
+ raise ValueError("Unrecognized version %s (%s)" % (msvc_version,msvc_version_numeric))
+ try:
+ maj = int(t[0])
+ min = int(t[1])
+ return maj, min
+ except ValueError, e:
+ raise ValueError("Unrecognized version %s (%s)" % (msvc_version,msvc_version_numeric))
def is_host_target_supported(host_target, msvc_version):
"""Return True if the given (host, target) tuple is supported given the
@@ -206,7 +220,7 @@ def find_vc_pdir(msvc_version):
raise MissingConfiguration("registry dir %s not found on the filesystem" % comps)
return None
-def find_batch_file(env,msvc_version):
+def find_batch_file(env,msvc_version,host_arch,target_arch):
"""
Find the location of the batch script which should set up the compiler
for any TARGET_ARCH whose compilers were installed by Visual Studio/VCExpress
@@ -218,7 +232,7 @@ def find_batch_file(env,msvc_version):
debug('vc.py: find_batch_file() pdir:%s'%pdir)
# filter out e.g. "Exp" from the version name
- msvc_ver_numeric = string.join(filter(lambda x: x in string.digits + ".", msvc_version), '')
+ msvc_ver_numeric = ''.join([x for x in msvc_version if x in string_digits + "."])
vernum = float(msvc_ver_numeric)
if 7 <= vernum < 8:
pdir = os.path.join(pdir, os.pardir, "Common7", "Tools")
@@ -234,7 +248,6 @@ def find_batch_file(env,msvc_version):
batfilename = None
installed_sdks=get_installed_sdks()
- (host_arch,target_arch)=get_host_target(env)
for _sdk in installed_sdks:
sdk_bat_file=_sdk.get_sdk_vc_script(host_arch,target_arch)
sdk_bat_file_path=os.path.join(pdir,sdk_bat_file)
@@ -330,6 +343,73 @@ def msvc_setup_env_once(env):
msvc_setup_env(env)
env["MSVC_SETUP_RUN"] = True
+def msvc_find_valid_batch_script(env,version):
+ debug('vc.py:msvc_find_valid_batch_script()')
+ # Find the host platform, target platform, and if present the requested
+ # target platform
+ (host_platform, target_platform,req_target_platform) = get_host_target(env)
+
+ # If the user hasn't specifically requested a TARGET_ARCH, and
+ # The TARGET_ARCH is amd64 then also try 32 bits if there are no viable
+ # 64 bit tools installed
+ try_target_archs = [target_platform]
+ if not req_target_platform and target_platform=='amd64':
+ try_target_archs.append('x86')
+
+ d = None
+ for tp in try_target_archs:
+ # Set to current arch.
+ env['TARGET_ARCH']=tp
+
+ debug("vc.py:msvc_find_valid_batch_script() trying target_platform:%s"%tp)
+ host_target = (host_platform, tp)
+ if not is_host_target_supported(host_target, version):
+ warn_msg = "host, target = %s not supported for MSVC version %s" % \
+ (host_target, version)
+ SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg)
+ arg = _HOST_TARGET_ARCH_TO_BAT_ARCH[host_target]
+
+ # Try to locate a batch file for this host/target platform combo
+ try:
+ (vc_script,sdk_script) = find_batch_file(env,version,host_platform,tp)
+ debug('vc.py:msvc_find_valid_batch_script() vc_script:%s sdk_script:%s'%(vc_script,sdk_script))
+ except VisualCException, e:
+ msg = str(e)
+ debug('Caught exception while looking for batch file (%s)' % msg)
+ warn_msg = "VC version %s not installed. " + \
+ "C/C++ compilers are most likely not set correctly.\n" + \
+ " Installed versions are: %s"
+ warn_msg = warn_msg % (version, cached_get_installed_vcs())
+ SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg)
+ continue
+
+ # Try to use the located batch file for this host/target platform combo
+ debug('vc.py:msvc_find_valid_batch_script() use_script 2 %s, args:%s\n' % (repr(vc_script), arg))
+ if vc_script:
+ try:
+ d = script_env(vc_script, args=arg)
+ except BatchFileExecutionError, e:
+ debug('vc.py:msvc_find_valid_batch_script() use_script 3: failed running VC script %s: %s: Error:%s'%(repr(vc_script),arg,e))
+ vc_script=None
+ 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=[])
+ 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
+ elif not vc_script and not sdk_script:
+ debug('vc.py:msvc_find_valid_batch_script() use_script 6: Neither VC script nor SDK script found')
+ continue
+
+ # If we cannot find a viable installed compiler, reset the TARGET_ARCH
+ # To it's initial value
+ if not d:
+ env['TARGET_ARCH']=req_target_platform
+
+ return d
+
+
def msvc_setup_env(env):
debug('msvc_setup_env()')
@@ -347,50 +427,16 @@ def msvc_setup_env(env):
env['MSVS_VERSION'] = version
env['MSVS'] = {}
- try:
- (vc_script,sdk_script) = find_batch_file(env,version)
- debug('vc.py:msvc_setup_env() vc_script:%s sdk_script:%s'%(vc_script,sdk_script))
- except VisualCException, e:
- msg = str(e)
- debug('Caught exception while looking for batch file (%s)' % msg)
- warn_msg = "VC version %s not installed. " + \
- "C/C++ compilers are most likely not set correctly.\n" + \
- " Installed versions are: %s"
- warn_msg = warn_msg % (version, cached_get_installed_vcs())
- SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg)
- return None
- debug('vc.py:msvc_setup_env() vc_script:%s sdk_script:%s'%(vc_script,sdk_script))
use_script = env.get('MSVC_USE_SCRIPT', True)
if SCons.Util.is_String(use_script):
- debug('use_script 1 %s\n' % repr(use_script))
+ debug('vc.py:msvc_setup_env() use_script 1 %s\n' % repr(use_script))
d = script_env(use_script)
- elif use_script:
- host_platform, target_platform = get_host_target(env)
- host_target = (host_platform, target_platform)
- if not is_host_target_supported(host_target, version):
- warn_msg = "host, target = %s not supported for MSVC version %s" % \
- (host_target, version)
- SCons.Warnings.warn(SCons.Warnings.VisualCMissingWarning, warn_msg)
- arg = _HOST_TARGET_ARCH_TO_BAT_ARCH[host_target]
- debug('use_script 2 %s, args:%s\n' % (repr(vc_script), arg))
- if vc_script:
- try:
- d = script_env(vc_script, args=arg)
- except BatchFileExecutionError, e:
- debug('use_script 3: failed running VC script %s: %s: Error:%s'%(repr(vc_script),arg,e))
- vc_script=None
- if not vc_script and sdk_script:
- debug('use_script 4: trying sdk script: %s'%(sdk_script))
- try:
- d = script_env(sdk_script,args=[])
- except BatchFileExecutionError,e:
- debug('use_script 5: failed running SDK script %s: Error:%s'%(repr(sdk_script),e))
- return None
- elif not vc_script and not sdk_script:
- debug('use_script 6: Neither VC script nor SDK script found')
- return None
-
+ elif use_script:
+ d = msvc_find_valid_batch_script(env,version)
+ debug('vc.py:msvc_setup_env() use_script 2 %s\n' % d)
+ if not d:
+ return d
else:
debug('MSVC_USE_SCRIPT set to False')
warn_msg = "MSVC_USE_SCRIPT set to False, assuming environment " \
diff --git a/engine/SCons/Tool/MSCommon/vs.py b/engine/SCons/Tool/MSCommon/vs.py
index e634a18..06030e2 100644
--- a/engine/SCons/Tool/MSCommon/vs.py
+++ b/engine/SCons/Tool/MSCommon/vs.py
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/MSCommon/vs.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/MSCommon/vs.py 5023 2010/06/14 22:05:46 scons"
__doc__ = """Module to detect Visual Studio and/or Visual C/C++
"""
@@ -40,7 +40,7 @@ from common import debug, \
import SCons.Tool.MSCommon.vc
-class VisualStudio:
+class VisualStudio(object):
"""
An abstract base class for trying to find installed versions of
Visual Studio.
@@ -385,9 +385,9 @@ def get_vs_by_version(msvs):
global SupportedVSMap
debug('vs.py:get_vs_by_version()')
- if not SupportedVSMap.has_key(msvs):
+ if msvs not in SupportedVSMap:
msg = "Visual Studio version %s is not supported" % repr(msvs)
- raise SCons.Errors.UserError, msg
+ raise SCons.Errors.UserError(msg)
get_installed_visual_studios()
vs = InstalledVSMap.get(msvs)
debug('InstalledVSMap:%s'%InstalledVSMap)
@@ -415,15 +415,13 @@ def get_default_version(env):
version: str
the default version.
"""
- if not env.has_key('MSVS') or not SCons.Util.is_Dict(env['MSVS']):
- # TODO(1.5):
- #versions = [vs.version for vs in get_installed_visual_studios()]
- versions = map(lambda vs: vs.version, get_installed_visual_studios())
+ if 'MSVS' not in env or not SCons.Util.is_Dict(env['MSVS']):
+ versions = [vs.version for vs in get_installed_visual_studios()]
env['MSVS'] = {'VERSIONS' : versions}
else:
versions = env['MSVS'].get('VERSIONS', [])
- if not env.has_key('MSVS_VERSION'):
+ if 'MSVS_VERSION' not in env:
if versions:
env['MSVS_VERSION'] = versions[0] #use highest version by default
else:
@@ -451,7 +449,7 @@ def get_default_arch(env):
arch = 'x86'
elif not arch in msvs.get_supported_arch():
fmt = "Visual Studio version %s does not support architecture %s"
- raise SCons.Errors.UserError, fmt % (env['MSVS_VERSION'], arch)
+ raise SCons.Errors.UserError(fmt % (env['MSVS_VERSION'], arch))
return arch
@@ -473,11 +471,15 @@ def msvs_setup_env(env):
vars = ('LIB', 'LIBPATH', 'PATH', 'INCLUDE')
msvs_list = get_installed_visual_studios()
- # TODO(1.5):
- #vscommonvarnames = [ vs.common_tools_var for vs in msvs_list ]
- vscommonvarnames = map(lambda vs: vs.common_tools_var, msvs_list)
- nenv = normalize_env(env['ENV'], vscommonvarnames + ['COMSPEC'])
- output = get_output(batfilename, arch, env=nenv)
+ vscommonvarnames = [vs.common_tools_var for vs in msvs_list]
+ save_ENV = env['ENV']
+ nenv = normalize_env(env['ENV'],
+ ['COMSPEC'] + vscommonvarnames,
+ force=True)
+ try:
+ output = get_output(batfilename, arch, env=nenv)
+ finally:
+ env['ENV'] = save_ENV
vars = parse_output(output, vars)
for k, v in vars.items():
@@ -487,9 +489,7 @@ def query_versions():
"""Query the system to get available versions of VS. A version is
considered when a batfile is found."""
msvs_list = get_installed_visual_studios()
- # TODO(1.5)
- #versions = [ msvs.version for msvs in msvs_list ]
- versions = map(lambda msvs: msvs.version, msvs_list)
+ versions = [msvs.version for msvs in msvs_list]
return versions
# Local Variables:
diff --git a/engine/SCons/Tool/Perforce.py b/engine/SCons/Tool/Perforce.py
index 08da75b..43d9f6e 100644
--- a/engine/SCons/Tool/Perforce.py
+++ b/engine/SCons/Tool/Perforce.py
@@ -8,7 +8,6 @@ selection method.
"""
-#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
@@ -29,9 +28,8 @@ selection method.
# 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__ = "src/engine/SCons/Tool/Perforce.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/Perforce.py 5023 2010/06/14 22:05:46 scons"
import os
@@ -44,7 +42,6 @@ import SCons.Util
from SCons.Tool.PharLapCommon import addPathIfNotExists
-
# Variables that we want to import from the base OS environment.
_import_env = [ 'P4PORT', 'P4CLIENT', 'P4USER', 'USER', 'USERNAME', 'P4PASSWD',
'P4CHARSET', 'P4LANGUAGE', 'SystemRoot' ]
@@ -57,6 +54,8 @@ def generate(env):
def PerforceFactory(env=env):
""" """
+ import SCons.Warnings as W
+ W.warn(W.DeprecatedSourceCodeWarning, """The Perforce() factory is deprecated and there is no replacement.""")
return SCons.Builder.Builder(action = PerforceAction, env = env)
#setattr(env, 'Perforce', PerforceFactory)
diff --git a/engine/SCons/Tool/PharLapCommon.py b/engine/SCons/Tool/PharLapCommon.py
index 2cfb02a..64dd02f 100644
--- a/engine/SCons/Tool/PharLapCommon.py
+++ b/engine/SCons/Tool/PharLapCommon.py
@@ -29,14 +29,13 @@ Phar Lap ETS tool chain. Right now, this is linkloc and
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/PharLapCommon.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/PharLapCommon.py 5023 2010/06/14 22:05:46 scons"
import os
import os.path
import SCons.Errors
import SCons.Util
import re
-import string
def getPharLapPath():
"""Reads the registry to find the installed path of the Phar Lap ETS
@@ -46,7 +45,7 @@ def getPharLapPath():
be found."""
if not SCons.Util.can_read_reg:
- raise SCons.Errors.InternalError, "No Windows registry module was found"
+ raise SCons.Errors.InternalError("No Windows registry module was found")
try:
k=SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE,
'SOFTWARE\\Pharlap\\ETS')
@@ -62,7 +61,7 @@ def getPharLapPath():
return os.path.normpath(val)
except SCons.Util.RegError:
- raise SCons.Errors.UserError, "Cannot find Phar Lap ETS path in the registry. Is it installed properly?"
+ raise SCons.Errors.UserError("Cannot find Phar Lap ETS path in the registry. Is it installed properly?")
REGEX_ETS_VER = re.compile(r'#define\s+ETS_VER\s+([0-9]+)')
@@ -79,7 +78,7 @@ def getPharLapVersion():
include_path = os.path.join(getPharLapPath(), os.path.normpath("include/embkern.h"))
if not os.path.exists(include_path):
- raise SCons.Errors.UserError, "Cannot find embkern.h in ETS include directory.\nIs Phar Lap ETS installed properly?"
+ raise SCons.Errors.UserError("Cannot find embkern.h in ETS include directory.\nIs Phar Lap ETS installed properly?")
mo = REGEX_ETS_VER.search(open(include_path, 'r').read())
if mo:
return int(mo.group(1))
@@ -97,14 +96,14 @@ def addPathIfNotExists(env_dict, key, path, sep=os.pathsep):
is_list = 1
paths = env_dict[key]
if not SCons.Util.is_List(env_dict[key]):
- paths = string.split(paths, sep)
+ paths = paths.split(sep)
is_list = 0
- if not os.path.normcase(path) in map(os.path.normcase, paths):
+ if os.path.normcase(path) not in list(map(os.path.normcase, paths)):
paths = [ path ] + paths
if is_list:
env_dict[key] = paths
else:
- env_dict[key] = string.join(paths, sep)
+ env_dict[key] = sep.join(paths)
except KeyError:
env_dict[key] = path
diff --git a/engine/SCons/Tool/RCS.py b/engine/SCons/Tool/RCS.py
index 4d14af7..5c5a6bd 100644
--- a/engine/SCons/Tool/RCS.py
+++ b/engine/SCons/Tool/RCS.py
@@ -8,7 +8,6 @@ selection method.
"""
-#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
@@ -29,9 +28,8 @@ selection method.
# 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__ = "src/engine/SCons/Tool/RCS.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/RCS.py 5023 2010/06/14 22:05:46 scons"
import SCons.Action
import SCons.Builder
@@ -43,6 +41,8 @@ def generate(env):
def RCSFactory(env=env):
""" """
+ import SCons.Warnings as W
+ W.warn(W.DeprecatedSourceCodeWarning, """The RCS() factory is deprecated and there is no replacement.""")
act = SCons.Action.Action('$RCS_COCOM', '$RCS_COCOMSTR')
return SCons.Builder.Builder(action = act, env = env)
diff --git a/engine/SCons/Tool/SCCS.py b/engine/SCons/Tool/SCCS.py
index 2893291..2983b83 100644
--- a/engine/SCons/Tool/SCCS.py
+++ b/engine/SCons/Tool/SCCS.py
@@ -8,7 +8,6 @@ selection method.
"""
-#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
@@ -29,9 +28,8 @@ selection method.
# 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__ = "src/engine/SCons/Tool/SCCS.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/SCCS.py 5023 2010/06/14 22:05:46 scons"
import SCons.Action
import SCons.Builder
@@ -43,6 +41,8 @@ def generate(env):
def SCCSFactory(env=env):
""" """
+ import SCons.Warnings as W
+ W.warn(W.DeprecatedSourceCodeWarning, """The SCCS() factory is deprecated and there is no replacement.""")
act = SCons.Action.Action('$SCCSCOM', '$SCCSCOMSTR')
return SCons.Builder.Builder(action = act, env = env)
diff --git a/engine/SCons/Tool/Subversion.py b/engine/SCons/Tool/Subversion.py
index 51a670a..26ff700 100644
--- a/engine/SCons/Tool/Subversion.py
+++ b/engine/SCons/Tool/Subversion.py
@@ -8,7 +8,6 @@ selection method.
"""
-#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
@@ -29,9 +28,8 @@ selection method.
# 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__ = "src/engine/SCons/Tool/Subversion.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/Subversion.py 5023 2010/06/14 22:05:46 scons"
import os.path
@@ -46,6 +44,8 @@ def generate(env):
def SubversionFactory(repos, module='', env=env):
""" """
# fail if repos is not an absolute path name?
+ import SCons.Warnings as W
+ W.warn(W.DeprecatedSourceCodeWarning, """The Subversion() factory is deprecated and there is no replacement.""")
if module != '':
module = os.path.join(module, '')
act = SCons.Action.Action('$SVNCOM', '$SVNCOMSTR')
diff --git a/engine/SCons/Tool/__init__.py b/engine/SCons/Tool/__init__.py
index 4a41a8c..e38d85f 100644
--- a/engine/SCons/Tool/__init__.py
+++ b/engine/SCons/Tool/__init__.py
@@ -34,9 +34,8 @@ tool definition.
# 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__ = "src/engine/SCons/Tool/__init__.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/__init__.py 5023 2010/06/14 22:05:46 scons"
import imp
import sys
@@ -85,7 +84,7 @@ for suffix in LaTeXSuffixes:
SourceFileScanner.add_scanner(suffix, LaTeXScanner)
SourceFileScanner.add_scanner(suffix, PDFLaTeXScanner)
-class Tool:
+class Tool(object):
def __init__(self, name, toolpath=[], **kw):
self.name = name
self.toolpath = toolpath + DefaultToolpath
@@ -113,7 +112,7 @@ class Tool:
file.close()
except ImportError, e:
if str(e)!="No module named %s"%self.name:
- raise SCons.Errors.EnvironmentError, e
+ raise SCons.Errors.EnvironmentError(e)
try:
import zipimport
except ImportError:
@@ -143,7 +142,7 @@ class Tool:
return module
except ImportError, e:
if str(e)!="No module named %s"%self.name:
- raise SCons.Errors.EnvironmentError, e
+ raise SCons.Errors.EnvironmentError(e)
try:
import zipimport
importer = zipimport.zipimporter( sys.modules['SCons.Tool'].__path__[0] )
@@ -152,10 +151,10 @@ class Tool:
return module
except ImportError, e:
m = "No tool named '%s': %s" % (self.name, e)
- raise SCons.Errors.EnvironmentError, m
+ raise SCons.Errors.EnvironmentError(m)
except ImportError, e:
m = "No tool named '%s': %s" % (self.name, e)
- raise SCons.Errors.EnvironmentError, m
+ raise SCons.Errors.EnvironmentError(m)
def __call__(self, env, *args, **kw):
if self.init_kw is not None:
@@ -170,7 +169,7 @@ class Tool:
env.Append(TOOLS = [ self.name ])
if hasattr(self, 'options'):
import SCons.Variables
- if not env.has_key('options'):
+ if 'options' not in env:
from SCons.Script import ARGUMENTS
env['options']=SCons.Variables.Variables(args=ARGUMENTS)
opts=env['options']
@@ -178,7 +177,7 @@ class Tool:
self.options(opts)
opts.Update(env)
- apply(self.generate, ( env, ) + args, kw)
+ self.generate(env, *args, **kw)
def __str__(self):
return self.name
@@ -428,7 +427,7 @@ def CreateJavaFileBuilder(env):
env['JAVASUFFIX'] = '.java'
return java_file
-class ToolInitializerMethod:
+class ToolInitializerMethod(object):
"""
This is added to a construction environment in place of a
method(s) normally called for a Builder (env.Object, env.StaticObject,
@@ -474,9 +473,9 @@ class ToolInitializerMethod:
builder = self.get_builder(env)
if builder is None:
return [], []
- return apply(builder, args, kw)
+ return builder(*args, **kw)
-class ToolInitializer:
+class ToolInitializer(object):
"""
A class for delayed initialization of Tools modules.
@@ -530,9 +529,9 @@ class ToolInitializer:
def Initializers(env):
ToolInitializer(env, ['install'], ['_InternalInstall', '_InternalInstallAs'])
def Install(self, *args, **kw):
- return apply(self._InternalInstall, args, kw)
+ return self._InternalInstall(*args, **kw)
def InstallAs(self, *args, **kw):
- return apply(self._InternalInstallAs, args, kw)
+ return self._InternalInstallAs(*args, **kw)
env.AddMethod(Install)
env.AddMethod(InstallAs)
@@ -546,7 +545,7 @@ def FindTool(tools, env):
def FindAllTools(tools, env):
def ToolExists(tool, env=env):
return Tool(tool).exists(env)
- return filter (ToolExists, tools)
+ return list(filter (ToolExists, tools))
def tool_list(platform, env):
@@ -646,27 +645,34 @@ def tool_list(platform, env):
fortran_compiler = FindTool(fortran_compilers, env) or fortran_compilers[0]
ar = FindTool(ars, env) or ars[0]
- other_tools = FindAllTools(['BitKeeper', 'CVS',
- 'dmd',
- 'filesystem',
- 'dvipdf', 'dvips', 'gs',
- 'jar', 'javac', 'javah',
- 'latex', 'lex',
- 'm4', #'midl', 'msvs',
- 'pdflatex', 'pdftex', 'Perforce',
- 'RCS', 'rmic', 'rpcgen',
- 'SCCS',
- # 'Subversion',
- 'swig',
- 'tar', 'tex',
- 'yacc', 'zip', 'rpm', 'wix']+other_plat_tools,
- env)
+ other_tools = FindAllTools(other_plat_tools + [
+ 'dmd',
+ #TODO: merge 'install' into 'filesystem' and
+ # make 'filesystem' the default
+ 'filesystem',
+ 'm4',
+ 'wix', #'midl', 'msvs',
+ # Parser generators
+ 'lex', 'yacc',
+ # Foreign function interface
+ 'rpcgen', 'swig',
+ # Java
+ 'jar', 'javac', 'javah', 'rmic',
+ # TeX
+ 'dvipdf', 'dvips', 'gs',
+ 'tex', 'latex', 'pdflatex', 'pdftex',
+ # Archivers
+ 'tar', 'zip', 'rpm',
+ # SourceCode factories
+ 'BitKeeper', 'CVS', 'Perforce',
+ 'RCS', 'SCCS', # 'Subversion',
+ ], env)
tools = ([linker, c_compiler, cxx_compiler,
fortran_compiler, assembler, ar]
+ other_tools)
- return filter(lambda x: x, tools)
+ return [x for x in tools if x]
# Local Variables:
# tab-width:4
diff --git a/engine/SCons/Tool/aixc++.py b/engine/SCons/Tool/aixc++.py
index 035ece4..62c5ef7 100644
--- a/engine/SCons/Tool/aixc++.py
+++ b/engine/SCons/Tool/aixc++.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/aixc++.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/aixc++.py 5023 2010/06/14 22:05:46 scons"
import os.path
diff --git a/engine/SCons/Tool/aixcc.py b/engine/SCons/Tool/aixcc.py
index 1c6ae14..bf1de34 100644
--- a/engine/SCons/Tool/aixcc.py
+++ b/engine/SCons/Tool/aixcc.py
@@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/aixcc.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/aixcc.py 5023 2010/06/14 22:05:46 scons"
import os.path
diff --git a/engine/SCons/Tool/aixf77.py b/engine/SCons/Tool/aixf77.py
index a5a9d8c..f680247 100644
--- a/engine/SCons/Tool/aixf77.py
+++ b/engine/SCons/Tool/aixf77.py
@@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/aixf77.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/aixf77.py 5023 2010/06/14 22:05:46 scons"
import os.path
diff --git a/engine/SCons/Tool/aixlink.py b/engine/SCons/Tool/aixlink.py
index 0e1b974..9531a4b 100644
--- a/engine/SCons/Tool/aixlink.py
+++ b/engine/SCons/Tool/aixlink.py
@@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/aixlink.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/aixlink.py 5023 2010/06/14 22:05:46 scons"
import os
import os.path
diff --git a/engine/SCons/Tool/applelink.py b/engine/SCons/Tool/applelink.py
index a56462d..4b3ae77 100644
--- a/engine/SCons/Tool/applelink.py
+++ b/engine/SCons/Tool/applelink.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/applelink.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/applelink.py 5023 2010/06/14 22:05:46 scons"
import SCons.Util
diff --git a/engine/SCons/Tool/ar.py b/engine/SCons/Tool/ar.py
index b0ae76b..68effb1 100644
--- a/engine/SCons/Tool/ar.py
+++ b/engine/SCons/Tool/ar.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/ar.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/ar.py 5023 2010/06/14 22:05:46 scons"
import SCons.Defaults
import SCons.Tool
diff --git a/engine/SCons/Tool/as.py b/engine/SCons/Tool/as.py
index bdd00db..f18ff57 100644
--- a/engine/SCons/Tool/as.py
+++ b/engine/SCons/Tool/as.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/as.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/as.py 5023 2010/06/14 22:05:46 scons"
import SCons.Defaults
import SCons.Tool
diff --git a/engine/SCons/Tool/bcc32.py b/engine/SCons/Tool/bcc32.py
index 67325d0..b7c7bf2 100644
--- a/engine/SCons/Tool/bcc32.py
+++ b/engine/SCons/Tool/bcc32.py
@@ -27,11 +27,10 @@ XXX
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/bcc32.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/bcc32.py 5023 2010/06/14 22:05:46 scons"
import os
import os.path
-import string
import SCons.Defaults
import SCons.Tool
diff --git a/engine/SCons/Tool/c++.py b/engine/SCons/Tool/c++.py
index d74cd96..907324d 100644
--- a/engine/SCons/Tool/c++.py
+++ b/engine/SCons/Tool/c++.py
@@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/c++.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/c++.py 5023 2010/06/14 22:05:46 scons"
import os.path
diff --git a/engine/SCons/Tool/cc.py b/engine/SCons/Tool/cc.py
index c565225..c3a6b92 100644
--- a/engine/SCons/Tool/cc.py
+++ b/engine/SCons/Tool/cc.py
@@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/cc.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/cc.py 5023 2010/06/14 22:05:46 scons"
import SCons.Tool
import SCons.Defaults
@@ -45,7 +45,7 @@ def add_common_cc_variables(env):
Add underlying common "C compiler" variables that
are used by multiple tools (specifically, c++).
"""
- if not env.has_key('_CCCOMCOM'):
+ if '_CCCOMCOM' not in env:
env['_CCCOMCOM'] = '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS'
# It's a hack to test for darwin here, but the alternative
# of creating an applecc.py to contain this seems overkill.
@@ -56,10 +56,10 @@ def add_common_cc_variables(env):
if env['PLATFORM'] == 'darwin':
env['_CCCOMCOM'] = env['_CCCOMCOM'] + ' $_FRAMEWORKPATH'
- if not env.has_key('CCFLAGS'):
+ if 'CCFLAGS' not in env:
env['CCFLAGS'] = SCons.Util.CLVar('')
- if not env.has_key('SHCCFLAGS'):
+ if 'SHCCFLAGS' not in env:
env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS')
def generate(env):
@@ -73,18 +73,6 @@ def generate(env):
shared_obj.add_action(suffix, SCons.Defaults.ShCAction)
static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter)
shared_obj.add_emitter(suffix, SCons.Defaults.SharedObjectEmitter)
-#<<<<<<< .working
-#
-# env['_CCCOMCOM'] = '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS'
-# # It's a hack to test for darwin here, but the alternative of creating
-# # an applecc.py to contain this seems overkill. Maybe someday the Apple
-# # platform will require more setup and this logic will be moved.
-# env['FRAMEWORKS'] = SCons.Util.CLVar('')
-# env['FRAMEWORKPATH'] = SCons.Util.CLVar('')
-# if env['PLATFORM'] == 'darwin':
-# env['_CCCOMCOM'] = env['_CCCOMCOM'] + ' $_FRAMEWORKPATH'
-#=======
-#>>>>>>> .merge-right.r1907
add_common_cc_variables(env)
diff --git a/engine/SCons/Tool/cvf.py b/engine/SCons/Tool/cvf.py
index 7930a38..4860241 100644
--- a/engine/SCons/Tool/cvf.py
+++ b/engine/SCons/Tool/cvf.py
@@ -27,7 +27,7 @@ Tool-specific initialization for the Compaq Visual Fortran compiler.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/cvf.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/cvf.py 5023 2010/06/14 22:05:46 scons"
import fortran
diff --git a/engine/SCons/Tool/default.py b/engine/SCons/Tool/default.py
index b477c7b..a2883d7 100644
--- a/engine/SCons/Tool/default.py
+++ b/engine/SCons/Tool/default.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/default.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/default.py 5023 2010/06/14 22:05:46 scons"
import SCons.Tool
diff --git a/engine/SCons/Tool/dmd.py b/engine/SCons/Tool/dmd.py
index d5dc5c1..a269354 100644
--- a/engine/SCons/Tool/dmd.py
+++ b/engine/SCons/Tool/dmd.py
@@ -54,10 +54,9 @@ Lib tool variables:
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/dmd.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/dmd.py 5023 2010/06/14 22:05:46 scons"
import os
-import string
import SCons.Action
import SCons.Builder
@@ -112,7 +111,7 @@ def generate(env):
# This is merely for the convenience of the dependency scanner.
dmd_path = env.WhereIs(dc)
if dmd_path:
- x = string.rindex(dmd_path, dc)
+ x = dmd_path.rindex(dc)
phobosDir = dmd_path[:x] + '/../src/phobos'
if os.path.isdir(phobosDir):
env.Append(DPATH = [phobosDir])
diff --git a/engine/SCons/Tool/dvi.py b/engine/SCons/Tool/dvi.py
index ce91cca..7eb9de4 100644
--- a/engine/SCons/Tool/dvi.py
+++ b/engine/SCons/Tool/dvi.py
@@ -27,7 +27,7 @@ Common DVI Builder definition for various other Tool modules that use it.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/dvi.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/dvi.py 5023 2010/06/14 22:05:46 scons"
import SCons.Builder
import SCons.Tool
diff --git a/engine/SCons/Tool/dvipdf.py b/engine/SCons/Tool/dvipdf.py
index cf6909d..1b352b3 100644
--- a/engine/SCons/Tool/dvipdf.py
+++ b/engine/SCons/Tool/dvipdf.py
@@ -29,9 +29,8 @@ selection method.
# 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__ = "src/engine/SCons/Tool/dvipdf.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/dvipdf.py 5023 2010/06/14 22:05:46 scons"
import SCons.Action
import SCons.Defaults
@@ -88,7 +87,7 @@ def PDFEmitter(target, source, env):
"""
def strip_suffixes(n):
return not SCons.Util.splitext(str(n))[1] in ['.aux', '.log']
- source = filter(strip_suffixes, source)
+ source = list(filter(strip_suffixes, source))
return (target, source)
def generate(env):
diff --git a/engine/SCons/Tool/dvips.py b/engine/SCons/Tool/dvips.py
index be8a5fe..d6e7006 100644
--- a/engine/SCons/Tool/dvips.py
+++ b/engine/SCons/Tool/dvips.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/dvips.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/dvips.py 5023 2010/06/14 22:05:46 scons"
import SCons.Action
import SCons.Builder
diff --git a/engine/SCons/Tool/f77.py b/engine/SCons/Tool/f77.py
index 17e7b6e..d4ec887 100644
--- a/engine/SCons/Tool/f77.py
+++ b/engine/SCons/Tool/f77.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/f77.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/f77.py 5023 2010/06/14 22:05:46 scons"
import SCons.Defaults
import SCons.Scanner.Fortran
diff --git a/engine/SCons/Tool/f90.py b/engine/SCons/Tool/f90.py
index 8db5824..b8829b7 100644
--- a/engine/SCons/Tool/f90.py
+++ b/engine/SCons/Tool/f90.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/f90.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/f90.py 5023 2010/06/14 22:05:46 scons"
import SCons.Defaults
import SCons.Scanner.Fortran
diff --git a/engine/SCons/Tool/f95.py b/engine/SCons/Tool/f95.py
index fc00566..66be308 100644
--- a/engine/SCons/Tool/f95.py
+++ b/engine/SCons/Tool/f95.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/f95.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/f95.py 5023 2010/06/14 22:05:46 scons"
import SCons.Defaults
import SCons.Tool
diff --git a/engine/SCons/Tool/filesystem.py b/engine/SCons/Tool/filesystem.py
index c015390..6bceb14 100644
--- a/engine/SCons/Tool/filesystem.py
+++ b/engine/SCons/Tool/filesystem.py
@@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/filesystem.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/filesystem.py 5023 2010/06/14 22:05:46 scons"
import SCons
from SCons.Tool.install import copyFunc
@@ -44,12 +44,12 @@ def copyto_emitter(target, source, env):
n_target = []
for t in target:
- n_target = n_target + map( lambda s, t=t: t.File( str( s ) ), source )
+ n_target = n_target + [t.File( str( s ) ) for s in source]
return (n_target, source)
def copy_action_func(target, source, env):
- assert( len(target) == len(source) ), "\ntarget: %s\nsource: %s" %(map(str, target),map(str, source))
+ assert( len(target) == len(source) ), "\ntarget: %s\nsource: %s" %(list(map(str, target)),list(map(str, source)))
for t, s in zip(target, source):
if copyFunc(t.get_path(), s.get_path(), env):
diff --git a/engine/SCons/Tool/fortran.py b/engine/SCons/Tool/fortran.py
index fea2660..f7b4e8d 100644
--- a/engine/SCons/Tool/fortran.py
+++ b/engine/SCons/Tool/fortran.py
@@ -31,10 +31,9 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/fortran.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/fortran.py 5023 2010/06/14 22:05:46 scons"
import re
-import string
import SCons.Action
import SCons.Defaults
diff --git a/engine/SCons/Tool/g++.py b/engine/SCons/Tool/g++.py
index 019939a..fa93329 100644
--- a/engine/SCons/Tool/g++.py
+++ b/engine/SCons/Tool/g++.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/g++.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/g++.py 5023 2010/06/14 22:05:46 scons"
import os.path
import re
diff --git a/engine/SCons/Tool/g77.py b/engine/SCons/Tool/g77.py
index 3b50b6d..c21f34b 100644
--- a/engine/SCons/Tool/g77.py
+++ b/engine/SCons/Tool/g77.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/g77.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/g77.py 5023 2010/06/14 22:05:46 scons"
import SCons.Util
from SCons.Tool.FortranCommon import add_all_to_env, add_f77_to_env
diff --git a/engine/SCons/Tool/gas.py b/engine/SCons/Tool/gas.py
index 52255ab..0ec021a 100644
--- a/engine/SCons/Tool/gas.py
+++ b/engine/SCons/Tool/gas.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/gas.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/gas.py 5023 2010/06/14 22:05:46 scons"
as_module = __import__('as', globals(), locals(), [])
diff --git a/engine/SCons/Tool/gcc.py b/engine/SCons/Tool/gcc.py
index 5994854..5d1a7d5 100644
--- a/engine/SCons/Tool/gcc.py
+++ b/engine/SCons/Tool/gcc.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/gcc.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/gcc.py 5023 2010/06/14 22:05:46 scons"
import cc
import os
diff --git a/engine/SCons/Tool/gfortran.py b/engine/SCons/Tool/gfortran.py
index 863e82a..2a3872e 100644
--- a/engine/SCons/Tool/gfortran.py
+++ b/engine/SCons/Tool/gfortran.py
@@ -32,7 +32,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/gfortran.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/gfortran.py 5023 2010/06/14 22:05:46 scons"
import SCons.Util
diff --git a/engine/SCons/Tool/gnulink.py b/engine/SCons/Tool/gnulink.py
index 71071f1..9845a69 100644
--- a/engine/SCons/Tool/gnulink.py
+++ b/engine/SCons/Tool/gnulink.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/gnulink.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/gnulink.py 5023 2010/06/14 22:05:46 scons"
import SCons.Util
diff --git a/engine/SCons/Tool/gs.py b/engine/SCons/Tool/gs.py
index 0e6deef..8ab63d7 100644
--- a/engine/SCons/Tool/gs.py
+++ b/engine/SCons/Tool/gs.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/gs.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/gs.py 5023 2010/06/14 22:05:46 scons"
import SCons.Action
import SCons.Platform
@@ -69,7 +69,7 @@ def generate(env):
def exists(env):
- if env.has_key('PS2PDF'):
+ if 'PS2PDF' in env:
return env.Detect(env['PS2PDF'])
else:
return env.Detect(gs) or SCons.Util.WhereIs(gs)
diff --git a/engine/SCons/Tool/hpc++.py b/engine/SCons/Tool/hpc++.py
index 28d766f..5be3854 100644
--- a/engine/SCons/Tool/hpc++.py
+++ b/engine/SCons/Tool/hpc++.py
@@ -31,10 +31,9 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/hpc++.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/hpc++.py 5023 2010/06/14 22:05:46 scons"
import os.path
-import string
import SCons.Util
@@ -67,8 +66,8 @@ def generate(env):
env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS +Z')
# determine version of aCC
line = os.popen(acc + ' -V 2>&1').readline().rstrip()
- if string.find(line, 'aCC: HP ANSI C++') == 0:
- env['CXXVERSION'] = string.split(line)[-1]
+ if line.find('aCC: HP ANSI C++') == 0:
+ env['CXXVERSION'] = line.split()[-1]
if env['PLATFORM'] == 'cygwin':
env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS')
diff --git a/engine/SCons/Tool/hpcc.py b/engine/SCons/Tool/hpcc.py
index f2ab04f..24b48c7 100644
--- a/engine/SCons/Tool/hpcc.py
+++ b/engine/SCons/Tool/hpcc.py
@@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/hpcc.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/hpcc.py 5023 2010/06/14 22:05:46 scons"
import SCons.Util
diff --git a/engine/SCons/Tool/hplink.py b/engine/SCons/Tool/hplink.py
index f6eff45..b2ad1ca 100644
--- a/engine/SCons/Tool/hplink.py
+++ b/engine/SCons/Tool/hplink.py
@@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/hplink.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/hplink.py 5023 2010/06/14 22:05:46 scons"
import os
import os.path
diff --git a/engine/SCons/Tool/icc.py b/engine/SCons/Tool/icc.py
index 0d4e617..fd5affe 100644
--- a/engine/SCons/Tool/icc.py
+++ b/engine/SCons/Tool/icc.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/icc.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/icc.py 5023 2010/06/14 22:05:46 scons"
import cc
diff --git a/engine/SCons/Tool/icl.py b/engine/SCons/Tool/icl.py
index ce98156..f1da778 100644
--- a/engine/SCons/Tool/icl.py
+++ b/engine/SCons/Tool/icl.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/icl.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/icl.py 5023 2010/06/14 22:05:46 scons"
import SCons.Tool.intelc
@@ -40,10 +40,10 @@ import SCons.Tool.intelc
def generate(*args, **kw):
"""Add Builders and construction variables for icl to an Environment."""
- return apply(SCons.Tool.intelc.generate, args, kw)
+ return SCons.Tool.intelc.generate(*args, **kw)
def exists(*args, **kw):
- return apply(SCons.Tool.intelc.exists, args, kw)
+ return SCons.Tool.intelc.exists(*args, **kw)
# Local Variables:
# tab-width:4
diff --git a/engine/SCons/Tool/ifl.py b/engine/SCons/Tool/ifl.py
index 93dc977..17ceb34 100644
--- a/engine/SCons/Tool/ifl.py
+++ b/engine/SCons/Tool/ifl.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/ifl.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/ifl.py 5023 2010/06/14 22:05:46 scons"
import SCons.Defaults
from SCons.Scanner.Fortran import FortranScan
@@ -43,12 +43,12 @@ def generate(env):
SCons.Tool.SourceFileScanner.add_scanner('.i', fscan)
SCons.Tool.SourceFileScanner.add_scanner('.i90', fscan)
- if not env.has_key('FORTRANFILESUFFIXES'):
+ if 'FORTRANFILESUFFIXES' not in env:
env['FORTRANFILESUFFIXES'] = ['.i']
else:
env['FORTRANFILESUFFIXES'].append('.i')
- if not env.has_key('F90FILESUFFIXES'):
+ if 'F90FILESUFFIXES' not in env:
env['F90FILESUFFIXES'] = ['.i90']
else:
env['F90FILESUFFIXES'].append('.i90')
diff --git a/engine/SCons/Tool/ifort.py b/engine/SCons/Tool/ifort.py
index 047afba..06bf484 100644
--- a/engine/SCons/Tool/ifort.py
+++ b/engine/SCons/Tool/ifort.py
@@ -32,9 +32,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/ifort.py 4720 2010/03/24 03:14:11 jars"
-
-import string
+__revision__ = "src/engine/SCons/Tool/ifort.py 5023 2010/06/14 22:05:46 scons"
import SCons.Defaults
from SCons.Scanner.Fortran import FortranScan
@@ -48,12 +46,12 @@ def generate(env):
SCons.Tool.SourceFileScanner.add_scanner('.i', fscan)
SCons.Tool.SourceFileScanner.add_scanner('.i90', fscan)
- if not env.has_key('FORTRANFILESUFFIXES'):
+ if 'FORTRANFILESUFFIXES' not in env:
env['FORTRANFILESUFFIXES'] = ['.i']
else:
env['FORTRANFILESUFFIXES'].append('.i')
- if not env.has_key('F90FILESUFFIXES'):
+ if 'F90FILESUFFIXES' not in env:
env['F90FILESUFFIXES'] = ['.i90']
else:
env['F90FILESUFFIXES'].append('.i90')
@@ -75,7 +73,7 @@ def generate(env):
for dialect in ['F77', 'F90', 'FORTRAN', 'F95']:
for var in ['%sCOM' % dialect, '%sPPCOM' % dialect,
'SH%sCOM' % dialect, 'SH%sPPCOM' % dialect]:
- env[var] = string.replace(env[var], '-o $TARGET', '-object:$TARGET')
+ env[var] = env[var].replace('-o $TARGET', '-object:$TARGET')
env['FORTRANMODDIRPREFIX'] = "/module:"
else:
env['FORTRANMODDIRPREFIX'] = "-module "
diff --git a/engine/SCons/Tool/ilink.py b/engine/SCons/Tool/ilink.py
index 4d8395f..71025d1 100644
--- a/engine/SCons/Tool/ilink.py
+++ b/engine/SCons/Tool/ilink.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/ilink.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/ilink.py 5023 2010/06/14 22:05:46 scons"
import SCons.Defaults
import SCons.Tool
diff --git a/engine/SCons/Tool/ilink32.py b/engine/SCons/Tool/ilink32.py
index 1765193..fb570f8 100644
--- a/engine/SCons/Tool/ilink32.py
+++ b/engine/SCons/Tool/ilink32.py
@@ -27,7 +27,7 @@ XXX
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/ilink32.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/ilink32.py 5023 2010/06/14 22:05:46 scons"
import SCons.Tool
import SCons.Tool.bcc32
diff --git a/engine/SCons/Tool/install.py b/engine/SCons/Tool/install.py
index 0d7b9d5..7b61bde 100644
--- a/engine/SCons/Tool/install.py
+++ b/engine/SCons/Tool/install.py
@@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/install.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/install.py 5023 2010/06/14 22:05:46 scons"
import os
import shutil
@@ -54,7 +54,7 @@ def copyFunc(dest, source, env):
if os.path.isdir(source):
if os.path.exists(dest):
if not os.path.isdir(dest):
- raise SCons.Errors.UserError, "cannot overwrite non-directory `%s' with a directory `%s'" % (str(dest), str(source))
+ raise SCons.Errors.UserError("cannot overwrite non-directory `%s' with a directory `%s'" % (str(dest), str(source)))
else:
parent = os.path.split(dest)[0]
if not os.path.exists(parent):
@@ -76,7 +76,7 @@ def installFunc(target, source, env):
raise SCons.Errors.UserError('Missing INSTALL construction variable.')
assert len(target)==len(source), \
- "Installing source %s into target %s: target and source lists must have same length."%(map(str, source), map(str, target))
+ "Installing source %s into target %s: target and source lists must have same length."%(list(map(str, source)), list(map(str, target)))
for t,s in zip(target,source):
if install(t.get_path(),s.get_path(),env):
return 1
@@ -108,7 +108,7 @@ def add_targets_to_INSTALLED_FILES(target, source, env):
_UNIQUE_INSTALLED_FILES = None
return (target, source)
-class DESTDIR_factory:
+class DESTDIR_factory(object):
""" a node factory, where all files will be relative to the dir supplied
in the constructor.
"""
@@ -135,7 +135,7 @@ BaseInstallBuilder = None
def InstallBuilderWrapper(env, target=None, source=None, dir=None, **kw):
if target and dir:
import SCons.Errors
- raise SCons.Errors.UserError, "Both target and dir defined for Install(), only one may be defined."
+ raise SCons.Errors.UserError("Both target and dir defined for Install(), only one may be defined.")
if not dir:
dir=target
@@ -149,7 +149,7 @@ def InstallBuilderWrapper(env, target=None, source=None, dir=None, **kw):
try:
dnodes = env.arg2nodes(dir, target_factory.Dir)
except TypeError:
- raise SCons.Errors.UserError, "Target `%s' of Install() is a file, but should be a directory. Perhaps you have the Install() arguments backwards?" % str(dir)
+ raise SCons.Errors.UserError("Target `%s' of Install() is a file, but should be a directory. Perhaps you have the Install() arguments backwards?" % str(dir))
sources = env.arg2nodes(source, env.fs.Entry)
tgt = []
for dnode in dnodes:
@@ -159,14 +159,14 @@ def InstallBuilderWrapper(env, target=None, source=None, dir=None, **kw):
# be relative to the top-level SConstruct directory.
target = env.fs.Entry('.'+os.sep+src.name, dnode)
#tgt.extend(BaseInstallBuilder(env, target, src, **kw))
- tgt.extend(apply(BaseInstallBuilder, (env, target, src), kw))
+ tgt.extend(BaseInstallBuilder(env, target, src, **kw))
return tgt
def InstallAsBuilderWrapper(env, target=None, source=None, **kw):
result = []
for src, tgt in map(lambda x, y: (x, y), source, target):
#result.extend(BaseInstallBuilder(env, tgt, src, **kw))
- result.extend(apply(BaseInstallBuilder, (env, tgt, src), kw))
+ result.extend(BaseInstallBuilder(env, tgt, src, **kw))
return result
added = None
diff --git a/engine/SCons/Tool/intelc.py b/engine/SCons/Tool/intelc.py
index a9b23d3..10e92cd 100644
--- a/engine/SCons/Tool/intelc.py
+++ b/engine/SCons/Tool/intelc.py
@@ -30,15 +30,15 @@ selection method.
# 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.
-#
+from __future__ import division
-__revision__ = "src/engine/SCons/Tool/intelc.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/intelc.py 5023 2010/06/14 22:05:46 scons"
import math, sys, os.path, glob, string, re
is_windows = sys.platform == 'win32'
is_win64 = is_windows and (os.environ['PROCESSOR_ARCHITECTURE'] == 'AMD64' or
- (os.environ.has_key('PROCESSOR_ARCHITEW6432') and
+ ('PROCESSOR_ARCHITEW6432' in os.environ and
os.environ['PROCESSOR_ARCHITEW6432'] == 'AMD64'))
is_linux = sys.platform == 'linux2'
is_mac = sys.platform == 'darwin'
@@ -69,7 +69,7 @@ def uniquify(s):
u = {}
for x in s:
u[x] = 1
- return u.keys()
+ return list(u.keys())
def linux_ver_normalize(vstr):
"""Normalize a Linux compiler version number.
@@ -81,7 +81,7 @@ def linux_ver_normalize(vstr):
m = re.match(r'([0-9]+)\.([0-9]+)\.([0-9]+)', vstr)
if m:
vmaj,vmin,build = m.groups()
- return float(vmaj) * 10 + float(vmin) + float(build) / 1000.;
+ return float(vmaj) * 10. + float(vmin) + float(build) / 1000.;
else:
f = float(vstr)
if is_windows:
@@ -117,9 +117,8 @@ def check_abi(abi):
try:
abi = valid_abis[abi]
except KeyError:
- raise SCons.Errors.UserError, \
- "Intel compiler: Invalid ABI %s, valid values are %s"% \
- (abi, valid_abis.keys())
+ raise SCons.Errors.UserError("Intel compiler: Invalid ABI %s, valid values are %s"% \
+ (abi, list(valid_abis.keys())))
return abi
def vercmp(a, b):
@@ -156,16 +155,14 @@ 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)
+ raise MissingRegistryError("%s was not found in the registry, for Intel compiler version %s, abi='%s'"%(K, version,abi))
# Get the value:
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\\%s was not found in the registry."%(K, valuename)
+ raise MissingRegistryError("%s\\%s was not found in the registry."%(K, valuename))
def get_all_compiler_versions():
@@ -243,9 +240,7 @@ def get_all_compiler_versions():
m = re.search(r'([0-9.]+)$', d)
if m:
versions.append(m.group(1))
- versions = uniquify(versions) # remove dups
- versions.sort(vercmp)
- return versions
+ return sorted(uniquify(versions)) # remove dups
def get_intel_compiler_top(version, abi):
"""
@@ -257,13 +252,12 @@ def get_intel_compiler_top(version, abi):
if is_windows:
if not SCons.Util.can_read_reg:
- raise NoRegistryModuleError, "No Windows registry module was found"
+ raise NoRegistryModuleError("No Windows registry module was found")
top = get_intel_registry_value('ProductDir', version, abi)
# pre-11, icl was in Bin. 11 and later, it's in Bin/<abi> 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")):
- raise MissingDirError, \
- "Can't find Intel compiler in %s"%(top)
+ raise MissingDirError("Can't find Intel compiler in %s"%(top))
elif is_mac or is_linux:
# first dir is new (>=9.0) style, second is old (8.0) style.
dirs=('/opt/intel/cc/%s', '/opt/intel_cc_%s')
@@ -275,8 +269,7 @@ def get_intel_compiler_top(version, abi):
top = d%version
break
if not top:
- raise MissingDirError, \
- "Can't find version %s Intel compiler in %s (abi='%s')"%(version,top, abi)
+ raise MissingDirError("Can't find version %s Intel compiler in %s (abi='%s')"%(version,top, abi))
return top
@@ -312,9 +305,8 @@ def generate(env, version=None, abi=None, topdir=None, verbose=0):
# get_version_from_list does that mapping.
v = get_version_from_list(version, vlist)
if not v:
- raise SCons.Errors.UserError, \
- "Invalid Intel compiler version %s: "%version + \
- "installed versions are %s"%(', '.join(vlist))
+ raise SCons.Errors.UserError("Invalid Intel compiler version %s: "%version + \
+ "installed versions are %s"%(', '.join(vlist)))
version = v
# if abi is unspecified, use ia32
@@ -406,7 +398,7 @@ def generate(env, version=None, abi=None, topdir=None, verbose=0):
# Couldn't get it from registry: use default subdir of topdir
env.PrependENVPath(p[0], os.path.join(topdir, p[2]))
else:
- env.PrependENVPath(p[0], string.split(path, os.pathsep))
+ env.PrependENVPath(p[0], path.split(os.pathsep))
# print "ICL %s: %s, final=%s"%(p[0], path, str(env['ENV'][p[0]]))
if is_windows:
@@ -445,7 +437,7 @@ def generate(env, version=None, abi=None, topdir=None, verbose=0):
for ld in [envlicdir, reglicdir]:
# If the string contains an '@', then assume it's a network
# license (port@system) and good by definition.
- if ld and (string.find(ld, '@') != -1 or os.path.exists(ld)):
+ if ld and (ld.find('@') != -1 or os.path.exists(ld)):
licdir = ld
break
if not licdir:
diff --git a/engine/SCons/Tool/ipkg.py b/engine/SCons/Tool/ipkg.py
index 3e8d223..c692053 100644
--- a/engine/SCons/Tool/ipkg.py
+++ b/engine/SCons/Tool/ipkg.py
@@ -33,10 +33,9 @@ packages fake_root.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/ipkg.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/ipkg.py 5023 2010/06/14 22:05:46 scons"
import os
-import string
import SCons.Builder
@@ -53,11 +52,8 @@ def generate(env):
env['IPKG'] = 'ipkg-build'
env['IPKGCOM'] = '$IPKG $IPKGFLAGS ${SOURCE}'
- # TODO(1.5)
- #env['IPKGUSER'] = os.popen('id -un').read().strip()
- #env['IPKGGROUP'] = os.popen('id -gn').read().strip()
- env['IPKGUSER'] = string.strip(os.popen('id -un').read())
- env['IPKGGROUP'] = string.strip(os.popen('id -gn').read())
+ env['IPKGUSER'] = os.popen('id -un').read().strip()
+ env['IPKGGROUP'] = os.popen('id -gn').read().strip()
env['IPKGFLAGS'] = SCons.Util.CLVar('-o $IPKGUSER -g $IPKGGROUP')
env['IPKGSUFFIX'] = '.ipk'
diff --git a/engine/SCons/Tool/jar.py b/engine/SCons/Tool/jar.py
index 2aaab96..9cb4eff 100644
--- a/engine/SCons/Tool/jar.py
+++ b/engine/SCons/Tool/jar.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/jar.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/jar.py 5023 2010/06/14 22:05:46 scons"
import SCons.Subst
import SCons.Util
diff --git a/engine/SCons/Tool/javac.py b/engine/SCons/Tool/javac.py
index df237a8..66651c3 100644
--- a/engine/SCons/Tool/javac.py
+++ b/engine/SCons/Tool/javac.py
@@ -29,13 +29,11 @@ selection method.
# 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__ = "src/engine/SCons/Tool/javac.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/javac.py 5023 2010/06/14 22:05:46 scons"
import os
import os.path
-import string
import SCons.Action
import SCons.Builder
@@ -45,7 +43,7 @@ import SCons.Util
def classname(path):
"""Turn a string (path name) into a Java class name."""
- return string.replace(os.path.normpath(path), os.sep, '.')
+ return os.path.normpath(path).replace(os.sep, '.')
def emit_java_classes(target, source, env):
"""Create and return lists of source java files
@@ -67,27 +65,25 @@ def emit_java_classes(target, source, env):
slist = []
js = _my_normcase(java_suffix)
- find_java = lambda n, js=js, ljs=len(js): _my_normcase(n[-ljs:]) == js
for entry in source:
entry = entry.rentry().disambiguate()
if isinstance(entry, SCons.Node.FS.File):
slist.append(entry)
elif isinstance(entry, SCons.Node.FS.Dir):
result = SCons.Util.OrderedDict()
- def visit(arg, dirname, names, fj=find_java, dirnode=entry.rdir()):
- java_files = filter(fj, names)
- # The on-disk entries come back in arbitrary order. Sort
- # them so our target and source lists are determinate.
- java_files.sort()
- mydir = dirnode.Dir(dirname)
- java_paths = map(lambda f, d=mydir: d.File(f), java_files)
+ dirnode = entry.rdir()
+ def find_java_files(arg, dirpath, filenames):
+ java_files = sorted([n for n in filenames
+ if _my_normcase(n).endswith(js)])
+ mydir = dirnode.Dir(dirpath)
+ java_paths = [mydir.File(f) for f in java_files]
for jp in java_paths:
arg[jp] = True
+ for dirpath, dirnames, filenames in os.walk(dirnode.get_abspath()):
+ find_java_files(result, dirpath, filenames)
+ entry.walk(find_java_files, result)
- os.path.walk(entry.rdir().get_abspath(), visit, result)
- entry.walk(visit, result)
-
- slist.extend(result.keys())
+ slist.extend(list(result.keys()))
else:
raise SCons.Errors.UserError("Java source must be File or Dir, not '%s'" % entry.__class__)
@@ -139,7 +135,7 @@ JavaBuilder = SCons.Builder.Builder(action = JavaAction,
target_factory = SCons.Node.FS.Entry,
source_factory = SCons.Node.FS.Entry)
-class pathopt:
+class pathopt(object):
"""
Callable object for generating javac-style path options from
a construction variable (e.g. -classpath, -sourcepath).
@@ -156,8 +152,8 @@ class pathopt:
if self.default:
path = path + [ env[self.default] ]
if path:
- return [self.opt, string.join(path, os.pathsep)]
- #return self.opt + " " + string.join(path, os.pathsep)
+ return [self.opt, os.pathsep.join(path)]
+ #return self.opt + " " + os.pathsep.join(path)
else:
return []
#return ""
@@ -194,7 +190,7 @@ def Java(env, target, source, *args, **kw):
b = env.JavaClassFile
else:
b = env.JavaClassDir
- result.extend(apply(b, (t, s) + args, kw))
+ result.extend(b(t, s, *args, **kw))
return result
diff --git a/engine/SCons/Tool/javah.py b/engine/SCons/Tool/javah.py
index 6a4314c..e92c423 100644
--- a/engine/SCons/Tool/javah.py
+++ b/engine/SCons/Tool/javah.py
@@ -31,10 +31,9 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/javah.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/javah.py 5023 2010/06/14 22:05:46 scons"
import os.path
-import string
import SCons.Action
import SCons.Builder
@@ -93,7 +92,7 @@ def emit_java_headers(target, source, env):
target[0]._morph()
tlist = []
for s in source:
- fname = string.replace(s.attributes.java_classname, '.', '_') + '.h'
+ fname = s.attributes.java_classname.replace('.', '_') + '.h'
t = target[0].File(fname)
t.attributes.java_lookupdir = target[0]
tlist.append(t)
@@ -112,7 +111,7 @@ def JavaHOutFlagGenerator(target, source, env, for_signature):
def getJavaHClassPath(env,target, source, for_signature):
path = "${SOURCE.attributes.java_classdir}"
- if env.has_key('JAVACLASSPATH') and env['JAVACLASSPATH']:
+ if 'JAVACLASSPATH' in env and env['JAVACLASSPATH']:
path = SCons.Util.AppendPath(path, env['JAVACLASSPATH'])
return "-classpath %s" % (path)
diff --git a/engine/SCons/Tool/latex.py b/engine/SCons/Tool/latex.py
index 56db43f..e4f1a51 100644
--- a/engine/SCons/Tool/latex.py
+++ b/engine/SCons/Tool/latex.py
@@ -32,7 +32,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/latex.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/latex.py 5023 2010/06/14 22:05:46 scons"
import SCons.Action
import SCons.Defaults
@@ -44,7 +44,7 @@ import SCons.Tool.tex
def LaTeXAuxFunction(target = None, source= None, env=None):
result = SCons.Tool.tex.InternalLaTeXAuxAction( SCons.Tool.tex.LaTeXAction, target, source, env )
if result != 0:
- print env['LATEX']," returned an error, check the log file"
+ SCons.Tool.tex.check_file_error_message(env['LATEX'])
return result
LaTeXAuxAction = SCons.Action.Action(LaTeXAuxFunction,
diff --git a/engine/SCons/Tool/lex.py b/engine/SCons/Tool/lex.py
index 920ff5f..aad5004 100644
--- a/engine/SCons/Tool/lex.py
+++ b/engine/SCons/Tool/lex.py
@@ -31,12 +31,10 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/lex.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/lex.py 5023 2010/06/14 22:05:46 scons"
import os.path
-import string
-
import SCons.Action
import SCons.Tool
import SCons.Util
@@ -62,7 +60,7 @@ def lexEmitter(target, source, env):
if option[:l] == fileGenOption:
# A file generating option is present, so add the
# file name to the target list.
- fileName = string.strip(option[l:])
+ fileName = option[l:].strip()
target.append(fileName)
return (target, source)
diff --git a/engine/SCons/Tool/link.py b/engine/SCons/Tool/link.py
index 2b6ccec..5905fe9 100644
--- a/engine/SCons/Tool/link.py
+++ b/engine/SCons/Tool/link.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/link.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/link.py 5023 2010/06/14 22:05:46 scons"
import SCons.Defaults
import SCons.Tool
diff --git a/engine/SCons/Tool/linkloc.py b/engine/SCons/Tool/linkloc.py
index abf29f4..ab5b735 100644
--- a/engine/SCons/Tool/linkloc.py
+++ b/engine/SCons/Tool/linkloc.py
@@ -32,7 +32,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/linkloc.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/linkloc.py 5023 2010/06/14 22:05:46 scons"
import os.path
import re
@@ -61,7 +61,7 @@ def repl_linker_command(m):
# to find it with recursive substitution
return m.group(1) + '#' + m.group(2)
-class LinklocGenerator:
+class LinklocGenerator(object):
def __init__(self, cmdline):
self.cmdline = cmdline
diff --git a/engine/SCons/Tool/m4.py b/engine/SCons/Tool/m4.py
index 48935cf..f43b594 100644
--- a/engine/SCons/Tool/m4.py
+++ b/engine/SCons/Tool/m4.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/m4.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/m4.py 5023 2010/06/14 22:05:46 scons"
import SCons.Action
import SCons.Builder
diff --git a/engine/SCons/Tool/masm.py b/engine/SCons/Tool/masm.py
index a4e91fc..5bb936a 100644
--- a/engine/SCons/Tool/masm.py
+++ b/engine/SCons/Tool/masm.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/masm.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/masm.py 5023 2010/06/14 22:05:46 scons"
import SCons.Defaults
import SCons.Tool
diff --git a/engine/SCons/Tool/midl.py b/engine/SCons/Tool/midl.py
index f1f4375..67660d1 100644
--- a/engine/SCons/Tool/midl.py
+++ b/engine/SCons/Tool/midl.py
@@ -31,9 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/midl.py 4720 2010/03/24 03:14:11 jars"
-
-import string
+__revision__ = "src/engine/SCons/Tool/midl.py 5023 2010/06/14 22:05:46 scons"
import SCons.Action
import SCons.Builder
@@ -53,10 +51,10 @@ def midl_emitter(target, source, env):
midlcom = env['MIDLCOM']
- if string.find(midlcom, '/proxy') != -1:
+ if midlcom.find('/proxy') != -1:
proxy = base + '_p.c'
t.append(proxy)
- if string.find(midlcom, '/dlldata') != -1:
+ if midlcom.find('/dlldata') != -1:
dlldata = base + '_data.c'
t.append(dlldata)
diff --git a/engine/SCons/Tool/mingw.py b/engine/SCons/Tool/mingw.py
index e93f1ad..6df46e0 100644
--- a/engine/SCons/Tool/mingw.py
+++ b/engine/SCons/Tool/mingw.py
@@ -31,11 +31,10 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/mingw.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/mingw.py 5023 2010/06/14 22:05:46 scons"
import os
import os.path
-import string
import SCons.Action
import SCons.Builder
@@ -73,7 +72,7 @@ def shlib_emitter(target, source, env):
no_import_lib = env.get('no_import_lib', 0)
if not dll:
- raise SCons.Errors.UserError, "A shared library should have exactly one target with the suffix: %s" % env.subst("$SHLIBSUFFIX")
+ raise SCons.Errors.UserError("A shared library should have exactly one target with the suffix: %s" % env.subst("$SHLIBSUFFIX"))
if not no_import_lib and \
not env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX'):
diff --git a/engine/SCons/Tool/mslib.py b/engine/SCons/Tool/mslib.py
index c568abd..a2933cb 100644
--- a/engine/SCons/Tool/mslib.py
+++ b/engine/SCons/Tool/mslib.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/mslib.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/mslib.py 5023 2010/06/14 22:05:46 scons"
import SCons.Defaults
import SCons.Tool
diff --git a/engine/SCons/Tool/mslink.py b/engine/SCons/Tool/mslink.py
index 36ad2fe..c291ba9 100644
--- a/engine/SCons/Tool/mslink.py
+++ b/engine/SCons/Tool/mslink.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/mslink.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/mslink.py 5023 2010/06/14 22:05:46 scons"
import os.path
@@ -103,7 +103,7 @@ def _dllEmitter(target, source, env, paramtp):
no_import_lib = env.get('no_import_lib', 0)
if not dll:
- raise SCons.Errors.UserError, 'A shared library should have exactly one target with the suffix: %s' % env.subst('$%sSUFFIX' % paramtp)
+ raise SCons.Errors.UserError('A shared library should have exactly one target with the suffix: %s' % env.subst('$%sSUFFIX' % paramtp))
insert_def = env.subst("$WINDOWS_INSERT_DEF")
if not insert_def in ['', '0', 0] and \
@@ -123,7 +123,7 @@ def _dllEmitter(target, source, env, paramtp):
'%sPREFIX' % paramtp, '%sSUFFIX' % paramtp,
"WINDOWSSHLIBMANIFESTPREFIX", "WINDOWSSHLIBMANIFESTSUFFIX"))
- if env.has_key('PDB') and env['PDB']:
+ if 'PDB' in env and env['PDB']:
pdb = env.arg2nodes('$PDB', target=target, source=source)[0]
extratargets.append(pdb)
target[0].attributes.pdb = pdb
@@ -161,7 +161,7 @@ def prog_emitter(target, source, env):
exe = env.FindIxes(target, "PROGPREFIX", "PROGSUFFIX")
if not exe:
- raise SCons.Errors.UserError, "An executable should have exactly one target with the suffix: %s" % env.subst("$PROGSUFFIX")
+ raise SCons.Errors.UserError("An executable should have exactly one target with the suffix: %s" % env.subst("$PROGSUFFIX"))
version_num, suite = SCons.Tool.msvs.msvs_parse_version(env.get('MSVS_VERSION', '6.0'))
if version_num >= 8.0 and env.get('WINDOWS_INSERT_MANIFEST', 0):
@@ -171,7 +171,7 @@ def prog_emitter(target, source, env):
"PROGPREFIX", "PROGSUFFIX",
"WINDOWSPROGMANIFESTPREFIX", "WINDOWSPROGMANIFESTSUFFIX"))
- if env.has_key('PDB') and env['PDB']:
+ if 'PDB' in env and env['PDB']:
pdb = env.arg2nodes('$PDB', target=target, source=source)[0]
extratargets.append(pdb)
target[0].attributes.pdb = pdb
@@ -179,10 +179,10 @@ def prog_emitter(target, source, env):
return (target+extratargets,source)
def RegServerFunc(target, source, env):
- if env.has_key('register') and env['register']:
+ if 'register' in env and env['register']:
ret = regServerAction([target[0]], [source[0]], env)
if ret:
- raise SCons.Errors.UserError, "Unable to register %s" % target[0]
+ raise SCons.Errors.UserError("Unable to register %s" % target[0])
else:
print "Registered %s sucessfully" % target[0]
return ret
diff --git a/engine/SCons/Tool/mssdk.py b/engine/SCons/Tool/mssdk.py
index ed5bd5c..08898c6 100644
--- a/engine/SCons/Tool/mssdk.py
+++ b/engine/SCons/Tool/mssdk.py
@@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/mssdk.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/mssdk.py 5023 2010/06/14 22:05:46 scons"
"""engine.SCons.Tool.mssdk
diff --git a/engine/SCons/Tool/msvc.py b/engine/SCons/Tool/msvc.py
index f145816..8c13580 100644
--- a/engine/SCons/Tool/msvc.py
+++ b/engine/SCons/Tool/msvc.py
@@ -31,11 +31,10 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/msvc.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/msvc.py 5023 2010/06/14 22:05:46 scons"
import os.path
import re
-import string
import sys
import SCons.Action
@@ -55,11 +54,11 @@ CXXSuffixes = ['.cc', '.cpp', '.cxx', '.c++', '.C++']
def validate_vars(env):
"""Validate the PCH and PCHSTOP construction variables."""
- if env.has_key('PCH') and env['PCH']:
- if not env.has_key('PCHSTOP'):
- raise SCons.Errors.UserError, "The PCHSTOP construction must be defined if PCH is defined."
+ if 'PCH' in env and env['PCH']:
+ if 'PCHSTOP' not in env:
+ raise SCons.Errors.UserError("The PCHSTOP construction must be defined if PCH is defined.")
if not SCons.Util.is_String(env['PCHSTOP']):
- raise SCons.Errors.UserError, "The PCHSTOP construction variable must be a string: %r"%env['PCHSTOP']
+ raise SCons.Errors.UserError("The PCHSTOP construction variable must be a string: %r"%env['PCHSTOP'])
def pch_emitter(target, source, env):
"""Adds the object file target."""
@@ -99,7 +98,7 @@ def object_emitter(target, source, env, parent_emitter):
# See issue #2505 for a discussion of what to do if it turns
# out this assumption causes trouble in the wild:
# http://scons.tigris.org/issues/show_bug.cgi?id=2505
- if env.has_key('PCH'):
+ if 'PCH' in env:
pch = env['PCH']
if str(target[0]) != SCons.Util.splitext(str(pch))[0] + '.obj':
env.Depends(target, pch)
@@ -254,9 +253,9 @@ def generate(env):
env['PCHCOM'] = '$CXX /Fo${TARGETS[1]} $CXXFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Yc$PCHSTOP /Fp${TARGETS[0]} $CCPDBFLAGS $PCHPDBFLAGS'
env['BUILDERS']['PCH'] = pch_builder
- if not env.has_key('ENV'):
+ if 'ENV' not in env:
env['ENV'] = {}
- if not env['ENV'].has_key('SystemRoot'): # required for dlls in the winsxs folders
+ if 'SystemRoot' not in env['ENV']: # required for dlls in the winsxs folders
env['ENV']['SystemRoot'] = SCons.Platform.win32.get_system_root()
def exists(env):
diff --git a/engine/SCons/Tool/msvs.py b/engine/SCons/Tool/msvs.py
index 17bb9a0..34fc0e7 100644
--- a/engine/SCons/Tool/msvs.py
+++ b/engine/SCons/Tool/msvs.py
@@ -29,17 +29,18 @@ selection method.
# 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__ = "src/engine/SCons/Tool/msvs.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/msvs.py 5023 2010/06/14 22:05:46 scons"
+
+import SCons.compat
import base64
import hashlib
import ntpath
import os
+# compat layer imports "cPickle" for us if it's available.
import pickle
import re
-import string
import sys
import SCons.Builder
@@ -57,23 +58,10 @@ from SCons.Defaults import processDefines
# DSP/DSW/SLN/VCPROJ files.
##############################################################################
-def _hexdigest(s):
- """Return a string as a string of hex characters.
- """
- # NOTE: This routine is a method in the Python 2.0 interface
- # of the native md5 module, but we want SCons to operate all
- # the way back to at least Python 1.5.2, which doesn't have it.
- h = string.hexdigits
- r = ''
- for c in s:
- i = ord(c)
- r = r + h[(i >> 4) & 0xF] + h[i & 0xF]
- return r
-
def xmlify(s):
- s = string.replace(s, "&", "&amp;") # do this first
- s = string.replace(s, "'", "&apos;")
- s = string.replace(s, '"', "&quot;")
+ s = s.replace("&", "&amp;") # do this first
+ s = s.replace("'", "&apos;")
+ s = s.replace('"', "&quot;")
return s
external_makefile_guid = '{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}'
@@ -88,9 +76,7 @@ def _generateGUID(slnfile, name):
# the generated file has a consistent GUID even if we generate
# it on a non-Windows platform.
m.update(ntpath.normpath(str(slnfile)) + str(name))
- # TODO(1.5)
- #solution = m.hexdigest().upper()
- solution = string.upper(_hexdigest(m.digest()))
+ solution = m.hexdigest().upper()
# convert most of the signature to GUID form (discard the rest)
solution = "{" + solution[:8] + "-" + solution[8:12] + "-" + solution[12:16] + "-" + solution[16:20] + "-" + solution[20:32] + "}"
return solution
@@ -116,7 +102,7 @@ def msvs_parse_version(s):
# which works regardless of how we were invoked.
def getExecScriptMain(env, xml=None):
scons_home = env.get('SCONS_HOME')
- if not scons_home and os.environ.has_key('SCONS_LIB_DIR'):
+ if not scons_home and 'SCONS_LIB_DIR' in os.environ:
scons_home = os.environ['SCONS_LIB_DIR']
if scons_home:
exec_script_main = "from os.path import join; import sys; sys.path = [ r'%s' ] + sys.path; import SCons.Script; SCons.Script.main()" % scons_home
@@ -139,7 +125,7 @@ else:
python_executable = os.path.join('$$(PYTHON_ROOT)',
os.path.split(sys.executable)[1])
-class Config:
+class Config(object):
pass
def splitFully(path):
@@ -161,7 +147,7 @@ def makeHierarchy(sources):
if len(path):
dict = hierarchy
for part in path[:-1]:
- if not dict.has_key(part):
+ if part not in dict:
dict[part] = {}
dict = dict[part]
dict[path[-1]] = file
@@ -169,7 +155,7 @@ def makeHierarchy(sources):
# print 'Warning: failed to decompose path for '+str(file)
return hierarchy
-class _DSPGenerator:
+class _DSPGenerator(object):
""" Base class for DSP generators """
srcargs = [
@@ -188,23 +174,21 @@ class _DSPGenerator:
else:
self.dspabs = get_abspath()
- if not env.has_key('variant'):
- raise SCons.Errors.InternalError, \
- "You must specify a 'variant' argument (i.e. 'Debug' or " +\
- "'Release') to create an MSVSProject."
+ if 'variant' not in env:
+ raise SCons.Errors.InternalError("You must specify a 'variant' argument (i.e. 'Debug' or " +\
+ "'Release') to create an MSVSProject.")
elif SCons.Util.is_String(env['variant']):
variants = [env['variant']]
elif SCons.Util.is_List(env['variant']):
variants = env['variant']
- if not env.has_key('buildtarget') or env['buildtarget'] == None:
+ if 'buildtarget' not in env or env['buildtarget'] == None:
buildtarget = ['']
elif SCons.Util.is_String(env['buildtarget']):
buildtarget = [env['buildtarget']]
elif SCons.Util.is_List(env['buildtarget']):
if len(env['buildtarget']) != len(variants):
- raise SCons.Errors.InternalError, \
- "Sizes of 'buildtarget' and 'variant' lists must be the same."
+ raise SCons.Errors.InternalError("Sizes of 'buildtarget' and 'variant' lists must be the same.")
buildtarget = []
for bt in env['buildtarget']:
if SCons.Util.is_String(bt):
@@ -219,14 +203,13 @@ class _DSPGenerator:
for _ in variants:
buildtarget.append(bt)
- if not env.has_key('outdir') or env['outdir'] == None:
+ if 'outdir' not in env or env['outdir'] == None:
outdir = ['']
elif SCons.Util.is_String(env['outdir']):
outdir = [env['outdir']]
elif SCons.Util.is_List(env['outdir']):
if len(env['outdir']) != len(variants):
- raise SCons.Errors.InternalError, \
- "Sizes of 'outdir' and 'variant' lists must be the same."
+ raise SCons.Errors.InternalError("Sizes of 'outdir' and 'variant' lists must be the same.")
outdir = []
for s in env['outdir']:
if SCons.Util.is_String(s):
@@ -241,14 +224,13 @@ class _DSPGenerator:
for v in variants:
outdir.append(s)
- if not env.has_key('runfile') or env['runfile'] == None:
+ if 'runfile' not in env or env['runfile'] == None:
runfile = buildtarget[-1:]
elif SCons.Util.is_String(env['runfile']):
runfile = [env['runfile']]
elif SCons.Util.is_List(env['runfile']):
if len(env['runfile']) != len(variants):
- raise SCons.Errors.InternalError, \
- "Sizes of 'runfile' and 'variant' lists must be the same."
+ raise SCons.Errors.InternalError("Sizes of 'runfile' and 'variant' lists must be the same.")
runfile = []
for s in env['runfile']:
if SCons.Util.is_String(s):
@@ -269,7 +251,7 @@ class _DSPGenerator:
self.env = env
- if self.env.has_key('name'):
+ if 'name' in self.env:
self.name = self.env['name']
else:
self.name = os.path.basename(SCons.Util.splitext(self.dspfile)[0])
@@ -289,14 +271,14 @@ class _DSPGenerator:
self.configs = {}
self.nokeep = 0
- if env.has_key('nokeep') and env['variant'] != 0:
+ if 'nokeep' in env and env['variant'] != 0:
self.nokeep = 1
if self.nokeep == 0 and os.path.exists(self.dspabs):
self.Parse()
for t in zip(sourcenames,self.srcargs):
- if self.env.has_key(t[1]):
+ if t[1] in self.env:
if SCons.Util.is_List(self.env[t[1]]):
for i in self.env[t[1]]:
if not i in self.sources[t[0]]:
@@ -306,9 +288,9 @@ class _DSPGenerator:
self.sources[t[0]].append(self.env[t[1]])
for n in sourcenames:
- # TODO(1.5):
- #self.sources[n].sort(lambda a, b: cmp(a.lower(), b.lower()))
- self.sources[n].sort(lambda a, b: cmp(string.lower(a), string.lower(b)))
+ #TODO 2.4: compat layer supports sorted(key=) but not sort(key=)
+ #TODO 2.4: self.sources[n].sort(key=lambda a: a.lower())
+ self.sources[n] = sorted(self.sources[n], key=lambda a: a.lower())
def AddConfig(self, variant, buildtarget, outdir, runfile, cmdargs, dspfile=dspfile):
config = Config()
@@ -367,8 +349,7 @@ class _GenerateV6DSP(_DSPGenerator):
def PrintHeader(self):
# pick a default config
- confkeys = self.configs.keys()
- confkeys.sort()
+ confkeys = sorted(self.configs.keys())
name = self.name
confkey = confkeys[0]
@@ -388,8 +369,7 @@ class _GenerateV6DSP(_DSPGenerator):
'# PROP Scc_LocalPath ""\n\n')
first = 1
- confkeys = self.configs.keys()
- confkeys.sort()
+ confkeys = sorted(self.configs.keys())
for kind in confkeys:
outdir = self.configs[kind].outdir
buildtarget = self.configs[kind].buildtarget
@@ -399,7 +379,7 @@ class _GenerateV6DSP(_DSPGenerator):
else:
self.file.write('\n!ELSEIF "$(CFG)" == "%s - Win32 %s"\n\n' % (name, kind))
- env_has_buildtarget = self.env.has_key('MSVSBUILDTARGET')
+ env_has_buildtarget = 'MSVSBUILDTARGET' in self.env
if not env_has_buildtarget:
self.env['MSVSBUILDTARGET'] = buildtarget
@@ -407,9 +387,7 @@ class _GenerateV6DSP(_DSPGenerator):
for base in ("BASE ",""):
self.file.write('# PROP %sUse_MFC 0\n'
'# PROP %sUse_Debug_Libraries ' % (base, base))
- # TODO(1.5):
- #if kind.lower().find('debug') < 0:
- if string.find(string.lower(kind), 'debug') < 0:
+ if kind.lower().find('debug') < 0:
self.file.write('0\n')
else:
self.file.write('1\n')
@@ -459,18 +437,12 @@ class _GenerateV6DSP(_DSPGenerator):
'Resource Files': 'r|rc|ico|cur|bmp|dlg|rc2|rct|bin|cnt|rtf|gif|jpg|jpeg|jpe',
'Other Files': ''}
- cats = categories.keys()
- # TODO(1.5):
- #cats.sort(lambda a, b: cmp(a.lower(), b.lower()))
- cats.sort(lambda a, b: cmp(string.lower(a), string.lower(b)))
- for kind in cats:
+ for kind in sorted(categories.keys(), key=lambda a: a.lower()):
if not self.sources[kind]:
continue # skip empty groups
self.file.write('# Begin Group "' + kind + '"\n\n')
- # TODO(1.5)
- #typelist = categories[kind].replace('|', ';')
- typelist = string.replace(categories[kind], '|', ';')
+ typelist = categories[kind].replace('|', ';')
self.file.write('# PROP Default_Filter "' + typelist + '"\n')
for file in self.sources[kind]:
@@ -493,9 +465,7 @@ class _GenerateV6DSP(_DSPGenerator):
line = dspfile.readline()
while line:
- # TODO(1.5):
- #if line.find("# End Project") > -1:
- if string.find(line, "# End Project") > -1:
+ if line.find("# End Project") > -1:
break
line = dspfile.readline()
@@ -539,7 +509,7 @@ class _GenerateV6DSP(_DSPGenerator):
try:
self.file = open(self.dspabs,'w')
except IOError, detail:
- raise SCons.Errors.InternalError, 'Unable to open "' + self.dspabs + '" for writing:' + str(detail)
+ raise SCons.Errors.InternalError('Unable to open "' + self.dspabs + '" for writing:' + str(detail))
else:
self.PrintHeader()
self.PrintProject()
@@ -664,8 +634,7 @@ class _GenerateV7DSP(_DSPGenerator):
def PrintProject(self):
self.file.write('\t<Configurations>\n')
- confkeys = self.configs.keys()
- confkeys.sort()
+ confkeys = sorted(self.configs.keys())
for kind in confkeys:
variant = self.configs[kind].variant
platform = self.configs[kind].platform
@@ -674,7 +643,7 @@ class _GenerateV7DSP(_DSPGenerator):
runfile = self.configs[kind].runfile
cmdargs = self.configs[kind].cmdargs
- env_has_buildtarget = self.env.has_key('MSVSBUILDTARGET')
+ env_has_buildtarget = 'MSVSBUILDTARGET' in self.env
if not env_has_buildtarget:
self.env['MSVSBUILDTARGET'] = buildtarget
@@ -687,11 +656,8 @@ class _GenerateV7DSP(_DSPGenerator):
rebuildcmd = xmlify(starting + self.env.subst('$MSVSREBUILDCOM', 1) + cmdargs)
cleancmd = xmlify(starting + self.env.subst('$MSVSCLEANCOM', 1) + cmdargs)
- # TODO(1.5)
- #preprocdefs = xmlify(';'.join(self.env.get('CPPDEFINES', [])))
- #includepath = xmlify(';'.join(self.env.get('CPPPATH', [])))
- preprocdefs = xmlify(string.join(processDefines(self.env.get('CPPDEFINES', [])), ';'))
- includepath = xmlify(string.join(self.env.get('CPPPATH', []), ';'))
+ preprocdefs = xmlify(';'.join(processDefines(self.env.get('CPPDEFINES', []))))
+ includepath = xmlify(';'.join(self.env.get('CPPPATH', [])))
if not env_has_buildtarget:
del self.env['MSVSBUILDTARGET']
@@ -718,10 +684,7 @@ class _GenerateV7DSP(_DSPGenerator):
self.file.write(pdata + '-->\n')
def printSources(self, hierarchy, commonprefix):
- sorteditems = hierarchy.items()
- # TODO(1.5):
- #sorteditems.sort(lambda a, b: cmp(a[0].lower(), b[0].lower()))
- sorteditems.sort(lambda a, b: cmp(string.lower(a[0]), string.lower(b[0])))
+ sorteditems = sorted(hierarchy.items(), key=lambda a: a[0].lower())
# First folders, then files
for key, value in sorteditems:
@@ -751,11 +714,8 @@ class _GenerateV7DSP(_DSPGenerator):
self.file.write('\t<Files>\n')
- cats = categories.keys()
- # TODO(1.5)
- #cats.sort(lambda a, b: cmp(a.lower(), b.lower()))
- cats.sort(lambda a, b: cmp(string.lower(a), string.lower(b)))
- cats = filter(lambda k, s=self: s.sources[k], cats)
+ cats = sorted([k for k in categories.keys() if self.sources[k]],
+ key=lambda a: a.lower())
for kind in cats:
if len(cats) > 1:
self.file.write('\t\t<Filter\n'
@@ -767,14 +727,14 @@ class _GenerateV7DSP(_DSPGenerator):
# First remove any common prefix
commonprefix = None
if len(sources) > 1:
- s = map(os.path.normpath, sources)
+ s = list(map(os.path.normpath, sources))
# take the dirname because the prefix may include parts
# of the filenames (e.g. if you have 'dir\abcd' and
# 'dir\acde' then the cp will be 'dir\a' )
cp = os.path.dirname( os.path.commonprefix(s) )
if cp and s[0][len(cp)] == os.sep:
# +1 because the filename starts after the separator
- sources = map(lambda s, l=len(cp)+1: s[l:], sources)
+ sources = [s[len(cp)+1:] for s in sources]
commonprefix = cp
elif len(sources) == 1:
commonprefix = os.path.dirname( sources[0] )
@@ -803,9 +763,7 @@ class _GenerateV7DSP(_DSPGenerator):
line = dspfile.readline()
while line:
- # TODO(1.5)
- #if line.find('<!-- SCons Data:') > -1:
- if string.find(line, '<!-- SCons Data:') > -1:
+ if line.find('<!-- SCons Data:') > -1:
break
line = dspfile.readline()
@@ -848,32 +806,29 @@ class _GenerateV7DSP(_DSPGenerator):
try:
self.file = open(self.dspabs,'w')
except IOError, detail:
- raise SCons.Errors.InternalError, 'Unable to open "' + self.dspabs + '" for writing:' + str(detail)
+ raise SCons.Errors.InternalError('Unable to open "' + self.dspabs + '" for writing:' + str(detail))
else:
self.PrintHeader()
self.PrintProject()
self.file.close()
-class _DSWGenerator:
+class _DSWGenerator(object):
""" Base class for DSW generators """
def __init__(self, dswfile, source, env):
self.dswfile = os.path.normpath(str(dswfile))
self.env = env
- if not env.has_key('projects'):
- raise SCons.Errors.UserError, \
- "You must specify a 'projects' argument to create an MSVSSolution."
+ if 'projects' not in env:
+ raise SCons.Errors.UserError("You must specify a 'projects' argument to create an MSVSSolution.")
projects = env['projects']
if not SCons.Util.is_List(projects):
- raise SCons.Errors.InternalError, \
- "The 'projects' argument must be a list of nodes."
+ raise SCons.Errors.InternalError("The 'projects' argument must be a list of nodes.")
projects = SCons.Util.flatten(projects)
if len(projects) < 1:
- raise SCons.Errors.UserError, \
- "You must specify at least one project to create an MSVSSolution."
- self.dspfiles = map(str, projects)
+ raise SCons.Errors.UserError("You must specify at least one project to create an MSVSSolution.")
+ self.dspfiles = list(map(str, projects))
- if self.env.has_key('name'):
+ if 'name' in self.env:
self.name = self.env['name']
else:
self.name = os.path.basename(SCons.Util.splitext(self.dswfile)[0])
@@ -898,7 +853,7 @@ class _GenerateV7DSW(_DSWGenerator):
if self.version_num >= 8.0:
self.versionstr = '9.00'
- if env.has_key('slnguid') and env['slnguid']:
+ if 'slnguid' in env and env['slnguid']:
self.slnguid = env['slnguid']
else:
self.slnguid = _generateGUID(dswfile, self.name)
@@ -906,7 +861,7 @@ class _GenerateV7DSW(_DSWGenerator):
self.configs = {}
self.nokeep = 0
- if env.has_key('nokeep') and env['variant'] != 0:
+ if 'nokeep' in env and env['variant'] != 0:
self.nokeep = 1
if self.nokeep == 0 and os.path.exists(self.dswfile):
@@ -926,10 +881,9 @@ class _GenerateV7DSW(_DSWGenerator):
self.configs[variant] = config
print "Adding '" + self.name + ' - ' + config.variant + '|' + config.platform + "' to '" + str(dswfile) + "'"
- if not env.has_key('variant'):
- raise SCons.Errors.InternalError, \
- "You must specify a 'variant' argument (i.e. 'Debug' or " +\
- "'Release') to create an MSVS Solution File."
+ if 'variant' not in env:
+ raise SCons.Errors.InternalError("You must specify a 'variant' argument (i.e. 'Debug' or " +\
+ "'Release') to create an MSVS Solution File.")
elif SCons.Util.is_String(env['variant']):
AddConfig(self, env['variant'])
elif SCons.Util.is_List(env['variant']):
@@ -992,11 +946,11 @@ class _GenerateV7DSW(_DSWGenerator):
self.file.write('Global\n')
env = self.env
- if env.has_key('MSVS_SCC_PROVIDER'):
+ if 'MSVS_SCC_PROVIDER' in env:
dspfile_base = os.path.basename(self.dspfile)
slnguid = self.slnguid
scc_provider = env.get('MSVS_SCC_PROVIDER', '')
- scc_provider = string.replace(scc_provider, ' ', r'\u0020')
+ scc_provider = scc_provider.replace(' ', r'\u0020')
scc_project_name = env.get('MSVS_SCC_PROJECT_NAME', '')
# scc_aux_path = env.get('MSVS_SCC_AUX_PATH', '')
scc_local_path = env.get('MSVS_SCC_LOCAL_PATH', '')
@@ -1022,8 +976,7 @@ class _GenerateV7DSW(_DSWGenerator):
else:
self.file.write('\tGlobalSection(SolutionConfiguration) = preSolution\n')
- confkeys = self.configs.keys()
- confkeys.sort()
+ confkeys = sorted(self.configs.keys())
cnt = 0
for name in confkeys:
variant = self.configs[name].variant
@@ -1077,7 +1030,7 @@ class _GenerateV7DSW(_DSWGenerator):
try:
self.file = open(self.dswfile,'w')
except IOError, detail:
- raise SCons.Errors.InternalError, 'Unable to open "' + self.dswfile + '" for writing:' + str(detail)
+ raise SCons.Errors.InternalError('Unable to open "' + self.dswfile + '" for writing:' + str(detail))
else:
self.PrintSolution()
self.file.close()
@@ -1126,7 +1079,7 @@ class _GenerateV6DSW(_DSWGenerator):
try:
self.file = open(self.dswfile,'w')
except IOError, detail:
- raise SCons.Errors.InternalError, 'Unable to open "' + self.dswfile + '" for writing:' + str(detail)
+ raise SCons.Errors.InternalError('Unable to open "' + self.dswfile + '" for writing:' + str(detail))
else:
self.PrintWorkspace()
self.file.close()
@@ -1136,7 +1089,7 @@ def GenerateDSP(dspfile, source, env):
"""Generates a Project file based on the version of MSVS that is being used"""
version_num = 6.0
- if env.has_key('MSVS_VERSION'):
+ if 'MSVS_VERSION' in env:
version_num, suite = msvs_parse_version(env['MSVS_VERSION'])
if version_num >= 7.0:
g = _GenerateV7DSP(dspfile, source, env)
@@ -1149,7 +1102,7 @@ def GenerateDSW(dswfile, source, env):
"""Generates a Solution/Workspace file based on the version of MSVS that is being used"""
version_num = 6.0
- if env.has_key('MSVS_VERSION'):
+ if 'MSVS_VERSION' in env:
version_num, suite = msvs_parse_version(env['MSVS_VERSION'])
if version_num >= 7.0:
g = _GenerateV7DSW(dswfile, source, env)
@@ -1225,7 +1178,7 @@ def projectEmitter(target, source, env):
source = source + env.subst('$MSVSSCONSCOM', 1)
source = source + env.subst('$MSVSENCODING', 1)
- if env.has_key('buildtarget') and env['buildtarget'] != None:
+ if 'buildtarget' in env and env['buildtarget'] != None:
if SCons.Util.is_String(env['buildtarget']):
source = source + ' "%s"' % env['buildtarget']
elif SCons.Util.is_List(env['buildtarget']):
@@ -1234,14 +1187,12 @@ def projectEmitter(target, source, env):
source = source + ' "%s"' % bt
else:
try: source = source + ' "%s"' % bt.get_abspath()
- except AttributeError: raise SCons.Errors.InternalError, \
- "buildtarget can be a string, a node, a list of strings or nodes, or None"
+ except AttributeError: raise SCons.Errors.InternalError("buildtarget can be a string, a node, a list of strings or nodes, or None")
else:
try: source = source + ' "%s"' % env['buildtarget'].get_abspath()
- except AttributeError: raise SCons.Errors.InternalError, \
- "buildtarget can be a string, a node, a list of strings or nodes, or None"
+ except AttributeError: raise SCons.Errors.InternalError("buildtarget can be a string, a node, a list of strings or nodes, or None")
- if env.has_key('outdir') and env['outdir'] != None:
+ if 'outdir' in env and env['outdir'] != None:
if SCons.Util.is_String(env['outdir']):
source = source + ' "%s"' % env['outdir']
elif SCons.Util.is_List(env['outdir']):
@@ -1250,20 +1201,18 @@ def projectEmitter(target, source, env):
source = source + ' "%s"' % s
else:
try: source = source + ' "%s"' % s.get_abspath()
- except AttributeError: raise SCons.Errors.InternalError, \
- "outdir can be a string, a node, a list of strings or nodes, or None"
+ except AttributeError: raise SCons.Errors.InternalError("outdir can be a string, a node, a list of strings or nodes, or None")
else:
try: source = source + ' "%s"' % env['outdir'].get_abspath()
- except AttributeError: raise SCons.Errors.InternalError, \
- "outdir can be a string, a node, a list of strings or nodes, or None"
+ except AttributeError: raise SCons.Errors.InternalError("outdir can be a string, a node, a list of strings or nodes, or None")
- if env.has_key('name'):
+ if 'name' in env:
if SCons.Util.is_String(env['name']):
source = source + ' "%s"' % env['name']
else:
- raise SCons.Errors.InternalError, "name must be a string"
+ raise SCons.Errors.InternalError("name must be a string")
- if env.has_key('variant'):
+ if 'variant' in env:
if SCons.Util.is_String(env['variant']):
source = source + ' "%s"' % env['variant']
elif SCons.Util.is_List(env['variant']):
@@ -1271,14 +1220,14 @@ def projectEmitter(target, source, env):
if SCons.Util.is_String(variant):
source = source + ' "%s"' % variant
else:
- raise SCons.Errors.InternalError, "name must be a string or a list of strings"
+ raise SCons.Errors.InternalError("name must be a string or a list of strings")
else:
- raise SCons.Errors.InternalError, "variant must be a string or a list of strings"
+ raise SCons.Errors.InternalError("variant must be a string or a list of strings")
else:
- raise SCons.Errors.InternalError, "variant must be specified"
+ raise SCons.Errors.InternalError("variant must be specified")
for s in _DSPGenerator.srcargs:
- if env.has_key(s):
+ if s in env:
if SCons.Util.is_String(env[s]):
source = source + ' "%s' % env[s]
elif SCons.Util.is_List(env[s]):
@@ -1286,9 +1235,9 @@ def projectEmitter(target, source, env):
if SCons.Util.is_String(t):
source = source + ' "%s"' % t
else:
- raise SCons.Errors.InternalError, s + " must be a string or a list of strings"
+ raise SCons.Errors.InternalError(s + " must be a string or a list of strings")
else:
- raise SCons.Errors.InternalError, s + " must be a string or a list of strings"
+ raise SCons.Errors.InternalError(s + " must be a string or a list of strings")
source = source + ' "%s"' % str(target[0])
source = [SCons.Node.Python.Value(source)]
@@ -1320,13 +1269,13 @@ def solutionEmitter(target, source, env):
if not source:
source = 'sln_inputs:'
- if env.has_key('name'):
+ if 'name' in env:
if SCons.Util.is_String(env['name']):
source = source + ' "%s"' % env['name']
else:
- raise SCons.Errors.InternalError, "name must be a string"
+ raise SCons.Errors.InternalError("name must be a string")
- if env.has_key('variant'):
+ if 'variant' in env:
if SCons.Util.is_String(env['variant']):
source = source + ' "%s"' % env['variant']
elif SCons.Util.is_List(env['variant']):
@@ -1334,19 +1283,19 @@ def solutionEmitter(target, source, env):
if SCons.Util.is_String(variant):
source = source + ' "%s"' % variant
else:
- raise SCons.Errors.InternalError, "name must be a string or a list of strings"
+ raise SCons.Errors.InternalError("name must be a string or a list of strings")
else:
- raise SCons.Errors.InternalError, "variant must be a string or a list of strings"
+ raise SCons.Errors.InternalError("variant must be a string or a list of strings")
else:
- raise SCons.Errors.InternalError, "variant must be specified"
+ raise SCons.Errors.InternalError("variant must be specified")
- if env.has_key('slnguid'):
+ if 'slnguid' in env:
if SCons.Util.is_String(env['slnguid']):
source = source + ' "%s"' % env['slnguid']
else:
- raise SCons.Errors.InternalError, "slnguid must be a string"
+ raise SCons.Errors.InternalError("slnguid must be a string")
- if env.has_key('projects'):
+ if 'projects' in env:
if SCons.Util.is_String(env['projects']):
source = source + ' "%s"' % env['projects']
elif SCons.Util.is_List(env['projects']):
@@ -1410,11 +1359,11 @@ def generate(env):
# Set-up ms tools paths for default version
msvc_setup_env_once(env)
- if env.has_key('MSVS_VERSION'):
+ if 'MSVS_VERSION' in env:
version_num, suite = msvs_parse_version(env['MSVS_VERSION'])
else:
(version_num, suite) = (7.0, None) # guess at a default
- if not env.has_key('MSVS'):
+ if 'MSVS' not in env:
env['MSVS'] = {}
if (version_num < 7.0):
env['MSVS']['PROJECTSUFFIX'] = '.dsp'
diff --git a/engine/SCons/Tool/mwcc.py b/engine/SCons/Tool/mwcc.py
index ec97ab5..fe6f0b3 100644
--- a/engine/SCons/Tool/mwcc.py
+++ b/engine/SCons/Tool/mwcc.py
@@ -30,11 +30,10 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/mwcc.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/mwcc.py 5023 2010/06/14 22:05:46 scons"
import os
import os.path
-import string
import SCons.Util
@@ -80,8 +79,8 @@ def set_vars(env):
ENV['CWFolder'] = version.path
ENV['LM_LICENSE_FILE'] = version.license
plus = lambda x: '+%s' % x
- ENV['MWCIncludes'] = string.join(map(plus, version.includes), os.pathsep)
- ENV['MWLibraries'] = string.join(map(plus, version.libs), os.pathsep)
+ ENV['MWCIncludes'] = os.pathsep.join(map(plus, version.includes))
+ ENV['MWLibraries'] = os.pathsep.join(map(plus, version.libs))
return 1
@@ -100,7 +99,7 @@ def find_versions():
product_key = SCons.Util.RegOpenKeyEx(HLM, product)
i = 0
- while 1:
+ while True:
name = product + '\\' + SCons.Util.RegEnumKey(product_key, i)
name_key = SCons.Util.RegOpenKeyEx(HLM, name)
@@ -120,7 +119,7 @@ def find_versions():
return versions
-class MWVersion:
+class MWVersion(object):
def __init__(self, version, path, platform):
self.version = version
self.path = path
diff --git a/engine/SCons/Tool/mwld.py b/engine/SCons/Tool/mwld.py
index 9880876..73d9f32 100644
--- a/engine/SCons/Tool/mwld.py
+++ b/engine/SCons/Tool/mwld.py
@@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/mwld.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/mwld.py 5023 2010/06/14 22:05:46 scons"
import SCons.Tool
@@ -85,7 +85,7 @@ def shlib_emitter(target, source, env):
no_import_lib = env.get('no_import_lib', 0)
if not dll:
- raise SCons.Errors.UserError, "A shared library should have exactly one target with the suffix: %s" % env.subst("$SHLIBSUFFIX")
+ raise SCons.Errors.UserError("A shared library should have exactly one target with the suffix: %s" % env.subst("$SHLIBSUFFIX"))
if not no_import_lib and \
not env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX'):
diff --git a/engine/SCons/Tool/nasm.py b/engine/SCons/Tool/nasm.py
index fe469d6..212e323 100644
--- a/engine/SCons/Tool/nasm.py
+++ b/engine/SCons/Tool/nasm.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/nasm.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/nasm.py 5023 2010/06/14 22:05:46 scons"
import SCons.Defaults
import SCons.Tool
diff --git a/engine/SCons/Tool/packaging/__init__.py b/engine/SCons/Tool/packaging/__init__.py
index 3ef610c..e7d684e 100644
--- a/engine/SCons/Tool/packaging/__init__.py
+++ b/engine/SCons/Tool/packaging/__init__.py
@@ -24,9 +24,8 @@ SCons Packaging Tool.
# 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__ = "src/engine/SCons/Tool/packaging/__init__.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/packaging/__init__.py 5023 2010/06/14 22:05:46 scons"
import SCons.Environment
from SCons.Variables import *
@@ -58,7 +57,7 @@ def Tag(env, target, source, *more_tags, **kw_tags):
kw_tags[first_tag[0]] = ''
if len(kw_tags) == 0 and len(more_tags) == 0:
- raise UserError, "No tags given."
+ raise UserError("No tags given.")
# XXX: sanity checks
for x in more_tags:
@@ -91,7 +90,7 @@ def Package(env, target=None, source=None, **kw):
source = env.FindInstalledFiles()
if len(source)==0:
- raise UserError, "No source for Package() given"
+ raise UserError("No source for Package() given")
# decide which types of packages shall be built. Can be defined through
# four mechanisms: command line argument, keyword argument,
@@ -105,16 +104,16 @@ def Package(env, target=None, source=None, **kw):
kw['PACKAGETYPE'] = GetOption('package_type')
if kw['PACKAGETYPE'] == None:
- if env['BUILDERS'].has_key('Tar'):
+ if 'Tar' in env['BUILDERS']:
kw['PACKAGETYPE']='targz'
- elif env['BUILDERS'].has_key('Zip'):
+ elif 'Zip' in env['BUILDERS']:
kw['PACKAGETYPE']='zip'
else:
- raise UserError, "No type for Package() given"
+ raise UserError("No type for Package() given")
PACKAGETYPE=kw['PACKAGETYPE']
if not is_List(PACKAGETYPE):
- PACKAGETYPE=string.split(PACKAGETYPE, ',')
+ PACKAGETYPE=PACKAGETYPE.split(',')
# load the needed packagers.
def load_packager(type):
@@ -124,7 +123,7 @@ def Package(env, target=None, source=None, **kw):
except ImportError, e:
raise EnvironmentError("packager %s not available: %s"%(type,str(e)))
- packagers=map(load_packager, PACKAGETYPE)
+ packagers=list(map(load_packager, PACKAGETYPE))
# set up targets and the PACKAGEROOT
try:
@@ -139,7 +138,7 @@ def Package(env, target=None, source=None, **kw):
default_target = default_name%kw
target.extend( [default_target]*size_diff )
- if not kw.has_key('PACKAGEROOT'):
+ if 'PACKAGEROOT' not in kw:
kw['PACKAGEROOT'] = default_name%kw
except KeyError, e:
@@ -153,7 +152,7 @@ def Package(env, target=None, source=None, **kw):
try:
for packager in packagers:
t=[target.pop(0)]
- t=apply(packager.package, [env,t,source], kw)
+ t=packager.package(env,t,source, **kw)
targets.extend(t)
assert( len(target) == 0 )
@@ -173,8 +172,7 @@ def Package(env, target=None, source=None, **kw):
args.remove('target')
args.remove('source')
# now remove any args for which we have a value in kw.
- #args=[x for x in args if not kw.has_key(x)]
- args=filter(lambda x, kw=kw: not kw.has_key(x), args)
+ args=[x for x in args if x not in kw]
if len(args)==0:
raise # must be a different error, so reraise
@@ -222,7 +220,7 @@ def options(opts):
opts.AddVariables(
EnumVariable( 'PACKAGETYPE',
'the type of package to create.',
- None, allowed_values=map( str, __all__ ),
+ None, allowed_values=list(map( str, __all__ )),
ignorecase=2
)
)
@@ -236,8 +234,8 @@ def copy_attr(f1, f2):
"""
#pattrs = [x for x in dir(f1) if not hasattr(f2, x) and\
# x.startswith('PACKAGING_')]
- copyit = lambda x, f2=f2: not hasattr(f2, x) and x[:10] == 'PACKAGING_'
- pattrs = filter(copyit, dir(f1))
+ copyit = lambda x: not hasattr(f2, x) and x[:10] == 'PACKAGING_'
+ pattrs = list(filter(copyit, dir(f1)))
for attr in pattrs:
setattr(f2, attr, getattr(f1, attr))
def putintopackageroot(target, source, env, pkgroot, honor_install_location=1):
@@ -291,7 +289,7 @@ def stripinstallbuilder(target, source, env):
(file.builder.name=="InstallBuilder" or\
file.builder.name=="InstallAsBuilder"))
- if len(filter(has_no_install_location, source)):
+ if len(list(filter(has_no_install_location, source))):
warn(Warning, "there are files to package which have no\
InstallBuilder attached, this might lead to irreproducible packages")
diff --git a/engine/SCons/Tool/packaging/ipk.py b/engine/SCons/Tool/packaging/ipk.py
index de1de7c..266bb70 100644
--- a/engine/SCons/Tool/packaging/ipk.py
+++ b/engine/SCons/Tool/packaging/ipk.py
@@ -24,7 +24,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/packaging/ipk.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/packaging/ipk.py 5023 2010/06/14 22:05:46 scons"
import SCons.Builder
import SCons.Node.FS
@@ -58,7 +58,7 @@ def package(env, target, source, PACKAGEROOT, NAME, VERSION, DESCRIPTION,
buildarchitecture = os.uname()[4]
buildarchitecture = archmap.get(buildarchitecture, buildarchitecture)
- if kw.has_key('ARCHITECTURE'):
+ if 'ARCHITECTURE' in kw:
buildarchitecture = kw['ARCHITECTURE']
# setup the kw to contain the mandatory arguments to this fucntion.
@@ -76,7 +76,7 @@ def package(env, target, source, PACKAGEROOT, NAME, VERSION, DESCRIPTION,
target=[ "%s_%s_%s.ipk"%(NAME, VERSION, buildarchitecture) ]
# now apply the Ipkg builder
- return apply(bld, [env, target, specfile], kw)
+ return bld(env, target, specfile, **kw)
def gen_ipk_dir(proot, source, env, kw):
# make sure the packageroot is a Dir object.
@@ -98,7 +98,7 @@ def gen_ipk_dir(proot, source, env, kw):
spec_target.append(control.File('preinst'))
# apply the builder to the specfile targets
- apply(s_bld, [env, spec_target, source], kw)
+ s_bld(env, spec_target, source, **kw)
# the packageroot directory does now contain the specfiles.
return proot
@@ -125,7 +125,7 @@ def build_specfiles(source, target, env):
control_file=open_file('control', target)
- if not env.has_key('X_IPK_DESCRIPTION'):
+ if 'X_IPK_DESCRIPTION' not in env:
env['X_IPK_DESCRIPTION']="%s\n %s"%(env['SUMMARY'],
env['DESCRIPTION'].replace('\n', '\n '))
@@ -173,7 +173,7 @@ Description: $X_IPK_DESCRIPTION
f.close()
# call a user specified function
- if env.has_key('CHANGE_SPECFILE'):
+ if 'CHANGE_SPECFILE' in env:
content += env['CHANGE_SPECFILE'](target)
return 0
diff --git a/engine/SCons/Tool/packaging/msi.py b/engine/SCons/Tool/packaging/msi.py
index cea3483..76dca18 100644
--- a/engine/SCons/Tool/packaging/msi.py
+++ b/engine/SCons/Tool/packaging/msi.py
@@ -24,9 +24,8 @@ The msi packager.
# 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__ = "src/engine/SCons/Tool/packaging/msi.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/packaging/msi.py 5023 2010/06/14 22:05:46 scons"
import os
import SCons
@@ -65,14 +64,14 @@ def convert_to_id(s, id_set):
charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYabcdefghijklmnopqrstuvwxyz0123456789_.'
if s[0] in '0123456789.':
s += '_'+s
- id = filter( lambda c : c in charset, s )
+ id = [c for c in s if c in charset]
# did we already generate an id for this file?
try:
return id_set[id][s]
except KeyError:
# no we did not so initialize with the id
- if not id_set.has_key(id): id_set[id] = { s : id }
+ if id not in id_set: id_set[id] = { s : id }
# there is a collision, generate an id which is unique by appending
# the collision number
else: id_set[id][s] = id + str(len(id_set[id]))
@@ -109,7 +108,7 @@ def gen_dos_short_file_name(file, filename_set):
# strip forbidden characters.
forbidden = '."/[]:;=, '
- fname = filter( lambda c : c not in forbidden, fname )
+ fname = [c for c in fname if c not in forbidden]
# check if we already generated a filename with the same number:
# thisis1.txt, thisis2.txt etc.
@@ -137,7 +136,7 @@ def create_feature_dict(files):
feature = [ feature ]
for f in feature:
- if not dict.has_key( f ):
+ if f not in dict:
dict[ f ] = [ file ]
else:
dict[ f ].append( file )
@@ -214,7 +213,7 @@ def build_wxsfile(target, source, env):
file.write( doc.toprettyxml() )
# call a user specified function
- if env.has_key('CHANGE_SPECFILE'):
+ if 'CHANGE_SPECFILE' in env:
env['CHANGE_SPECFILE'](target, source)
except KeyError, e:
@@ -296,9 +295,11 @@ def build_wxsfile_file_section(root, files, NAME, VERSION, VENDOR, filename_set,
upper_dir = ''
# walk down the xml tree finding parts of the directory
- dir_parts = filter( lambda d: d != '', dir_parts )
+ dir_parts = [d for d in dir_parts if d != '']
for d in dir_parts[:]:
- already_created = filter( lambda c: c.nodeName == 'Directory' and c.attributes['LongName'].value == escape(d), Directory.childNodes )
+ already_created = [c for c in Directory.childNodes
+ if c.nodeName == 'Directory'
+ and c.attributes['LongName'].value == escape(d)]
if already_created != []:
Directory = already_created[0]
@@ -464,7 +465,7 @@ def build_wxsfile_header_section(root, spec):
Product.childNodes.append( Package )
# set "mandatory" default values
- if not spec.has_key('X_MSI_LANGUAGE'):
+ if 'X_MSI_LANGUAGE' not in spec:
spec['X_MSI_LANGUAGE'] = '1033' # select english
# mandatory sections, will throw a KeyError if the tag is not available
@@ -475,10 +476,10 @@ def build_wxsfile_header_section(root, spec):
Package.attributes['Description'] = escape( spec['SUMMARY'] )
# now the optional tags, for which we avoid the KeyErrror exception
- if spec.has_key( 'DESCRIPTION' ):
+ if 'DESCRIPTION' in spec:
Package.attributes['Comments'] = escape( spec['DESCRIPTION'] )
- if spec.has_key( 'X_MSI_UPGRADE_CODE' ):
+ if 'X_MSI_UPGRADE_CODE' in spec:
Package.attributes['X_MSI_UPGRADE_CODE'] = escape( spec['X_MSI_UPGRADE_CODE'] )
# We hardcode the media tag as our current model cannot handle it.
@@ -511,7 +512,7 @@ def package(env, target, source, PACKAGEROOT, NAME, VERSION,
# put the arguments into the env and call the specfile builder.
env['msi_spec'] = kw
- specfile = apply( wxs_builder, [env, target, source], kw )
+ specfile = wxs_builder(* [env, target, source], **kw)
# now call the WiX Tool with the built specfile added as a source.
msifile = env.WiX(target, specfile)
diff --git a/engine/SCons/Tool/packaging/rpm.py b/engine/SCons/Tool/packaging/rpm.py
index 80d5a89..ff693b9 100644
--- a/engine/SCons/Tool/packaging/rpm.py
+++ b/engine/SCons/Tool/packaging/rpm.py
@@ -24,12 +24,10 @@ The rpm packager.
# 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__ = "src/engine/SCons/Tool/packaging/rpm.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/packaging/rpm.py 5023 2010/06/14 22:05:46 scons"
import os
-import string
import SCons.Builder
@@ -65,7 +63,7 @@ def package(env, target, source, PACKAGEROOT, NAME, VERSION,
buildarchitecture = os.uname()[4]
buildarchitecture = archmap.get(buildarchitecture, buildarchitecture)
- if kw.has_key('ARCHITECTURE'):
+ if 'ARCHITECTURE' in kw:
buildarchitecture = kw['ARCHITECTURE']
fmt = '%s-%s-%s.%s.rpm'
@@ -81,9 +79,9 @@ def package(env, target, source, PACKAGEROOT, NAME, VERSION,
del kw['source'], kw['target'], kw['env']
# if no "SOURCE_URL" tag is given add a default one.
- if not kw.has_key('SOURCE_URL'):
+ if 'SOURCE_URL' not in kw:
#kw['SOURCE_URL']=(str(target[0])+".tar.gz").replace('.rpm', '')
- kw['SOURCE_URL']=string.replace(str(target[0])+".tar.gz", '.rpm', '')
+ kw['SOURCE_URL']=(str(target[0])+".tar.gz").replace('.rpm', '')
# mangle the source and target list for the rpmbuild
env = OverrideEnvironment(env, kw)
@@ -92,7 +90,7 @@ def package(env, target, source, PACKAGEROOT, NAME, VERSION,
target, source = collectintargz(target, source, env)
# now call the rpm builder to actually build the packet.
- return apply(bld, [env, target, source], kw)
+ return bld(env, target, source, **kw)
def collectintargz(target, source, env):
""" Puts all source files into a tar.gz file. """
@@ -102,21 +100,21 @@ def collectintargz(target, source, env):
# filter out the target we are building the source list for.
#sources = [s for s in sources if not (s in target)]
- sources = filter(lambda s, t=target: not (s in t), sources)
+ sources = [s for s in sources if s not in target]
# find the .spec file for rpm and add it since it is not necessarily found
# by the FindSourceFiles function.
#sources.extend( [s for s in source if str(s).rfind('.spec')!=-1] )
- spec_file = lambda s: string.rfind(str(s), '.spec') != -1
- sources.extend( filter(spec_file, source) )
+ spec_file = lambda s: str(s).rfind('.spec') != -1
+ sources.extend( list(filter(spec_file, source)) )
# as the source contains the url of the source package this rpm package
# is built from, we extract the target name
#tarball = (str(target[0])+".tar.gz").replace('.rpm', '')
- tarball = string.replace(str(target[0])+".tar.gz", '.rpm', '')
+ tarball = (str(target[0])+".tar.gz").replace('.rpm', '')
try:
#tarball = env['SOURCE_URL'].split('/')[-1]
- tarball = string.split(env['SOURCE_URL'], '/')[-1]
+ tarball = env['SOURCE_URL'].split('/')[-1]
except KeyError, e:
raise SCons.Errors.UserError( "Missing PackageTag '%s' for RPM packager" % e.args[0] )
@@ -150,7 +148,7 @@ def build_specfile(target, source, env):
file.close()
# call a user specified function
- if env.has_key('CHANGE_SPECFILE'):
+ if 'CHANGE_SPECFILE' in env:
env['CHANGE_SPECFILE'](target, source)
except KeyError, e:
@@ -188,16 +186,16 @@ def build_specfile_sections(spec):
# Default prep, build, install and clean rules
# TODO: optimize those build steps, to not compile the project a second time
- if not spec.has_key('X_RPM_PREP'):
+ if 'X_RPM_PREP' not in spec:
spec['X_RPM_PREP'] = '[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT"' + '\n%setup -q'
- if not spec.has_key('X_RPM_BUILD'):
+ if 'X_RPM_BUILD' not in spec:
spec['X_RPM_BUILD'] = 'mkdir "$RPM_BUILD_ROOT"'
- if not spec.has_key('X_RPM_INSTALL'):
+ if 'X_RPM_INSTALL' not in spec:
spec['X_RPM_INSTALL'] = 'scons --install-sandbox="$RPM_BUILD_ROOT" "$RPM_BUILD_ROOT"'
- if not spec.has_key('X_RPM_CLEAN'):
+ if 'X_RPM_CLEAN' not in spec:
spec['X_RPM_CLEAN'] = '[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT"'
str = str + SimpleTagCompiler(optional_sections, mandatory=0).compile( spec )
@@ -254,7 +252,7 @@ def build_specfile_header(spec):
# if not s.has_key('x_rpm_BuildRequires'):
# s['x_rpm_BuildRequires'] = 'scons'
- if not spec.has_key('X_RPM_BUILDROOT'):
+ if 'X_RPM_BUILDROOT' not in spec:
spec['X_RPM_BUILDROOT'] = '%{_tmppath}/%{name}-%{version}-%{release}'
str = str + SimpleTagCompiler(optional_header_fields, mandatory=0).compile( spec )
@@ -268,7 +266,7 @@ def build_specfile_filesection(spec, files):
"""
str = '%files\n'
- if not spec.has_key('X_RPM_DEFATTR'):
+ if 'X_RPM_DEFATTR' not in spec:
spec['X_RPM_DEFATTR'] = '(-,root,root)'
str = str + '%%defattr %s\n' % spec['X_RPM_DEFATTR']
@@ -302,7 +300,7 @@ def build_specfile_filesection(spec, files):
return str
-class SimpleTagCompiler:
+class SimpleTagCompiler(object):
""" This class is a simple string substition utility:
the replacement specfication is stored in the tagset dictionary, something
like:
@@ -333,11 +331,11 @@ class SimpleTagCompiler:
def strip_country_code(tag):
return tag[:-2]
- replacements = self.tagset.items()
+ replacements = list(self.tagset.items())
str = ""
#domestic = [ (k,v) for k,v in replacements if not is_international(k) ]
- domestic = filter(lambda t, i=is_international: not i(t[0]), replacements)
+ domestic = [t for t in replacements if not is_international(t[0])]
for key, replacement in domestic:
try:
str = str + replacement % values[key]
@@ -346,12 +344,12 @@ class SimpleTagCompiler:
raise e
#international = [ (k,v) for k,v in replacements if is_international(k) ]
- international = filter(lambda t, i=is_international: i(t[0]), replacements)
+ international = [t for t in replacements if is_international(t[0])]
for key, replacement in international:
try:
#int_values_for_key = [ (get_country_code(k),v) for k,v in values.items() if strip_country_code(k) == key ]
- x = filter(lambda t,key=key,s=strip_country_code: s(t[0]) == key, values.items())
- int_values_for_key = map(lambda t,g=get_country_code: (g(t[0]),t[1]), x)
+ x = [t for t in values.items() if strip_country_code(t[0]) == key]
+ int_values_for_key = [(get_country_code(t[0]),t[1]) for t in x]
for v in int_values_for_key:
str = str + replacement % v
except KeyError, e:
diff --git a/engine/SCons/Tool/packaging/src_tarbz2.py b/engine/SCons/Tool/packaging/src_tarbz2.py
index def9fcc..7ff3bed 100644
--- a/engine/SCons/Tool/packaging/src_tarbz2.py
+++ b/engine/SCons/Tool/packaging/src_tarbz2.py
@@ -26,7 +26,7 @@ The tarbz2 SRC packager.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/packaging/src_tarbz2.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/packaging/src_tarbz2.py 5023 2010/06/14 22:05:46 scons"
from SCons.Tool.packaging import putintopackageroot
diff --git a/engine/SCons/Tool/packaging/src_targz.py b/engine/SCons/Tool/packaging/src_targz.py
index 0550a45..a493cde 100644
--- a/engine/SCons/Tool/packaging/src_targz.py
+++ b/engine/SCons/Tool/packaging/src_targz.py
@@ -26,7 +26,7 @@ The targz SRC packager.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/packaging/src_targz.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/packaging/src_targz.py 5023 2010/06/14 22:05:46 scons"
from SCons.Tool.packaging import putintopackageroot
diff --git a/engine/SCons/Tool/packaging/src_zip.py b/engine/SCons/Tool/packaging/src_zip.py
index 3d7dc3f..0d89b36 100644
--- a/engine/SCons/Tool/packaging/src_zip.py
+++ b/engine/SCons/Tool/packaging/src_zip.py
@@ -26,7 +26,7 @@ The zip SRC packager.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/packaging/src_zip.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/packaging/src_zip.py 5023 2010/06/14 22:05:46 scons"
from SCons.Tool.packaging import putintopackageroot
diff --git a/engine/SCons/Tool/packaging/tarbz2.py b/engine/SCons/Tool/packaging/tarbz2.py
index d1b9dc8..a1d6da8 100644
--- a/engine/SCons/Tool/packaging/tarbz2.py
+++ b/engine/SCons/Tool/packaging/tarbz2.py
@@ -26,7 +26,7 @@ The tarbz2 SRC packager.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/packaging/tarbz2.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/packaging/tarbz2.py 5023 2010/06/14 22:05:46 scons"
from SCons.Tool.packaging import stripinstallbuilder, putintopackageroot
diff --git a/engine/SCons/Tool/packaging/targz.py b/engine/SCons/Tool/packaging/targz.py
index e0770f3..f2a3d49 100644
--- a/engine/SCons/Tool/packaging/targz.py
+++ b/engine/SCons/Tool/packaging/targz.py
@@ -26,7 +26,7 @@ The targz SRC packager.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/packaging/targz.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/packaging/targz.py 5023 2010/06/14 22:05:46 scons"
from SCons.Tool.packaging import stripinstallbuilder, putintopackageroot
diff --git a/engine/SCons/Tool/packaging/zip.py b/engine/SCons/Tool/packaging/zip.py
index 7b79103..359de97 100644
--- a/engine/SCons/Tool/packaging/zip.py
+++ b/engine/SCons/Tool/packaging/zip.py
@@ -26,7 +26,7 @@ The zip SRC packager.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/packaging/zip.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/packaging/zip.py 5023 2010/06/14 22:05:46 scons"
from SCons.Tool.packaging import stripinstallbuilder, putintopackageroot
diff --git a/engine/SCons/Tool/pdf.py b/engine/SCons/Tool/pdf.py
index c83a377..9d8aaab 100644
--- a/engine/SCons/Tool/pdf.py
+++ b/engine/SCons/Tool/pdf.py
@@ -28,7 +28,7 @@ Add an explicit action to run epstopdf to convert .eps files to .pdf
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/pdf.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/pdf.py 5023 2010/06/14 22:05:46 scons"
import SCons.Builder
import SCons.Tool
diff --git a/engine/SCons/Tool/pdflatex.py b/engine/SCons/Tool/pdflatex.py
index 757f47c..368c795 100644
--- a/engine/SCons/Tool/pdflatex.py
+++ b/engine/SCons/Tool/pdflatex.py
@@ -32,7 +32,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/pdflatex.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/pdflatex.py 5023 2010/06/14 22:05:46 scons"
import SCons.Action
import SCons.Util
@@ -44,7 +44,7 @@ PDFLaTeXAction = None
def PDFLaTeXAuxFunction(target = None, source= None, env=None):
result = SCons.Tool.tex.InternalLaTeXAuxAction( PDFLaTeXAction, target, source, env )
if result != 0:
- print env['PDFLATEX']," returned an error, check the log file"
+ SCons.Tool.tex.check_file_error_message(env['PDFLATEX'])
return result
PDFLaTeXAuxAction = None
diff --git a/engine/SCons/Tool/pdftex.py b/engine/SCons/Tool/pdftex.py
index 90bc687..6296f7a 100644
--- a/engine/SCons/Tool/pdftex.py
+++ b/engine/SCons/Tool/pdftex.py
@@ -32,7 +32,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/pdftex.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/pdftex.py 5023 2010/06/14 22:05:46 scons"
import os
import SCons.Action
@@ -59,11 +59,11 @@ def PDFTeXLaTeXFunction(target = None, source= None, env=None):
if SCons.Tool.tex.is_LaTeX(source,env,abspath):
result = PDFLaTeXAuxAction(target,source,env)
if result != 0:
- print env['PDFLATEX']," returned an error, check the log file"
+ SCons.Tool.tex.check_file_error_message(env['PDFLATEX'])
else:
result = PDFTeXAction(target,source,env)
if result != 0:
- print env['PDFTEX']," returned an error, check the log file"
+ SCons.Tool.tex.check_file_error_message(env['PDFTEX'])
return result
PDFTeXLaTeXAction = None
diff --git a/engine/SCons/Tool/qt.py b/engine/SCons/Tool/qt.py
index d63b586..90331aa 100644
--- a/engine/SCons/Tool/qt.py
+++ b/engine/SCons/Tool/qt.py
@@ -32,7 +32,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/qt.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/qt.py 5023 2010/06/14 22:05:46 scons"
import os.path
import re
@@ -81,7 +81,7 @@ def find_file(filename, paths, node_factory):
return node
return None
-class _Automoc:
+class _Automoc(object):
"""
Callable class, which works as an emitter for Programs, SharedLibraries and
StaticLibraries.
diff --git a/engine/SCons/Tool/rmic.py b/engine/SCons/Tool/rmic.py
index 71deadf..d35ea54 100644
--- a/engine/SCons/Tool/rmic.py
+++ b/engine/SCons/Tool/rmic.py
@@ -31,10 +31,9 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/rmic.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/rmic.py 5023 2010/06/14 22:05:46 scons"
import os.path
-import string
import SCons.Action
import SCons.Builder
@@ -86,7 +85,7 @@ def emit_rmic_classes(target, source, env):
tlist = []
for s in source:
for suff in stub_suffixes:
- fname = string.replace(s.attributes.java_classname, '.', os.sep) + \
+ fname = s.attributes.java_classname.replace('.', os.sep) + \
suff + class_suffix
t = target[0].File(fname)
t.attributes.java_lookupdir = target[0]
diff --git a/engine/SCons/Tool/rpcgen.py b/engine/SCons/Tool/rpcgen.py
index 22f54a9..40b6ed0 100644
--- a/engine/SCons/Tool/rpcgen.py
+++ b/engine/SCons/Tool/rpcgen.py
@@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/rpcgen.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/rpcgen.py 5023 2010/06/14 22:05:46 scons"
from SCons.Builder import Builder
import SCons.Util
diff --git a/engine/SCons/Tool/rpm.py b/engine/SCons/Tool/rpm.py
index 47b7c6f..f5c41a1 100644
--- a/engine/SCons/Tool/rpm.py
+++ b/engine/SCons/Tool/rpm.py
@@ -33,7 +33,7 @@ tar.gz consisting of the source file and a specfile.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/rpm.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/rpm.py 5023 2010/06/14 22:05:46 scons"
import os
import re
diff --git a/engine/SCons/Tool/sgiar.py b/engine/SCons/Tool/sgiar.py
index 56b2f7e..aa5d451 100644
--- a/engine/SCons/Tool/sgiar.py
+++ b/engine/SCons/Tool/sgiar.py
@@ -33,7 +33,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/sgiar.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/sgiar.py 5023 2010/06/14 22:05:46 scons"
import SCons.Defaults
import SCons.Tool
diff --git a/engine/SCons/Tool/sgic++.py b/engine/SCons/Tool/sgic++.py
index 5d38d50..ae6460a 100644
--- a/engine/SCons/Tool/sgic++.py
+++ b/engine/SCons/Tool/sgic++.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/sgic++.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/sgic++.py 5023 2010/06/14 22:05:46 scons"
import SCons.Util
diff --git a/engine/SCons/Tool/sgicc.py b/engine/SCons/Tool/sgicc.py
index 8115452..08f42fa 100644
--- a/engine/SCons/Tool/sgicc.py
+++ b/engine/SCons/Tool/sgicc.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/sgicc.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/sgicc.py 5023 2010/06/14 22:05:46 scons"
import cc
diff --git a/engine/SCons/Tool/sgilink.py b/engine/SCons/Tool/sgilink.py
index fd0e270..0f1060f 100644
--- a/engine/SCons/Tool/sgilink.py
+++ b/engine/SCons/Tool/sgilink.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/sgilink.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/sgilink.py 5023 2010/06/14 22:05:46 scons"
import SCons.Util
diff --git a/engine/SCons/Tool/sunar.py b/engine/SCons/Tool/sunar.py
index b673db2..0fe3820 100644
--- a/engine/SCons/Tool/sunar.py
+++ b/engine/SCons/Tool/sunar.py
@@ -32,7 +32,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/sunar.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/sunar.py 5023 2010/06/14 22:05:46 scons"
import SCons.Defaults
import SCons.Tool
diff --git a/engine/SCons/Tool/sunc++.py b/engine/SCons/Tool/sunc++.py
index cde72cb..14ae59f 100644
--- a/engine/SCons/Tool/sunc++.py
+++ b/engine/SCons/Tool/sunc++.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/sunc++.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/sunc++.py 5023 2010/06/14 22:05:46 scons"
import SCons
diff --git a/engine/SCons/Tool/suncc.py b/engine/SCons/Tool/suncc.py
index 8b4b338..4848766 100644
--- a/engine/SCons/Tool/suncc.py
+++ b/engine/SCons/Tool/suncc.py
@@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/suncc.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/suncc.py 5023 2010/06/14 22:05:46 scons"
import SCons.Util
diff --git a/engine/SCons/Tool/sunf77.py b/engine/SCons/Tool/sunf77.py
index ddc30c3..34dea3e 100644
--- a/engine/SCons/Tool/sunf77.py
+++ b/engine/SCons/Tool/sunf77.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/sunf77.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/sunf77.py 5023 2010/06/14 22:05:46 scons"
import SCons.Util
diff --git a/engine/SCons/Tool/sunf90.py b/engine/SCons/Tool/sunf90.py
index 78e756b..74a3856 100644
--- a/engine/SCons/Tool/sunf90.py
+++ b/engine/SCons/Tool/sunf90.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/sunf90.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/sunf90.py 5023 2010/06/14 22:05:46 scons"
import SCons.Util
diff --git a/engine/SCons/Tool/sunf95.py b/engine/SCons/Tool/sunf95.py
index 12190c4..e825f61 100644
--- a/engine/SCons/Tool/sunf95.py
+++ b/engine/SCons/Tool/sunf95.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/sunf95.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/sunf95.py 5023 2010/06/14 22:05:46 scons"
import SCons.Util
diff --git a/engine/SCons/Tool/sunlink.py b/engine/SCons/Tool/sunlink.py
index 4fb8625..5af2256 100644
--- a/engine/SCons/Tool/sunlink.py
+++ b/engine/SCons/Tool/sunlink.py
@@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/sunlink.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/sunlink.py 5023 2010/06/14 22:05:46 scons"
import os
import os.path
diff --git a/engine/SCons/Tool/swig.py b/engine/SCons/Tool/swig.py
index 8ad4596..85aab70 100644
--- a/engine/SCons/Tool/swig.py
+++ b/engine/SCons/Tool/swig.py
@@ -31,11 +31,10 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/swig.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/swig.py 5023 2010/06/14 22:05:46 scons"
import os.path
import re
-import string
import subprocess
import SCons.Action
@@ -72,7 +71,7 @@ def _find_modules(src):
for m in matches:
mnames.append(m[2])
- directors = directors or string.find(m[0], 'directors') >= 0
+ directors = directors or m[0].find('directors') >= 0
return mnames, directors
def _add_director_header_targets(target, env):
@@ -97,29 +96,26 @@ def _swigEmitter(target, source, env):
mnames, directors = _find_modules(src)
if directors:
_add_director_header_targets(target, env)
- python_files = map(lambda m: m + ".py", mnames)
+ python_files = [m + ".py" for m in mnames]
outdir = env.subst('$SWIGOUTDIR', target=target, source=source)
# .py files should be generated in SWIGOUTDIR if specified,
# otherwise in the same directory as the target
if outdir:
- python_files = map(lambda j, o=outdir, e=env:
- e.fs.File(os.path.join(o, j)),
- python_files)
+ python_files = [env.fs.File(os.path.join(outdir, j)) for j in python_files]
else:
- python_files = map(lambda m, d=target[0].dir:
- d.File(m), python_files)
+ python_files = [target[0].dir.File(m) for m in python_files]
target.extend(python_files)
if "-java" in flags:
if mnames is None:
mnames, directors = _find_modules(src)
if directors:
_add_director_header_targets(target, env)
- java_files = map(lambda m: [m + ".java", m + "JNI.java"], mnames)
+ java_files = [[m + ".java", m + "JNI.java"] for m in mnames]
java_files = SCons.Util.flatten(java_files)
outdir = env.subst('$SWIGOUTDIR', target=target, source=source)
if outdir:
- java_files = map(lambda j, o=outdir: os.path.join(o, j), java_files)
- java_files = map(env.fs.File, java_files)
+ java_files = [os.path.join(outdir, j) for j in java_files]
+ java_files = list(map(env.fs.File, java_files))
for jf in java_files:
t_from_s = lambda t, p, s, x: t.dir
SCons.Util.AddMethod(jf, t_from_s, 'target_from_source')
diff --git a/engine/SCons/Tool/tar.py b/engine/SCons/Tool/tar.py
index 65a16b3..0005ef7 100644
--- a/engine/SCons/Tool/tar.py
+++ b/engine/SCons/Tool/tar.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/tar.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/tar.py 5023 2010/06/14 22:05:46 scons"
import SCons.Action
import SCons.Builder
diff --git a/engine/SCons/Tool/tex.py b/engine/SCons/Tool/tex.py
index 3f9dee3..b4b2819 100644
--- a/engine/SCons/Tool/tex.py
+++ b/engine/SCons/Tool/tex.py
@@ -32,12 +32,12 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/tex.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/tex.py 5023 2010/06/14 22:05:46 scons"
import os.path
import re
-import string
import shutil
+import sys
import SCons.Action
import SCons.Node
@@ -133,6 +133,10 @@ _null = SCons.Scanner.LaTeX._null
modify_env_var = SCons.Scanner.LaTeX.modify_env_var
+def check_file_error_message(utility, filename='log'):
+ msg = '%s returned an error, check the %s file\n' % (utility, filename)
+ sys.stdout.write(msg)
+
def FindFile(name,suffixes,paths,env,requireExt=False):
if requireExt:
name,ext = SCons.Util.splitext(name)
@@ -232,8 +236,7 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None
#
# routine to update MD5 hash and compare
#
- # TODO(1.5): nested scopes
- def check_MD5(filenode, suffix, saved_hashes=saved_hashes, targetbase=targetbase):
+ def check_MD5(filenode, suffix):
global must_rerun_latex
# two calls to clear old csig
filenode.clear_memoized_values()
@@ -292,13 +295,13 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None
target_aux = os.path.join(targetdir, auxfilename)
if os.path.exists(target_aux):
content = open(target_aux, "rb").read()
- if string.find(content, "bibdata") != -1:
+ if content.find("bibdata") != -1:
if Verbose:
print "Need to run bibtex"
bibfile = env.fs.File(targetbase)
result = BibTeXAction(bibfile, bibfile, env)
if result != 0:
- print env['BIBTEX']," returned an error, check the blg file"
+ check_file_error_message(env['BIBTEX'], 'blg')
return result
must_rerun_latex = check_MD5(suffix_nodes['.bbl'],'.bbl')
break
@@ -311,7 +314,7 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None
idxfile = suffix_nodes['.idx']
result = MakeIndexAction(idxfile, idxfile, env)
if result != 0:
- print env['MAKEINDEX']," returned an error, check the ilg file"
+ check_file_error_message(env['MAKEINDEX'], 'ilg')
return result
# TO-DO: need to add a way for the user to extend this list for whatever
@@ -329,7 +332,8 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None
nclfile = suffix_nodes['.nlo']
result = MakeNclAction(nclfile, nclfile, env)
if result != 0:
- print env['MAKENCL']," (nomenclature) returned an error, check the nlg file"
+ check_file_error_message('%s (nomenclature)' % env['MAKENCL'],
+ 'nlg')
#return result
# Now decide if latex will need to be run again due to glossary.
@@ -340,7 +344,8 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None
glofile = suffix_nodes['.glo']
result = MakeGlossaryAction(glofile, glofile, env)
if result != 0:
- print env['MAKEGLOSSARY']," (glossary) returned an error, check the glg file"
+ check_file_error_message('%s (glossary)' % env['MAKEGLOSSARY'],
+ 'glg')
#return result
# Now decide if latex will need to be run again due to acronyms.
@@ -351,7 +356,8 @@ def InternalLaTeXAuxAction(XXXLaTeXAction, target = None, source= None, env=None
acrfile = suffix_nodes['.acn']
result = MakeAcronymsAction(acrfile, acrfile, env)
if result != 0:
- print env['MAKEACRONYMS']," (acronymns) returned an error, check the alg file"
+ check_file_error_message('%s (acronyms)' % env['MAKEACRONYMS'],
+ 'alg')
return result
# Now decide if latex needs to be run yet again to resolve warnings.
@@ -420,9 +426,7 @@ def is_LaTeX(flist,env,abspath):
pass
else:
# Split at os.pathsep to convert into absolute path
- # TODO(1.5)
- #paths = paths.split(os.pathsep)
- paths = string.split(paths, os.pathsep)
+ paths = paths.split(os.pathsep)
# now that we have the path list restore the env
if savedpath is _null:
@@ -488,11 +492,11 @@ def TeXLaTeXFunction(target = None, source= None, env=None):
if is_LaTeX(source,env,abspath):
result = LaTeXAuxAction(target,source,env)
if result != 0:
- print env['LATEX']," returned an error, check the log file"
+ check_file_error_message(env['LATEX'])
else:
result = TeXAction(target,source,env)
if result != 0:
- print env['TEX']," returned an error, check the log file"
+ check_file_error_message(env['TEX'])
return result
def TeXLaTeXStrFunction(target = None, source= None, env=None):
@@ -646,9 +650,7 @@ def tex_emitter_core(target, source, env, graphics_extensions):
pass
else:
# Split at os.pathsep to convert into absolute path
- # TODO(1.5)
- #paths = paths.split(os.pathsep)
- paths = string.split(paths, os.pathsep)
+ paths = paths.split(os.pathsep)
# now that we have the path list restore the env
if savedpath is _null:
diff --git a/engine/SCons/Tool/textfile.py b/engine/SCons/Tool/textfile.py
index 5d1611b..0293bb9 100644
--- a/engine/SCons/Tool/textfile.py
+++ b/engine/SCons/Tool/textfile.py
@@ -44,7 +44,7 @@ Textfile/Substfile builder for SCons.
is unpredictible whether the expansion will occur.
"""
-__revision__ = "src/engine/SCons/Tool/textfile.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/textfile.py 5023 2010/06/14 22:05:46 scons"
import SCons
@@ -84,12 +84,12 @@ def _action(target, source, env):
% repr(linesep), None)
# create a dictionary to use for the substitutions
- if not env.has_key('SUBST_DICT'):
+ if 'SUBST_DICT' not in env:
subs = None # no substitutions
else:
d = env['SUBST_DICT']
if is_Dict(d):
- d = d.items()
+ d = list(d.items())
elif is_Sequence(d):
pass
else:
diff --git a/engine/SCons/Tool/tlib.py b/engine/SCons/Tool/tlib.py
index 7b03638..6344e71 100644
--- a/engine/SCons/Tool/tlib.py
+++ b/engine/SCons/Tool/tlib.py
@@ -27,7 +27,7 @@ XXX
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/tlib.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/tlib.py 5023 2010/06/14 22:05:46 scons"
import SCons.Tool
import SCons.Tool.bcc32
diff --git a/engine/SCons/Tool/wix.py b/engine/SCons/Tool/wix.py
index 603092c..1a95e22 100644
--- a/engine/SCons/Tool/wix.py
+++ b/engine/SCons/Tool/wix.py
@@ -30,12 +30,11 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/wix.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/wix.py 5023 2010/06/14 22:05:46 scons"
import SCons.Builder
import SCons.Action
import os
-import string
def generate(env):
"""Add Builders and construction variables for WiX to an Environment."""
@@ -68,7 +67,7 @@ def exists(env):
# try to find the candle.exe and light.exe tools and
# add the install directory to light libpath.
#for path in os.environ['PATH'].split(os.pathsep):
- for path in string.split(os.environ['PATH'], os.pathsep):
+ for path in os.environ['PATH'].split(os.pathsep):
if not path:
continue
diff --git a/engine/SCons/Tool/yacc.py b/engine/SCons/Tool/yacc.py
index 6b5ad3f..0f8744f 100644
--- a/engine/SCons/Tool/yacc.py
+++ b/engine/SCons/Tool/yacc.py
@@ -31,10 +31,9 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/yacc.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/yacc.py 5023 2010/06/14 22:05:46 scons"
import os.path
-import string
import SCons.Defaults
import SCons.Tool
@@ -71,7 +70,7 @@ def _yaccEmitter(target, source, env, ysuf, hsuf):
if option[:l] == fileGenOption:
# A file generating option is present, so add the file
# name to the list of targets.
- fileName = string.strip(option[l:])
+ fileName = option[l:].strip()
target.append(fileName)
return (target, source)
diff --git a/engine/SCons/Tool/zip.py b/engine/SCons/Tool/zip.py
index 42f23a2..36fd436 100644
--- a/engine/SCons/Tool/zip.py
+++ b/engine/SCons/Tool/zip.py
@@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Tool/zip.py 4720 2010/03/24 03:14:11 jars"
+__revision__ = "src/engine/SCons/Tool/zip.py 5023 2010/06/14 22:05:46 scons"
import os.path
@@ -49,16 +49,15 @@ except ImportError:
if internal_zip:
zipcompression = zipfile.ZIP_DEFLATED
def zip(target, source, env):
- def visit(arg, dirname, names):
- for name in names:
- path = os.path.join(dirname, name)
- if os.path.isfile(path):
- arg.write(path)
compression = env.get('ZIPCOMPRESSION', 0)
zf = zipfile.ZipFile(str(target[0]), 'w', compression)
for s in source:
if s.isdir():
- os.path.walk(str(s), visit, zf)
+ for dirpath, dirnames, filenames in os.walk(str(s)):
+ for fname in filenames:
+ path = os.path.join(dirpath, fname)
+ if os.path.isfile(path):
+ zf.write(path)
else:
zf.write(str(s))
zf.close()