-
Notifications
You must be signed in to change notification settings - Fork 2
/
bootstrap.py
37 lines (29 loc) · 1001 Bytes
/
bootstrap.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
#!/usr/bin/env jython
import sys
import os
from os.path import isfile, isdir, abspath
import subprocess
from glob import glob
def read_classpath():
with open("/tmp/classpath.txt", "r") as f:
return f.read()
def write_classpath(classpath):
with open("/tmp/classpath.txt", "w") as f:
f.write(classpath)
if not isfile("/tmp/classpath.txt"):
# Import all required jar files to perform AST contstruction
paths = [jar for jar in glob("/home/ubuntu/Desktop/FaCoY/GitSearch/Libs/*.jar") ]
classpath = "%s:%s" % (":".join(paths), os.environ.get("CLASSPATH"))
write_classpath(classpath)
else:
classpath = read_classpath()
os.environ["CLASSPATH"] = classpath
#print(os.environ["CLASSPATH"])
current_dir = os.getcwd()
os.environ["JYTHONPATH"] = current_dir + ":" + ":".join( [ abspath(folder) for folder in glob("*") if isdir(folder)] )
#print os.environ["JYTHONPATH"]
if sys.argv[1] == "clean":
os.remove("/tmp/classpath.txt")
print "Cleaned"
else:
subprocess.call(["jython", sys.argv[1]])