summaryrefslogtreecommitdiff
path: root/qutebrowser/utils/utils.py
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2020-11-20 10:47:33 +0100
committerFlorian Bruhin <me@the-compiler.org>2020-11-20 10:54:42 +0100
commit46e6839e21d9ff72abb6c5d49d5abaa5a8da8a81 (patch)
tree0106beacec49f9cfc25c4f4ed7c9eac1a9036993 /qutebrowser/utils/utils.py
parente46adf32bdf880385319cb701d926fec6899046d (diff)
downloadqutebrowser-46e6839e21d9ff72abb6c5d49d5abaa5a8da8a81.tar.gz
qutebrowser-46e6839e21d9ff72abb6c5d49d5abaa5a8da8a81.zip
Replace pkg_resources.parse_version by QVersionNumber
Partially addresses #4667. Supersedes #5768, #5852, #5893 See #5495
Diffstat (limited to 'qutebrowser/utils/utils.py')
-rw-r--r--qutebrowser/utils/utils.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/qutebrowser/utils/utils.py b/qutebrowser/utils/utils.py
index 7c2bf843d..851de4250 100644
--- a/qutebrowser/utils/utils.py
+++ b/qutebrowser/utils/utils.py
@@ -38,7 +38,7 @@ import ctypes
import ctypes.util
from typing import Any, Callable, IO, Iterator, Optional, Sequence, Tuple, Type, Union
-from PyQt5.QtCore import QUrl
+from PyQt5.QtCore import QUrl, QVersionNumber
from PyQt5.QtGui import QColor, QClipboard, QDesktopServices
from PyQt5.QtWidgets import QApplication
import pkg_resources
@@ -210,6 +210,12 @@ def resource_filename(filename: str) -> str:
return pkg_resources.resource_filename(qutebrowser.__name__, filename)
+def parse_version(version: str) -> QVersionNumber:
+ """Parse a version string."""
+ v_q, _suffix = QVersionNumber.fromString(version)
+ return v_q.normalized()
+
+
def _get_color_percentage(x1: int, y1: int, z1: int, a1: int,
x2: int, y2: int, z2: int, a2: int,
percent: int) -> Tuple[int, int, int, int]: