Use pkg_resources instead of distutils for version

Fixes #767. See #770.
This commit is contained in:
Florian Bruhin 2015-06-18 18:45:51 +02:00
parent ef78f69822
commit 9ca06ecfa2
2 changed files with 6 additions and 8 deletions

View File

@ -24,9 +24,8 @@ import sys
import html
import getpass
import traceback
import distutils.version # pylint: disable=no-name-in-module,import-error
# https://bitbucket.org/logilab/pylint/issue/73/
import pkg_resources
from PyQt5.QtCore import pyqtSlot, Qt, QSize, qVersion
from PyQt5.QtWidgets import (QDialog, QLabel, QTextEdit, QPushButton,
QVBoxLayout, QHBoxLayout, QCheckBox,
@ -328,8 +327,8 @@ class _CrashDialog(QDialog):
"""
# pylint: disable=no-member
# https://bitbucket.org/logilab/pylint/issue/73/
new_version = distutils.version.StrictVersion(newest)
cur_version = distutils.version.StrictVersion(qutebrowser.__version__)
new_version = pkg_resources.parse_version(newest)
cur_version = pkg_resources.parse_version(qutebrowser.__version__)
lines = ['The report has been sent successfully. Thanks!']
if new_version > cur_version:
lines.append("<b>Note:</b> The newest available version is v{}, "

View File

@ -31,10 +31,9 @@ import io
import os
import sys
import operator
import distutils.version # pylint: disable=no-name-in-module,import-error
# https://bitbucket.org/logilab/pylint/issue/73/
import contextlib
import pkg_resources
from PyQt5.QtCore import (qVersion, QEventLoop, QDataStream, QByteArray,
QIODevice, QSaveFile)
from PyQt5.QtWidgets import QApplication
@ -60,8 +59,8 @@ def version_check(version, op=operator.ge):
"""
# pylint: disable=no-member
# https://bitbucket.org/logilab/pylint/issue/73/
return op(distutils.version.StrictVersion(qVersion()),
distutils.version.StrictVersion(version))
return op(pkg_resources.parse_version(qVersion()),
pkg_resources.parse_version(version))
def check_overflow(arg, ctype, fatal=True):