From b315fcf6200eb55e165f85b0b2d2513aaccccbc5 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Thu, 16 Jul 2015 21:01:11 -0400 Subject: * Replace ConfigParser with CBCConfigParser * Raise IncompleteEnv on bad path in ~/.cbcrc --- cbc/environment.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cbc/environment.py b/cbc/environment.py index c484ac6..0f0a9f9 100644 --- a/cbc/environment.py +++ b/cbc/environment.py @@ -1,7 +1,8 @@ import os -from .exceptions import IncompleteEnv -from configparser import ConfigParser, ExtendedInterpolation import time +from .exceptions import IncompleteEnv +from .parsers import CBCConfigParser, ExtendedInterpolation + class Environment(object): @@ -24,13 +25,15 @@ class Environment(object): if os.path.exists(self.rcpath): if os.path.isfile(self.rcpath): - self.configrc = ConfigParser(interpolation=ExtendedInterpolation()) + self.configrc = CBCConfigParser(interpolation=ExtendedInterpolation()) self.configrc.read(self.rcpath) if 'settings' in self.configrc.sections(): if 'path' in self.configrc['settings']: self.cbchome = self.configrc['settings']['path'] - + if not self.cbchome: + raise IncompleteEnv('.cbcrc empty path detected. Check: settings -> path') + if self.cbchome is None: raise IncompleteEnv('CBC_HOME is undefined.') -- cgit