[PATCH] import rpm lazily
by Richard Marko
fixes rhbz#864324
Signed-off-by: Richard Marko <rmarko(a)redhat.com>
---
src/hooks/abrt_exception_handler.py.in | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/src/hooks/abrt_exception_handler.py.in b/src/hooks/abrt_exception_handler.py.in
index 91a9909..24877bf 100644
--- a/src/hooks/abrt_exception_handler.py.in
+++ b/src/hooks/abrt_exception_handler.py.in
@@ -26,20 +26,12 @@ import sys
import os
import inspect
-try:
- import rpm
- HAVE_RPM = True
-except ImportError as imperr:
- HAVE_RPM = False
- import syslog
- syslog.syslog("RPM module not available, cannot query RPM db for package "\
- "names")
-
class RPMinfoError(Exception):
"""Exception class for RPMdb-querying related errors"""
pass
def write_dump(tb_text, tb):
+
if sys.argv[0][0] == "/":
executable = os.path.abspath(sys.argv[0])
else:
@@ -47,10 +39,14 @@ def write_dump(tb_text, tb):
# (BTW, we *can't* assume the script is in current directory.)
executable = sys.argv[0]
- if HAVE_RPM:
+ dso_list = None
+ try:
+ import rpm
dso_list = get_dso_list(tb)
- else:
- dso_list = None
+ except ImportError as imperr:
+ import syslog
+ syslog.syslog("RPM module not available, cannot query RPM db for package "\
+ "names")
# Open ABRT daemon's socket and write data to it
try:
@@ -116,6 +112,7 @@ def get_package_for_file(fpath):
"""
+ import rpm
ts = rpm.TransactionSet()
mi = ts.dbMatch("basenames", fpath)
try:
--
1.7.11.7
11 years, 7 months
Session Autoreporting
by Jakub Filak
Hi folks,
as you might know, I've been working on automatic reporting from desktop
session for the last week. I feel that the development is in a state when I
want to show you the code. I've created an git branch session_autoreporting
and pushed the code there.
I'm attaching and an activity diagram describing basic design of the feature.
Regards
Jakub
11 years, 7 months