1
2 """scons.Node.Alias
3
4 Alias nodes.
5
6 This creates a hash of global Aliases (dummy targets).
7
8 """
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 __revision__ = "src/engine/SCons/Node/Alias.py rel_2.4.1:3453:73fefd3ea0b0 2015/11/09 03:25:05 bdbaddog"
34
35 import collections
36
37 import SCons.Errors
38 import SCons.Node
39 import SCons.Util
40
42 - def Alias(self, name, **kw):
51
53 try:
54 return self[name]
55 except KeyError:
56 return None
57
59 __slots__ = ('csig',)
60 current_version_id = 2
61 field_list = ['csig']
64
66 """
67 Return all fields that shall be pickled. Walk the slots in the class
68 hierarchy and add those to the state dictionary. If a '__dict__' slot is
69 available, copy all entries to the dictionary. Also include the version
70 id, which is fixed for all instances of a class.
71 """
72 state = getattr(self, '__dict__', {}).copy()
73 for obj in type(self).mro():
74 for name in getattr(obj,'__slots__',()):
75 if hasattr(self, name):
76 state[name] = getattr(self, name)
77
78 state['_version_id'] = self.current_version_id
79 try:
80 del state['__weakref__']
81 except KeyError:
82 pass
83
84 return state
85
87 """
88 Restore the attributes from a pickled state.
89 """
90
91 del state['_version_id']
92 for key, value in state.items():
93 if key not in ('__weakref__',):
94 setattr(self, key, value)
95
96
100
101 -class Alias(SCons.Node.Node):
102
103 NodeInfo = AliasNodeInfo
104 BuildInfo = AliasBuildInfo
105
111
113 return '"' + self.__str__() + '"'
114
117
120
121 really_build = SCons.Node.Node.build
122 is_up_to_date = SCons.Node.Node.children_are_up_to_date
123
129
130 - def get_contents(self):
131 """The contents of an alias is the concatenation
132 of the content signatures of all its sources."""
133 childsigs = [n.get_csig() for n in self.children()]
134 return ''.join(childsigs)
135
137 """An Alias is not recorded in .sconsign files"""
138 pass
139
140
141
142
143
145 """A "builder" for aliases."""
146 pass
147
153
155 """
156 Generate a node's content signature, the digested signature
157 of its content.
158
159 node - the node
160 cache - alternate node to use for the signature cache
161 returns - the content signature
162 """
163 try:
164 return self.ninfo.csig
165 except AttributeError:
166 pass
167
168 contents = self.get_contents()
169 csig = SCons.Util.MD5signature(contents)
170 self.get_ninfo().csig = csig
171 return csig
172
173 default_ans = AliasNameSpace()
174
175 SCons.Node.arg2nodes_lookups.append(default_ans.lookup)
176
177
178
179
180
181
182