blob: 78b64ccb9061146ea8a8f37748ff7eedb10a0e80 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
import os
class IncompleteEnv(Exception):
pass
class Environment(object):
def __init__(self, *args, **kwargs):
self.environ = os.environ.copy()
self.config = {}
self.cbchome = None
if 'CBC_HOME' in kwargs:
self.cbchome = kwargs['CBC_HOME']
if 'CBC_HOME' in self.environ:
self.cbchome = self.environ['CBC_HOME']
if self.cbchome is None:
raise IncompleteEnv('Environment.cbchome is undefined')
if not os.path.exists(self.cbchome):
os.makedirs(self.cbchome)
self.config['meta'] = self.join('meta.yaml')
self.config['build'] = self.join('build.sh')
self.config['build_windows'] = self.join('bld.bat')
def join(self, path):
return os.path.join(self.cbchome, path)
|