File: autoconfig.py

package info (click to toggle)
pygccxml 3.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,444 kB
  • sloc: xml: 29,841; python: 13,914; cpp: 2,671; makefile: 163; ansic: 59
file content (58 lines) | stat: -rw-r--r-- 1,904 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Copyright 2014-2017 Insight Software Consortium.
# Copyright 2004-2009 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0.
# See http://www.boost.org/LICENSE_1_0.txt

import os
import sys
import logging
import warnings
import platform

# Prevents copy.deepcopy RecursionError in some tests (Travis build)
sys.setrecursionlimit(10000)

this_module_dir_path = os.path.abspath(
    os.path.dirname(sys.modules[__name__].__file__))

data_directory = os.path.join(this_module_dir_path, 'data')
build_directory = os.path.join(this_module_dir_path, 'temp')

if not os.path.exists(build_directory):
    os.makedirs(build_directory)

sys.path.insert(1, os.path.join(os.curdir, '..'))
# The tests are run on the parent pygccxml directory, not the one
# in site-packages. Insert the directory's path.
sys.path.insert(1, "../src/pygccxml")

from pygccxml import parser  # nopep8
from pygccxml import utils  # nopep8

# We want to make sure we throw an error for ALL the warnings during the
# tests. This will allow us to be notified by the build bots, so that the
# warnings can be fixed.
warnings.simplefilter("error", Warning)

# Set logging level
utils.loggers.set_level(logging.CRITICAL)

# Find out the c++ parser (gccxml or castxml)
generator_path, generator_name = utils.find_xml_generator()


class cxx_parsers_cfg(object):
    config = parser.load_xml_generator_configuration(
        os.path.normpath(this_module_dir_path + '/xml_generator.cfg'),
        xml_generator_path=generator_path,
        working_directory=data_directory,
        xml_generator=generator_name)

    if platform.system() == 'Windows':
        config.define_symbols.append('_HAS_EXCEPTIONS=0')


if cxx_parsers_cfg.config.xml_generator:
    generator_name = cxx_parsers_cfg.config.xml_generator
if cxx_parsers_cfg.config.xml_generator_path:
    generator_path = cxx_parsers_cfg.config.xml_generator_path