aboutsummaryrefslogtreecommitdiff
path: root/cbc
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-16 21:01:11 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-16 21:01:11 -0400
commitb315fcf6200eb55e165f85b0b2d2513aaccccbc5 (patch)
treec4b44bb7498d696b7312b9488fc4dbaa82a78929 /cbc
parent4e1ffdc496c7f77dcd55296084476ca81a0e5d86 (diff)
downloadcbc-b315fcf6200eb55e165f85b0b2d2513aaccccbc5.tar.gz
* Replace ConfigParser with CBCConfigParser
* Raise IncompleteEnv on bad path in ~/.cbcrc
Diffstat (limited to 'cbc')
-rw-r--r--cbc/environment.py11
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.')