From 3a8198bfb603a6aaf3cc795f753d741530bdcb51 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 23 Jun 2015 09:28:34 -0400 Subject: Refactored and split apart exceptions --- cbc/environment.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'cbc/environment.py') diff --git a/cbc/environment.py b/cbc/environment.py index 78b64cc..34d77b2 100755 --- a/cbc/environment.py +++ b/cbc/environment.py @@ -1,7 +1,8 @@ import os +from .exceptions import IncompleteEnv +from tempfile import TemporaryDirectory +import time -class IncompleteEnv(Exception): - pass class Environment(object): def __init__(self, *args, **kwargs): @@ -19,10 +20,17 @@ class Environment(object): if not os.path.exists(self.cbchome): os.makedirs(self.cbchome) - + + temp_prefix = os.path.basename(os.path.splitext(__name__)[0]) + tempdir = TemporaryDirectory(prefix=temp_prefix, dir=self.cbchome) + self.working_dir = tempdir.name + time.sleep(10) self.config['meta'] = self.join('meta.yaml') self.config['build'] = self.join('build.sh') self.config['build_windows'] = self.join('bld.bat') + print(self.working_dir) def join(self, path): - return os.path.join(self.cbchome, path) \ No newline at end of file + return os.path.join(self.cbchome, path) + + \ No newline at end of file -- cgit