From: Zac Medico Date: Thu, 25 Aug 2011 00:32:30 +0000 (-0700) Subject: SafeConfigParser: renamed to ConfigParser in 3.2 X-Git-Tag: v2.2.0_alpha52~72 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4a4912dfcec973fc849d7e1326fb3309b5142228;p=portage.git SafeConfigParser: renamed to ConfigParser in 3.2 --- diff --git a/pym/portage/_sets/__init__.py b/pym/portage/_sets/__init__.py index 1b3484ec1..34ca74b5d 100644 --- a/pym/portage/_sets/__init__.py +++ b/pym/portage/_sets/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2007 Gentoo Foundation +# Copyright 2007-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from __future__ import print_function @@ -6,8 +6,13 @@ from __future__ import print_function __all__ = ["SETPREFIX", "get_boolean", "SetConfigError", "SetConfig", "load_default_config"] +import sys try: - from configparser import SafeConfigParser, NoOptionError + from configparser import NoOptionError + if sys.hexversion >= 0x3020000: + from configparser import ConfigParser as SafeConfigParser + else: + from configparser import SafeConfigParser except ImportError: from ConfigParser import SafeConfigParser, NoOptionError from portage import os diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py index 9f0bb99cd..ac9793e4a 100644 --- a/pym/portage/repository/config.py +++ b/pym/portage/repository/config.py @@ -3,10 +3,15 @@ import io import logging +import sys import re try: - from configparser import SafeConfigParser, ParsingError + from configparser import ParsingError + if sys.hexversion >= 0x3020000: + from configparser import ConfigParser as SafeConfigParser + else: + from configparser import SafeConfigParser except ImportError: from ConfigParser import SafeConfigParser, ParsingError from portage import os