Skip to content

Commit

Permalink
When zkg is bundled with Zeek, prepend Zeek's Python module path
Browse files Browse the repository at this point in the history
Prepending instead of appending ensures that the bundled zkg picks the
zeekpkg module shipped with Zeek, not any others available elsewhere
in Python's search path.
  • Loading branch information
ckreibich committed Jun 9, 2021
1 parent 8d9e5a1 commit fdd1e7f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions zkg
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ except ImportError as error:
file=sys.stderr)
sys.exit(1)

# For Zeek-bundled installation, explictly add the Python path we've
# installed ourselves under, so we find the zeekpkg module:
# For Zeek-bundled installation, prepend the Python path of the Zeek
# installation. This ensures we find the matching zeekpkg module
# first, avoiding potential conflicts with installations elsewhere on
# the system.
ZEEK_PYTHON_DIR = '@PY_MOD_INSTALL_DIR@'
if os.path.isdir(ZEEK_PYTHON_DIR):
sys.path.append(os.path.abspath(ZEEK_PYTHON_DIR))
sys.path.insert(0, os.path.abspath(ZEEK_PYTHON_DIR))
else:
ZEEK_PYTHON_DIR = None

Expand Down

0 comments on commit fdd1e7f

Please sign in to comment.