Package SCons :: Module CacheDir :: Class CacheDir
[hide private]
[frames] | no frames]

Class CacheDir

source code

object --+
         |
        CacheDir

Instance Methods [hide private]
 
__init__(self, path)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
CacheDebug(self, fmt, target, cachefile) source code
 
is_enabled(self) source code
 
cachepath(self, node) source code
 
retrieve(self, node)
This method is called from multiple threads in a parallel build, so only do thread safe stuff here.
source code
 
push(self, node) source code
 
push_if_forced(self, node) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, path)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: object.__init__
(inherited documentation)

retrieve(self, node)

source code 

This method is called from multiple threads in a parallel build, so only do thread safe stuff here. Do thread unsafe stuff in built().

Note that there's a special trick here with the execute flag (one that's not normally done for other actions). Basically if the user requested a no_exec (-n) build, then SCons.Action.execute_actions is set to 0 and when any action is called, it does its showing but then just returns zero instead of actually calling the action execution operation. The problem for caching is that if the file does NOT exist in cache then the CacheRetrieveString won't return anything to show for the task, but the Action.__call__ won't call CacheRetrieveFunc; instead it just returns zero, which makes the code below think that the file was successfully retrieved from the cache, therefore it doesn't do any subsequent building. However, the CacheRetrieveString didn't print anything because it didn't actually exist in the cache, and no more build actions will be performed, so the user just sees nothing. The fix is to tell Action.__call__ to always execute the CacheRetrieveFunc and then have the latter explicitly check SCons.Action.execute_actions itself.