mirror of https://gitlab.com/openlp/openlp.git
Merge branch 'issue-1859' into 'master'
Use Python's version comparison, not Qt's Closes #1859 See merge request openlp/openlp!724
This commit is contained in:
commit
a40d5e894e
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -95,6 +95,7 @@ MODULES = [
|
|||
'pymediainfo',
|
||||
'vlc',
|
||||
'qrcode',
|
||||
'packaging',
|
||||
]
|
||||
|
||||
|
||||
|
|
1
setup.py
1
setup.py
|
@ -105,6 +105,7 @@ using a computer and a display/projector.""",
|
|||
'flask-cors',
|
||||
'lxml',
|
||||
'Mako',
|
||||
'packaging',
|
||||
'platformdirs',
|
||||
'PyICU',
|
||||
'pymediainfo >= 2.2',
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue