diff options
Diffstat (limited to 'cbc/environment.py')
-rw-r--r-- | cbc/environment.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/cbc/environment.py b/cbc/environment.py index cd1389b..7bc427c 100644 --- a/cbc/environment.py +++ b/cbc/environment.py @@ -9,6 +9,8 @@ class Environment(object): self.environ = os.environ.copy()
self.config = {}
self.cbchome = None
+ self.pwd = os.path.abspath(os.curdir)
+ self.pkgdir = None
if 'CBC_HOME' in kwargs:
self.cbchome = kwargs['CBC_HOME']
@@ -21,17 +23,31 @@ class Environment(object): if self.cbchome is None:
raise IncompleteEnv('Environment.cbchome is undefined')
+
+ self.cbchome = os.path.abspath(self.cbchome)
if not os.path.exists(self.cbchome):
os.makedirs(self.cbchome)
+ def _script_meta(self):
self.config['script'] = {}
self.config['script']['meta'] = self.join('meta.yaml')
self.config['script']['build_linux'] = self.join('build.sh')
self.config['script']['build_windows'] = self.join('bld.bat')
- def join(self, path):
- return os.path.join(self.cbchome, path)
+ def join(self, filename):
+ return os.path.abspath(os.path.join(self.pkgdir, filename))
+ def mkpkgdir(self, pkgname):
+ pkgdir = os.path.join(self.cbchome, pkgname)
+
+ if not pkgname:
+ raise IncompleteEnv('Empty package name passed to {0}'.format(__name__))
+ if not os.path.exists(pkgdir):
+ os.mkdir(pkgdir)
+
+ self.pkgdir = pkgdir
+ self._script_meta()
+
'''
def local_temp(self):
temp_prefix = os.path.basename(os.path.splitext(__name__)[0])
|