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

View File

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