-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_environment.py
46 lines (33 loc) · 1.01 KB
/
test_environment.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
43
44
45
46
import sys
import shutil
REQUIRED_PYTHON = "python3"
REQUIRED_SOFTWARES = [
'plink',
'tabix',
'vcftools'
]
def main():
system_major = sys.version_info.major
if REQUIRED_PYTHON == "python3":
required_major = 3
else:
raise ValueError("Unrecognized python interpreter: {}".format(
REQUIRED_PYTHON))
if system_major != required_major:
raise TypeError(
"This project requires Python {}. Found: Python {}".format(
required_major, sys.version))
# test for software dependencies
path = dict()
for software in REQUIRED_SOFTWARES:
path[software] = shutil.which(software)
if None in path.values():
for key, value in path.items():
if value is None:
print(f"{key} is required for analyses")
raise Exception(
"This project requires some software installed!"
)
print(">>> Development environment passes all tests!")
if __name__ == '__main__':
main()