[Checkins] SVN: z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/ Apply patch of Ben Dadsetan that fixes unwanted aborts on Windows.

Uli Fouquet uli at gnufix.de
Fri Apr 17 15:13:50 EDT 2009


Log message for revision 99254:
  Apply patch of Ben Dadsetan that fixes  unwanted aborts on Windows.

Changed:
  U   z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/README.txt
  U   z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/downloader.py

-=-
Modified: z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/README.txt
===================================================================
--- z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/README.txt	2009-04-17 19:11:55 UTC (rev 99253)
+++ z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/README.txt	2009-04-17 19:13:49 UTC (rev 99254)
@@ -112,8 +112,8 @@
 We create source distributions for them in a directory::
 
     >>> colours = tmpdir('colours')
+    >>> sdist(colour, colours)
     >>> sdist(orange, colours)
-    >>> sdist(colour, colours)
     >>> ls(colours)
     -  colour-0.1.zip
     -  orange-0.1.zip
@@ -137,8 +137,8 @@
 In this case the recipe will do nothing.  So the url does not get
 used.  Running the buildout gives us::
 
-    >>> print 'start..', system(buildout)
-    start...
+    >>> print 'start..\n', system(buildout)
+    start.. 
     ...
     Installing basket.
     <BLANKLINE>
@@ -169,8 +169,9 @@
 
     >>> tarball.list(verbose=False)
     tmp/tmpDlQSIQbuildoutSetUp/_TEST_/colours/
+    tmp/tmpDlQSIQbuildoutSetUp/_TEST_/colours/colour-0.1.zip
     tmp/tmpDlQSIQbuildoutSetUp/_TEST_/colours/orange-0.1.zip
-    tmp/tmpDlQSIQbuildoutSetUp/_TEST_/colours/colour-0.1.zip
+
     >>> tarball.close()
     >>> ls(tarserver)
     -  colours.tgz

Modified: z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/downloader.py
===================================================================
--- z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/downloader.py	2009-04-17 19:11:55 UTC (rev 99253)
+++ z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/downloader.py	2009-04-17 19:13:49 UTC (rev 99254)
@@ -107,9 +107,26 @@
                     log.error("Failed to install required eggs with the tar "
                               "ball.")
             finally:
+                # The Windows CPython has issues in the urllib module.
+                # urllib keeps files open in specific cases that can not
+                # be closed without finishing the process.
+                # Failing to remove temporary files should not stop the
+                # entire process. User is warned and can take action.
                 if not keep_tarball:
-                    os.unlink(tarball_location)
-                shutil.rmtree(extraction_dir)
+                    try:
+                        os.unlink(tarball_location)
+                    except OSError, win_error:
+                        log.warn("Could not remove temporary file %s: %s"
+                                 % (tarball_location, win_error))
+                        log.warn("Please remove the file manually")
+                                 
+                try:
+                    shutil.rmtree(extraction_dir)
+                except OSError, win_error:
+                    log.warn("Could not remove temporary directory %s: %s"
+                             % (extraction_dir, win_error))
+                    log.warn("Please remove the directory manually.")
+                                 
 
         # Return files that were created by the recipe. The buildout
         # will remove all returned files upon reinstall.



More information about the Checkins mailing list