6 This creates a hash of global Aliases (dummy targets).
11 # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
13 # Permission is hereby granted, free of charge, to any person obtaining
14 # a copy of this software and associated documentation files (the
15 # "Software"), to deal in the Software without restriction, including
16 # without limitation the rights to use, copy, modify, merge, publish,
17 # distribute, sublicense, and/or sell copies of the Software, and to
18 # permit persons to whom the Software is furnished to do so, subject to
19 # the following conditions:
21 # The above copyright notice and this permission notice shall be included
22 # in all copies or substantial portions of the Software.
24 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
25 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
26 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 __revision__ = "src/engine/SCons/Node/Alias.py 5023 2010/06/14 22:05:46 scons"
41 class AliasNameSpace(collections.UserDict):
42 def Alias(self, name, **kw):
43 if isinstance(name, SCons.Node.Alias.Alias):
48 a = SCons.Node.Alias.Alias(name, **kw)
52 def lookup(self, name, **kw):
58 class AliasNodeInfo(SCons.Node.NodeInfoBase):
59 current_version_id = 1
61 def str_to_node(self, s):
62 return default_ans.Alias(s)
64 class AliasBuildInfo(SCons.Node.BuildInfoBase):
65 current_version_id = 1
67 class Alias(SCons.Node.Node):
69 NodeInfo = AliasNodeInfo
70 BuildInfo = AliasBuildInfo
72 def __init__(self, name):
73 SCons.Node.Node.__init__(self)
76 def str_for_display(self):
77 return '"' + self.__str__() + '"'
85 really_build = SCons.Node.Node.build
86 is_up_to_date = SCons.Node.Node.children_are_up_to_date
88 def is_under(self, dir):
89 # Make Alias nodes get built regardless of
90 # what directory scons was run from. Alias nodes
91 # are outside the filesystem:
94 def get_contents(self):
95 """The contents of an alias is the concatenation
96 of the content signatures of all its sources."""
97 childsigs = [n.get_csig() for n in self.children()]
98 return ''.join(childsigs)
101 """An Alias is not recorded in .sconsign files"""
108 def changed_since_last_build(self, target, prev_ni):
109 cur_csig = self.get_csig()
111 return cur_csig != prev_ni.csig
112 except AttributeError:
116 """A "builder" for aliases."""
120 try: del self.builder
121 except AttributeError: pass
122 self.reset_executor()
123 self.build = self.really_build
127 Generate a node's content signature, the digested signature
131 cache - alternate node to use for the signature cache
132 returns - the content signature
135 return self.ninfo.csig
136 except AttributeError:
139 contents = self.get_contents()
140 csig = SCons.Util.MD5signature(contents)
141 self.get_ninfo().csig = csig
144 default_ans = AliasNameSpace()
146 SCons.Node.arg2nodes_lookups.append(default_ans.lookup)
150 # indent-tabs-mode:nil
152 # vim: set expandtab tabstop=4 shiftwidth=4: