[Checkins] SVN: zc.recipe.cmmi/trunk/src/zc/recipe/cmmi/__init__.py updated to latest download API changes in zc.buildout

Thomas Lotze tl at gocept.com
Wed Aug 12 09:29:24 EDT 2009


Log message for revision 102709:
  updated to latest download API changes in zc.buildout

Changed:
  U   zc.recipe.cmmi/trunk/src/zc/recipe/cmmi/__init__.py

-=-
Modified: zc.recipe.cmmi/trunk/src/zc/recipe/cmmi/__init__.py
===================================================================
--- zc.recipe.cmmi/trunk/src/zc/recipe/cmmi/__init__.py	2009-08-12 12:50:30 UTC (rev 102708)
+++ zc.recipe.cmmi/trunk/src/zc/recipe/cmmi/__init__.py	2009-08-12 13:29:23 UTC (rev 102709)
@@ -113,12 +113,16 @@
         if not os.path.exists(dest):
             os.mkdir(dest)
 
-        fname = download(self.url, md5sum=self.options.get('md5sum'))
+        fname, is_temp = download(self.url, md5sum=self.options.get('md5sum'))
 
         # now unpack and work as normal
         tmp = tempfile.mkdtemp('buildout-'+self.name)
         logger.info('Unpacking and configuring')
-        setuptools.archive_util.unpack_archive(fname, tmp)
+        try:
+            setuptools.archive_util.unpack_archive(fname, tmp)
+        finally:
+            if is_temp:
+                os.remove(fname)
 
         for key, value in self.environ.items():
             logger.info('Updating environment: %s=%s' % (key, value))
@@ -135,9 +139,14 @@
                 if self.patch is not '':
                     # patch may be a filesystem path or url
                     # url patches can go through the cache
-                    self.patch = download(
+                    self.patch, is_temp = download(
                         self.patch, md5sum=self.options.get('patch-md5sum'))
-                    system("patch %s < %s" % (self.patch_options, self.patch))
+                    try:
+                        system("patch %s < %s"
+                               % (self.patch_options, self.patch))
+                    finally:
+                        if is_temp:
+                            os.remove(self.patch)
                 if self.autogen is not '':
                     logger.info('auto generating configure files')
                     system("./%s" % self.autogen)



More information about the Checkins mailing list