-
Notifications
You must be signed in to change notification settings - Fork 0
/
localtoxinstall.py
36 lines (30 loc) · 1.06 KB
/
localtoxinstall.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python
"""
Custom install command for tox when developing on several jukebox projects at the same time.
This will simply execute a localtoxinstall script where you can install dependencies in develop mode.
"""
from __future__ import print_function
import os
import sys
import subprocess
def start_process(args):
p = subprocess.Popen(args, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
print(p.communicate())
rc = p.poll()
if rc:
print('Process returncode: %s for args %s' % (rc, args), file=sys.stderr)
sys.exit(rc)
script = os.path.join(os.path.dirname(__file__), 'localtoxinstall')
if not os.path.exists(script):
print('localtoxinstall script not found. Create a localtoxinstall script file \
in the project dir. Have a look at the template for more information. \
Do not put the localtoxinstall script under version control!')
sys.exit(1)
print(sys.argv)
if '--no-deps' not in sys.argv:
args = ['sh', script]
start_process(args)
args = ['pip', 'install']
args.extend(sys.argv[1:])
print(args)
start_process(args)