Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 """Launches an anaconda environment to run some scipy hypothesis tests.""" | |
| 2 | |
| 3 import json | |
| 4 import os | |
| 5 import subprocess | |
| 6 import sys | |
| 7 | |
| 8 class ScipyNotInstalledError(Exception): | |
| 9 pass | |
| 10 | |
| 11 def main(argv, anaconda_path=None): | |
| 12 if not anaconda_path: | |
| 13 if os.name == 'nt': | |
| 14 anaconda_path = r'c:\conda-py-scientific\python.exe' | |
| 15 else: | |
| 16 anaconda_path = '/opt/conda-py-scientific/bin/python' | |
| 17 if not os.path.exists(anaconda_path): | |
| 18 raise ScipyNotInstalledError() | |
| 19 | |
| 20 _, list_a, list_b, significance = argv | |
| 21 | |
| 22 inner_script_location = os.path.join(os.path.dirname(os.path.realpath( | |
| 23 __file__)), 'significantly_different_inner.py') | |
| 24 | |
| 25 conda_environ = dict(os.environ) | |
| 26 del conda_environ["PYTHONPATH"] | |
|
Vadim Sh.
2016/02/12 02:01:31
nit: conda_environ.pop("PYTHONPATH", None)
Otherw
| |
| 27 | |
| 28 return json.loads(subprocess.check_output( | |
| 29 [anaconda_path, inner_script_location,list_a, list_b, significance], | |
| 30 env=conda_environ)) | |
| 31 | |
| 32 if __name__ == '__main__': | |
| 33 result = main(sys.argv) | |
| 34 if result: | |
| 35 print json.dumps(result, indent=4) | |
| 36 sys.exit(0) | |
| 37 sys.exit(1) | |
| OLD | NEW |