electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 7a99fdc275ed0b87910df1727bfb4dae4c8206c4
parent 8e32f494691f70b47d133c9caab6ff58911cb53c
Author: SomberNight <somber.night@protonmail.com>
Date:   Mon,  6 May 2019 19:10:29 +0200

kivy: fix crash in logging.py; platform.platform() not available

Diffstat:
Melectrum/base_crash_reporter.py | 6++----
Melectrum/gui/kivy/uix/dialogs/crash_reporter.py | 8--------
Melectrum/gui/qt/exception_window.py | 3---
Melectrum/logging.py | 15++++++++++++++-
4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/electrum/base_crash_reporter.py b/electrum/base_crash_reporter.py @@ -31,6 +31,7 @@ from .version import ELECTRUM_VERSION from . import constants from .i18n import _ from .util import make_aiohttp_session +from .logging import describe_os_version class BaseCrashReporter: @@ -95,7 +96,7 @@ class BaseCrashReporter: args = { "app_version": ELECTRUM_VERSION, "python_version": sys.version, - "os": self.get_os_version(), + "os": describe_os_version(), "wallet_type": "unknown", "locale": locale.getdefaultlocale()[0] or "?", "description": self.get_user_description() @@ -129,6 +130,3 @@ class BaseCrashReporter: def get_wallet_type(self): raise NotImplementedError - - def get_os_version(self): - raise NotImplementedError diff --git a/electrum/gui/kivy/uix/dialogs/crash_reporter.py b/electrum/gui/kivy/uix/dialogs/crash_reporter.py @@ -156,14 +156,6 @@ class CrashReporter(BaseCrashReporter, Factory.Popup): def get_wallet_type(self): return self.main_window.wallet.wallet_type - def get_os_version(self): - if utils.platform is not "android": - return utils.platform - import jnius - bv = jnius.autoclass('android.os.Build$VERSION') - b = jnius.autoclass('android.os.Build') - return "Android {} on {} {} ({})".format(bv.RELEASE, b.BRAND, b.DEVICE, b.DISPLAY) - class CrashReportDetails(Factory.Popup): def __init__(self, text): diff --git a/electrum/gui/qt/exception_window.py b/electrum/gui/qt/exception_window.py @@ -124,9 +124,6 @@ class Exception_Window(BaseCrashReporter, QWidget, MessageBoxMixin, Logger): def get_wallet_type(self): return self.main_window.wallet.wallet_type - def get_os_version(self): - return platform.platform() - def _show_window(*args): if not Exception_Window._active_window: diff --git a/electrum/logging.py b/electrum/logging.py @@ -167,9 +167,22 @@ def configure_logging(config): from . import ELECTRUM_VERSION _logger.info(f"Electrum version: {ELECTRUM_VERSION} - https://electrum.org - https://github.com/spesmilo/electrum") - _logger.info(f"Python version: {sys.version}. On platform: {platform.platform()}") + _logger.info(f"Python version: {sys.version}. On platform: {describe_os_version()}") _logger.info(f"Logging to file: {str(_logfile_path)}") def get_logfile_path() -> Optional[pathlib.Path]: return _logfile_path + + +def describe_os_version() -> str: + if 'ANDROID_DATA' in os.environ: + from kivy import utils + if utils.platform is not "android": + return utils.platform + import jnius + bv = jnius.autoclass('android.os.Build$VERSION') + b = jnius.autoclass('android.os.Build') + return "Android {} on {} {} ({})".format(bv.RELEASE, b.BRAND, b.DEVICE, b.DISPLAY) + else: + return platform.platform()