[svnbook commit] r2521 - trunk/src/tools

maxb noreply at red-bean.com
Wed Nov 8 15:40:52 CST 2006


Author: maxb
Date: Wed Nov  8 15:40:51 2006
New Revision: 2521

Modified:
   trunk/src/tools/build-nightlies

Log:
* src/tools/build-nightlies: Attempt to fix to email errors when make fails.


Modified: trunk/src/tools/build-nightlies
==============================================================================
--- trunk/src/tools/build-nightlies	(original)
+++ trunk/src/tools/build-nightlies	Wed Nov  8 15:40:51 2006
@@ -23,7 +23,7 @@
     return ((hours and "%dh " % hours or "")
             + (minutes and "%dm " % minutes or "")
             + "%ds" % seconds)
-    
+
 
 def sendmail(subject, body):
     outerrfp, infp = popen2.popen4(
@@ -96,31 +96,34 @@
     if locale in SKIP_PDF_LOCALES:
         book_formats.remove('pdf')
 
-    # Build
-    make_cmd = (['make', 'INSTALL_SUBDIR=__TEMPINSTALL__', 'clean', 'valid']
-                + map(lambda x: 'install-%s' % x, book_formats))
-    if os.path.isdir(temp_dir):
-        if DRYRUN:
-            print "Erase: %s" % (temp_dir)
-        else:
-            shutil.rmtree(temp_dir)
-    os.chdir(locale_dir)
     try:
-        cmd = " ".join(make_cmd)
-        if DRYRUN:
-            print "Run: %s" % (cmd)
-        else:
-            outerrfp, infp = popen2.popen4(cmd, mode='r')
-            logfp = open(build_log, 'w', 1)
-            while 1:
-                data = outerrfp.readline()
-                if not data: break
-                logfp.write(data)
-    finally:
-        os.chdir(cwd)
+        # Build
+        make_cmd = (['make', 'INSTALL_SUBDIR=__TEMPINSTALL__', 'clean', 'valid']
+                    + map(lambda x: 'install-%s' % x, book_formats))
+        if os.path.isdir(temp_dir):
+            if DRYRUN:
+                print "Erase: %s" % (temp_dir)
+            else:
+                shutil.rmtree(temp_dir)
+        os.chdir(locale_dir)
+        try:
+            cmd = " ".join(make_cmd)
+            if DRYRUN:
+                print "Run: %s" % (cmd)
+            else:
+                child = popen2.Popen4(cmd)
+                logfp = open(build_log, 'w', 1)
+                while 1:
+                    data = child.fromchild.readline()
+                    if not data: break
+                    logfp.write(data)
+                exitcode = child.wait()
+                if exitcode:
+                    raise RuntimeError("make exited with error %d" % exitcode)
+        finally:
+            os.chdir(cwd)
 
-    # Move stuff into place.  Ignore any errors.
-    try:
+        # Move stuff into place.
         if os.path.isdir(dropspot_locale_path):
             if DRYRUN:
                 print "Erase: %s" % (dropspot_locale_path)




More information about the svnbook-dev mailing list