diff --git a/README.md b/README.md index 6660277..e0fd268 100644 --- a/README.md +++ b/README.md @@ -44,10 +44,10 @@ You can find the latest released binary at the following links: ### For running from source: - Python 3.3+ -- [PyQt5](http://www.riverbankcomputing.co.uk/software/pyqt/download5) 5.2.0+ +- [PyQt](http://www.riverbankcomputing.co.uk/software/pyqt/download5) 5.2.0+ - [Pillow](http://pypi.python.org/pypi/Pillow/) 2.7.0+ - [psutil](https://pypi.python.org/pypi/psutil) 2.0+ -- [python-slugify](http://pypi.python.org/pypi/python-slugify) +- [python-slugify](http://pypi.python.org/pypi/python-slugify) 0.1.0+ On Debian based distributions these two commands should install all dependencies: ``` diff --git a/kcc/KCC_gui.py b/kcc/KCC_gui.py index 2a3780e..1b0c013 100644 --- a/kcc/KCC_gui.py +++ b/kcc/KCC_gui.py @@ -37,6 +37,7 @@ from PyQt5 import QtGui, QtCore, QtWidgets, QtNetwork from xml.dom.minidom import parse from psutil import Popen, Process from copy import copy +from distutils.version import StrictVersion from .shared import md5Checksum, HTMLStripper from . import comic2ebook from . import KCC_rc_web @@ -244,7 +245,7 @@ class VersionThread(QtCore.QThread): except Exception: return latestVersion = XML.childNodes[0].getElementsByTagName('latest')[0].childNodes[0].toxml() - if tuple(map(int, (latestVersion.split(".")))) > tuple(map(int, (__version__.split(".")))): + if StrictVersion(latestVersion) > StrictVersion(__version__): if sys.platform.startswith('win'): self.newVersion = latestVersion self.md5 = XML.childNodes[0].getElementsByTagName('WindowsMD5')[0].childNodes[0].toxml() @@ -1045,11 +1046,9 @@ class KCCGUI(KCC_ui.Ui_KCC): line = line.decode("utf-8") if 'Amazon kindlegen' in line: versionCheck = line.split('V')[1].split(' ')[0] - if tuple(map(int, (versionCheck.split(".")))) < tuple(map(int, ('2.9'.split(".")))): + if StrictVersion(versionCheck) < StrictVersion('2.9'): self.addMessage('Your KindleGen is outdated! Creating MOBI might fail.' - ' Please update KindleGen from Amazon\'s website.', 'warning') + '1000765211">KindleGen is outdated! MOBI conversion might fail.', 'warning') break else: self.KindleGen = False diff --git a/kcc/shared.py b/kcc/shared.py index b8c7334..5a6602b 100644 --- a/kcc/shared.py +++ b/kcc/shared.py @@ -23,6 +23,7 @@ __docformat__ = 'restructuredtext en' import os from hashlib import md5 from html.parser import HTMLParser +from distutils.version import StrictVersion class HTMLStripper(HTMLParser): @@ -81,25 +82,27 @@ def dependencyCheck(level): missing = [] if level > 2: try: - from PyQt5 import QtCore, QtNetwork, QtWidgets - if tuple(map(int, ('5.2.0'.split(".")))) > tuple(map(int, (QtCore.qVersion().split(".")))): - missing.append('PyQt5 5.2.0+') + from PyQt5.QtCore import qVersion as qtVersion + if StrictVersion('5.2.0') > StrictVersion(qtVersion()): + missing.append('PyQt 5.2.0+') except ImportError: - missing.append('PyQt5 5.2.0+') + missing.append('PyQt 5.2.0+') if level > 1: try: - import psutil - if tuple(map(int, ('2.0.0'.split(".")))) > tuple(map(int, psutil.version_info)): + from psutil import __version__ as psutilVersion + if StrictVersion('2.0.0') > StrictVersion(psutilVersion): missing.append('psutil 2.0.0+') except ImportError: missing.append('psutil 2.0.0+') try: - import slugify + from slugify import __version__ as slugifyVersion + if StrictVersion('0.1.0') > StrictVersion(slugifyVersion): + missing.append('python-slugify 0.1.0+') except ImportError: - missing.append('python-slugify') + missing.append('python-slugify 0.1.0+') try: - import PIL - if tuple(map(int, ('2.7.0'.split(".")))) > tuple(map(int, (PIL.PILLOW_VERSION.split(".")))): + from PIL import PILLOW_VERSION as pillowVersion + if StrictVersion('2.7.0') > StrictVersion(pillowVersion): missing.append('Pillow 2.7.0+') except ImportError: missing.append('Pillow 2.7.0+')