[Checkins] SVN: z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/downloader.py Apply patch of Ben Dadsetan to fix nasty Windows warnings.

Uli Fouquet uli at gnufix.de
Sun Apr 19 10:46:37 EDT 2009


Log message for revision 99274:
  Apply patch of Ben Dadsetan to fix nasty Windows warnings.

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

-=-
Modified: z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/downloader.py
===================================================================
--- z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/downloader.py	2009-04-19 13:34:06 UTC (rev 99273)
+++ z3c.recipe.eggbasket/trunk/z3c/recipe/eggbasket/downloader.py	2009-04-19 14:46:37 UTC (rev 99274)
@@ -112,22 +112,31 @@
                 # be closed without finishing the process.
                 # Failing to remove temporary files should not stop the
                 # entire process. User is warned and can take action.
+                
+                # Keep track of warnings and mention them at the end of
+                # the install() method.
+                temp_obj_warn = []
                 if not keep_tarball:
                     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")
+                    except OSError, os_error: # Most likely a WindowsError
+                        temp_obj_warn.append(('file', tarball_location, os_error))
                                  
                 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.")
-                                 
+                except OSError, os_error: # Most likely a WindowsError
+                    temp_obj_warn.append(('directory', extraction_dir, os_error))
 
+                if len(temp_obj_warn):
+                    for warning_ in temp_obj_warn:
+                        type_, location_, except_ = warning_
+                        log.warn("Could not remove temporary %s %s"
+                                 % (type_, tarball_location))
+                        log.warn(os_error)
+                        log.warn("!!** Please remove the %s manually **!!"
+                                 % (type_,))
+
+
         # Return files that were created by the recipe. The buildout
         # will remove all returned files upon reinstall.
         return tuple()



More information about the Checkins mailing list