| OLD | NEW |
| 1 """SCons.Script.SConscript | 1 """SCons.Script.SConscript |
| 2 | 2 |
| 3 This module defines the Python API provided to SConscript and SConstruct | 3 This module defines the Python API provided to SConscript and SConstruct |
| 4 files. | 4 files. |
| 5 | 5 |
| 6 """ | 6 """ |
| 7 | 7 |
| 8 # | 8 # |
| 9 # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundat
ion | 9 # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 The SCons Foundat
ion |
| 10 # | 10 # |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 # | 21 # |
| 22 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY | 22 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY |
| 23 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | 23 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE |
| 24 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | 24 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 25 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | 25 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
| 26 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | 26 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
| 27 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 27 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 28 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 28 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 29 # | 29 # |
| 30 | 30 |
| 31 __revision__ = "src/engine/SCons/Script/SConscript.py 3603 2008/10/10 05:46:45 s
cons" | 31 __revision__ = "src/engine/SCons/Script/SConscript.py 3842 2008/12/20 22:59:52 s
cons" |
| 32 | 32 |
| 33 import SCons | 33 import SCons |
| 34 import SCons.Action | 34 import SCons.Action |
| 35 import SCons.Builder | 35 import SCons.Builder |
| 36 import SCons.Defaults | 36 import SCons.Defaults |
| 37 import SCons.Environment | 37 import SCons.Environment |
| 38 import SCons.Errors | 38 import SCons.Errors |
| 39 import SCons.Node | 39 import SCons.Node |
| 40 import SCons.Node.Alias | 40 import SCons.Node.Alias |
| 41 import SCons.Node.FS | 41 import SCons.Node.FS |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 frame = call_stack.pop() | 272 frame = call_stack.pop() |
| 273 try: | 273 try: |
| 274 fs.chdir(frame.prev_dir, change_os_dir=sconscript_chdir) | 274 fs.chdir(frame.prev_dir, change_os_dir=sconscript_chdir) |
| 275 except OSError: | 275 except OSError: |
| 276 # There was no local directory, so chdir to the | 276 # There was no local directory, so chdir to the |
| 277 # Repository directory. Like above, we do this | 277 # Repository directory. Like above, we do this |
| 278 # directly. | 278 # directly. |
| 279 fs.chdir(frame.prev_dir, change_os_dir=0) | 279 fs.chdir(frame.prev_dir, change_os_dir=0) |
| 280 rdir = frame.prev_dir.rdir() | 280 rdir = frame.prev_dir.rdir() |
| 281 rdir._create() # Make sure there's a directory there. | 281 rdir._create() # Make sure there's a directory there. |
| 282 os.chdir(rdir.get_abspath()) | 282 try: |
| 283 os.chdir(rdir.get_abspath()) |
| 284 except OSError, e: |
| 285 # We still couldn't chdir there, so raise the error, |
| 286 # but only if actions are being executed. |
| 287 # |
| 288 # If the -n option was used, the directory would *not* |
| 289 # have been created and we should just carry on and |
| 290 # let things muddle through. This isn't guaranteed |
| 291 # to work if the SConscript files are reading things |
| 292 # from disk (for example), but it should work well |
| 293 # enough for most configurations. |
| 294 if SCons.Action.execute_actions: |
| 295 raise e |
| 283 | 296 |
| 284 results.append(frame.retval) | 297 results.append(frame.retval) |
| 285 | 298 |
| 286 # if we only have one script, don't return a tuple | 299 # if we only have one script, don't return a tuple |
| 287 if len(results) == 1: | 300 if len(results) == 1: |
| 288 return results[0] | 301 return results[0] |
| 289 else: | 302 else: |
| 290 return tuple(results) | 303 return tuple(results) |
| 291 | 304 |
| 292 def SConscript_exception(file=sys.stderr): | 305 def SConscript_exception(file=sys.stderr): |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 GlobalDict = {} | 623 GlobalDict = {} |
| 611 | 624 |
| 612 import SCons.Script | 625 import SCons.Script |
| 613 d = SCons.Script.__dict__ | 626 d = SCons.Script.__dict__ |
| 614 def not_a_module(m, d=d, mtype=type(SCons.Script)): | 627 def not_a_module(m, d=d, mtype=type(SCons.Script)): |
| 615 return type(d[m]) != mtype | 628 return type(d[m]) != mtype |
| 616 for m in filter(not_a_module, dir(SCons.Script)): | 629 for m in filter(not_a_module, dir(SCons.Script)): |
| 617 GlobalDict[m] = d[m] | 630 GlobalDict[m] = d[m] |
| 618 | 631 |
| 619 return GlobalDict.copy() | 632 return GlobalDict.copy() |
| OLD | NEW |