Remove references and checks for lxml

This commit is contained in:
Veronica Berglyd Olsen
2023-05-29 21:52:43 +02:00
parent 1d90d6d385
commit af923d6050
11 changed files with 6 additions and 30 deletions
-1
View File
@@ -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
+1 -4
View File
@@ -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.
-6
View File
@@ -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()
-1
View File
@@ -47,7 +47,6 @@ more contributions are listed on the project's <a href="https://crowdin.com/proj
<p>
<a href="https://www.qt.io">Qt5</a> by Qt Company<br>
<a href="https://www.riverbankcomputing.com/software/pyqt">PyQt5</a> by Riverbank Computing<br>
<a href="https://lxml.de">lxml</a> by Martijn Faassen<br>
<a href="https://abiword.github.io/enchant">Enchant</a> by Dom Lachowicz<br>
<a href="https://pyenchant.github.io/pyenchant">PyEnchant</a> by Dimitri Merejkowsky
</p>
+1 -3
View File
@@ -597,7 +597,7 @@ class ToOdt(Tokenizer):
xElem = ET.SubElement(self._xText, _mkTag("text", pTag), attrib=tAttr)
# It's important to set the initial text field to empty, otherwise
# lxml will add a line break if the first subelement is a span.
# xmlIndent will add a line break if the first subelement is a span.
xElem.text = ""
if not theText:
@@ -1315,8 +1315,6 @@ class XMLParagraph:
"""This is a helper class to manage the text content of a single
XML element using mixed content tags.
See: https://lxml.de/tutorial.html#the-element-class
Rules:
* The root tag can only have text set, never tail.
* Any span must be under root, and the text in the span is set in
-7
View File
@@ -128,12 +128,6 @@ class NWErrorMessage(QDialog):
except Exception:
kernelVersion = "Unknown"
try:
import lxml
lxmlVersion = lxml.__version__ # type: ignore
except Exception:
lxmlVersion = "Unknown"
try:
import enchant
enchantVersion = enchant.__version__
@@ -148,7 +142,6 @@ class NWErrorMessage(QDialog):
f"Host OS: {sys.platform} ({kernelVersion})\n"
f"Python: {sys.version.split()[0]} ({sys.hexversion:#x})\n"
f"Qt: {QT_VERSION_STR}, PyQt: {PYQT_VERSION_STR}\n"
f"lxml: {lxmlVersion}\n"
f"enchant: {enchantVersion}\n\n"
f"{exType.__name__}:\n{str(exValue)}\n\n"
f"Traceback:\n{exTrace}\n"
-1
View File
@@ -35,7 +35,6 @@ include_package_data = True
packages = find_namespace:
install_requires =
pyqt5>=5.10
lxml>=4.2.0
pyenchant>=3.0.0
[options.packages.find]
+2 -2
View File
@@ -2,14 +2,14 @@ Source: novelwriter
Maintainer: Veronica Berglyd Olsen <code@vkbo.net>
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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
-3
View File
@@ -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