From aab9805bc677af10bba6630589f1b12d426cc8dd Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sat, 15 Feb 2020 21:39:21 +0100 Subject: [PATCH] Remove dependency on appdirs package for finding config dir as this is provided by Qt --- README.md | 2 -- docs/source/started.txt | 1 - novelWriter.py | 6 ------ nw/config.py | 6 +++--- nw/constants/constants.py | 4 ---- requirements.txt | 1 - setup.py | 1 - 7 files changed, 3 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 0325cb84..b16c3a91 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,6 @@ For the apt package manager on Debian systems, the following Python3 packages ar * `python3-pyqt5` for the GUI * `python3-pyqt5.qtsvg` may need to be installed separately -* `python3-appdirs` for locating the system's config folder * `python3-lxml` for writing project files These are optional, but recommended: @@ -88,7 +87,6 @@ in the application folder. You can also do them one at a time, skipping the ones you don't need: ``` python3 -m pip install pyqt5 -python3 -m pip install appdirs python3 -m pip install lxml python3 -m pip install pyenchant python3 -m pip install latexcodec diff --git a/docs/source/started.txt b/docs/source/started.txt index 747a8c27..aa6977a8 100644 --- a/docs/source/started.txt +++ b/docs/source/started.txt @@ -26,7 +26,6 @@ On some operating systems you need to use ``python3`` instead of ``python``. The following Python packages are required to run novelWriter: * ``pyqt5`` for the GUI -* ``appdirs`` for locating the system's config folder * ``lxml`` for writing project files .. note:: diff --git a/novelWriter.py b/novelWriter.py index d7c3d314..3aa88038 100755 --- a/novelWriter.py +++ b/novelWriter.py @@ -27,12 +27,6 @@ except: print("ERROR: Failed to load dependency python3-lxml") sys.exit(1) -try: - import appdirs -except: - print("ERROR: Failed to load dependency python3-appdirs") - sys.exit(1) - if __name__ == "__main__": import nw nw.main(sys.argv[1:]) diff --git a/nw/config.py b/nw/config.py index 3aa6a254..9aa7e6d8 100644 --- a/nw/config.py +++ b/nw/config.py @@ -16,11 +16,10 @@ import sys import nw from os import path, mkdir, makedirs -from appdirs import user_config_dir from datetime import datetime from PyQt5.Qt import PYQT_VERSION_STR -from PyQt5.QtCore import QT_VERSION_STR +from PyQt5.QtCore import QT_VERSION_STR, QStandardPaths from nw.constants import nwFiles, nwUnicode from nw.common import splitVersionNumber @@ -167,7 +166,8 @@ class Config: def initConfig(self, confPath=None): if confPath is None: - self.confPath = user_config_dir(self.appHandle) + confRoot = QStandardPaths.writableLocation(QStandardPaths.ConfigLocation) + self.confPath = path.join(confRoot, self.appHandle) else: logger.info("Setting config from alternative path: %s" % confPath) self.confPath = confPath diff --git a/nw/constants/constants.py b/nw/constants/constants.py index f85f6558..78e0c7b3 100644 --- a/nw/constants/constants.py +++ b/nw/constants/constants.py @@ -116,10 +116,6 @@ class nwDependencies(): "site" : "", "docs" : "", }, - "appdirs" : { - "site" : "", - "docs" : "", - }, "lxml" : { "site" : "", "docs" : "", diff --git a/requirements.txt b/requirements.txt index b1d28992..648be38e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,4 @@ pyqt5 -appdirs lxml pyenchant latexcodec diff --git a/setup.py b/setup.py index 75f2fbd7..081befd5 100755 --- a/setup.py +++ b/setup.py @@ -38,7 +38,6 @@ setuptools.setup( python_requires = ">=3.5", install_requires = [ "pyqt5", - "appdirs", "lxml", "pyenchant", "latexcodec",