commit: f3c9664657f2edf41e249cff378b7fb60e1262e2
Author: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed May 14 20:56:23 2014 +0000
Commit: Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed May 14 20:56:23 2014 +0000
URL:
http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=f3c96646
layman/config.py: Adds py3 compatibility for ConfigParser
---
layman/config.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/layman/config.py b/layman/config.py
index bf33f50..0827b71 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -28,7 +28,14 @@ __version__ = "0.2"
import sys
import os
-import ConfigParser
+
+try:
+ # Import for Python3
+ import configparser as ConfigParser
+ from configparser import BasicInterpolation
+except:
+ # Import for Python2
+ import ConfigParser
from layman.output import Message
from layman.utils import path
@@ -247,6 +254,7 @@ class BareConfig(object):
return overlays
if (key in self._options
and not self._options[key] is None):
+ self._options['config'] = '/etc/layman/layman.cfg'
return self._options[key]
if self.config and self.config.has_option('MAIN', key):
if key in self._defaults['t/f_options']: