Add proper virtualenv support to run_checks.py
This commit is contained in:
parent
18443a6880
commit
6a7e454789
@ -91,10 +91,15 @@ def run(name, target=None, print_version=False):
|
|||||||
if target is not None:
|
if target is not None:
|
||||||
args.append(target)
|
args.append(target)
|
||||||
with _adjusted_pythonpath(name):
|
with _adjusted_pythonpath(name):
|
||||||
|
# for virtualenvs
|
||||||
|
executable = os.path.join(os.path.dirname(sys.executable), name)
|
||||||
|
if not os.path.exists(executable):
|
||||||
|
# in $PATH
|
||||||
|
executable = name
|
||||||
if print_version:
|
if print_version:
|
||||||
subprocess.call([name, '--version'])
|
subprocess.call([executable, '--version'])
|
||||||
try:
|
try:
|
||||||
status = subprocess.call([name] + args)
|
status = subprocess.call([executable] + args)
|
||||||
except OSError:
|
except OSError:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
status = None
|
status = None
|
||||||
|
Loading…
Reference in New Issue
Block a user