Fix SafeConfigParser DeprecationWarning in Python 3.2

SafeConfigParser is deprecated in Python 3.2 and log warning
like " DeprecationWarning: The SafeConfigParser class has
been renamed to ConfigParser in Python 3.2. This alias will be
removed in future versions. Use ConfigParser directly instead."
So use ConfigParser in Python 3.2+.

Closes-Bug: #1618666
Change-Id: I225bde35b18bd410f3fe9d415759d1def0a91aca
This commit is contained in:
ChangBo Guo(gcb) 2016-09-11 17:34:23 +08:00
parent 9149414fd8
commit f8c1ee3950
2 changed files with 12 additions and 2 deletions

View File

@ -21,6 +21,7 @@ It is used via a single directive in the .rst file
"""
import re
import sys
from six.moves import configparser
@ -158,6 +159,10 @@ class FeatureMatrixDirective(rst.Directive):
:returns: Matrix instance
"""
# SafeConfigParser was deprecated in Python 3.2
if sys.version_info >= (3, 2):
cfg = configparser.ConfigParser()
else:
cfg = configparser.SafeConfigParser()
env = self.state.document.settings.env
filename = self.arguments[0]

View File

@ -23,6 +23,7 @@ It is used via a single directive in the .rst file
"""
import re
import sys
import six
from six.moves import configparser
@ -129,6 +130,10 @@ class SupportMatrixDirective(rst.Directive):
:returns: SupportMatrix instance
"""
# SafeConfigParser was deprecated in Python 3.2
if sys.version_info >= (3, 2):
cfg = configparser.ConfigParser()
else:
cfg = configparser.SafeConfigParser()
env = self.state.document.settings.env
fname = self.arguments[0]