diff options
Diffstat (limited to 'scripts/template_verifier.py')
-rwxr-xr-x | scripts/template_verifier.py | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/scripts/template_verifier.py b/scripts/template_verifier.py index 581f1168ff..8f822daf6a 100755 --- a/scripts/template_verifier.py +++ b/scripts/template_verifier.py @@ -47,23 +47,26 @@ import os.path # * it doesn't depend on the current directory # * it doesn't depend on another file being present. -root = os.path.abspath(__file__) -# always insert the directory of the script in the search path -dir = os.path.dirname(root) -if dir not in sys.path: - sys.path.insert(0, dir) - -# Now go look for indra/lib/python in the parent dies -while root != os.path.sep: - root = os.path.dirname(root) - dir = os.path.join(root, 'indra', 'lib', 'python') - if os.path.isdir(dir): - if dir not in sys.path: - sys.path.insert(0, dir) - break -else: - print >>sys.stderr, "This script is not inside a valid installation." - sys.exit(1) +def add_indra_lib_path(): + root = os.path.realpath(__file__) + # always insert the directory of the script in the search path + dir = os.path.dirname(root) + if dir not in sys.path: + sys.path.insert(0, dir) + + # Now go look for indra/lib/python in the parent dies + while root != os.path.sep: + root = os.path.dirname(root) + dir = os.path.join(root, 'indra', 'lib', 'python') + if os.path.isdir(dir): + if dir not in sys.path: + sys.path.insert(0, dir) + break + else: + print >>sys.stderr, "This script is not inside a valid installation." + sys.exit(1) + +add_indra_lib_path() import optparse import os |