mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-19 17:14:43 +04:00
Performance hack
This commit is contained in:
parent
1a8095e71e
commit
6b62ec47e8
1 changed files with 1 additions and 14 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
|
|
||||||
from plumbum import local
|
from plumbum import local
|
||||||
import subprocess
|
|
||||||
|
|
||||||
PY_ENV = 'py_env'
|
PY_ENV = 'py_env'
|
||||||
|
|
||||||
|
|
@ -17,21 +16,9 @@ def install_environment():
|
||||||
|
|
||||||
|
|
||||||
def run_hook(hook, file_args):
|
def run_hook(hook, file_args):
|
||||||
# TODO: batch filenames
|
|
||||||
process = subprocess.Popen(
|
|
||||||
['bash', '-c', ' '.join(
|
|
||||||
['source {0}/bin/activate &&'.format(PY_ENV)] +
|
|
||||||
[hook['entry']] + hook.get('args', []) + list(file_args)
|
|
||||||
)],
|
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
|
||||||
)
|
|
||||||
ret = process.communicate()
|
|
||||||
|
|
||||||
return (process.returncode,) + ret
|
|
||||||
|
|
||||||
return local['bash'][
|
return local['bash'][
|
||||||
'-c', ' '.join(
|
'-c', ' '.join(
|
||||||
['source {0}/bin/activate &&'.format(PY_ENV)] +
|
['source {0}/bin/activate &&'.format(PY_ENV)] +
|
||||||
[hook['entry']] + hook.get('args', []) + list(file_args)
|
[hook['entry']] + hook.get('args', []) + list(file_args)
|
||||||
)
|
)
|
||||||
].run()
|
].run()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue