def test_config_signature(self):
        diff_cfg_list = self.build_differing_cfg_list()
        def_cfg = diff_cfg_list[0]
        def_sig = declarations_cache.configuration_signature(def_cfg)

        # Test changes that should cause sig changes
        for cfg in diff_cfg_list[1:]:
            self.assertTrue(
                declarations_cache.configuration_signature(cfg) != def_sig)

        # Test changes that should not cause sig changes
        no_changes = def_cfg.clone()
        self.assertTrue(
            declarations_cache.configuration_signature(no_changes) == def_sig)

        # start_decls_changed = def_cfg.clone()
        # start_decls_changed.start_with_declarations = "test object"
        # self.assertTrue(
        #   configuration_signature(start_decls_changed) == def_sig)

        ignore_changed = def_cfg.clone()
        ignore_changed.ignore_gccxml_output = True
        self.assertTrue(
            declarations_cache.configuration_signature(ignore_changed) ==
            def_sig)
    def test_config_signature(self):
        diff_cfg_list = self.build_differing_cfg_list()
        def_cfg = diff_cfg_list[0]
        def_sig = declarations_cache.configuration_signature(def_cfg)

        # Test changes that should cause sig changes
        for cfg in diff_cfg_list[1:]:
            self.assert_(declarations_cache.configuration_signature(cfg) != def_sig)

        # Test changes that should not cause sig changes
        no_changes = def_cfg.clone()
        self.assert_(declarations_cache.configuration_signature(no_changes) == def_sig)

        # start_decls_changed = def_cfg.clone()
        # start_decls_changed.start_with_declarations = "test object"
        # self.assert_(configuration_signature(start_decls_changed) == def_sig)

        ignore_changed = def_cfg.clone()
        ignore_changed.ignore_gccxml_output = True
        self.assert_(declarations_cache.configuration_signature(ignore_changed) == def_sig)
def mb_override__init__( self
              , files
              , gccxml_path=''
              , working_directory='.'
              , include_paths=None
              , define_symbols=None
              , undefine_symbols=None
              , start_with_declarations=None
              , compilation_mode=None
              , cache=None
              , optimize_queries=True
              , ignore_gccxml_output=False
              , indexing_suite_version=1
              , cflags=""
              , dependent_headers=[]):
    """  See standard method. 
       dependent_headers: A list of header files (full paths) that this module depends
                  upon and should be made part of the cache signature.
    """
    object.__init__( self )
    self.logger = _logging_.loggers.module_builder
    gccxml_config = parser.config_t(
        gccxml_path=gccxml_path
        , working_directory=working_directory
        , include_paths=include_paths
        , define_symbols=define_symbols
        , undefine_symbols=undefine_symbols
        , start_with_declarations=start_with_declarations
        , ignore_gccxml_output=ignore_gccxml_output
        , cflags=cflags)

    #may be in future I will add those directories to user_defined_directories
    #to self.__code_creator.
    self._module_builder_t__working_dir = os.path.abspath( working_directory )

    self._module_builder_t__parsed_files = map( decls_package.filtering.normalize_path
                               , parser.project_reader_t.get_os_file_names( files ) )
    tmp = map( lambda file_: os.path.split( file_ )[0], self._module_builder_t__parsed_files )
    self._module_builder_t__parsed_dirs = filter( None, tmp )
    
    self._module_builder_t__global_ns = None

    # Have to do it here because the parser changes the config :(
    config_sig = configuration_signature(gccxml_config)
    
    # If we have a cache filename
    # - Compute signature and check it against file
    # - If matches, load it
    if cache and os.path.exists(cache):        
        mb_cache = ModuleBuilderCache(cache)
        self._module_builder_t__global_ns = \
            mb_cache.getCachedTree(self._module_builder_t__parsed_files, config_sig)
        self._module_builder_t__code_creator = None
    
    # If didn't load global_ns from cache
    # - Parse and optimize it
    # - Then save to cache if requested
    if not self._module_builder_t__global_ns:
        self.logger.info("Parsing declarations.")
        self._module_builder_t__global_ns = self._module_builder_t__parse_declarations( files
                                                      , gccxml_config
                                                      , compilation_mode
                                                      , None
                                                      , indexing_suite_version)
        self._module_builder_t__code_creator = None
        if optimize_queries:
            self.logger.info("Running optimizer.")
            self.run_query_optimizer()
        
        if cache:
            mb_cache = ModuleBuilderCache(cache)
            mb_cache.dumpCachedTree(self._module_builder_t__parsed_files,
                                    config_sig, self._module_builder_t__global_ns)            

    self._module_builder_t__declarations_code_head = []
    self._module_builder_t__declarations_code_tail = []

    self._module_builder_t__registrations_code_head = []
    self._module_builder_t__registrations_code_tail = []