diff options
author | Jiri Moskovcak <jmoskovc@redhat.com> | 2010-03-25 19:35:33 +0100 |
---|---|---|
committer | Jiri Moskovcak <jmoskovc@redhat.com> | 2010-03-25 19:35:33 +0100 |
commit | d6473ecb61e8e31198d1253f2ef8bf9c3fde6b04 (patch) | |
tree | 9bf763880535d23f9545b4b070a560144bef4f9d /src | |
parent | 85de076f5a36fc4a40fca65c088946008c1d4551 (diff) | |
download | abrt-d6473ecb61e8e31198d1253f2ef8bf9c3fde6b04.tar.gz abrt-d6473ecb61e8e31198d1253f2ef8bf9c3fde6b04.tar.xz abrt-d6473ecb61e8e31198d1253f2ef8bf9c3fde6b04.zip |
PYHOOK: don't use sitecustomize.py rhbz#539497
Diffstat (limited to 'src')
-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 |
4 files changed, 14 insertions, 19 deletions
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 |