From: Michael Vrable Date: Thu, 6 Nov 2008 18:47:56 +0000 (-0800) Subject: cumulus-util: Automatically set Python search path. X-Git-Url: http://git.vrable.net/?p=cumulus.git;a=commitdiff_plain;h=cb7620ebf655e86cfe8000bf0bac9269394b652e cumulus-util: Automatically set Python search path. Attempt to set the Python library search path so that cumulus-util can find the cumulus Python modules, without PYTHON_PATH having to be set explicitly. Modules are looked for in the "python" directory where the cumulus-util binary resides; this is appropriate for running cumulus-util directly from the source code directory, but may not be if the tools are installed somewhere else. --- diff --git a/cumulus-util b/cumulus-util index 05043f1..ce80ff6 100755 --- a/cumulus-util +++ b/cumulus-util @@ -4,6 +4,12 @@ import getpass, os, stat, sys, time from optparse import OptionParser + +# Automatically set Python path, based on script directory. This should be +# removed if the tools are properly installed somewhere. +script_directory = os.path.dirname(sys.argv[0]) +sys.path.append(os.path.join(script_directory, 'python')) + import cumulus # Compatibility