diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-16 21:01:11 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-16 21:01:11 -0400 |
commit | b315fcf6200eb55e165f85b0b2d2513aaccccbc5 (patch) | |
tree | c4b44bb7498d696b7312b9488fc4dbaa82a78929 /cbc/environment.py | |
parent | 4e1ffdc496c7f77dcd55296084476ca81a0e5d86 (diff) | |
download | cbc-b315fcf6200eb55e165f85b0b2d2513aaccccbc5.tar.gz |
* Replace ConfigParser with CBCConfigParser
* Raise IncompleteEnv on bad path in ~/.cbcrc
Diffstat (limited to 'cbc/environment.py')
-rw-r--r-- | cbc/environment.py | 11 |
1 files 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.') |