mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Clean up how the environments work.
This commit is contained in:
parent
a1ba715b50
commit
6cda5bfe27
4 changed files with 61 additions and 23 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue