[Checkins] SVN: zc.recipe.cmmi/trunk/ make sure the location folder does not exists before creating it

Tarek Ziade ziade.tarek at gmail.com
Tue Feb 26 17:26:35 EST 2008


Log message for revision 84284:
  make sure the location folder does not exists before creating it

Changed:
  U   zc.recipe.cmmi/trunk/CHANGES.txt
  U   zc.recipe.cmmi/trunk/zc/recipe/cmmi/__init__.py
  A   zc.recipe.cmmi/trunk/zc/recipe/cmmi/misc.txt
  U   zc.recipe.cmmi/trunk/zc/recipe/cmmi/tests.py

-=-
Modified: zc.recipe.cmmi/trunk/CHANGES.txt
===================================================================
--- zc.recipe.cmmi/trunk/CHANGES.txt	2008-02-26 20:43:09 UTC (rev 84283)
+++ zc.recipe.cmmi/trunk/CHANGES.txt	2008-02-26 22:26:34 UTC (rev 84284)
@@ -7,6 +7,11 @@
 Added support for patches to be downloaded from a url rather than only using
 patches on the filesystem
 
+Bugs Fixed
+----------
+
+Check if the `location` folder exists before creating it.
+
 1.1.0
 =====
 

Modified: zc.recipe.cmmi/trunk/zc/recipe/cmmi/__init__.py
===================================================================
--- zc.recipe.cmmi/trunk/zc/recipe/cmmi/__init__.py	2008-02-26 20:43:09 UTC (rev 84283)
+++ zc.recipe.cmmi/trunk/zc/recipe/cmmi/__init__.py	2008-02-26 22:26:34 UTC (rev 84284)
@@ -68,7 +68,8 @@
         setuptools.archive_util.unpack_archive(fname, tmp)
           
         here = os.getcwd()
-        os.mkdir(dest)
+        if not os.path.exists(dest):
+            os.mkdir(dest)
 
         try:
             os.chdir(tmp)

Added: zc.recipe.cmmi/trunk/zc/recipe/cmmi/misc.txt
===================================================================
--- zc.recipe.cmmi/trunk/zc/recipe/cmmi/misc.txt	                        (rev 0)
+++ zc.recipe.cmmi/trunk/zc/recipe/cmmi/misc.txt	2008-02-26 22:26:34 UTC (rev 84284)
@@ -0,0 +1,38 @@
+Various tests
+=============
+
+This doctest contains misc tests.
+
+Creating the location folder
+----------------------------
+
+When the recipe is subclassed, the `location` folder might be created
+before `zc.recipe.cmmi` has a chance to create it, so we need to make
+sure it checks that the folder does not exists before it is created.
+   
+In the test below, the `foo` folder is created before the recipe
+is launched::
+
+    >>> location = join(sample_buildout, 'parts', 'foo')
+    >>> mkdir(location)
+
+    >>> write('buildout.cfg',
+    ... """
+    ... [buildout]
+    ... parts = foo
+    ... log-level = DEBUG
+    ...
+    ... [foo]
+    ... recipe = zc.recipe.cmmi
+    ... url = file://%s/foo.tgz
+    ... """ % (distros))
+
+    >>> print system('bin/buildout') 
+    Installing...
+    ...
+    installing foo
+    <BLANKLINE>
+    
+    >>> ls(join(sample_buildout, 'parts'))
+    d  foo
+


Property changes on: zc.recipe.cmmi/trunk/zc/recipe/cmmi/misc.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: zc.recipe.cmmi/trunk/zc/recipe/cmmi/tests.py
===================================================================
--- zc.recipe.cmmi/trunk/zc/recipe/cmmi/tests.py	2008-02-26 20:43:09 UTC (rev 84283)
+++ zc.recipe.cmmi/trunk/zc/recipe/cmmi/tests.py	2008-02-26 22:26:34 UTC (rev 84284)
@@ -100,5 +100,20 @@
                ]),
             optionflags = doctest.ELLIPSIS
             ),
+        
+        doctest.DocFileSuite(
+            'misc.txt',
+            setUp=setUp,
+            tearDown=zc.buildout.testing.buildoutTearDown,
 
+            checker=renormalizing.RENormalizing([
+               zc.buildout.testing.normalize_path,
+               zc.buildout.testing.normalize_script,
+               zc.buildout.testing.normalize_egg_py,
+               normalize_bang,
+               (re.compile('extdemo[.]pyd'), 'extdemo.so')
+               ]),
+            optionflags = doctest.ELLIPSIS
+            ),
+
         ))



More information about the Checkins mailing list