From c58b5e71d0155adf18f32c0cdea3c199b909752f Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Tue, 4 Aug 2020 21:36:24 +0200 Subject: [PATCH] Use shutil.which to check for existence of executable instead --- nw/config.py | 19 ++++++++++--------- nw/core/spellcheck.py | 1 - 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/nw/config.py b/nw/config.py index ac5e9fca..9e17b6ca 100644 --- a/nw/config.py +++ b/nw/config.py @@ -33,7 +33,7 @@ import nw from os import path, mkdir, unlink, rename from time import time -from distutils import spawn +from shutil import which from PyQt5.Qt import PYQT_VERSION_STR from PyQt5.QtCore import QT_VERSION_STR, QStandardPaths, QSysInfo @@ -203,9 +203,8 @@ class Config: self.kernelVer = "Unknown" # Packages - self.hasEnchant = False - self.hasSymSpell = False - self.hasAssistant = False # The Qt Assistant + self.hasEnchant = False # The pyenchant package + self.hasAssistant = False # The Qt Assistant executable # Recent Cache self.recentProj = {} @@ -896,17 +895,19 @@ class Config: try: import enchant self.hasEnchant = True - logger.debug("Checking package pyenchant: Ok") + logger.debug("Checking package 'pyenchant': Ok") except: self.hasEnchant = False - logger.debug("Checking package pyenchant: Missing") + logger.debug("Checking package 'pyenchant': Missing") try: - self.hasAssistant = spawn.find_executable("assistant") - logger.debug("Checking executable assistant: Ok") + self.hasAssistant = which("assistant") except: self.hasAssistant = False - logger.debug("Checking executable assistant: Missing") + if self.hasAssistant: + logger.debug("Checking executable 'assistant': Ok") + else: + logger.debug("Checking executable 'assistant': Missing") return diff --git a/nw/core/spellcheck.py b/nw/core/spellcheck.py index 44d0fc38..28e25e40 100644 --- a/nw/core/spellcheck.py +++ b/nw/core/spellcheck.py @@ -43,7 +43,6 @@ class NWSpellCheck(): SP_INTERNAL = "internal" SP_ENCHANT = "enchant" - SP_SYMSPELL = "symspell" theDict = None PROJW = []