forked from NickRuiz/wikitrans-pootle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setuppath
executable file
·34 lines (29 loc) · 1.32 KB
/
setuppath
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
#!/usr/bin/env python
import sys
import os
scriptname = os.path.abspath(sys.argv[0])
translatedir = os.path.dirname(scriptname)
pythonpathstr = []
pathstr = []
for translatesubdir in ("convert", "tools", "filters", "services"):
pathstr.append('"%s"' % os.path.join(translatedir, "translate", translatesubdir))
pathstr.append('"%s"' % os.path.join(translatedir, "tools"))
pathstr.append('"%s"' % os.path.join(translatedir, "Pootle"))
pathstr.append('"%s"' % os.path.join(translatedir, "Pootle", "tools"))
pathstr.append('"%s"' % os.path.join(translatedir, "virtaal", "bin"))
pathstr.append('"$PATH"')
pythonpathstr.append('"%s"' % translatedir)
pythonpathstr.append('"%s"' % os.path.join(translatedir, "virtaal"))
pythonpathstr.append('"%s"' % os.path.join(translatedir, "Pootle", "local_apps"))
pythonpathstr.append('"$PYTHONPATH"')
setpathfile = open(os.path.join(translatedir, "setpath"), "w")
setpathfile.write("#!/bin/bash\n")
setpathfile.write("#Running this script won't work. Use\n")
setpathfile.write("# source setpath\n")
setpathfile.write("#or\n")
setpathfile.write("# . setpath\n")
setpathfile.write("export PYTHONPATH=%s\n" % ":".join(pythonpathstr))
setpathfile.write("export PATH=%s\n" % ":".join(pathstr))
setpathfile.write("export PYTHONTYPECHECK=1\n")
setpathfile.close()
os.chmod(os.path.join(translatedir, "setpath"), 0755)