pygccxml.utils package

Modules

Logger classes and a few convenience methods.

class pygccxml.utils.utils.cached(method)

Bases: property

Convert a method into a cached attribute.

static reset()
pygccxml.utils.utils.contains_parent_dir(fpath, dirs)

Returns true if paths in dirs start with fpath.

Precondition: dirs and fpath should be normalizeed before calling this function.

pygccxml.utils.utils.create_temp_file_name(suffix, prefix=None, dir=None)

Small convenience function that creates temporary files.

This function is a wrapper around the Python built-in function tempfile.mkstemp.

class pygccxml.utils.utils.enum

Bases: object

Usage example:

class fruits(enum):
    apple = 0
    orange = 1

fruits.has_value( 1 )
fruits.name_of( 1 )
classmethod has_value(enum_numeric_value)
classmethod name_of(enum_numeric_value)
pygccxml.utils.utils.find_xml_generator(name=None)

Try to find a c++ parser. Returns path and name.

Parameters:name (str) – name of the c++ parser: castxml or gccxml

If no name is given the function first looks for gccxml, then for castxml. If no c++ parser is found the function raises an exception.

pygccxml.utils.utils.get_architecture()

Returns computer architecture: 32 or 64.

The guess is based on maxint.

pygccxml.utils.utils.get_tr1(name)

When using libstd++, there is a tr1 namespace.

Note that tr1 was also replaced by std in declarations.py, for the parent attribute.

Return either an empty string or tr1::, useful for appending to search patterns.

pygccxml.utils.utils.is_str(s)

Python 2 and 3 compatible string checker.

class pygccxml.utils.utils.loggers

Bases: object

Class-namespace, defines a few loggers classes, used in the project.

all_loggers = [<logging.Logger object at 0x7f0d7118d910>, <logging.Logger object at 0x7f0d7118d410>, <logging.Logger object at 0x7f0d7118d710>, <logging.Logger object at 0x7f0d7118d810>, <logging.Logger object at 0x7f0d7118d610>]

Contains all logger classes, defined by the class.

cxx_parser = <logging.Logger object>

Logger for C++ parser functionality

If you set this logger level to DEBUG, you will be able to see the exact command line, used to invoke GCC-XML and errors that occures during XML parsing

declarations_cache = <logging.Logger object>

Logger for declarations tree cache functionality

If you set this logger level to DEBUG, you will be able to see what is exactly happens, when you read the declarations from cache file. You will be able to decide, whether it worse for you to use this or that cache strategy.

pdb_reader = <logging.Logger object>

Logger for MS .pdb file reader functionality

queries_engine = <logging.Logger object>

Logger for query engine functionality.

If you set this logger level to DEBUG, you will be able to see what queries you do against declarations tree, measure performance and may be even to improve it. Query engine reports queries and whether they are optimized or not.

root = <logging.Logger object>

Root logger exists for your convenience only.

static set_level(level)

Set the same logging level for all the loggers at once.

class pygccxml.utils.utils.native_compiler

Bases: object

Provides information about the compiler which was used to build the Python executable

static get_gccxml_compiler()
static get_version()
pygccxml.utils.utils.normalize_path(some_path)

Return os.path.normpath(os.path.normcase(some_path))

pygccxml.utils.utils.remove_file_no_raise(file_name, config)

Removes file from disk if exception is raised.