[Checkins] SVN: zc.recipe.cmmi/branches/miles-download-cache/zc/recipe/cmmi/__init__.py fix bugs from refactoring

Miles Waller miles at jamkit.com
Fri Aug 3 14:07:22 EDT 2007


Log message for revision 78557:
  fix bugs from refactoring

Changed:
  U   zc.recipe.cmmi/branches/miles-download-cache/zc/recipe/cmmi/__init__.py

-=-
Modified: zc.recipe.cmmi/branches/miles-download-cache/zc/recipe/cmmi/__init__.py
===================================================================
--- zc.recipe.cmmi/branches/miles-download-cache/zc/recipe/cmmi/__init__.py	2007-08-03 17:45:45 UTC (rev 78556)
+++ zc.recipe.cmmi/branches/miles-download-cache/zc/recipe/cmmi/__init__.py	2007-08-03 18:07:22 UTC (rev 78557)
@@ -59,39 +59,35 @@
 
         fname = getFromCache( url, self.name, self.download_cache, self.install_from_cache)
  
+        # now unpack and work as normal
+        tmp = tempfile.mkdtemp('buildout-'+self.name)
+        logging.getLogger(self.name).info('Unpacking and configuring')
+        setuptools.archive_util.unpack_archive(fname, tmp)
+          
+        here = os.getcwd()
+        os.mkdir(dest)
+
         try:
-            # now unpack and work as normal
-            tmp = tempfile.mkdtemp('buildout-'+self.name)
-            logging.getLogger(self.name).info( 'Unpacking and configuring %s' % self.filename)
-            setuptools.archive_util.unpack_archive(fname, tmp)
-            
-            os.mkdir(dest)
-            here = os.getcwd()
+            os.chdir(tmp)                                        
             try:
-                os.chdir(tmp)                                        
-                try:
-                    if not os.path.exists('configure'):
-                        entries = os.listdir(tmp)
-                        if len(entries) == 1:
-                            os.chdir(entries[0])
-                        else:
-                            raise ValueError("Couldn't find configure")
-                    if patch is not '':
-                        system("patch %s < %s" % (patch_options, patch))
-                    system("./configure --prefix=%s %s" %
-                           (dest, extra_options))
-                    system("make")
-                    system("make install")
-                finally:
-                    os.chdir(here)
-            except:
-                os.rmdir(dest)
-                raise
+                if not os.path.exists('configure'):
+                    entries = os.listdir(tmp)
+                    if len(entries) == 1:
+                        os.chdir(entries[0])
+                    else:
+                        raise ValueError("Couldn't find configure")
+                if patch is not '':
+                    system("patch %s < %s" % (patch_options, patch))
+                system("./configure --prefix=%s %s" %
+                       (dest, extra_options))
+                system("make")
+                system("make install")
+            finally:
+                os.chdir(here)
+        except:
+            os.rmdir(dest)
+            raise
 
-        finally:
-            shutil.rmtree(tmp)
-            if tmp2 is not None:
-               shutil.rmtree(tmp2)
 
         return dest
 
@@ -141,7 +137,8 @@
                 fname = os.path.join(cache_name, filename)
                 if filename != "cache.ini":
                     now = datetime.datetime.utcnow()
-                    cache_ini = open(os.path.join(cache_name, "cache.ini"), "w")                    print >>cache_ini, "[cache]"
+                    cache_ini = open(os.path.join(cache_name, "cache.ini"), "w")
+                    print >>cache_ini, "[cache]"
                     print >>cache_ini, "download_url =", url
                     print >>cache_ini, "retrieved =", now.isoformat() + "Z"
                     cache_ini.close()



More information about the Checkins mailing list