← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~raoul-snyman/openlp/version-files into lp:openlp

 

Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/version-files into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/version-files/+merge/142402

Expand the version checking to include nightlies, development releases and stable releases.

Change the nightly build to check a new "nightly_version.txt" file, while the development releases now will check the old "dev_version.txt" and the stable releases continue to check the "version.txt" file.

To determine whether a build is a development or a stable release, the second digit in the version number is checked to see if it is odd or even. Even numbers indicate stable releases, and odd numbers indicate development releases.
-- 
https://code.launchpad.net/~raoul-snyman/openlp/version-files/+merge/142402
Your team OpenLP Core is requested to review the proposed merge of lp:~raoul-snyman/openlp/version-files into lp:openlp.
=== modified file 'openlp/.version'
--- openlp/.version	2012-11-29 19:10:45 +0000
+++ openlp/.version	2013-01-08 20:52:25 +0000
@@ -1,1 +1,1 @@
-2.0
+2.1.0-bzr2141

=== modified file 'openlp/core/utils/__init__.py'
--- openlp/core/utils/__init__.py	2012-12-29 20:56:56 +0000
+++ openlp/core/utils/__init__.py	2013-01-08 20:52:25 +0000
@@ -29,12 +29,13 @@
 """
 The :mod:`openlp.core.utils` module provides the utility libraries for OpenLP.
 """
-from datetime import datetime
+from datetime import datetime, timedelta
 from distutils.version import LooseVersion
 import logging
 import locale
 import os
 import re
+from reportlab.graphics.charts.utils import seconds2str
 from subprocess import Popen, PIPE
 import sys
 import urllib2
@@ -277,20 +278,31 @@
 
     ``current_version``
         The current version of OpenLP.
+
+    **Rules around versions and version files:**
+
+    * If a version number has a build (i.e. -bzr1234), then it is a nightly.
+    * If a version number's minor version is an odd number, it is a development release.
+    * If a version number's minor version is an even number, it is a stable release.
     """
     version_string = current_version[u'full']
     # set to prod in the distribution config file.
     settings = Settings()
     settings.beginGroup(u'general')
-    last_test = settings.value(u'last version test', datetime.now().date())
+    # This defaults to yesterday in order to force the update check to run when you've never run it before.
+    last_test = settings.value(u'last version test', datetime.now().date() - timedelta(days=1))
     this_test = datetime.now().date()
     settings.setValue(u'last version test', this_test)
     settings.endGroup()
     if last_test != this_test:
         if current_version[u'build']:
-            req = urllib2.Request(u'http://www.openlp.org/files/dev_version.txt')
+            req = urllib2.Request(u'http://www.openlp.org/files/nightly_version.txt')
         else:
-            req = urllib2.Request(u'http://www.openlp.org/files/version.txt')
+            version_parts = current_version[u'version'].split(u'.')
+            if int(version_parts[1]) % 2 != 0:
+                req = urllib2.Request(u'http://www.openlp.org/files/dev_version.txt')
+            else:
+                req = urllib2.Request(u'http://www.openlp.org/files/version.txt')
         req.add_header(u'User-Agent', u'OpenLP/%s' % current_version[u'full'])
         remote_version = None
         try:


Follow ups