diff options
-rw-r--r-- | pym/portage/_sets/__init__.py | 9 | ||||
-rw-r--r-- | pym/portage/repository/config.py | 7 |
2 files changed, 13 insertions, 3 deletions
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 |