6 This creates a hash of global Aliases (dummy targets).
11 # Copyright (c) 2001, 2002, 2003 Steven Knight
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__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
41 class AliasNameSpace(UserDict.UserDict):
42 def Alias(self, name):
43 if self.has_key(name):
44 raise SCons.Errors.UserError
45 self[name] = SCons.Node.Alias.Alias(name)
48 def lookup(self, name):
54 class Alias(SCons.Node.Node):
55 def __init__(self, name):
56 SCons.Node.Node.__init__(self)
63 """A "builder" for aliases."""
66 def current(self, calc):
67 """If all of our children were up-to-date, then this
68 Alias was up-to-date, too."""
69 # Allow the children to calculate their signatures.
72 for kid in self.children(None):
74 if s and (not state or s > state):
76 if state == 0 or state == SCons.Node.up_to_date:
82 """An Alias is not recorded in .sconsign files"""
85 def is_under(self, dir):
86 # Make Alias nodes get built regardless of
87 # what directory scons was run from. Alias nodes
88 # are outside the filesystem:
91 def get_contents(self):
92 """The contents of an alias is the concatenation
93 of all the contents of its sources"""
95 for kid in self.children(None):
96 contents = contents + kid.get_contents()
99 default_ans = AliasNameSpace()
101 SCons.Node.arg2nodes_lookups.append(default_ans.lookup)