aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/scripts/template_verifier.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xlinden/scripts/template_verifier.py32
1 files changed, 27 insertions, 5 deletions
diff --git a/linden/scripts/template_verifier.py b/linden/scripts/template_verifier.py
index f1f3953..d451cbf 100755
--- a/linden/scripts/template_verifier.py
+++ b/linden/scripts/template_verifier.py
@@ -38,13 +38,35 @@ If [FILE] [FILE] is specified, two local files will be checked against
38each other. 38each other.
39""" 39"""
40 40
41from os.path import realpath, dirname, join, exists 41import sys
42setup_path = join(dirname(realpath(__file__)), "setup-path.py") 42import os.path
43if exists(setup_path): 43
44 execfile(setup_path) 44# Look for indra/lib/python in all possible parent directories ...
45# This is an improvement over the setup-path.py method used previously:
46# * the script may blocated anywhere inside the source tree
47# * it doesn't depend on the current directory
48# * it doesn't depend on another file being present.
49
50root = os.path.abspath(__file__)
51# always insert the directory of the script in the search path
52dir = os.path.dirname(root)
53if dir not in sys.path:
54 sys.path.insert(0, dir)
55
56# Now go look for indra/lib/python in the parent dies
57while root != os.path.sep:
58 root = os.path.dirname(root)
59 dir = os.path.join(root, 'indra', 'lib', 'python')
60 if os.path.isdir(dir):
61 if dir not in sys.path:
62 sys.path.insert(0, dir)
63 break
64else:
65 print >>sys.stderr, "This script is not inside a valid installation."
66 sys.exit(1)
67
45import optparse 68import optparse
46import os 69import os
47import sys
48import urllib 70import urllib
49 71
50from indra.ipc import compatibility 72from indra.ipc import compatibility