Esempio n. 1
0
    def __init__(self, custom_opttree):
        """
        Initializes a lazyrunner environment.  The environment options
        are identical to those on the command line.
                 
        project_directory = '.',
        debug_mode = False, 
        verbose = False,
        no_cache = False, 
        force = False,
        cache_read_only = False, 
        cache_directory = None,
        no_compile = False, 
        config_module = 'conf'
        
        """

        self.log = logging.getLogger("Manager")
            
        ################################################################################
        # Init all the module lookup stuff
        opttree = configuration.setupOptionTree(custom_opttree, self.log, False)
        
        loading.resetAndInitModuleLoading(opttree)

        opttree = configuration.setupOptionTree(custom_opttree, self.log, True)
        self.opttree = opttree

        pmodule.resetAndInitialize()
        parameter_module.resetAndInitialize()
        
        loading.resetAndInitModules(self.opttree)
                
        parameter_module.finalize()
        pmodule.finalize()
Esempio n. 2
0
def clean(custom_opttree = None, **kwargs):
    
    if custom_opttree is None:
        custom_opttree = TreeDict()
        
    custom_opttree.update(TreeDict.fromdict(kwargs))
    
    __initLoggingSystem(custom_opttree)

    log = logging.getLogger("Configuration")
    opttree = configuration.setupOptionTree(custom_opttree, log, False)

    loading.cleanAll(opttree)
Esempio n. 3
0
def __initLoggingSystem(custom_opttree):
            
    # get one filled in with the defaults
    opttree = configuration.setupOptionTree(custom_opttree, None, False)
    
    # Set up the logging stuff
    logging.basicConfig(
        format = opttree.logging.format,
        datefmt = opttree.logging.datefmt,
        level = logging.DEBUG if opttree.verbose else logging.INFO
    )

    if hasattr(logging, "captureWarnings"):
        logging.captureWarnings(True)