Clean up how the environments work.

This commit is contained in:
Anthony Sottile 2014-03-22 16:33:24 -07:00
parent a1ba715b50
commit 6cda5bfe27
4 changed files with 61 additions and 23 deletions

View file

@ -6,12 +6,10 @@ from pre_commit.languages import helpers
PY_ENV = 'py_env'
class PythonEnv(object):
def __init__(self):
self.env_prefix = '. {0}/bin/activate &&'.format(PY_ENV)
def run(self, cmd, **kwargs):
return local['bash']['-c', ' '.join([self.env_prefix, cmd])].run(**kwargs)
class PythonEnv(helpers.Environment):
@property
def env_prefix(self):
return '. {0}/bin/activate &&'.format(PY_ENV)
@contextlib.contextmanager