[Checkins] SVN: zc.buildout/trunk/zc.recipe.egg_/ Added support for the buildout newest option.

Jim Fulton jim at zope.com
Wed Feb 7 18:43:37 EST 2007


Log message for revision 72431:
  Added support for the buildout newest option.
  
  Also added a missing tests for upgrading.
  

Changed:
  U   zc.buildout/trunk/zc.recipe.egg_/CHANGES.txt
  U   zc.buildout/trunk/zc.recipe.egg_/setup.py
  U   zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/README.txt
  U   zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/custom.py
  U   zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/custom.txt
  U   zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/egg.py

-=-
Modified: zc.buildout/trunk/zc.recipe.egg_/CHANGES.txt
===================================================================
--- zc.buildout/trunk/zc.recipe.egg_/CHANGES.txt	2007-02-07 22:21:31 UTC (rev 72430)
+++ zc.buildout/trunk/zc.recipe.egg_/CHANGES.txt	2007-02-07 23:43:36 UTC (rev 72431)
@@ -8,6 +8,14 @@
 Change History
 **************
 
+1.0.0b5 (2007-02-??)
+====================
+
+Feature Changes
+---------------
+
+- Added support for the buildout newest option.
+
 1.0.0b4 (2007-01-17)
 ====================
 

Modified: zc.buildout/trunk/zc.recipe.egg_/setup.py
===================================================================
--- zc.buildout/trunk/zc.recipe.egg_/setup.py	2007-02-07 22:21:31 UTC (rev 72430)
+++ zc.buildout/trunk/zc.recipe.egg_/setup.py	2007-02-07 23:43:36 UTC (rev 72431)
@@ -7,7 +7,7 @@
 name = "zc.recipe.egg"
 setup(
     name = name,
-    version = "1.0.0b4",
+    version = "1.0.0b5",
     author = "Jim Fulton",
     author_email = "jim at zope.com",
     description = "Recipe for installing Python package distributions as eggs",

Modified: zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/README.txt
===================================================================
--- zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/README.txt	2007-02-07 22:21:31 UTC (rev 72430)
+++ zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/README.txt	2007-02-07 23:43:36 UTC (rev 72431)
@@ -64,8 +64,6 @@
 Let's run the buildout:
 
     >>> import os
-    >>> os.chdir(sample_buildout)
-    >>> buildout = os.path.join(sample_buildout, 'bin', 'buildout')
     >>> print system(buildout),
     buildout: Installing demo
     zc.buildout.easy_install: Getting new distribution for demo<0.3
@@ -83,9 +81,9 @@
 
 We see that we got an egg for demo that met the requirement, as well
 as the egg for demoneeded, which demo requires.  (We also see an egg
-link for the recipe.  This egg link was actually created as part of
-the sample buildout setup. Normally, when using the recipe, you'll get
-a regular egg installation.)
+link for the recipe in the develop-eggs directory.  This egg link was
+actually created as part of the sample buildout setup. Normally, when
+using the recipe, you'll get a regular egg installation.)
 
 Script generation
 -----------------
@@ -186,7 +184,7 @@
 
 If we run the demo script, it prints out some minimal data:
 
-    >>> print system(os.path.join(sample_buildout, 'bin', 'demo')),
+    >>> print system(join(sample_buildout, 'bin', 'demo')),
     2 1
 
 The value it prints out happens to be some values defined in the
@@ -195,7 +193,7 @@
 We can also run the py-demo script.  Here we'll just print out
 the bits if the path added to reflect the eggs:
 
-    >>> print system(os.path.join(sample_buildout, 'bin', 'py-demo'),
+    >>> print system(join(sample_buildout, 'bin', 'py-demo'),
     ... """import os, sys
     ... for p in sys.path:
     ...     if 'demo' in p:
@@ -206,9 +204,14 @@
     demo-0.2-py2.4.egg
     demoneeded-1.1-py2.4.egg
 
-The recipe gets the most recent distribution that satisfies the
-specification. For example, We remove the restriction on demo:
+Egg updating
+------------
 
+The recipe normally gets the most recent distribution that satisfies the
+specification.  It won't do this is the buildout is either in
+non-newest mode or in offline mode.  To see how this works, we'll
+remove the restriction on demo:
+
     >>> write(sample_buildout, 'buildout.cfg',
     ... """
     ... [buildout]
@@ -220,9 +223,34 @@
     ... index = %(server)s/index
     ... """ % dict(server=link_server))
 
-    >>> print system(buildout),
+and run the buildout in non-newest mode:
+
+    >>> print system(buildout+' -N'),
     buildout: Uninstalling demo
     buildout: Installing demo
+
+Note that we removed the eggs option, and the eggs defaulted to the
+part name. Because we removed the eggs option, the demo was
+reinstalled.
+
+We'll also run the buildout in off-line mode:
+
+    >>> print system(buildout+' -o'),
+    buildout: Updating demo
+
+We didn't get an update for demo:
+
+    >>> ls(sample_buildout, 'eggs')
+    -  demo-0.2-py2.3.egg
+    -  demoneeded-1.1-py2.3.egg
+    -  setuptools-0.6-py2.3.egg
+    -  zc.buildout-1.0-py2.3.egg
+
+If we run the buildout on the default online and newest modes, 
+we'll get an update for demo:
+
+    >>> print system(buildout),
+    buildout: Updating demo
     zc.buildout.easy_install: Getting new distribution for demo
     zc.buildout.easy_install: Got demo 0.3
 
@@ -235,12 +263,9 @@
     -  setuptools-0.6-py2.4.egg
     -  zc.buildout-1.0-py2.4.egg
 
-Note that we removed the eggs option, and the eggs
-defaulted to the part name.
-
 The script is updated too:
 
-    >>> print system(os.path.join(sample_buildout, 'bin', 'demo')),
+    >>> print system(join(sample_buildout, 'bin', 'demo')),
     3 1
 
 Controlling script generation
@@ -442,7 +467,6 @@
 If the buildout offline option is set to "true", then no attempt will
 be made to contact an index server:
 
-
     >>> write(sample_buildout, 'buildout.cfg',
     ... """
     ... [buildout]

Modified: zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/custom.py
===================================================================
--- zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/custom.py	2007-02-07 22:21:31 UTC (rev 72430)
+++ zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/custom.py	2007-02-07 23:43:36 UTC (rev 72431)
@@ -61,12 +61,15 @@
         if buildout['buildout'].get('offline') == 'true':
             self.install = lambda: ()
 
+        self.newest = buildout['buildout'].get('newest') == 'true'
+
     def install(self):
         options = self.options
         distribution = options.get('eggs', self.name).strip()
         return zc.buildout.easy_install.build(
             distribution, options['_d'], self.build_ext,
             self.links, self.index, options['executable'], [options['_e']],
+            newest=self.newest,
             )
         
 class Develop(Base):

Modified: zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/custom.txt
===================================================================
--- zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/custom.txt	2007-02-07 22:21:31 UTC (rev 72430)
+++ zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/custom.txt	2007-02-07 23:43:36 UTC (rev 72431)
@@ -132,8 +132,6 @@
     ... include-dirs = include
     ... """ % dict(server=link_server))
 
-    >>> buildout = join('bin', 'buildout')
-
     >>> print system(buildout),
     buildout: Installing extdemo
     zip_safe flag not set; analyzing archive contents...
@@ -200,6 +198,51 @@
     >>> print system(join('bin', 'demo')),
     42
 
+Updating
+--------
+
+The custom recipe will normally check for new source distributions
+that meet the given specification.  This can be suppressed using the
+buildout non-newest and offline modes.  We'll generate a new source
+distribution for extdemo:
+
+    >>> update_extdemo()
+
+If we run the buildout in non-newest or offline modes:
+
+    >>> print system(buildout+' -N'),
+    buildout: Develop: /sample-buildout/demo
+    buildout: Updating extdemo
+    buildout: Updating demo
+
+    >>> print system(buildout+' -o'),
+    buildout: Develop: /sample-buildout/demo
+    buildout: Updating extdemo
+    buildout: Updating demo
+
+We won't get an update.
+
+    >>> ls(sample_buildout, 'develop-eggs')
+    -  demo.egg-link
+    d  extdemo-1.4-py2.4-unix-i686.egg
+    -  zc.recipe.egg.egg-link
+
+But if we run the buildout in the default on-line and newest modes, we
+will:
+
+    >>> print system(buildout),
+    buildout: Develop: /sample-buildout/demo
+    buildout: Updating extdemo
+    zip_safe flag not set; analyzing archive contents...
+    buildout: Updating demo
+
+    >>> ls(sample_buildout, 'develop-eggs')
+    -  demo.egg-link
+    d  extdemo-1.4-py2.4-linux-i686.egg
+    d  extdemo-1.5-py2.4-linux-i686.egg
+    -  zc.recipe.egg.egg-link
+
+
 Controlling develop-egg generation
 ==================================
 

Modified: zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/egg.py
===================================================================
--- zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/egg.py	2007-02-07 22:21:31 UTC (rev 72430)
+++ zc.buildout/trunk/zc.recipe.egg_/src/zc/recipe/egg/egg.py	2007-02-07 23:43:36 UTC (rev 72431)
@@ -76,7 +76,8 @@
                 index = self.index, 
                 executable = options['executable'],
                 always_unzip=options.get('unzip') == 'true',
-                path=[options['develop-eggs-directory']]
+                path=[options['develop-eggs-directory']],
+                newest=self.buildout['buildout'].get('newest') == 'true',
                 )
 
         return orig_distributions, ws



More information about the Checkins mailing list