diff options
author | David Sommerseth <davids@redhat.com> | 2013-01-14 17:30:01 +0100 |
---|---|---|
committer | Clark Williams <clark.williams@gmail.com> | 2014-03-27 09:45:09 -0500 |
commit | 54fe9e7e07e4749d62f388c18480b6df2f1799c7 (patch) | |
tree | 0fc7554c42ee30aa03bd7c4084dc248787cebc99 | |
parent | 21cf15cf8d920ffb218652d9e6b222bb1f228962 (diff) | |
download | rteval-54fe9e7e07e4749d62f388c18480b6df2f1799c7.tar.gz |
rteval-2.0-3.1.el6rt: Fix issues with wrong installdir
Just a temporary hack until the whole path detection is overhauled.
Signed-off-by: David Sommerseth <davids@redhat.com>
(cherry picked from commit ad54f695d4629b4f77f264b5c87cd6adc5d011af)
Signed-off-by: Clark Williams <clark.williams@gmail.com>
-rw-r--r-- | rteval/rtevalConfig.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/rteval/rtevalConfig.py b/rteval/rtevalConfig.py index 530626e..2a7e41d 100644 --- a/rteval/rtevalConfig.py +++ b/rteval/rtevalConfig.py @@ -30,7 +30,7 @@ # including keys needed to generate an equivalently functional executable # are deemed to be part of the source code. # -import os +import os, sys import ConfigParser from Log import Log @@ -56,9 +56,15 @@ def default_config_search(relative_path, verifdef=os.path.isdir): return False -if os.path.dirname(os.path.abspath(__file__)) != '/usr/local/bin': - installdir = os.path.dirname(os.path.abspath(__file__)) -else: +# HACK: A temporary hack to try to figure out where the install dir is. +typical_install_paths = ('/usr/bin','/usr/local/bin') +try: + if typical_install_paths.index(os.path.dirname(os.path.abspath(sys.argv[0]))): + installdir = os.path.dirname(os.path.abspath(sys.argv[0])) + else: + installdir = '/usr/share/rteval' + +except ValueError: installdir = '/usr/share/rteval' default_config = { |