Use a property

This commit is contained in:
Pradyun Gedam 2018-01-23 21:32:34 +05:30
parent 470d48ad6e
commit cb6aa5be26
No known key found for this signature in database
GPG Key ID: DA17C4B29CB32E4B
1 changed files with 7 additions and 3 deletions

View File

@ -15,6 +15,10 @@ class BuildEnvironment(object):
self._temp_dir = TempDirectory(kind="build-env")
self._no_clean = no_clean
@property
def path(self):
return self._temp_dir.path
def __enter__(self):
self._temp_dir.create()
@ -23,8 +27,8 @@ class BuildEnvironment(object):
install_scheme = 'nt' if (os.name == 'nt') else 'posix_prefix'
install_dirs = get_paths(install_scheme, vars={
'base': self._temp_dir.path,
'platbase': self._temp_dir.path,
'base': self.path,
'platbase': self.path,
})
scripts = install_dirs['scripts']
@ -44,7 +48,7 @@ class BuildEnvironment(object):
else:
os.environ['PYTHONPATH'] = lib_dirs
return self._temp_dir.path
return self.path
def __exit__(self, exc_type, exc_val, exc_tb):
if not self._no_clean: