Skip to content

Commit ad7a595

Browse files
mamolliMichka
authored andcommitted
SafeConfigParser is deprecated in python 3.2 and newer, so use ConfigParser instead. Add support for cflags property in config files
Cherry-picked from develop branch
1 parent ddc991c commit ad7a595

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

pygccxml/parser/config.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,11 @@ def load_xml_generator_configuration(configuration, **defaults):
343343
"""
344344
loads CastXML or GCC-XML configuration from an `.ini` file or any other
345345
file class
346-
:class:`ConfigParser.SafeConfigParser` is able to parse.
346+
:class:`configparser.ConfigParser` is able to parse.
347347
348348
:param configuration: configuration could be
349349
string(configuration file path) or instance
350-
of :class:`ConfigParser.SafeConfigParser` class
350+
of :class:`configparser.ConfigParser` class
351351
352352
:rtype: :class:`.xml_generator_configuration_t`
353353
@@ -381,10 +381,10 @@ def load_xml_generator_configuration(configuration, **defaults):
381381
parser = configuration
382382
if utils.is_str(configuration):
383383
try:
384-
from configparser import SafeConfigParser
384+
from configparser import ConfigParser
385385
except ImportError:
386-
from ConfigParser import SafeConfigParser
387-
parser = SafeConfigParser()
386+
from ConfigParser import SafeConfigParser as ConfigParser
387+
parser = ConfigParser()
388388
parser.read(configuration)
389389

390390
# Create a new empty configuration
@@ -419,6 +419,8 @@ def load_xml_generator_configuration(configuration, **defaults):
419419
cfg.xml_generator = value
420420
elif name == 'keep_xml':
421421
cfg.keep_xml = value
422+
elif name == 'cflags':
423+
cfg.cflags = value
422424
elif name == 'flags':
423425
cfg.flags = value
424426
elif name == 'compiler_path':

0 commit comments

Comments
 (0)