Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: scons-2.0.1/engine/SCons/Node/Alias.py

Issue 6711079: Added an unmodified copy of SCons to third_party. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/third_party/
Patch Set: '' Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « scons-2.0.1/engine/SCons/Memoize.py ('k') | scons-2.0.1/engine/SCons/Node/FS.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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 # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The S Cons Foundation
12 #
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:
20 #
21 # The above copyright notice and this permission notice shall be included
22 # in all copies or substantial portions of the Software.
23 #
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.
31 #
32
33 __revision__ = "src/engine/SCons/Node/Alias.py 5134 2010/08/16 23:02:40 bdeegan"
34
35 import collections
36
37 import SCons.Errors
38 import SCons.Node
39 import SCons.Util
40
41 class AliasNameSpace(collections.UserDict):
42 def Alias(self, name, **kw):
43 if isinstance(name, SCons.Node.Alias.Alias):
44 return name
45 try:
46 a = self[name]
47 except KeyError:
48 a = SCons.Node.Alias.Alias(name, **kw)
49 self[name] = a
50 return a
51
52 def lookup(self, name, **kw):
53 try:
54 return self[name]
55 except KeyError:
56 return None
57
58 class AliasNodeInfo(SCons.Node.NodeInfoBase):
59 current_version_id = 1
60 field_list = ['csig']
61 def str_to_node(self, s):
62 return default_ans.Alias(s)
63
64 class AliasBuildInfo(SCons.Node.BuildInfoBase):
65 current_version_id = 1
66
67 class Alias(SCons.Node.Node):
68
69 NodeInfo = AliasNodeInfo
70 BuildInfo = AliasBuildInfo
71
72 def __init__(self, name):
73 SCons.Node.Node.__init__(self)
74 self.name = name
75
76 def str_for_display(self):
77 return '"' + self.__str__() + '"'
78
79 def __str__(self):
80 return self.name
81
82 def make_ready(self):
83 self.get_csig()
84
85 really_build = SCons.Node.Node.build
86 is_up_to_date = SCons.Node.Node.children_are_up_to_date
87
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:
92 return 1
93
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)
99
100 def sconsign(self):
101 """An Alias is not recorded in .sconsign files"""
102 pass
103
104 #
105 #
106 #
107
108 def changed_since_last_build(self, target, prev_ni):
109 cur_csig = self.get_csig()
110 try:
111 return cur_csig != prev_ni.csig
112 except AttributeError:
113 return 1
114
115 def build(self):
116 """A "builder" for aliases."""
117 pass
118
119 def convert(self):
120 try: del self.builder
121 except AttributeError: pass
122 self.reset_executor()
123 self.build = self.really_build
124
125 def get_csig(self):
126 """
127 Generate a node's content signature, the digested signature
128 of its content.
129
130 node - the node
131 cache - alternate node to use for the signature cache
132 returns - the content signature
133 """
134 try:
135 return self.ninfo.csig
136 except AttributeError:
137 pass
138
139 contents = self.get_contents()
140 csig = SCons.Util.MD5signature(contents)
141 self.get_ninfo().csig = csig
142 return csig
143
144 default_ans = AliasNameSpace()
145
146 SCons.Node.arg2nodes_lookups.append(default_ans.lookup)
147
148 # Local Variables:
149 # tab-width:4
150 # indent-tabs-mode:nil
151 # End:
152 # vim: set expandtab tabstop=4 shiftwidth=4:
OLDNEW
« no previous file with comments | « scons-2.0.1/engine/SCons/Memoize.py ('k') | scons-2.0.1/engine/SCons/Node/FS.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698