-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·57 lines (53 loc) · 1.89 KB
/
setup.py
File metadata and controls
executable file
·57 lines (53 loc) · 1.89 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python
from __future__ import print_function
import os, sys
sys.path.insert(0, "pipeline/lib/python")
import config
print("Checking for the necessary python packages...", end="")
sys.stdout.flush()
packages = ["os", "sys", "shutil", "stat", "socket", "struct", "subprocess",
"glob", "contextlib", "signal", "unittest", "re", "platform",
"tarfile", "time", "datetime", "pytz", "MySQLdb", "xml",
"numpy", "scipy", "pylab", "mpfit", "pyfits", "cPickle", "pickle",
"psr_utils", "pyslalib", "presto", "prepfold", "pypsrcat",
"sifting", "ratings", "diagnostics", "profile_tools", "infodata",
"analyse_sp", "group_sp", "sp_utils",
"config", "utils", "database", "handle_exit", "msub", "matplotlib",
"__future__"]
for package in packages:
try:
__import__(package)
except ImportError:
print("\nERROR: Could not find %s"%package)
print("Exiting")
sys.exit(1)
print("sucess")
print("Testing database connection...", end="")
sys.stdout.flush()
import database
try:
db = database.Database("observations")
except:
print("\nWARNING: Could not connect to observations database")
print("Continuing...")
else:
db.close()
print("success")
print("Attempting to create directory structure...", end="")
sys.stdout.flush()
for dir in [config.datadir,os.path.join(config.datadir,"holding"),
config.jobsdir,config.logsdir,config.baseoutdir]:
if os.path.exists(dir) and os.path.isdir(dir):
pass
else:
try:
os.makedirs(dir)
except OSError:
print("\nERROR: Could not create %s"%dir)
print("Exiting")
sys.exit(1)
print ("success")
print("To begin processing add\n"\
"{0}/bin to your PATH and\n"\
"{0}/lib/python to your PYTHONPATH\n"\
"and run driver.sh".format(config.pipelinedir))