diff options
-rw-r--r-- | abrt.spec | 1 | ||||
-rw-r--r-- | src/Hooks/Makefile.am | 2 | ||||
-rw-r--r-- | src/Hooks/abrt.pth | 1 | ||||
-rw-r--r-- | src/Hooks/abrt_exception_handler.py.in | 13 | ||||
-rw-r--r-- | src/Hooks/sitecustomize.py | 17 |
5 files changed, 15 insertions, 19 deletions
@@ -442,6 +442,7 @@ fi %attr(4755, abrt, abrt) %{_libexecdir}/abrt-hook-python %{_libdir}/%{name}/libPython.so* %{python_site}/*.py* +%{python_site}/abrt.pth %files cli diff --git a/src/Hooks/Makefile.am b/src/Hooks/Makefile.am index 2b04990a..6845c72c 100644 --- a/src/Hooks/Makefile.am +++ b/src/Hooks/Makefile.am @@ -47,7 +47,7 @@ abrt_hook_python_CPPFLAGS = \ abrt_hook_python_LDADD = \ ../../lib/Utils/libABRTUtils.la -python_PYTHON = sitecustomize.py abrt_exception_handler.py +python_PYTHON = abrt.pth abrt_exception_handler.py EXTRA_DIST = abrt_exception_handler.py.in $(man_MANS) CLEANFILES := $(notdir $(wildcard *~)) $(notdir $(wildcard *\#)) $(notdir $(wildcard \.\#*)) $(notdir $(wildcard *.pyc)) diff --git a/src/Hooks/abrt.pth b/src/Hooks/abrt.pth new file mode 100644 index 00000000..39fc292e --- /dev/null +++ b/src/Hooks/abrt.pth @@ -0,0 +1 @@ +import abrt_exception_handler diff --git a/src/Hooks/abrt_exception_handler.py.in b/src/Hooks/abrt_exception_handler.py.in index b5e15b80..8a5d8060 100644 --- a/src/Hooks/abrt_exception_handler.py.in +++ b/src/Hooks/abrt_exception_handler.py.in @@ -1,3 +1,4 @@ +#:mode=python: # -*- coding: utf-8 -*- ## Copyright (C) 2001-2005 Red Hat, Inc. ## Copyright (C) 2001-2005 Harald Hoyer <harald@redhat.com> @@ -26,7 +27,6 @@ import os import syslog import subprocess - def write_dump(pid, tb): executable = "Exception raised from python shell" if sys.argv[0]: @@ -132,6 +132,17 @@ def installExceptionHandler(): """ sys.excepthook = lambda etype, value, tb: handleMyException((etype, value, tb)) +# install the exception handler when the abrt_exception_handler +# module is imported +try: + installExceptionHandler() +except Exception, e: + # TODO: log errors? + # OTOH, if abrt is deinstalled uncleanly + # and this file (sitecustomize.py) exists but + # abrt_exception_handler module does not exist, we probably + # don't want to irritate admins... + pass if __name__ == '__main__': # test exception raised to show the effect diff --git a/src/Hooks/sitecustomize.py b/src/Hooks/sitecustomize.py deleted file mode 100644 index 8970e530..00000000 --- a/src/Hooks/sitecustomize.py +++ /dev/null @@ -1,17 +0,0 @@ -# ABRT crash hook -# -# This special script is placed in -# /usr/local/lib/pythonNNN/site-packages/sitecustomize.py -# and python interpreter runs it automatically everytime -# some python script is executed. - -try: - from abrt_exception_handler import installExceptionHandler - installExceptionHandler() -except Exception, e: - # TODO: log errors? - # OTOH, if abrt is deinstalled uncleanly - # and this file (sitecustomize.py) exists but - # abrt_exception_handler module does not exist, we probably - # don't want to irritate admins... - pass |