[Checkins] SVN: grokproject/trunk/ Catch download error when trying to get the big grok tarball.

Maurits van Rees m.van.rees at zestsoftware.nl
Thu Jun 5 08:15:33 EDT 2008


Log message for revision 87167:
  Catch download error when trying to get the big grok tarball.
  

Changed:
  U   grokproject/trunk/CHANGES.txt
  U   grokproject/trunk/grokproject/templates.py

-=-
Modified: grokproject/trunk/CHANGES.txt
===================================================================
--- grokproject/trunk/CHANGES.txt	2008-06-05 11:57:26 UTC (rev 87166)
+++ grokproject/trunk/CHANGES.txt	2008-06-05 12:15:32 UTC (rev 87167)
@@ -4,6 +4,8 @@
 0.8 (unreleased)
 ------------------
 
+* Catch download error when trying to get the big grok tarball.
+
 * Add a line at the end of bootstrap.py again to install the eggbasket
   section.
 

Modified: grokproject/trunk/grokproject/templates.py
===================================================================
--- grokproject/trunk/grokproject/templates.py	2008-06-05 11:57:26 UTC (rev 87166)
+++ grokproject/trunk/grokproject/templates.py	2008-06-05 12:15:32 UTC (rev 87167)
@@ -116,19 +116,23 @@
                 print "Finished downloading."
                 print "Installing eggs to %s ..." % eggs_dir
 
-                tf = tarfile.open(temp_tarball_name,
-                                  'r:gz')
-                links = []
-                for name in tf.getnames():
-                    tf.extract(name, extraction_dir)
-                    links.append(os.path.join(extraction_dir, name))
-                tf.close()
+                try:
+                    tf = tarfile.open(temp_tarball_name,
+                                      'r:gz')
+                except tarfile.ReadError, e:
+                    print "ReadError: %s.  Not using tarball." % e
+                else:
+                    links = []
+                    for name in tf.getnames():
+                        tf.extract(name, extraction_dir)
+                        links.append(os.path.join(extraction_dir, name))
+                    tf.close()
 
-                result = install_grok(target_dir=eggs_dir, version=version,
-                                      links=links)
-                if result is False:
-                    print "Failed to install Grok with the tar ball."
-                    print "Continuing with buildout instead."
+                    result = install_grok(target_dir=eggs_dir, version=version,
+                                          links=links)
+                    if result is False:
+                        print "Failed to install Grok with the tar ball."
+                        print "Continuing with buildout instead."
             finally:
                 shutil.rmtree(extraction_dir)
                 os.unlink(temp_tarball_name)



More information about the Checkins mailing list