[pitivi] application: Fix detection of newer version not yet published
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] application: Fix detection of newer version not yet published
- Date: Wed, 2 Apr 2014 15:30:17 +0000 (UTC)
commit e1b77e69a4603d367ed47fc6a6be5a977748bd17
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Sun Mar 30 22:59:39 2014 +0200
application: Fix detection of newer version not yet published
pitivi/application.py | 8 ++++----
tests/test_application.py | 12 ++++++++++++
2 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/pitivi/application.py b/pitivi/application.py
index 939a2bb..73d22c0 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -209,11 +209,11 @@ class Pitivi(Gtk.Application, Loggable):
if version_status.upper() == "CURRENT":
# This is the latest.
current_version = version
+ self.info("Latest software version is %s", current_version)
- self.info("Latest software version is %s", current_version)
- # Python is magical... comparing version *strings* always works,
- # even with different major.minor.nano version number schemes!
- if VERSION > current_version:
+ VERSION_split = [int(i) for i in VERSION.split(".")]
+ current_version_split = [int(i) for i in current_version.split(".")]
+ if VERSION_split > current_version_split:
status = "CURRENT"
self.info("Running version %s, which is newer than the latest known version. Considering it
as the latest current version.", VERSION)
elif status is "UNSUPPORTED":
diff --git a/tests/test_application.py b/tests/test_application.py
index 064c040..c283bb3 100644
--- a/tests/test_application.py
+++ b/tests/test_application.py
@@ -71,3 +71,15 @@ class TestPitivi(TestCase):
app._versionInfoReceivedCb(MockGioFile(), "999.0=CURRENT\n%s=SUPPORTED" % configure.VERSION, None)
self.assertFalse(app.isLatest())
self.assertEqual("999.0", app.getLatest())
+
+ app = application.Pitivi()
+ app.emit("startup")
+ app._versionInfoReceivedCb(MockGioFile(), "0.91=current", None)
+ self.assertTrue(app.isLatest())
+ self.assertEqual("0.91", app.getLatest())
+
+ app = application.Pitivi()
+ app.emit("startup")
+ app._versionInfoReceivedCb(MockGioFile(), "0.100000000=current", None)
+ self.assertFalse(app.isLatest())
+ self.assertEqual("0.100000000", app.getLatest())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]