diff options
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/SCons/Action.py | 13 | ||||
-rw-r--r-- | src/engine/SCons/ActionTests.py | 30 | ||||
-rw-r--r-- | src/engine/SCons/Node/Alias.py | 3 | ||||
-rw-r--r-- | src/engine/SCons/Node/FS.py | 3 | ||||
-rw-r--r-- | src/engine/SCons/Node/Python.py | 5 | ||||
-rw-r--r-- | src/engine/SCons/Taskmaster.py | 15 | ||||
-rw-r--r-- | src/engine/SCons/Tool/dmd.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/Tool/g77.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Tool/intelc.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/Tool/msvc.py | 35 |
10 files changed, 70 insertions, 42 deletions
diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py index d2211b7..1bc9baac 100644 --- a/src/engine/SCons/Action.py +++ b/src/engine/SCons/Action.py @@ -277,7 +277,10 @@ def _function_contents(func): closure = [] #xxx = [_object_contents(x.cell_contents) for x in closure] - xxx = map(lambda x: _object_contents(x.cell_contents), closure) + try: + xxx = map(lambda x: _object_contents(x.cell_contents), closure) + except AttributeError: + xxx = [] contents.append(',(' + string.join(xxx, ',') + ')') return string.join(contents, '') @@ -809,7 +812,13 @@ class FunctionAction(_ActionAction): return c def array(a): def quote(s): - return '"' + str(s) + '"' + try: + str_for_display = s.str_for_display + except AttributeError: + s = repr(s) + else: + s = str_for_display() + return s return '[' + string.join(map(quote, a), ", ") + ']' try: strfunc = self.execfunction.strfunction diff --git a/src/engine/SCons/ActionTests.py b/src/engine/SCons/ActionTests.py index a503981..2fb3b06 100644 --- a/src/engine/SCons/ActionTests.py +++ b/src/engine/SCons/ActionTests.py @@ -172,6 +172,8 @@ class Environment: class DummyNode: def __init__(self, name): self.name = name + def str_for_display(self): + return '"' + self.name + '"' def __str__(self): return self.name def rfile(self): @@ -432,10 +434,10 @@ class _ActionActionTestCase(unittest.TestCase): result = a("out", "in", env) assert result.status == 7, result s = sio.getvalue() - assert s == 'execfunc(["out"], ["in"])\n', s + assert s == "execfunc(['out'], ['in'])\n", s a.chdir = 'xyz' - expect = 'os.chdir(%s)\nexecfunc(["out"], ["in"])\nos.chdir(%s)\n' + expect = "os.chdir(%s)\nexecfunc(['out'], ['in'])\nos.chdir(%s)\n" sio = StringIO.StringIO() sys.stdout = sio @@ -458,7 +460,7 @@ class _ActionActionTestCase(unittest.TestCase): result = b("out", "in", env) assert result.status == 7, result.status s = sio.getvalue() - assert s == 'firstfunc(["out"], ["in"])\nexecfunc(["out"], ["in"])\n', s + assert s == "firstfunc(['out'], ['in'])\nexecfunc(['out'], ['in'])\n", s SCons.Action.execute_actions = 0 @@ -467,14 +469,14 @@ class _ActionActionTestCase(unittest.TestCase): result = a("out", "in", env) assert result == 0, result s = sio.getvalue() - assert s == 'execfunc(["out"], ["in"])\n', s + assert s == "execfunc(['out'], ['in'])\n", s sio = StringIO.StringIO() sys.stdout = sio result = b("out", "in", env) assert result == 0, result s = sio.getvalue() - assert s == 'firstfunc(["out"], ["in"])\nexecfunc(["out"], ["in"])\nlastfunc(["out"], ["in"])\n', s + assert s == "firstfunc(['out'], ['in'])\nexecfunc(['out'], ['in'])\nlastfunc(['out'], ['in'])\n", s SCons.Action.print_actions_presub = 1 SCons.Action.execute_actions = 1 @@ -484,35 +486,35 @@ class _ActionActionTestCase(unittest.TestCase): result = a("out", "in", env) assert result.status == 7, result.status s = sio.getvalue() - assert s == 'Building out with action:\n execfunc(target, source, env)\nexecfunc(["out"], ["in"])\n', s + assert s == "Building out with action:\n execfunc(target, source, env)\nexecfunc(['out'], ['in'])\n", s sio = StringIO.StringIO() sys.stdout = sio result = a("out", "in", env, presub=0) assert result.status == 7, result.status s = sio.getvalue() - assert s == 'execfunc(["out"], ["in"])\n', s + assert s == "execfunc(['out'], ['in'])\n", s sio = StringIO.StringIO() sys.stdout = sio result = a("out", "in", env, presub=1) assert result.status == 7, result.status s = sio.getvalue() - assert s == 'Building out with action:\n execfunc(target, source, env)\nexecfunc(["out"], ["in"])\n', s + assert s == "Building out with action:\n execfunc(target, source, env)\nexecfunc(['out'], ['in'])\n", s sio = StringIO.StringIO() sys.stdout = sio result = b(["out"], "in", env, presub=1) assert result.status == 7, result.status s = sio.getvalue() - assert s == 'Building out with action:\n firstfunc(target, source, env)\nfirstfunc(["out"], ["in"])\nBuilding out with action:\n execfunc(target, source, env)\nexecfunc(["out"], ["in"])\n', s + assert s == "Building out with action:\n firstfunc(target, source, env)\nfirstfunc(['out'], ['in'])\nBuilding out with action:\n execfunc(target, source, env)\nexecfunc(['out'], ['in'])\n", s sio = StringIO.StringIO() sys.stdout = sio result = b(["out", "list"], "in", env, presub=1) assert result.status == 7, result.status s = sio.getvalue() - assert s == 'Building out and list with action:\n firstfunc(target, source, env)\nfirstfunc(["out", "list"], ["in"])\nBuilding out and list with action:\n execfunc(target, source, env)\nexecfunc(["out", "list"], ["in"])\n', s + assert s == "Building out and list with action:\n firstfunc(target, source, env)\nfirstfunc(['out', 'list'], ['in'])\nBuilding out and list with action:\n execfunc(target, source, env)\nexecfunc(['out', 'list'], ['in'])\n", s a2 = SCons.Action.Action(execfunc) @@ -521,14 +523,14 @@ class _ActionActionTestCase(unittest.TestCase): result = a2("out", "in", env) assert result.status == 7, result.status s = sio.getvalue() - assert s == 'Building out with action:\n execfunc(target, source, env)\nexecfunc(["out"], ["in"])\n', s + assert s == "Building out with action:\n execfunc(target, source, env)\nexecfunc(['out'], ['in'])\n", s sio = StringIO.StringIO() sys.stdout = sio result = a2("out", "in", env, presub=0) assert result.status == 7, result.status s = sio.getvalue() - assert s == 'execfunc(["out"], ["in"])\n', s + assert s == "execfunc(['out'], ['in'])\n", s SCons.Action.execute_actions = 0 @@ -537,7 +539,7 @@ class _ActionActionTestCase(unittest.TestCase): result = a2("out", "in", env, presub=0) assert result == 0, result s = sio.getvalue() - assert s == 'execfunc(["out"], ["in"])\n', s + assert s == "execfunc(['out'], ['in'])\n", s sio = StringIO.StringIO() sys.stdout = sio @@ -568,7 +570,7 @@ class _ActionActionTestCase(unittest.TestCase): result.append(s) env['PRINT_CMD_LINE_FUNC'] = my_print_cmd_line a("output", "input", env) - assert result == ['execfunc(["output"], ["input"])'], result + assert result == ["execfunc(['output'], ['input'])"], result finally: diff --git a/src/engine/SCons/Node/Alias.py b/src/engine/SCons/Node/Alias.py index bb23d3f..93558f9 100644 --- a/src/engine/SCons/Node/Alias.py +++ b/src/engine/SCons/Node/Alias.py @@ -74,6 +74,9 @@ class Alias(SCons.Node.Node): SCons.Node.Node.__init__(self) self.name = name + def str_for_display(self): + return '"' + self.__str__() + '"' + def __str__(self): return self.name diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index bd8b564..b154e34 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -544,6 +544,9 @@ class Base(SCons.Node.Node): self.cwd = None # will hold the SConscript directory for target nodes self.duplicate = directory.duplicate + def str_for_display(self): + return '"' + self.__str__() + '"' + def must_be_same(self, klass): """ This node, which already existed, is being looked up as the diff --git a/src/engine/SCons/Node/Python.py b/src/engine/SCons/Node/Python.py index 7cdea14..741d7e9 100644 --- a/src/engine/SCons/Node/Python.py +++ b/src/engine/SCons/Node/Python.py @@ -56,9 +56,12 @@ class Value(SCons.Node.Node): if not built_value is None: self.built_value = built_value - def __str__(self): + def str_for_display(self): return repr(self.value) + def __str__(self): + return str(self.value) + def make_ready(self): self.get_csig() diff --git a/src/engine/SCons/Taskmaster.py b/src/engine/SCons/Taskmaster.py index 6f93ca7..27dd1f0 100644 --- a/src/engine/SCons/Taskmaster.py +++ b/src/engine/SCons/Taskmaster.py @@ -529,7 +529,7 @@ class Taskmaster: while self.candidates: candidates = self.candidates self.candidates = [] - self.will_not_build(candidates) + self.will_not_build(candidates, lambda n: n.state < NODE_UP_TO_DATE) return None def _find_next_ready_node(self): @@ -634,6 +634,9 @@ class Taskmaster: # take a stab at evaluating them (or their children). children_not_visited.reverse() self.candidates.extend(self.order(children_not_visited)) + #if T and children_not_visited: + # T.write('Taskmaster: adding to candidates: %s\n' % map(str, children_not_visited)) + # T.write('Taskmaster: candidates now: %s\n' % map(str, self.candidates)) # Skip this node if any of its children have failed. # @@ -731,7 +734,7 @@ class Taskmaster: return task - def will_not_build(self, nodes): + def will_not_build(self, nodes, mark_fail=lambda n: n.state != NODE_FAILED): """ Perform clean-up about nodes that will never be built. """ @@ -742,8 +745,8 @@ class Taskmaster: for node in nodes: # Set failure state on all of the parents that were dependent # on this failed build. - if node.state != NODE_FAILED: - node.state = NODE_FAILED + if mark_fail(node): + node.set_state(NODE_FAILED) parents = node.waiting_parents to_visit = to_visit | parents pending_children = pending_children - parents @@ -759,8 +762,8 @@ class Taskmaster: to_visit.remove(node) else: break - if node.state != NODE_FAILED: - node.state = NODE_FAILED + if mark_fail(node): + node.set_state(NODE_FAILED) parents = node.waiting_parents to_visit = to_visit | parents pending_children = pending_children - parents diff --git a/src/engine/SCons/Tool/dmd.py b/src/engine/SCons/Tool/dmd.py index a173162..53432c6 100644 --- a/src/engine/SCons/Tool/dmd.py +++ b/src/engine/SCons/Tool/dmd.py @@ -194,7 +194,7 @@ def generate(env): env['SMART_LINKCOM'] = smart_link[linkcom] except KeyError: def _smartLink(source, target, env, for_signature, - defaultLinker=linkcom): + defaultLinker=linkcom, dc=dc): if isD(source): try: libs = env['LIBS'] diff --git a/src/engine/SCons/Tool/g77.py b/src/engine/SCons/Tool/g77.py index 058b061..66d3d89 100644 --- a/src/engine/SCons/Tool/g77.py +++ b/src/engine/SCons/Tool/g77.py @@ -48,8 +48,8 @@ def generate(env): env['SHFORTRANFLAGS'] = SCons.Util.CLVar('$FORTRANFLAGS') env['SHF77FLAGS'] = SCons.Util.CLVar('$F77FLAGS') else: - env['SHFORTRANFLAGS'] = SCons.Util.CLVar('$SHFORTRANFLAGS -fPIC') - env['SHF77FLAGS'] = SCons.Util.CLVar('$SHF77FLAGS -fPIC') + env['SHFORTRANFLAGS'] = SCons.Util.CLVar('$FORTRANFLAGS -fPIC') + env['SHF77FLAGS'] = SCons.Util.CLVar('$F77FLAGS -fPIC') env['FORTRAN'] = fcomp env['SHFORTRAN'] = '$FORTRAN' diff --git a/src/engine/SCons/Tool/intelc.py b/src/engine/SCons/Tool/intelc.py index db5d06e..020a6f7 100644 --- a/src/engine/SCons/Tool/intelc.py +++ b/src/engine/SCons/Tool/intelc.py @@ -394,7 +394,7 @@ def generate(env, version=None, abi=None, topdir=None, verbose=0): if version is None: version = '' # Each path has a registry entry, use that or default to subdir - for p in paths.keys(): + for p in paths: try: path=get_intel_registry_value(p[1], version, abi) # These paths may have $(ICInstallDir) diff --git a/src/engine/SCons/Tool/msvc.py b/src/engine/SCons/Tool/msvc.py index a1067c0..1a42d62 100644 --- a/src/engine/SCons/Tool/msvc.py +++ b/src/engine/SCons/Tool/msvc.py @@ -203,6 +203,11 @@ def _parse_msvc8_overrides(version,platform,suite): user_settings = doc.getElementsByTagName('UserSettings')[0] tool_options = user_settings.getElementsByTagName('ToolsOptions')[0] tool_options_categories = tool_options.getElementsByTagName('ToolsOptionsCategory') + environment_var_map = { + 'IncludeDirectories' : 'INCLUDE', + 'LibraryDirectories' : 'LIBRARY', + 'ExecutableDirectories' : 'PATH', + } for category in tool_options_categories: category_name = category.attributes.get('name') if category_name is not None and category_name.value == 'Projects': @@ -215,21 +220,21 @@ def _parse_msvc8_overrides(version,platform,suite): property_name = property.attributes.get('name') if property_name is None: continue - elif property_name.value == 'IncludeDirectories': - include_dirs = property.childNodes[0].data - # ToDo: Support for other destinations than Win32 - include_dirs = include_dirs.replace('Win32|', '') - dirs['INCLUDE'] = include_dirs - elif property_name.value == 'LibraryDirectories': - lib_dirs = property.childNodes[0].data.replace('Win32|', '') - # ToDo: Support for other destinations than Win32 - lib_dirs = lib_dirs.replace('Win32|', '') - dirs['LIBRARY'] = lib_dirs - elif property_name.value == 'ExecutableDirectories': - path_dirs = property.childNodes[0].data.replace('Win32|', '') - # ToDo: Support for other destinations than Win32 - path_dirs = path_dirs.replace('Win32|', '') - dirs['PATH'] = path_dirs + var_name = environment_var_map.get(property_name) + if var_name: + data = property.childNodes[0].data + value_list = string.split(data, '|') + if len(value_list) == 1: + dirs[var_name] = value_list[0] + else: + while value_list: + dest, value = value_list[:2] + del value_list[:2] + # ToDo: Support for destinations + # other than Win32 + if dest == 'Win32': + dirs[var_name] = value + break else: # There are no default directories in the registry for VS8 Express :( raise SCons.Errors.InternalError, "Unable to find MSVC paths in the registry." |