diff options
Diffstat (limited to 'src/engine/SCons/Defaults.py')
-rw-r--r-- | src/engine/SCons/Defaults.py | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py index d25d3ee..4a18045 100644 --- a/src/engine/SCons/Defaults.py +++ b/src/engine/SCons/Defaults.py @@ -10,7 +10,7 @@ from distutils.msvccompiler. """ # -# Copyright (c) 2001 - 2016 The SCons Foundation +# Copyright (c) 2001 - 2017 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -33,7 +33,7 @@ from distutils.msvccompiler. # from __future__ import division -__revision__ = "src/engine/SCons/Defaults.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog" +__revision__ = "src/engine/SCons/Defaults.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog" import os @@ -261,9 +261,13 @@ def copy_func(dest, src, symlinks=True): else: return copy_func(dest, os.path.realpath(src)) elif os.path.isfile(src): - return shutil.copy2(src, dest) + shutil.copy2(src, dest) + return 0 else: - return shutil.copytree(src, dest, symlinks) + shutil.copytree(src, dest, symlinks) + # copytree returns None in python2 and destination string in python3 + # A error is raised in both cases, so we can just return 0 for success + return 0 Copy = ActionFactory( copy_func, @@ -298,7 +302,7 @@ def mkdir_func(dest): for entry in dest: try: os.makedirs(str(entry)) - except os.error, e: + except os.error as e: p = str(entry) if (e.args[0] == errno.EEXIST or (sys.platform=='win32' and e.args[0]==183)) \ @@ -458,7 +462,7 @@ def processDefines(defs): else: l.append(str(d[0])) elif SCons.Util.is_Dict(d): - for macro,value in d.iteritems(): + for macro,value in d.items(): if value is not None: l.append(str(macro) + '=' + str(value)) else: @@ -484,6 +488,7 @@ def processDefines(defs): l = [str(defs)] return l + def _defines(prefix, defs, suffix, env, c=_concat_ixes): """A wrapper around _concat_ixes that turns a list or string into a list of C preprocessor command-line definitions. @@ -491,6 +496,7 @@ def _defines(prefix, defs, suffix, env, c=_concat_ixes): return c(prefix, env.subst_path(processDefines(defs)), suffix, env) + class NullCmdGenerator(object): """This is a callable class that can be used in place of other command generators if you don't want them to do anything. @@ -509,6 +515,7 @@ class NullCmdGenerator(object): def __call__(self, target, source, env, for_signature=None): return self.cmd + class Variable_Method_Caller(object): """A class for finding a construction variable on the stack and calling one of its methods. @@ -540,10 +547,10 @@ class Variable_Method_Caller(object): frame = frame.f_back return None -# if env[version_var] id defined, returns env[flags_var], otherwise returns None +# if $version_var is not empty, returns env[flags_var], otherwise returns None def __libversionflags(env, version_var, flags_var): try: - if env[version_var]: + if env.subst('$'+version_var): return env[flags_var] except KeyError: pass |