Rev 160: Re-enable the _LOG_FILE code. in http://bazaar.launchpad.net/~jameinel/other/bzr-windows-installers

John Arbash Meinel john at arbash-meinel.com
Wed May 25 09:06:20 UTC 2011


At http://bazaar.launchpad.net/~jameinel/other/bzr-windows-installers

------------------------------------------------------------
revno: 160
revision-id: john at arbash-meinel.com-20110525090614-hejxvu1fr7bxe5ay
parent: john at arbash-meinel.com-20110524140950-c4zv7krrcvpmxasl
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: bzr-windows-installers
timestamp: Wed 2011-05-25 11:06:14 +0200
message:
  Re-enable the _LOG_FILE code.
  
  It makes the output more readable (less noisy), and it makes the actual effect
  debuggable, since the log file is preserved.
-------------- next part --------------
=== modified file 'build.py'
--- a/build.py	2010-10-16 10:52:12 +0000
+++ b/build.py	2011-05-25 09:06:14 +0000
@@ -106,15 +106,9 @@
             env[k] = str(v)
     if _LOG_FILE:
         # TODO: make this non-blocking
-        proc = subprocess.Popen(args, env=env,
-            stdout=subprocess.PIPE)
-        log_file = open(_LOG_FILE, "a")
-        try:
-            output = proc.communicate()[0]
-            log_file.write(output)
-        finally:
-            log_file.close()
-        result = proc.returncode
+        with open(_LOG_FILE, "ab") as f:
+                proc = subprocess.Popen(args, env=env, stdout=f)
+        result = proc.wait()
     else:
         result = subprocess.call(args, env=env)
     if result not in good_exit_codes:
@@ -151,7 +145,7 @@
         """
         # Build the images
         self.init_build_dir()
-        #_set_log_file(self.build_dir, "buildout")
+        _set_log_file(self.build_dir, "buildout")
         for distro in distros:
             self.build_image(distro)
         return os.getcwdu()
@@ -285,7 +279,7 @@
 
         # Log the build process (ENABLE LATER)
         log_dir = os.path.join(self.root, "releases")
-        #_set_log_file(log_dir, self.distro_name)
+        _set_log_file(log_dir, self.distro_name)
 
         # Checkout the base branch
         remove(self.target)



More information about the bazaar-commits mailing list