-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtest_setup.py
More file actions
39 lines (32 loc) · 1.26 KB
/
test_setup.py
File metadata and controls
39 lines (32 loc) · 1.26 KB
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
from environ import DIRS
import os
def check_command_line_tools():
"""Check command line tool availability"""
from subprocess import Popen, PIPE
print('*** COMMAND LINE TOOLS ***')
for tool in ['python', 'ipython', 'ctlike']:
location = Popen(['which', tool],
stdout=PIPE).communicate()[0]
print('{0:.<20} {1}'.format(tool, location.strip() or 'MISSING'))
def check_python_modules():
"""Check python package availability"""
PACKAGES = ['ebltable','pyfits', 'astropy','yaml','iminuit','numpy','scipy','matplotlib','ebl']
print('*** PYTHON PACKAGES ***')
for package in PACKAGES:
try:
exec('import %s' % package)
filename = eval('%s.__file__' % package)
print('{0:.<20} {1}'.format(package, filename))
except ImportError:
print('{0:.<20} {1}'.format(package, 'MISSING'))
def check_dirs():
"""Check directory availability"""
print('*** DIRECTORIES ***')
for tag in DIRS.keys():
dir = DIRS.get(tag, 'MISSING')
status = 'YES' if os.path.isdir(dir) else 'NO'
print('{tag:.<20} {status:.<10} {dir}'.format(**locals()))
if __name__ == '__main__':
check_command_line_tools()
check_python_modules()
check_dirs()