From af923d60502252cde9d37b9d287a5ff8ea86400f Mon Sep 17 00:00:00 2001
From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com>
Date: Mon, 29 May 2023 21:52:43 +0200
Subject: [PATCH] Remove references and checks for lxml
---
CREDITS.md | 1 -
docs/source/int_source.rst | 5 +----
novelwriter/__init__.py | 6 ------
novelwriter/assets/text/credits_en.htm | 1 -
novelwriter/core/toodt.py | 4 +---
novelwriter/error.py | 7 -------
setup.cfg | 1 -
setup/debian/control | 4 ++--
setup/windows_install.bat | 2 +-
setup/windows_uninstall.bat | 2 +-
tests/test_base/test_base_init.py | 3 ---
11 files changed, 6 insertions(+), 30 deletions(-)
diff --git a/CREDITS.md b/CREDITS.md
index 489495dd..d792ce6f 100644
--- a/CREDITS.md
+++ b/CREDITS.md
@@ -40,7 +40,6 @@ The following libraries are dependencies of novelWriter:
* [Qt5](https://www.qt.io) by Qt Company
* [PyQt5](https://www.riverbankcomputing.com/software/pyqt) by Riverbank Computing
-* [lxml](https://lxml.de) by Martijn Faassen
* [Enchant](https://abiword.github.io/enchant) by Dom Lachowicz
* [PyEnchant](https://pyenchant.github.io/pyenchant) by Dimitri Merejkowsky
diff --git a/docs/source/int_source.rst b/docs/source/int_source.rst
index 3ae3bfaf..3630b537 100644
--- a/docs/source/int_source.rst
+++ b/docs/source/int_source.rst
@@ -46,13 +46,10 @@ format of the main project file. Everything else is handled with standard Python
The following Python packages are needed to run novelWriter:
* ``PyQt5`` – needed for connecting with the Qt5 libraries.
-* ``lxml`` – needed for full XML support.
* ``PyEnchant`` – needed for spell checking (optional).
PyQt/Qt should be at least 5.10, but ideally 5.13 or higher for all features to work. For instance,
-searching using regular expressions with full Unicode support requires 5.13. There is no known
-minimum version requirement for package ``lxml``, but the code was originally written with 4.2,
-which is therefore set as the minimum. It may work on lower versions. You have to test it.
+searching using regular expressions with full Unicode support requires 5.13.
If you want spell checking, you must install the ``PyEnchant`` package. The spell check library
must be at least 3.0 to work with Windows. On Linux, 2.0 also works fine.
diff --git a/novelwriter/__init__.py b/novelwriter/__init__.py
index ccc9a333..c85d949b 100644
--- a/novelwriter/__init__.py
+++ b/novelwriter/__init__.py
@@ -185,12 +185,6 @@ def main(sysArgs=None):
)
errorCode |= 0x10
- try:
- import lxml # noqa: F401
- except ImportError:
- errorData.append("Python module 'lxml' is missing")
- errorCode |= 0x20
-
if errorData:
errApp = QApplication([])
errDlg = QErrorMessage()
diff --git a/novelwriter/assets/text/credits_en.htm b/novelwriter/assets/text/credits_en.htm
index 80790378..525ffca9 100644
--- a/novelwriter/assets/text/credits_en.htm
+++ b/novelwriter/assets/text/credits_en.htm
@@ -47,7 +47,6 @@ more contributions are listed on the project's Qt5 by Qt Company
PyQt5 by Riverbank Computing
- lxml by Martijn Faassen
Enchant by Dom Lachowicz
PyEnchant by Dimitri Merejkowsky
Section: text
Priority: optional
-Build-Depends: dh-python, python3-setuptools, python3-all, debhelper (>= 9), python3 (>=3.7), python3-pyqt5 (>= 5.10), python3-lxml (>= 4.0), python3-enchant (>= 2.0)
+Build-Depends: dh-python, python3-setuptools, python3-all, debhelper (>= 9), python3 (>=3.7), python3-pyqt5 (>= 5.10), python3-enchant (>= 2.0)
Standards-Version: 4.5.1
Homepage: https://novelwriter.io
X-Python3-Version: >= 3.7
Package: novelwriter
Architecture: all
-Depends: ${misc:Depends}, ${python3:Depends}, python3 (>=3.7), python3-pyqt5 (>= 5.10), python3-lxml (>= 4.0), python3-enchant (>= 2.0)
+Depends: ${misc:Depends}, ${python3:Depends}, python3 (>=3.7), python3-pyqt5 (>= 5.10), python3-enchant (>= 2.0)
Description: A markdown-like text editor for planning and writing novels
novelWriter is a plain text editor designed for writing novels assembled from
many smaller text documents. It uses a minimal formatting syntax inspired by
diff --git a/setup/windows_install.bat b/setup/windows_install.bat
index 474c8861..4b2c80d6 100644
--- a/setup/windows_install.bat
+++ b/setup/windows_install.bat
@@ -19,7 +19,7 @@ if exist setup.py (
)
echo.
-:: Install the PyQt5, lxml and pyenchant dependencies
+:: Install the PyQt5 and pyenchant dependencies
pip install --user pywin32 -r requirements.txt
:: Create the desktop and start menu icons
diff --git a/setup/windows_uninstall.bat b/setup/windows_uninstall.bat
index 7522f4bd..18523176 100644
--- a/setup/windows_uninstall.bat
+++ b/setup/windows_uninstall.bat
@@ -29,7 +29,7 @@ goto afterUninst
:: Remove the desktop and start menu icons
python setup.py win-uninstall
-:: Remove the PyQt5, lxml and pyenchant dependencies
+:: Remove the PyQt5 and pyenchant dependencies
pip uninstall --yes -r requirements.txt
:afterUninst
diff --git a/tests/test_base/test_base_init.py b/tests/test_base/test_base_init.py
index 71056fb7..a932dcfa 100644
--- a/tests/test_base/test_base_init.py
+++ b/tests/test_base/test_base_init.py
@@ -154,7 +154,6 @@ def testBaseInit_Imports(caplog, monkeypatch, fncPath):
monkeypatch.setattr("PyQt5.QtWidgets.QErrorMessage.__init__", lambda *a: None)
monkeypatch.setattr("PyQt5.QtWidgets.QErrorMessage.resize", lambda *a: None)
monkeypatch.setattr("PyQt5.QtWidgets.QErrorMessage.showMessage", lambda *a: None)
- monkeypatch.setitem(sys.modules, "lxml", None)
monkeypatch.setattr("sys.hexversion", 0x0)
monkeypatch.setattr("novelwriter.CONFIG.verQtValue", 0x050000)
monkeypatch.setattr("novelwriter.CONFIG.verPyQtValue", 0x050000)
@@ -167,11 +166,9 @@ def testBaseInit_Imports(caplog, monkeypatch, fncPath):
assert ex.value.code & 4 == 4 # Python version not satisfied
assert ex.value.code & 8 == 8 # Qt version not satisfied
assert ex.value.code & 16 == 16 # PyQt version not satisfied
- assert ex.value.code & 32 == 32 # lxml package missing
assert "At least Python" in caplog.messages[0]
assert "At least Qt5" in caplog.messages[1]
assert "At least PyQt5" in caplog.messages[2]
- assert "lxml" in caplog.messages[3]
# END Test testBaseInit_Imports