Exemplo n.º 1
0
Arquivo: Session.py Projeto: Val9/jasy
 def permutate(self):
     """ Generator method for permutations for improving output capabilities """
     
     header("Processing permutations...")
     
     permutations = self.getPermutations()
     length = len(permutations)
     
     for pos, current in enumerate(permutations):
         info(colorize("Permutation %s/%s:" % (pos+1, length), "bold"))
         setPermutation(current)
         indent()
         yield current
         outdent()
Exemplo n.º 2
0
def storeKernel(fileName, debug=False):
    """
    Writes a so-called kernel script to the given location. This script contains
    data about possible permutations based on current session values. It optionally
    might include asset data (useful when boot phase requires some assets) and 
    localization data (if only one locale is built).
    
    Optimization of the script is auto-enabled when no other information is given.
    
    This method returns the classes which are included by the script so you can 
    exclude it from the real other generated output files.
    """
    
    header("Storing kernel...")
    
    # This exports all field values from the session
    fields = session.exportFields()
    
    # This permutation injects data in the core classes and configures debugging as given by parameter
    setPermutation(Permutation({
        "debug" : debug,
        "fields" : fields
    }))
    
    # Build resolver
    # We need the permutation here because the field configuration might rely on detection classes
    resolver = Resolver()
    resolver.addClassName("core.Env")
    resolver.addClassName("core.io.Asset")
    resolver.addClassName("core.io.Queue")
    
    # Sort resulting class list
    classes = resolver.getSortedClasses()
    storeCompressed(classes, fileName)
    
    setPermutation(None)
    
    return classes