forked from broadinstitute/viral-ngs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_tools.py
executable file
·42 lines (37 loc) · 1.28 KB
/
install_tools.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
37
38
39
40
41
42
#!/usr/bin/env python
''' This script installs every Tool needed by viral-ngs
'''
from __future__ import print_function
import os.path
import sys
import timeit
import tools
from tools import *
import util.file
__author__ = "[email protected]"
def install_all_tools():
sumtime = 0.0
n_tools = 0
n_success = 0
for tool_class in tools.all_tool_classes():
t = tool_class()
print("installing %s .. " % tool_class.__name__, end="")
sys.stdout.flush()
runtime = timeit.timeit(t.install)
sumtime += runtime
success = t.is_installed()
print("SUCCESS" if success else "FAILED", end="")
print(" (%0.1f seconds)" % runtime)
sys.stdout.flush()
if success:
n_success += 1
n_tools += 1
print("Total %d tools attempted, %d succeeded, %d failed, cumulative install time %0.1f seconds" % (
n_tools, n_success, n_tools - n_success, sumtime))
return (n_tools == n_success)
if __name__ == '__main__':
print("this install script is %s" % (
os.path.abspath(os.path.expanduser(__file__))))
print("installing tools into: %s (build, conda-tools, conda-cache)" % (
os.path.join(util.file.get_project_path(), 'tools')))
sys.exit(0 if install_all_tools() else 1)