[Checkins] SVN: bluebream/trunk/src/bluebream/bluebream_base/template.py Choose only the latest minor version. Also be sure 1.0 or 1.0b3 should be

Christophe Combelles ccomb at free.fr
Tue Aug 24 20:36:18 EDT 2010


Log message for revision 115928:
  Choose only the latest minor version. Also be sure 1.0 or 1.0b3 should be
  upgraded to 1.0.x (The bug was also discovered in z3c.checkversions)
  

Changed:
  U   bluebream/trunk/src/bluebream/bluebream_base/template.py

-=-
Modified: bluebream/trunk/src/bluebream/bluebream_base/template.py
===================================================================
--- bluebream/trunk/src/bluebream/bluebream_base/template.py	2010-08-25 00:34:21 UTC (rev 115927)
+++ bluebream/trunk/src/bluebream/bluebream_base/template.py	2010-08-25 00:36:17 UTC (rev 115928)
@@ -77,13 +77,27 @@
                 parser = FindLatest()
                 parser.feed(urlopen(DOWNLOAD_URL).read())
 
-                # return the highest version
+                # return the highest minor version
                 if not len(parser.versions):
                     raise IOError('No versions found')
-                latest = sorted(parser.versions,
-                              key=lambda v: parse_version(v))[-1]
+                all_versions = sorted(parser.versions,
+                                      key=lambda v: parse_version(v),
+                                      reverse=True)
+                for v in all_versions:
+                    trunked_v = [x for x in parse_version(v)[:2] if not x.startswith('*')]
+                    trunked_current = [x for x in parse_version(current)[:2] if not x.startswith('*')]
+                    while len(trunked_v) < 2:
+                        trunked_v.append('00000000')
+                    while len(trunked_current) < 2:
+                        trunked_current.append('00000000')
+                    if trunked_v > trunked_current:
+                        continue
+                    latest = v
+                    break
+
                 print str(latest) + '\n'
-                # warn the user if there is a change in latest template
+
+                # warn the user if there is a change in the latest template
                 last_change = '1.0b4' # feature introduced for 1.0b4
                 for line in urlopen(DOWNLOAD_URL
                                     + 'bluebream-%s.cfg' % latest).readlines():



More information about the checkins mailing list