OLD | NEW |
1 """SCons.Node | 1 """SCons.Node |
2 | 2 |
3 The Node package for the SCons software construction utility. | 3 The Node package for the SCons software construction utility. |
4 | 4 |
5 This is, in many ways, the heart of SCons. | 5 This is, in many ways, the heart of SCons. |
6 | 6 |
7 A Node is where we encapsulate all of the dependency information about | 7 A Node is where we encapsulate all of the dependency information about |
8 any thing that SCons can build, or about any thing which SCons can use | 8 any thing that SCons can build, or about any thing which SCons can use |
9 to build some other thing. The canonical "thing," of course, is a file, | 9 to build some other thing. The canonical "thing," of course, is a file, |
10 but a Node can also represent something remote (like a web page) or | 10 but a Node can also represent something remote (like a web page) or |
11 something completely abstract (like an Alias). | 11 something completely abstract (like an Alias). |
12 | 12 |
13 Each specific type of "thing" is specifically represented by a subclass | 13 Each specific type of "thing" is specifically represented by a subclass |
14 of the Node base class: Node.FS.File for files, Node.Alias for aliases, | 14 of the Node base class: Node.FS.File for files, Node.Alias for aliases, |
15 etc. Dependency information is kept here in the base class, and | 15 etc. Dependency information is kept here in the base class, and |
16 information specific to files/aliases/etc. is in the subclass. The | 16 information specific to files/aliases/etc. is in the subclass. The |
17 goal, if we've done this correctly, is that any type of "thing" should | 17 goal, if we've done this correctly, is that any type of "thing" should |
18 be able to depend on any other type of "thing." | 18 be able to depend on any other type of "thing." |
19 | 19 |
20 """ | 20 """ |
21 | 21 |
22 # | 22 # |
23 # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundat
ion | 23 # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons F
oundation |
24 # | 24 # |
25 # Permission is hereby granted, free of charge, to any person obtaining | 25 # Permission is hereby granted, free of charge, to any person obtaining |
26 # a copy of this software and associated documentation files (the | 26 # a copy of this software and associated documentation files (the |
27 # "Software"), to deal in the Software without restriction, including | 27 # "Software"), to deal in the Software without restriction, including |
28 # without limitation the rights to use, copy, modify, merge, publish, | 28 # without limitation the rights to use, copy, modify, merge, publish, |
29 # distribute, sublicense, and/or sell copies of the Software, and to | 29 # distribute, sublicense, and/or sell copies of the Software, and to |
30 # permit persons to whom the Software is furnished to do so, subject to | 30 # permit persons to whom the Software is furnished to do so, subject to |
31 # the following conditions: | 31 # the following conditions: |
32 # | 32 # |
33 # The above copyright notice and this permission notice shall be included | 33 # The above copyright notice and this permission notice shall be included |
34 # in all copies or substantial portions of the Software. | 34 # in all copies or substantial portions of the Software. |
35 # | 35 # |
36 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY | 36 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY |
37 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | 37 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE |
38 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | 38 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
39 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | 39 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
40 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | 40 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
41 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 41 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
42 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 42 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
43 # | 43 # |
44 | 44 |
45 __revision__ = "src/engine/SCons/Node/__init__.py 3842 2008/12/20 22:59:52 scons
" | 45 __revision__ = "src/engine/SCons/Node/__init__.py 3897 2009/01/13 06:45:54 scons
" |
46 | 46 |
47 import copy | 47 import copy |
48 from itertools import chain, izip | 48 from itertools import chain, izip |
49 import string | 49 import string |
50 import UserList | 50 import UserList |
51 | 51 |
52 from SCons.Debug import logInstanceCreation | 52 from SCons.Debug import logInstanceCreation |
53 import SCons.Executor | 53 import SCons.Executor |
54 import SCons.Memoize | 54 import SCons.Memoize |
55 import SCons.Util | 55 import SCons.Util |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 if implicit is not None: | 614 if implicit is not None: |
615 # We now add the implicit dependencies returned from the | 615 # We now add the implicit dependencies returned from the |
616 # stored .sconsign entry to have already been converted | 616 # stored .sconsign entry to have already been converted |
617 # to Nodes for us. (We used to run them through a | 617 # to Nodes for us. (We used to run them through a |
618 # source_factory function here.) | 618 # source_factory function here.) |
619 | 619 |
620 # Update all of the targets with them. This | 620 # Update all of the targets with them. This |
621 # essentially short-circuits an N*M scan of the | 621 # essentially short-circuits an N*M scan of the |
622 # sources for each individual target, which is a hell | 622 # sources for each individual target, which is a hell |
623 # of a lot more efficient. | 623 # of a lot more efficient. |
624 for tgt in executor.targets: | 624 for tgt in executor.get_all_targets(): |
625 tgt.add_to_implicit(implicit) | 625 tgt.add_to_implicit(implicit) |
626 | 626 |
627 if implicit_deps_unchanged or self.is_up_to_date(): | 627 if implicit_deps_unchanged or self.is_up_to_date(): |
628 return | 628 return |
629 # one of this node's sources has changed, | 629 # one of this node's sources has changed, |
630 # so we must recalculate the implicit deps: | 630 # so we must recalculate the implicit deps: |
631 self.implicit = [] | 631 self.implicit = [] |
632 self.implicit_set = set() | 632 self.implicit_set = set() |
633 | 633 |
634 # Have the executor scan the sources. | 634 # Have the executor scan the sources. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 if self.has_builder(): | 707 if self.has_builder(): |
708 binfo.bact = str(executor) | 708 binfo.bact = str(executor) |
709 binfo.bactsig = SCons.Util.MD5signature(executor.get_contents()) | 709 binfo.bactsig = SCons.Util.MD5signature(executor.get_contents()) |
710 | 710 |
711 if self._specific_sources: | 711 if self._specific_sources: |
712 sources = [] | 712 sources = [] |
713 for s in self.sources: | 713 for s in self.sources: |
714 if s not in ignore_set: | 714 if s not in ignore_set: |
715 sources.append(s) | 715 sources.append(s) |
716 else: | 716 else: |
717 sources = executor.get_unignored_sources(self.ignore) | 717 sources = executor.get_unignored_sources(self, self.ignore) |
718 seen = set() | 718 seen = set() |
719 bsources = [] | 719 bsources = [] |
720 bsourcesigs = [] | 720 bsourcesigs = [] |
721 for s in sources: | 721 for s in sources: |
722 if not s in seen: | 722 if not s in seen: |
723 seen.add(s) | 723 seen.add(s) |
724 bsources.append(s) | 724 bsources.append(s) |
725 bsourcesigs.append(s.get_ninfo()) | 725 bsourcesigs.append(s.get_ninfo()) |
726 binfo.bsources = bsources | 726 binfo.bsources = bsources |
727 binfo.bsourcesigs = bsourcesigs | 727 binfo.bsourcesigs = bsourcesigs |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1321 parent = None | 1321 parent = None |
1322 self.eval_func(node, parent) | 1322 self.eval_func(node, parent) |
1323 return node | 1323 return node |
1324 return None | 1324 return None |
1325 | 1325 |
1326 def is_done(self): | 1326 def is_done(self): |
1327 return not self.stack | 1327 return not self.stack |
1328 | 1328 |
1329 | 1329 |
1330 arg2nodes_lookups = [] | 1330 arg2nodes_lookups = [] |
OLD | NEW |