summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
authorRussel Winder <russel@winder.org.uk>2016-01-01 13:52:31 (GMT)
committerRussel Winder <russel@winder.org.uk>2016-01-01 13:52:31 (GMT)
commit34cf3bdb1743de9a5534bfd25998d0a01297f004 (patch)
tree95b6de82092af962dd5136c4017e7388bbb72aa2 /src/engine
parent2a270c8f314e959c78e9deda29c8f250bb934dd6 (diff)
downloadSCons-34cf3bdb1743de9a5534bfd25998d0a01297f004.zip
SCons-34cf3bdb1743de9a5534bfd25998d0a01297f004.tar.gz
SCons-34cf3bdb1743de9a5534bfd25998d0a01297f004.tar.bz2
Run futurize --stage1.
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/SCons/Action.py3
-rw-r--r--src/engine/SCons/EnvironmentTests.py3
-rw-r--r--src/engine/SCons/Node/__init__.py38
-rw-r--r--src/engine/SCons/Script/Main.py6
-rw-r--r--src/engine/SCons/Script/SConscript.py4
-rw-r--r--src/engine/SCons/Tool/cyglink.py37
-rw-r--r--src/engine/SCons/Tool/f08.py4
-rw-r--r--src/engine/SCons/Tool/msvs.py136
-rw-r--r--src/engine/SCons/Tool/swig.py5
-rwxr-xr-xsrc/engine/SCons/compat/six.py4
-rw-r--r--src/engine/SCons/compat/sixTests.py3
-rw-r--r--src/engine/SCons/cppTests.py4
12 files changed, 131 insertions, 116 deletions
diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py
index d11f30d..a4e75f3 100644
--- a/src/engine/SCons/Action.py
+++ b/src/engine/SCons/Action.py
@@ -101,7 +101,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import dis
import os
-# compat layer imports "cPickle" for us if it's available.
import pickle
import re
import sys
@@ -272,7 +271,7 @@ def _function_contents(func):
contents.append(b',()')
# The function contents depends on the closure captured cell values.
- closure = func.func_closure or []
+ closure = func.__closure__ or []
#xxx = [_object_contents(x.cell_contents) for x in closure]
try:
diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py
index 99d169a..4b57763 100644
--- a/src/engine/SCons/EnvironmentTests.py
+++ b/src/engine/SCons/EnvironmentTests.py
@@ -20,6 +20,7 @@
# 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 print_function
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
@@ -1868,7 +1869,7 @@ def generate(env):
# test for pull request #150
env = self.TestEnvironment()
env._dict.pop('BUILDERS')
- assert env.has_key('BUILDERS') is False
+ assert ('BUILDERS' in env) is False
env2 = env.Clone()
def test_Copy(self):
diff --git a/src/engine/SCons/Node/__init__.py b/src/engine/SCons/Node/__init__.py
index 85e30c2..1a76b60 100644
--- a/src/engine/SCons/Node/__init__.py
+++ b/src/engine/SCons/Node/__init__.py
@@ -19,6 +19,8 @@ be able to depend on any other type of "thing."
"""
+from __future__ import print_function
+
#
# __COPYRIGHT__
#
@@ -151,7 +153,7 @@ def exists_file(node):
# The source file does not exist. Make sure no old
# copy remains in the variant directory.
if print_duplicate:
- print "dup: no src for %s, unlinking old variant copy"%self
+ print("dup: no src for %s, unlinking old variant copy"%self)
if exists_base(node) or node.islink():
node.fs.unlink(node.get_internal_path())
# Return None explicitly because the Base.exists() call
@@ -205,13 +207,13 @@ def get_contents_dir(node):
contents.append('%s %s\n' % (n.get_csig(), n.name))
return ''.join(contents)
-def get_contents_file(node):
+def get_contents_file(node):
if not node.rexists():
return ''
fname = node.rfile().get_abspath()
try:
contents = open(fname, "rb").read()
- except EnvironmentError, e:
+ except EnvironmentError as e:
if not e.filename:
e.filename = fname
raise
@@ -407,21 +409,21 @@ class NodeInfoBase(object):
for name in getattr(obj,'__slots__',()):
if hasattr(self, name):
state[name] = getattr(self, name)
-
+
state['_version_id'] = self.current_version_id
try:
del state['__weakref__']
except KeyError:
pass
return state
-
+
def __setstate__(self, state):
"""
Restore the attributes from a pickled state. The version is discarded.
"""
# TODO check or discard version
del state['_version_id']
-
+
for key, value in state.items():
if key not in ('__weakref__',):
setattr(self, key, value)
@@ -456,7 +458,7 @@ class BuildInfoBase(object):
"""
state = other.__getstate__()
self.__setstate__(state)
-
+
def __getstate__(self):
"""
Return all fields that shall be pickled. Walk the slots in the class
@@ -536,7 +538,7 @@ class Node(object):
class Attrs(object):
__slots__ = ('shared', '__dict__')
-
+
def __init__(self):
if SCons.Debug.track_instances: logInstanceCreation(self, 'Node.Node')
@@ -588,7 +590,7 @@ class Node(object):
self._func_rexists = 1
self._func_get_contents = 0
self._func_target_from_source = 0
-
+
self.clear_memoized_values()
# Let the interface in which the build engine is embedded
@@ -776,16 +778,16 @@ class Node(object):
def release_target_info(self):
"""Called just after this node has been marked
up-to-date or was built completely.
-
+
This is where we try to release as many target node infos
as possible for clean builds and update runs, in order
to minimize the overall memory consumption.
-
+
By purging attributes that aren't needed any longer after
a Node (=File) got built, we don't have to care that much how
many KBytes a Node actually requires...as long as we free
the memory shortly afterwards.
-
+
@see: built() and File.release_target_info()
"""
pass
@@ -934,7 +936,7 @@ class Node(object):
node = nodes.pop(0)
scanner = node._get_scanner(env, initial_scanner, root_node_scanner, kw)
-
+
if not scanner:
continue
@@ -958,14 +960,14 @@ class Node(object):
else:
# handle explicit scanner case
scanner = initial_scanner.select(self)
-
+
if not scanner:
# no scanner could be found for the given node's scanner key;
# thus, make an attempt at using a default.
scanner = root_node_scanner
-
+
return scanner
-
+
def get_env_scanner(self, env, kw={}):
return env.get_scanner(self.scanner_key())
@@ -1422,14 +1424,14 @@ class Node(object):
any difference, but we now rely on checking every dependency
to make sure that any necessary Node information (for example,
the content signature of an #included .h file) is updated.
-
+
The allowcache option was added for supporting the early
release of the executor/builder structures, right after
a File target was built. When set to true, the return
value of this changed method gets cached for File nodes.
Like this, the executor isn't needed any longer for subsequent
calls to changed().
-
+
@see: FS.File.changed(), FS.File.release_target_info()
"""
t = 0
diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py
index 71d64fc..7cc7d47 100644
--- a/src/engine/SCons/Script/Main.py
+++ b/src/engine/SCons/Script/Main.py
@@ -10,6 +10,8 @@ some other module. If it's specific to the "scons" script invocation,
it goes here.
"""
+from __future__ import print_function
+
unsupported_python_version = (2, 6, 0)
deprecated_python_version = (2, 7, 0)
@@ -354,13 +356,13 @@ class CleanTask(SCons.Taskmaster.AlwaysTask):
for t in self._get_files_to_clean():
try:
removed = t.remove()
- except OSError, e:
+ except OSError as e:
# An OSError may indicate something like a permissions
# issue, an IOError would indicate something like
# the file not existing. In either case, print a
# message and keep going to try to remove as many
# targets as possible.
- print("scons: Could not remove '{}':".format(str(t)), e.strerror)
+ print(("scons: Could not remove '{}':".format(str(t)), e.strerror))
else:
if removed:
display("Removed " + str(t))
diff --git a/src/engine/SCons/Script/SConscript.py b/src/engine/SCons/Script/SConscript.py
index ab032be..6480ace 100644
--- a/src/engine/SCons/Script/SConscript.py
+++ b/src/engine/SCons/Script/SConscript.py
@@ -5,6 +5,8 @@ files.
"""
+from __future__ import print_function
+
#
# __COPYRIGHT__
#
@@ -68,7 +70,7 @@ def get_calling_namespaces():
"""Return the locals and globals for the function that called
into this module in the current call stack."""
try: 1//0
- except ZeroDivisionError:
+ except ZeroDivisionError:
# Don't start iterating with the current stack-frame to
# prevent creating reference cycles (f_back is safe).
frame = sys.exc_info()[2].tb_frame.f_back
diff --git a/src/engine/SCons/Tool/cyglink.py b/src/engine/SCons/Tool/cyglink.py
index 2f54a17..f69b886 100644
--- a/src/engine/SCons/Tool/cyglink.py
+++ b/src/engine/SCons/Tool/cyglink.py
@@ -7,6 +7,9 @@ It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
+
+from __future__ import absolute_import, print_function
+
import re
import os
@@ -15,8 +18,8 @@ import SCons.Util
import SCons.Tool
#MAYBE: from . import gnulink
-import gnulink
-import link
+from . import gnulink
+from . import link
def _lib_generator(target, source, env, for_signature, **kw):
try: cmd = kw['cmd']
@@ -59,7 +62,7 @@ def _lib_emitter(target, source, env, **kw):
Verbose = False
if Verbose:
- print "_lib_emitter: target[0]=%r" % target[0].get_path()
+ print("_lib_emitter: target[0]=%r" % target[0].get_path())
try: vp = kw['varprefix']
except KeyError: vp = 'SHLIB'
@@ -71,7 +74,7 @@ def _lib_emitter(target, source, env, **kw):
no_import_lib = env.get('no_import_lib', 0)
if Verbose:
- print "_lib_emitter: dll=%r" % dll.get_path()
+ print("_lib_emitter: dll=%r" % dll.get_path())
if not dll or len(target) > 1:
raise SCons.Errors.UserError("A shared library should have exactly one target with the suffix: %s" % env.subst("$%sSUFFIX" % vp))
@@ -82,14 +85,14 @@ def _lib_emitter(target, source, env, **kw):
dll.name = pre + dll.name[len(pre)+3:]
if Verbose:
- print "_lib_emitter: dll.name=%r" % dll.name
+ print("_lib_emitter: dll.name=%r" % dll.name)
orig_target = target
target = [env.fs.File(dll)]
target[0].attributes.shared = 1
if Verbose:
- print "_lib_emitter: after target=[env.fs.File(dll)]: target[0]=%r" % target[0].get_path()
+ print("_lib_emitter: after target=[env.fs.File(dll)]: target[0]=%r" % target[0].get_path())
# Append an import lib target
if not no_import_lib:
@@ -98,11 +101,11 @@ def _lib_emitter(target, source, env, **kw):
'%sPREFIX' % vp, '%sSUFFIX' % vp,
'IMPLIBPREFIX', 'IMPLIBSUFFIX')
if Verbose:
- print "_lib_emitter: target_strings=%r" % target_strings
+ print("_lib_emitter: target_strings=%r" % target_strings)
implib_target = env.fs.File(target_strings)
if Verbose:
- print "_lib_emitter: implib_target=%r" % implib_target.get_path()
+ print("_lib_emitter: implib_target=%r" % implib_target.get_path())
implib_target.attributes.shared = 1
target.append(implib_target)
@@ -110,7 +113,7 @@ def _lib_emitter(target, source, env, **kw):
implib_libtype=libtype,
generator_libtype=libtype+'ImpLib')
if Verbose:
- print "_lib_emitter: implib symlinks=%r" % SCons.Tool.StringizeLibSymlinks(symlinks)
+ print("_lib_emitter: implib symlinks=%r" % SCons.Tool.StringizeLibSymlinks(symlinks))
if symlinks:
SCons.Tool.EmitLibSymlinks(env, symlinks, implib_target, clean_targets = target[0])
implib_target.attributes.shliblinks = symlinks
@@ -128,13 +131,13 @@ def _versioned_lib_suffix(env, suffix, version):
If suffix='.dll', and version='0.1.2', then it returns '-0-1-2.dll'"""
Verbose = False
if Verbose:
- print "_versioned_lib_suffix: suffix= ", suffix
- print "_versioned_lib_suffix: version= ", version
+ print("_versioned_lib_suffix: suffix= ", suffix)
+ print("_versioned_lib_suffix: version= ", version)
cygversion = re.sub('\.', '-', version)
if not suffix.startswith('-' + cygversion):
suffix = '-' + cygversion + suffix
if Verbose:
- print "_versioned_lib_suffix: return suffix= ", suffix
+ print("_versioned_lib_suffix: return suffix= ", suffix)
return suffix
def _versioned_implib_name(env, libnode, version, prefix, suffix, **kw):
@@ -150,8 +153,8 @@ def _versioned_implib_symlinks(env, libnode, version, prefix, suffix, **kw):
Verbose = False
if Verbose:
- print "_versioned_implib_symlinks: libnode=%r" % libnode.get_path()
- print "_versioned_implib_symlinks: version=%r" % version
+ print("_versioned_implib_symlinks: libnode=%r" % libnode.get_path())
+ print("_versioned_implib_symlinks: version=%r" % version)
try: libtype = kw['libtype']
except KeyError: libtype = 'ShLib'
@@ -159,13 +162,13 @@ def _versioned_implib_symlinks(env, libnode, version, prefix, suffix, **kw):
linkdir = os.path.dirname(libnode.get_path())
if Verbose:
- print "_versioned_implib_symlinks: linkdir=%r" % linkdir
+ print("_versioned_implib_symlinks: linkdir=%r" % linkdir)
name = SCons.Tool.ImpLibNameGenerator(env, libnode,
implib_libtype=libtype,
generator_libtype=libtype+'ImpLib')
if Verbose:
- print "_versioned_implib_symlinks: name=%r" % name
+ print("_versioned_implib_symlinks: name=%r" % name)
major = version.split('.')[0]
@@ -173,7 +176,7 @@ def _versioned_implib_symlinks(env, libnode, version, prefix, suffix, **kw):
symlinks = [(link0, libnode)]
if Verbose:
- print "_versioned_implib_symlinks: return symlinks=%r" % SCons.Tool.StringizeLibSymlinks(symlinks)
+ print("_versioned_implib_symlinks: return symlinks=%r" % SCons.Tool.StringizeLibSymlinks(symlinks))
return symlinks
diff --git a/src/engine/SCons/Tool/f08.py b/src/engine/SCons/Tool/f08.py
index a45a61d..7fa5872 100644
--- a/src/engine/SCons/Tool/f08.py
+++ b/src/engine/SCons/Tool/f08.py
@@ -8,6 +8,8 @@ selection method.
"""
+from __future__ import absolute_import
+
#
# __COPYRIGHT__
#
@@ -36,7 +38,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import SCons.Defaults
import SCons.Tool
import SCons.Util
-import fortran
+from . import fortran
from SCons.Tool.FortranCommon import add_all_to_env, add_f08_to_env
compilers = ['f08']
diff --git a/src/engine/SCons/Tool/msvs.py b/src/engine/SCons/Tool/msvs.py
index efdc8a1..c3c8164 100644
--- a/src/engine/SCons/Tool/msvs.py
+++ b/src/engine/SCons/Tool/msvs.py
@@ -29,6 +29,7 @@ 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 print_function
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
@@ -39,7 +40,6 @@ import base64
import hashlib
import ntpath
import os
-# compat layer imports "cPickle" for us if it's available.
import pickle
import re
import sys
@@ -71,7 +71,7 @@ def xmlify(s):
# Returns a tuple of nodes.
def processIncludes(includes, env, target, source):
return SCons.PathList.PathList(includes).subst_path(env, target, source)
-
+
external_makefile_guid = '{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}'
@@ -169,15 +169,15 @@ class _UserGenerator(object):
Base class for .dsp.user file generator
'''
# Default instance values.
- # Ok ... a bit defensive, but it does not seem reasonable to crash the
+ # Ok ... a bit defensive, but it does not seem reasonable to crash the
# build for a workspace user file. :-)
usrhead = None
- usrdebg = None
+ usrdebg = None
usrconf = None
- createfile = False
+ createfile = False
def __init__(self, dspfile, source, env):
# DebugSettings should be a list of debug dictionary sorted in the same order
- # as the target list and variants
+ # as the target list and variants
if 'variant' not in env:
raise SCons.Errors.InternalError("You must specify a 'variant' argument (i.e. 'Debug' or " +\
"'Release') to create an MSVSProject.")
@@ -185,7 +185,7 @@ class _UserGenerator(object):
variants = [env['variant']]
elif SCons.Util.is_List(env['variant']):
variants = env['variant']
-
+
if 'DebugSettings' not in env or env['DebugSettings'] == None:
dbg_settings = []
elif SCons.Util.is_Dict(env['DebugSettings']):
@@ -201,12 +201,12 @@ class _UserGenerator(object):
dbg_settings.append({})
else:
dbg_settings = []
-
+
if len(dbg_settings) == 1:
dbg_settings = dbg_settings * len(variants)
-
+
self.createfile = self.usrhead and self.usrdebg and self.usrconf and \
- dbg_settings and bool([ds for ds in dbg_settings if ds])
+ dbg_settings and bool([ds for ds in dbg_settings if ds])
if self.createfile:
dbg_settings = dict(zip(variants, dbg_settings))
@@ -216,22 +216,22 @@ class _UserGenerator(object):
for key in [k for k in self.usrdebg.keys() if k in src]:
trg[key] = str(src[key])
self.configs[var].debug = trg
-
+
def UserHeader(self):
encoding = self.env.subst('$MSVSENCODING')
versionstr = self.versionstr
self.usrfile.write(self.usrhead % locals())
-
+
def UserProject(self):
pass
-
+
def Build(self):
if not self.createfile:
return
try:
filename = self.dspabs +'.user'
self.usrfile = open(filename, 'w')
- except IOError, detail:
+ except IOError as detail:
raise SCons.Errors.InternalError('Unable to open "' + filename + '" for writing:' + str(detail))
else:
self.UserHeader()
@@ -291,7 +291,7 @@ class _GenerateV7User(_UserGenerator):
self.usrconf = V9UserConfiguration
self.usrdebg = V9DebugSettings
_UserGenerator.__init__(self, dspfile, source, env)
-
+
def UserProject(self):
confkeys = sorted(self.configs.keys())
for kind in confkeys:
@@ -299,8 +299,8 @@ class _GenerateV7User(_UserGenerator):
platform = self.configs[kind].platform
debug = self.configs[kind].debug
if debug:
- debug_settings = '\n'.join(['\t\t\t\t%s="%s"' % (key, xmlify(value))
- for key, value in debug.items()
+ debug_settings = '\n'.join(['\t\t\t\t%s="%s"' % (key, xmlify(value))
+ for key, value in debug.items()
if value is not None])
self.usrfile.write(self.usrconf % locals())
self.usrfile.write('\t</Configurations>\n</VisualStudioUserFile>')
@@ -346,7 +346,7 @@ V10DebugSettings = {
class _GenerateV10User(_UserGenerator):
"""Generates a Project'user file for MSVS 2010"""
-
+
def __init__(self, dspfile, source, env):
self.versionstr = '4.0'
self.usrhead = V10UserHeader
@@ -361,8 +361,8 @@ class _GenerateV10User(_UserGenerator):
platform = self.configs[kind].platform
debug = self.configs[kind].debug
if debug:
- debug_settings = '\n'.join(['\t\t<%s>%s</%s>' % (key, xmlify(value), key)
- for key, value in debug.items()
+ debug_settings = '\n'.join(['\t\t<%s>%s</%s>' % (key, xmlify(value), key)
+ for key, value in debug.items()
if value is not None])
self.usrfile.write(self.usrconf % locals())
self.usrfile.write('</Project>')
@@ -458,7 +458,7 @@ class _DSPGenerator(object):
runfile.append(s)
self.sconscript = env['MSVSSCONSCRIPT']
-
+
if 'cmdargs' not in env or env['cmdargs'] == None:
cmdargs = [''] * len(variants)
elif SCons.Util.is_String(env['cmdargs']):
@@ -468,7 +468,7 @@ class _DSPGenerator(object):
raise SCons.Errors.InternalError("Sizes of 'cmdargs' and 'variant' lists must be the same.")
else:
cmdargs = env['cmdargs']
-
+
self.env = env
if 'name' in self.env:
@@ -550,16 +550,16 @@ V6DSPHeader = """\
CFG=%(name)s - Win32 %(confkey)s
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
-!MESSAGE
+!MESSAGE
!MESSAGE NMAKE /f "%(name)s.mak".
-!MESSAGE
+!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
+!MESSAGE
!MESSAGE NMAKE /f "%(name)s.mak" CFG="%(name)s - Win32 %(confkey)s"
-!MESSAGE
+!MESSAGE
!MESSAGE Possible choices for configuration are:
-!MESSAGE
+!MESSAGE
"""
class _GenerateV6DSP(_DSPGenerator):
@@ -818,7 +818,7 @@ class _GenerateV7DSP(_DSPGenerator, _GenerateV7User):
self.dspheader = V7DSPHeader
self.dspconfiguration = V7DSPConfiguration
self.file = None
-
+
_GenerateV7User.__init__(self, dspfile, source, env)
def PrintHeader(self):
@@ -895,7 +895,7 @@ class _GenerateV7DSP(_DSPGenerator, _GenerateV7User):
preprocdefs = xmlify(';'.join(processDefines(self.env.get('CPPDEFINES', []))))
includepath_Dirs = processIncludes(self.env.get('CPPPATH', []), self.env, None, None)
includepath = xmlify(';'.join([str(x) for x in includepath_Dirs]))
-
+
if not env_has_buildtarget:
del self.env['MSVSBUILDTARGET']
@@ -1044,7 +1044,7 @@ class _GenerateV7DSP(_DSPGenerator, _GenerateV7User):
self.PrintHeader()
self.PrintProject()
self.file.close()
-
+
_GenerateV7User.Build(self)
V10DSPHeader = """\
@@ -1101,7 +1101,7 @@ class _GenerateV10DSP(_DSPGenerator, _GenerateV10User):
self.dspheader = V10DSPHeader
self.dspconfiguration = V10DSPProjectConfiguration
self.dspglobals = V10DSPGlobals
-
+
_GenerateV10User.__init__(self, dspfile, source, env)
def PrintHeader(self):
@@ -1132,27 +1132,27 @@ class _GenerateV10DSP(_DSPGenerator, _GenerateV10User):
'\t\t<SccLocalPath>%s</SccLocalPath>\n' % (scc_project_name, scc_local_path_legacy))
else:
self.dspglobals = self.dspglobals.replace('%(scc_attrs)s', '')
-
+
self.file.write(self.dspheader % locals())
-
+
self.file.write('\t<ItemGroup Label="ProjectConfigurations">\n')
-
+
confkeys = sorted(self.configs.keys())
for kind in confkeys:
variant = self.configs[kind].variant
platform = self.configs[kind].platform
self.file.write(self.dspconfiguration % locals())
-
+
self.file.write('\t</ItemGroup>\n')
-
+
self.file.write(self.dspglobals % locals())
-
+
def PrintProject(self):
name = self.name
confkeys = sorted(self.configs.keys())
-
+
self.file.write('\t<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\n')
-
+
toolset = ''
if 'MSVC_VERSION' in self.env:
version_num, suite = msvs_parse_version(self.env['MSVC_VERSION'])
@@ -1165,16 +1165,16 @@ class _GenerateV10DSP(_DSPGenerator, _GenerateV10User):
self.file.write('\t<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\n')
self.file.write('\t<ImportGroup Label="ExtensionSettings">\n')
self.file.write('\t</ImportGroup>\n')
-
+
for kind in confkeys:
variant = self.configs[kind].variant
platform = self.configs[kind].platform
self.file.write(V10DSPImportGroupCondition % locals())
-
+
self.file.write('\t<PropertyGroup Label="UserMacros" />\n')
self.file.write('\t<PropertyGroup>\n')
self.file.write('\t<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>\n')
-
+
for kind in confkeys:
variant = self.configs[kind].variant
platform = self.configs[kind].platform
@@ -1182,7 +1182,7 @@ class _GenerateV10DSP(_DSPGenerator, _GenerateV10User):
buildtarget = self.configs[kind].buildtarget
runfile = self.configs[kind].runfile
cmdargs = self.configs[kind].cmdargs
-
+
env_has_buildtarget = 'MSVSBUILDTARGET' in self.env
if not env_has_buildtarget:
self.env['MSVSBUILDTARGET'] = buildtarget
@@ -1207,29 +1207,29 @@ class _GenerateV10DSP(_DSPGenerator, _GenerateV10User):
del self.env['MSVSBUILDTARGET']
self.file.write(V10DSPCommandLine % locals())
-
+
self.file.write('\t</PropertyGroup>\n')
-
+
#filter settings in MSVS 2010 are stored in separate file
self.filtersabs = self.dspabs + '.filters'
try:
self.filters_file = open(self.filtersabs, 'w')
except IOError as detail:
raise SCons.Errors.InternalError('Unable to open "' + self.filtersabs + '" for writing:' + str(detail))
-
+
self.filters_file.write('<?xml version="1.0" encoding="utf-8"?>\n'
'<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\n')
-
+
self.PrintSourceFiles()
-
+
self.filters_file.write('</Project>')
self.filters_file.close()
-
+
self.file.write('\t<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\n'
'\t<ImportGroup Label="ExtensionTargets">\n'
'\t</ImportGroup>\n'
'</Project>\n')
-
+
if self.nokeep == 0:
# now we pickle some data and add it to the file -- MSDEV will ignore it.
pdata = pickle.dumps(self.configs,1)
@@ -1241,7 +1241,7 @@ class _GenerateV10DSP(_DSPGenerator, _GenerateV10User):
def printFilters(self, hierarchy, name):
sorteditems = sorted(hierarchy.items(), key = lambda a: a[0].lower())
-
+
for key, value in sorteditems:
if SCons.Util.is_Dict(value):
filter_name = name + '\\' + key
@@ -1249,14 +1249,14 @@ class _GenerateV10DSP(_DSPGenerator, _GenerateV10User):
'\t\t\t<UniqueIdentifier>%s</UniqueIdentifier>\n'
'\t\t</Filter>\n' % (filter_name, _generateGUID(self.dspabs, filter_name)))
self.printFilters(value, filter_name)
-
+
def printSources(self, hierarchy, kind, commonprefix, filter_name):
keywords = {'Source Files': 'ClCompile',
'Header Files': 'ClInclude',
'Local Headers': 'ClInclude',
'Resource Files': 'None',
'Other Files': 'None'}
-
+
sorteditems = sorted(hierarchy.items(), key = lambda a: a[0].lower())
# First folders, then files
@@ -1270,7 +1270,7 @@ class _GenerateV10DSP(_DSPGenerator, _GenerateV10User):
if commonprefix:
file = os.path.join(commonprefix, value)
file = os.path.normpath(file)
-
+
self.file.write('\t\t<%s Include="%s" />\n' % (keywords[kind], file))
self.filters_file.write('\t\t<%s Include="%s">\n'
'\t\t\t<Filter>%s</Filter>\n'
@@ -1282,10 +1282,10 @@ class _GenerateV10DSP(_DSPGenerator, _GenerateV10User):
'Local Headers': 'h;hpp;hxx;hm;inl',
'Resource Files': 'r;rc;ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe',
'Other Files': ''}
-
+
cats = sorted([k for k in categories.keys() if self.sources[k]],
key = lambda a: a.lower())
-
+
# print vcxproj.filters file first
self.filters_file.write('\t<ItemGroup>\n')
for kind in cats:
@@ -1293,7 +1293,7 @@ class _GenerateV10DSP(_DSPGenerator, _GenerateV10User):
'\t\t\t<UniqueIdentifier>{7b42d31d-d53c-4868-8b92-ca2bc9fc052f}</UniqueIdentifier>\n'
'\t\t\t<Extensions>%s</Extensions>\n'
'\t\t</Filter>\n' % (kind, categories[kind]))
-
+
# First remove any common prefix
sources = self.sources[kind]
commonprefix = None
@@ -1306,17 +1306,17 @@ class _GenerateV10DSP(_DSPGenerator, _GenerateV10User):
# +1 because the filename starts after the separator
sources = [s[len(cp)+1:] for s in sources]
commonprefix = cp
-
+
hierarchy = makeHierarchy(sources)
self.printFilters(hierarchy, kind)
-
+
self.filters_file.write('\t</ItemGroup>\n')
-
+
# then print files and filters
for kind in cats:
self.file.write('\t<ItemGroup>\n')
self.filters_file.write('\t<ItemGroup>\n')
-
+
# First remove any common prefix
sources = self.sources[kind]
commonprefix = None
@@ -1329,13 +1329,13 @@ class _GenerateV10DSP(_DSPGenerator, _GenerateV10User):
# +1 because the filename starts after the separator
sources = [s[len(cp)+1:] for s in sources]
commonprefix = cp
-
+
hierarchy = makeHierarchy(sources)
self.printSources(hierarchy, kind, commonprefix, kind)
-
+
self.file.write('\t</ItemGroup>\n')
self.filters_file.write('\t</ItemGroup>\n')
-
+
# add the SConscript file outside of the groups
self.file.write('\t<ItemGroup>\n'
'\t\t<None Include="%s" />\n'
@@ -1354,7 +1354,7 @@ class _GenerateV10DSP(_DSPGenerator, _GenerateV10User):
self.PrintHeader()
self.PrintProject()
self.file.close()
-
+
_GenerateV10User.Build(self)
class _DSWGenerator(object):
@@ -1462,7 +1462,7 @@ class _GenerateV7DSW(_DSWGenerator):
'SLN_RELATIVE_FOLDER_PATH': dsp_relative_folder_path,
'SLN_RELATIVE_FILE_PATH': dsp_relative_file_path}
self.dspfiles_info.append(dspfile_info)
-
+
self.dspfiles_info = []
GenerateProjectFilesInfo(self)
@@ -1508,7 +1508,7 @@ class _GenerateV7DSW(_DSWGenerator):
self.file.write('# Visual Studio 2008\n')
elif self.version_num >= 8.0:
self.file.write('# Visual Studio 2005\n')
-
+
for dspinfo in self.dspfiles_info:
name = dspinfo['NAME']
base, suffix = SCons.Util.splitext(name)
@@ -1970,7 +1970,7 @@ def generate(env):
else:
env['MSVS']['PROJECTSUFFIX'] = '.vcxproj'
env['MSVS']['SOLUTIONSUFFIX'] = '.sln'
-
+
if (version_num >= 10.0):
env['MSVSENCODING'] = 'utf-8'
else:
diff --git a/src/engine/SCons/Tool/swig.py b/src/engine/SCons/Tool/swig.py
index 9d1965d..fa86174 100644
--- a/src/engine/SCons/Tool/swig.py
+++ b/src/engine/SCons/Tool/swig.py
@@ -7,6 +7,7 @@ It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
+from __future__ import print_function
#
# __COPYRIGHT__
@@ -144,10 +145,10 @@ def _get_swig_version(env, swig):
out = pipe.stdout.read()
match = re.search(r'SWIG Version\s+(\S+).*', out, re.MULTILINE)
if match:
- if verbose: print "Version is:%s"%match.group(1)
+ if verbose: print("Version is:%s"%match.group(1))
return match.group(1)
else:
- if verbose: print "Unable to detect version: [%s]"%out
+ if verbose: print("Unable to detect version: [%s]"%out)
def generate(env):
"""Add Builders and construction variables for swig to an Environment."""
diff --git a/src/engine/SCons/compat/six.py b/src/engine/SCons/compat/six.py
index 019130f..0e8850c 100755
--- a/src/engine/SCons/compat/six.py
+++ b/src/engine/SCons/compat/six.py
@@ -43,7 +43,7 @@ if PY3:
else:
string_types = basestring,
integer_types = (int, long)
- class_types = (type, types.ClassType)
+ class_types = (type, type)
text_type = unicode
binary_type = str
@@ -462,7 +462,7 @@ if PY3:
Iterator = object
else:
def get_unbound_function(unbound):
- return unbound.im_func
+ return unbound.__func__
def create_bound_method(func, obj):
return types.MethodType(func, obj, obj.__class__)
diff --git a/src/engine/SCons/compat/sixTests.py b/src/engine/SCons/compat/sixTests.py
index f8c1979..71df78d 100644
--- a/src/engine/SCons/compat/sixTests.py
+++ b/src/engine/SCons/compat/sixTests.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
#
# __COPYRIGHT__
#
@@ -28,7 +29,7 @@ class sixTestCase(unittest.TestCase):
def test_import(self):
"""Test that six imports correctly."""
import sys
- print sys.path
+ print(sys.path)
from SCons.compat.six import PY2, PY3
self.assertTrue(PY2 or PY3)
diff --git a/src/engine/SCons/cppTests.py b/src/engine/SCons/cppTests.py
index 9f4b875..28a1f5e 100644
--- a/src/engine/SCons/cppTests.py
+++ b/src/engine/SCons/cppTests.py
@@ -21,6 +21,8 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
+from __future__ import absolute_import
+
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import atexit
@@ -29,7 +31,7 @@ import unittest
import TestUnit
-import cpp
+from . import cpp