[Checkins] SVN: bluebream/trunk/ warn the user if the project template significantly changed

Christophe Combelles ccomb at free.fr
Tue Jul 27 19:15:54 EDT 2010


Log message for revision 115132:
  warn the user if the project template significantly changed
  

Changed:
  U   bluebream/trunk/CHANGES.txt
  U   bluebream/trunk/HOWTO_RELEASE.txt
  U   bluebream/trunk/src/bluebream/bluebream_base/template.py
  U   bluebream/trunk/src/bluebream/bluebream_base/tests/bluebream.txt
  U   bluebream/trunk/versions.cfg

-=-
Modified: bluebream/trunk/CHANGES.txt
===================================================================
--- bluebream/trunk/CHANGES.txt	2010-07-27 20:49:28 UTC (rev 115131)
+++ bluebream/trunk/CHANGES.txt	2010-07-27 23:15:54 UTC (rev 115132)
@@ -7,6 +7,7 @@
 - Fixed the generated buildout and make it repeatable
 - Added the "extends-cache" Buildout option to cache
   the extended configuration files
+- warn the user if the project template has significant changes
 
 1.0b3 (2010-07-11)
 ------------------

Modified: bluebream/trunk/HOWTO_RELEASE.txt
===================================================================
--- bluebream/trunk/HOWTO_RELEASE.txt	2010-07-27 20:49:28 UTC (rev 115131)
+++ bluebream/trunk/HOWTO_RELEASE.txt	2010-07-27 23:15:54 UTC (rev 115132)
@@ -19,6 +19,14 @@
     $ ./bin/buildout
     $ ./bin/test
 
+If you made some significant changes in the project template,
+update the LAST_TEMPLATE_CHANGE marker in `versions.cfg` to the new version.
+Example::
+
+    # The marker below gives the last version with
+    # significant changes in the project template:
+    # LAST_TEMPLATE_CHANGE = 1.0.2
+
 If all tests pass, release a new version using the included `zest.releaser`::
 
     $ ./bin/prerelease
@@ -30,7 +38,7 @@
     If you want to do the same manually, it corresponds to the following steps:
 
     - set the correct version number in `setup.py`
-    - update the `CHANGELOG.txt`
+    - update the `CHANGES.txt`
     - commit, and create a svn tag for this new version
     - change `setup.py` and the `CHANGELOG.txt` to point to the next dev version
     - create a clean checkout of the tag in a new directory and run::

Modified: bluebream/trunk/src/bluebream/bluebream_base/template.py
===================================================================
--- bluebream/trunk/src/bluebream/bluebream_base/template.py	2010-07-27 20:49:28 UTC (rev 115131)
+++ bluebream/trunk/src/bluebream/bluebream_base/template.py	2010-07-27 23:15:54 UTC (rev 115132)
@@ -39,7 +39,8 @@
 
 
 class BlueBream(templates.Template):
-
+    """ The main paster template for Bluebream
+    """
     _template_dir = 'project_template'
     summary = "A BlueBream project, base template"
 
@@ -65,21 +66,39 @@
         """This method checks the variables and ask for missing ones
         """
         # Find the latest versions.cfg online
-        latest = pkg_resources.get_distribution('bluebream').version
+        current = pkg_resources.get_distribution('bluebream').version
+        latest = current
         try:
             if 'offline' not in vars:  #offline is used in tests
-                print 'Searching the latest version...'
+                sys.stdout.write('Searching the latest version... ')
+                parse_version = pkg_resources.parse_version
+
                 # parse the download html page and store versions
                 parser = FindLatest()
                 parser.feed(urlopen(DOWNLOAD_URL).read())
+
                 # return the highest version
+                if not len(parser.versions):
+                    raise IOError('No versions found')
                 latest = sorted(parser.versions,
-                              key=lambda v: pkg_resources.parse_version(v))[-1]
-                print 'Latest version found: %s' % latest
+                              key=lambda v: parse_version(v))[-1]
+                print str(latest) + '\n'
+                # warn the user if there is a change in latest template
+                last_change = '1.0b4' # feature introduced for 1.0b4
+                for line in urlopen(DOWNLOAD_URL
+                                    + 'bluebream-%s.cfg' % latest).readlines():
+                    if 'LAST_TEMPLATE_CHANGE' in line:
+                        last_change = line.split('=')[1].strip()
+                        break
+                if parse_version(last_change) > parse_version(current):
+                    print ('**WARNING**: the project template for Bluebream '
+                           'has changed since version %s.\n'
+                           'You should upgrade to this version.\n' % last_change)
+
         except IOError:
             # if something wrong occurs, we keep the current version
-            print u'Error while getting the latest version online'
-            print u'Please check that you can access %s' % DOWNLOAD_URL
+            print u'**WARNING**: error while getting the latest version online'
+            print u'Please check that you can access %s\n' % DOWNLOAD_URL
 
         # suggest what Paste chose
         for var in self.vars:
@@ -122,7 +141,6 @@
         if len(self.ns_split) == 1:
             vars['ns_prefix'] = ''
 
-
     def post(self, command, output_dir, vars):
         """Add namespace packages and move the main package to the last level
         """

Modified: bluebream/trunk/src/bluebream/bluebream_base/tests/bluebream.txt
===================================================================
--- bluebream/trunk/src/bluebream/bluebream_base/tests/bluebream.txt	2010-07-27 20:49:28 UTC (rev 115131)
+++ bluebream/trunk/src/bluebream/bluebream_base/tests/bluebream.txt	2010-07-27 23:15:54 UTC (rev 115132)
@@ -388,3 +388,14 @@
 shell = sample.main.debug:Shell
 ...
 
+The version file should contain a special marker to define the last version in
+which the template significantly changed:
+
+>>> import bluebream, os
+>>> from os.path import join, dirname
+>>> version_file = open(join(dirname(dirname(dirname(bluebream.__file__))), 'versions.cfg')).read()
+>>> 'LAST_TEMPLATE_CHANGE' in version_file
+True
+
+
+

Modified: bluebream/trunk/versions.cfg
===================================================================
--- bluebream/trunk/versions.cfg	2010-07-27 20:49:28 UTC (rev 115131)
+++ bluebream/trunk/versions.cfg	2010-07-27 23:15:54 UTC (rev 115132)
@@ -1,5 +1,9 @@
 # main version file for BlueBream
 
+# The marker below gives the last version with
+# significant changes in the project template:
+# LAST_TEMPLATE_CHANGE = 1.0b4
+
 [buildout]
 extends = http://download.zope.org/zopetoolkit/index/1.0a2/ztk-versions.cfg
           http://download.zope.org/zopetoolkit/index/1.0a2/zopeapp-versions.cfg



More information about the checkins mailing list