Пример #1
0
 def compile(self):
     """ 
         This method will compile and prepare everything to start evaluation
         the configuration specification.
         
         This method will:
         - load all namespaces
         - compile the __config__ namespace
         - start resolving it and importing unknown namespaces
     """
     self.load()
     statements = []
     for unit in self._units:
         if unit.unit is not None:
             statements.extend(unit.unit.compile())
             
     # add the entity type (hack?)
     entity = DefineEntity("Entity", "The entity all other entities inherit from.")
     entity.namespace = Namespace("std", self.__root_ns)
     
     requires_rel = DefineRelation([Reference("Entity", ["std"]), "requires", [0, None], False], 
                                   [Reference("Entity", ["std"]), "provides", [0, None], False])
     requires_rel.namespace = Namespace("std", self.__root_ns)
     
     statements.append(entity)
     statements.append(requires_rel)
     
     return statements