-
Notifications
You must be signed in to change notification settings - Fork 43
/
mkcodeintel
executable file
·47 lines (37 loc) · 1.03 KB
/
mkcodeintel
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
#!/usr/bin/python
# Simple script to generate a .codeintel/config file for a buildout directory.
# The buildout must use collective.recipe.omelette to generate a parts/omelette
# directory. This will be used as the Python path
import os.path
import sys
path = "parts/omelette"
buildout = "bin/buildout"
python = sys.executable
if len(sys.argv) > 1:
path = sys.argv[1]
path = os.path.abspath(path)
if len(sys.argv) > 2:
python = sys.argv[2]
if not os.path.exists(path):
print "Cannot find path", path
sys.exit(1)
if not os.path.exists(python):
print "Cannot find interpreter", python
sys.exit(1)
if os.path.exists(buildout):
hashbang = open(buildout, 'r').readline()
if hashbang.startswith("#!"):
hashbang = hashbang[2:]
python = hashbang.strip()
if not os.path.exists(".codeintel"):
os.mkdir(".codeintel")
open(os.path.join(".codeintel", "config"), "w").write("""\
{
"Python": {
"python": "%s",
"pythonExtraPaths": [
"%s"
]
}
}
""" % (python, path))