OLD | NEW |
1 """SCons.Tool | 1 """SCons.Tool |
2 | 2 |
3 SCons tool selection. | 3 SCons tool selection. |
4 | 4 |
5 This looks for modules that define a callable object that can modify | 5 This looks for modules that define a callable object that can modify |
6 a construction environment as appropriate for a given tool (or tool | 6 a construction environment as appropriate for a given tool (or tool |
7 chain). | 7 chain). |
8 | 8 |
9 Note that because this subsystem just *selects* a callable that can | 9 Note that because this subsystem just *selects* a callable that can |
10 modify a construction environment, it's possible for people to define | 10 modify a construction environment, it's possible for people to define |
(...skipping 18 matching lines...) Expand all Loading... |
29 # | 29 # |
30 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY | 30 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY |
31 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | 31 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE |
32 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | 32 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
33 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | 33 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
34 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | 34 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
35 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 35 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
36 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 36 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
37 # | 37 # |
38 | 38 |
39 __revision__ = "src/engine/SCons/Tool/__init__.py 3603 2008/10/10 05:46:45 scons
" | 39 __revision__ = "src/engine/SCons/Tool/__init__.py 3842 2008/12/20 22:59:52 scons
" |
40 | 40 |
41 import imp | 41 import imp |
42 import sys | 42 import sys |
43 | 43 |
44 import SCons.Builder | 44 import SCons.Builder |
45 import SCons.Errors | 45 import SCons.Errors |
46 import SCons.Node.FS | 46 import SCons.Node.FS |
47 import SCons.Scanner | 47 import SCons.Scanner |
48 import SCons.Scanner.C | 48 import SCons.Scanner.C |
49 import SCons.Scanner.D | 49 import SCons.Scanner.D |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 try: | 135 try: |
136 smpath = sys.modules['SCons.Tool'].__path__ | 136 smpath = sys.modules['SCons.Tool'].__path__ |
137 try: | 137 try: |
138 file, path, desc = imp.find_module(self.name, smpath) | 138 file, path, desc = imp.find_module(self.name, smpath) |
139 module = imp.load_module(full_name, file, path, desc) | 139 module = imp.load_module(full_name, file, path, desc) |
140 setattr(SCons.Tool, self.name, module) | 140 setattr(SCons.Tool, self.name, module) |
141 if file: | 141 if file: |
142 file.close() | 142 file.close() |
143 return module | 143 return module |
144 except ImportError, e: | 144 except ImportError, e: |
145 if e!="No module named %s"%self.name: | 145 if str(e)!="No module named %s"%self.name: |
146 raise SCons.Errors.EnvironmentError, e | 146 raise SCons.Errors.EnvironmentError, e |
147 try: | 147 try: |
148 import zipimport | 148 import zipimport |
149 importer = zipimport.zipimporter( sys.modules['SCons.Too
l'].__path__[0] ) | 149 importer = zipimport.zipimporter( sys.modules['SCons.Too
l'].__path__[0] ) |
150 module = importer.load_module(full_name) | 150 module = importer.load_module(full_name) |
151 setattr(SCons.Tool, self.name, module) | 151 setattr(SCons.Tool, self.name, module) |
152 return module | 152 return module |
153 except ImportError, e: | 153 except ImportError, e: |
154 m = "No tool named '%s': %s" % (self.name, e) | 154 m = "No tool named '%s': %s" % (self.name, e) |
155 raise SCons.Errors.EnvironmentError, m | 155 raise SCons.Errors.EnvironmentError, m |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 'swig', | 658 'swig', |
659 'tar', 'tex', | 659 'tar', 'tex', |
660 'yacc', 'zip', 'rpm', 'wix'], | 660 'yacc', 'zip', 'rpm', 'wix'], |
661 env) | 661 env) |
662 | 662 |
663 tools = ([linker, c_compiler, cxx_compiler, | 663 tools = ([linker, c_compiler, cxx_compiler, |
664 fortran_compiler, assembler, ar] | 664 fortran_compiler, assembler, ar] |
665 + other_tools) | 665 + other_tools) |
666 | 666 |
667 return filter(lambda x: x, tools) | 667 return filter(lambda x: x, tools) |
OLD | NEW |