[Checkins] SVN: zc.buildout/branches/help-api/ - Fixed a bug that caused buildouts to fail when variable

Godefroid Chapelle gotcha at bubblenet.be
Sun Mar 29 17:24:03 EDT 2009


Log message for revision 98530:
  - Fixed a bug that caused buildouts to fail when variable
    substitutions are used to name standard directories, as in::
  
  [buildout]
      eggs-directory = ${buildout:directory}/develop-eggs

Changed:
  U   zc.buildout/branches/help-api/CHANGES.txt
  U   zc.buildout/branches/help-api/src/zc/buildout/buildout.py
  U   zc.buildout/branches/help-api/src/zc/buildout/tests.py

-=-
Modified: zc.buildout/branches/help-api/CHANGES.txt
===================================================================
--- zc.buildout/branches/help-api/CHANGES.txt	2009-03-29 21:23:56 UTC (rev 98529)
+++ zc.buildout/branches/help-api/CHANGES.txt	2009-03-29 21:24:03 UTC (rev 98530)
@@ -4,9 +4,18 @@
 Change History
 **************
 
-1.1 (2008-07-19)
-================
+1.1.1 (2008-07-28)
+==================
 
+- Fixed a bug that caused buildouts to fail when variable
+  substitutions are used to name standard directories, as in::
+
+    [buildout]
+    eggs-directory = ${buildout:directory}/develop-eggs
+
+1.1.0 (2008-07-19)
+==================
+
 - Added a buildout-level unzip option tp change the default policy for
   unzipping zip-safe eggs.
 

Modified: zc.buildout/branches/help-api/src/zc/buildout/buildout.py
===================================================================
--- zc.buildout/branches/help-api/src/zc/buildout/buildout.py	2009-03-29 21:23:56 UTC (rev 98529)
+++ zc.buildout/branches/help-api/src/zc/buildout/buildout.py	2009-03-29 21:24:03 UTC (rev 98530)
@@ -126,8 +126,11 @@
         # used already (Gottfried Ganssauge)
         buildout_section = data.get('buildout')
             
-        # Try to make sure we have absolute paths for standard directories. We do this
-        # before doing substitutions, in case a one of these gets read by another section.
+        # Try to make sure we have absolute paths for standard
+        # directories. We do this before doing substitutions, in case
+        # a one of these gets read by another section.  If any
+        # variable references are used though, we leave it as is in
+        # _buildout_path.
         if 'directory' in buildout_section:
             self._buildout_dir = buildout_section['directory']
             for name in ('bin', 'parts', 'eggs', 'develop-eggs'):
@@ -254,8 +257,10 @@
 
         os.chdir(options['directory'])
 
-    def _buildout_path(self, *names):
-        return os.path.join(self._buildout_dir, *names)
+    def _buildout_path(self, name):
+        if '${' in name:
+            return name
+        return os.path.join(self._buildout_dir, name)
 
     def bootstrap(self, args):
         __doing__ = 'Bootstraping.'

Modified: zc.buildout/branches/help-api/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/branches/help-api/src/zc/buildout/tests.py	2009-03-29 21:23:56 UTC (rev 98529)
+++ zc.buildout/branches/help-api/src/zc/buildout/tests.py	2009-03-29 21:24:03 UTC (rev 98530)
@@ -2854,6 +2854,19 @@
 
     """
 
+def dont_mess_with_standard_dirs_with_variable_refs():
+    """
+    >>> write('buildout.cfg',
+    ... '''
+    ... [buildout]
+    ... eggs-directory = ${buildout:directory}/develop-eggs
+    ... parts = 
+    ... ''' % globals())
+    >>> print system(buildout),
+    
+    """
+
+
 ######################################################################
     
 def create_sample_eggs(test, executable=sys.executable):



More information about the Checkins mailing list