How to use the autoconfig.data_directory function in autoconfig

To help you get started, we’ve selected a few autoconfig examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gccxml / pygccxml / unittests / filtering_tester.py View on Github external
def __init__(self, *args):
        parser_test_case.parser_test_case_t.__init__(self, *args)
        self.__fname = 'declarations_for_filtering.hpp'
        self.__fpath = declarations.filtering.normalize_path( 
                            os.path.join( autoconfig.data_directory, self.__fname ) ) 
github gccxml / pygccxml / unittests / pdb_tester.py View on Github external
def __init__(self, *args):
        unittest.TestCase.__init__(self, *args)
        self.pdb_file = os.path.join( autoconfig.data_directory
                                      , 'msvc_build'
                                      , 'Debug'
                                      , 'msvc_build.pdb' )
github gccxml / pygccxml / unittests / cache_enums_tester.py View on Github external
def __init__(self, *args):
        parser_test_case.parser_test_case_t.__init__(self, *args)
        self.header = os.path.join(
            autoconfig.data_directory,
            'declarations_enums.hpp')
        self.cache_file = os.path.join(
            autoconfig.data_directory,
            'pygccxml.cache')
        if os.path.exists(self.cache_file) and os.path.isfile(self.cache_file):
            os.remove(self.cache_file)
github gccxml / pygccxml / unittests / copy_constructor_tester.py View on Github external
def setUp(self):
        if not self.global_ns:

            # Extract the xml file from the bz2 archive
            bz2_path = os.path.join(
                autoconfig.data_directory,
                'ogre.1.7.xml.bz2')
            self.xml_path = os.path.join(
                autoconfig.data_directory,
                'ogre.1.7.xml')
            with open(self.xml_path, 'wb') as new_file:
                # bz2.BZ2File can not be used in a with statement in python 2.6
                bz2_file = bz2.BZ2File(bz2_path, 'rb')
                for data in iter(lambda: bz2_file.read(100 * 1024), b''):
                    new_file.write(data)
                bz2_file.close()

            reader = parser.source_reader_t(autoconfig.cxx_parsers_cfg.gccxml)
            self.global_ns = declarations.get_global_namespace(
                reader.read_xml_file(
                    self.xml_path))
            self.global_ns.init_optimizer()
github gccxml / pygccxml / unittests / decl_string_tester.py View on Github external
def __init__(self, *args):
        parser_test_case.parser_test_case_t.__init__(self, *args)
        self.header = os.path.join(
            autoconfig.data_directory,
            'declarations_calldef.hpp')
        self.template = """
        //test generated declaration string using gcc(xml) compiler
github gccxml / pygccxml / unittests / reopen_cache_tester.py View on Github external
Test re-oping cache files.

    This test is run by file_cache_tester.py in a subprocess.

    """

    if "__pypy__" in sys.builtin_module_names:
        # This test is broken on travis with pypy3.3-5.2-alpha1
        # It is annoying but only the alpha version is working without
        # segfaulting, and it is quite old now. Also; this test is due for
        # removal because the utils.xml_generator mechanism is being
        # deprecated. So this test can just be skipped until it is completely
        # removed
        return

    data = autoconfig.data_directory

    # xml_generator has not been set
    if utils.xml_generator is not "":
        raise Exception

    # Try to reopen an old cache file and check if there is an exception
    # These old files do not know about the xml generator; a RuntimeError
    # should be thrown, asking to regenerate the cache file.
    c_file = os.path.join(data, 'old_cache.cache')
    error = False
    try:
        parser.file_cache_t(c_file)
    except RuntimeError:
        error = True
    if error is False:
        raise Exception
github gccxml / pygccxml / unittests / cache_enums_tester.py View on Github external
def __init__(self, *args):
        parser_test_case.parser_test_case_t.__init__(self, *args)
        self.header = os.path.join(
            autoconfig.data_directory,
            'declarations_enums.hpp')
        self.cache_file = os.path.join(
            autoconfig.data_directory,
            'pygccxml.cache')
        if os.path.exists(self.cache_file) and os.path.isfile(self.cache_file):
            os.remove(self.cache_file)
github gccxml / pygccxml / unittests / misc / profile_parser.py View on Github external
# Copyright 2014-2016 Insight Software Consortium.
# Copyright 2004-2008 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0.
# See http://www.boost.org/LICENSE_1_0.txt

import os
import hotshot
import hotshot.stats

import autoconfig
import test_parser

if __name__ == "__main__":
    statistics_file = os.path.join(autoconfig.data_directory, 'profile.stat')
    profile = hotshot.Profile(statistics_file)
    profile.runcall(test_parser.run_suite)
    profile.close()
    statistics = hotshot.stats.load(statistics_file)
    statistics.strip_dirs()
    statistics.sort_stats('time', 'calls')
    statistics.print_stats(20)
github gccxml / pygccxml / unittests / file_cache_tester.py View on Github external
def __init__(self, *args):
        parser_test_case.parser_test_case_t.__init__(self, *args)
        self.header = os.path.join(autoconfig.data_directory, 'core_cache.hpp')
        self.cache_file = os.path.join(
            autoconfig.data_directory,
            'pygccxml.cache')
        if os.path.exists(self.cache_file) and os.path.isfile(self.cache_file):
            os.remove(self.cache_file)
github gccxml / pygccxml / unittests / demangled_tester.py View on Github external
def setUp(self):
        reader = parser.source_reader_t(self.config)
        decls = None
        if 32 == self.architecture:
            decls = reader.read_file(self.header)
        else:
            original_get_architecture = utils.get_architecture
            utils.get_architecture = lambda: 64
            decls = reader.read_xml_file(
                os.path.join(
                    autoconfig.data_directory,
                    'demangled_tester_64bit.xml'))
            utils.get_architecture = original_get_architecture
        self.global_ns = declarations.get_global_namespace(decls)