diff --git a/appveyor.yml b/appveyor.yml index 6fc3c2ba5..5b34006d9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -31,7 +31,7 @@ install: # Update pip - python -m pip install --upgrade pip # Install generic dependencies from pypi. - - python -m pip install sqlalchemy alembic platformdirs chardet beautifulsoup4 lxml Mako mysql-connector-python pytest mock psycopg2-binary websockets waitress six requests QtAwesome PyQt5 PyQtWebEngine pymediainfo PyMuPDF QDarkStyle python-vlc flask-cors pytest-qt pyenchant pysword qrcode flask + - python -m pip install sqlalchemy alembic platformdirs chardet beautifulsoup4 lxml Mako mysql-connector-python pytest mock psycopg2-binary websockets waitress six requests QtAwesome PyQt5 PyQtWebEngine pymediainfo PyMuPDF QDarkStyle python-vlc flask-cors pytest-qt pyenchant pysword qrcode flask packaging # Install Windows only dependencies - cmd: python -m pip install pyodbc pypiwin32 - cmd: choco install vlc %CHOCO_VLC_ARG% --no-progress --limit-output diff --git a/openlp/core/version.py b/openlp/core/version.py index 9e6cd9c28..49b5ada06 100644 --- a/openlp/core/version.py +++ b/openlp/core/version.py @@ -27,6 +27,7 @@ import sys from collections import OrderedDict from datetime import date +from packaging.version import parse from PyQt5 import QtCore from openlp.core.common.applocation import AppLocation @@ -114,8 +115,7 @@ class VersionWorker(ThreadWorker): retries += 1 else: self.no_internet.emit() - if remote_version and (QtCore.QVersionNumber.fromString(remote_version) > - QtCore.QVersionNumber.fromString(self.current_version['full'])): + if remote_version and (parse(remote_version) > parse(self.current_version['full'])): self.new_version.emit(remote_version) self.quit.emit() diff --git a/scripts/check_dependencies.py b/scripts/check_dependencies.py index 6748b6ba3..fc75e68ce 100755 --- a/scripts/check_dependencies.py +++ b/scripts/check_dependencies.py @@ -95,6 +95,7 @@ MODULES = [ 'pymediainfo', 'vlc', 'qrcode', + 'packaging', ] diff --git a/setup.py b/setup.py index e72503289..10ff3b5db 100644 --- a/setup.py +++ b/setup.py @@ -105,6 +105,7 @@ using a computer and a display/projector.""", 'flask-cors', 'lxml', 'Mako', + 'packaging', 'platformdirs', 'PyICU', 'pymediainfo >= 2.2', diff --git a/tests/openlp_core/test_version.py b/tests/openlp_core/test_version.py index 9761dff2b..71bc1d669 100644 --- a/tests/openlp_core/test_version.py +++ b/tests/openlp_core/test_version.py @@ -135,7 +135,7 @@ def test_worker_start_nightly_version(mock_get_web_page, mock_platform): """ # GIVEN: A last check date, current version, and an instance of worker last_check_date = '1970-01-01' - current_version = {'full': '2.1-bzr2345', 'version': '2.1', 'build': '2345'} + current_version = {'full': '2.1.0+git2345', 'version': '2.1', 'build': '2345'} mock_platform.system.return_value = 'Linux' mock_platform.release.return_value = '4.12.0-1-amd64' mock_get_web_page.return_value = '2.4.6' @@ -148,7 +148,7 @@ def test_worker_start_nightly_version(mock_get_web_page, mock_platform): # THEN: The check completes and the signal is emitted expected_download_url = 'https://get.openlp.org/versions/nightly_version.txt' - expected_headers = {'User-Agent': 'OpenLP/2.1-bzr2345 Linux/4.12.0-1-amd64; '} + expected_headers = {'User-Agent': 'OpenLP/2.1.0+git2345 Linux/4.12.0-1-amd64; '} mock_get_web_page.assert_called_once_with(expected_download_url, headers=expected_headers) mock_new_version.emit.assert_called_once_with('2.4.6') mock_quit.emit.assert_called_once_with() @@ -162,7 +162,7 @@ def test_worker_empty_response(mock_get_web_page, mock_platform): """ # GIVEN: A last check date, current version, and an instance of worker last_check_date = '1970-01-01' - current_version = {'full': '2.1-bzr2345', 'version': '2.1', 'build': '2345'} + current_version = {'full': '2.1+git2345', 'version': '2.1', 'build': '2345'} mock_platform.system.return_value = 'Linux' mock_platform.release.return_value = '4.12.0-1-amd64' mock_get_web_page.return_value = '\n' @@ -175,7 +175,7 @@ def test_worker_empty_response(mock_get_web_page, mock_platform): # THEN: The check completes and the signal is emitted expected_download_url = 'https://get.openlp.org/versions/nightly_version.txt' - expected_headers = {'User-Agent': 'OpenLP/2.1-bzr2345 Linux/4.12.0-1-amd64; '} + expected_headers = {'User-Agent': 'OpenLP/2.1+git2345 Linux/4.12.0-1-amd64; '} mock_get_web_page.assert_called_once_with(expected_download_url, headers=expected_headers) assert mock_new_version.emit.call_count == 0 mock_quit.emit.assert_called_once_with()