55 lines
1.5 KiB
Diff
55 lines
1.5 KiB
Diff
|
From 188c0e8297f65f7bf222dde86bd472f6fadeab4d Mon Sep 17 00:00:00 2001
|
||
|
From: Fabian Vogt <fabian@ritter-vogt.de>
|
||
|
Date: Wed, 23 Nov 2022 10:23:37 +0100
|
||
|
Subject: [PATCH 2/2] Make python distro and psutil modules in the gdb preable
|
||
|
optional
|
||
|
|
||
|
Those are only used if sentry is enabled. The other modules are part of python
|
||
|
itself. If they are missing, disable sentry support.
|
||
|
---
|
||
|
src/data/gdb/preamble.py | 10 ++++++++--
|
||
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git a/src/data/gdb/preamble.py b/src/data/gdb/preamble.py
|
||
|
index 114a5ad9..1f7595e5 100644
|
||
|
--- a/src/data/gdb/preamble.py
|
||
|
+++ b/src/data/gdb/preamble.py
|
||
|
@@ -6,7 +6,6 @@ import gdb
|
||
|
from gdb.FrameDecorator import FrameDecorator
|
||
|
|
||
|
from datetime import datetime
|
||
|
-import distro
|
||
|
import uuid
|
||
|
import os
|
||
|
import json
|
||
|
@@ -15,11 +14,11 @@ import signal
|
||
|
import re
|
||
|
import binascii
|
||
|
import platform
|
||
|
-import psutil
|
||
|
import multiprocessing
|
||
|
from pathlib import Path
|
||
|
|
||
|
if os.getenv('DRKONQI_WITH_SENTRY'):
|
||
|
+ # Initialize sentry reports for exceptions in this script
|
||
|
try:
|
||
|
import sentry_sdk
|
||
|
sentry_sdk.init(
|
||
|
@@ -31,6 +30,13 @@ if os.getenv('DRKONQI_WITH_SENTRY'):
|
||
|
except ImportError:
|
||
|
print("python sentry-sdk not installed :(")
|
||
|
|
||
|
+ try:
|
||
|
+ import distro
|
||
|
+ import psutil
|
||
|
+ except ImportError:
|
||
|
+ print("python distro and/or psutil modules missing, disabling sentry")
|
||
|
+ del os.environ['DRKONQI_WITH_SENTRY']
|
||
|
+
|
||
|
def mangle_path(path):
|
||
|
if not path:
|
||
|
return path
|
||
|
--
|
||
|
2.39.1
|
||
|
|