From: Jason Ish Date: Wed, 31 Jan 2018 22:31:37 +0000 (-0600) Subject: bin/suricata-update: handle non-standard install prefixes. X-Git-Tag: 1.0.0rc1~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d9b7a36268af2e9891add4563318641ae00518da;p=thirdparty%2Fsuricata-update.git bin/suricata-update: handle non-standard install prefixes. Look to see if the modules are in a known location relative to the location of suricata-update and to the sys.path if found. Allows suricata-update to be installed with non-standard --prefixes. --- diff --git a/bin/suricata-update b/bin/suricata-update index e8230cf..f2e8557 100755 --- a/bin/suricata-update +++ b/bin/suricata-update @@ -19,6 +19,13 @@ import sys import os +exec_dir = os.path.dirname(__file__) +version_info = sys.version_info +pyver = "%d.%d" % (version_info.major, version_info.minor) +site_path = "%s/../lib/python%s/site-packages" % (exec_dir, pyver) + +if os.path.exists("%s/suricata/update" % (site_path)): + sys.path.insert(0, site_path) sys.path.insert( 0, os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0]))))