Bug 1257516 - Use the logger for virtualenv manager output. r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 25 Mar 2016 16:37:37 +0900
changeset 290976 2a6f03d3e6d446601bffcf88de57b649e5b41c90
parent 290975 450ffa461818bdc9eb0763216ea27efc3d311504
child 290977 e521d0d6b1bf2fe858519d98e452581953cdee6a
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1257516
milestone48.0a1
Bug 1257516 - Use the logger for virtualenv manager output. r=ted
build/moz.configure/init.configure
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -160,16 +160,17 @@ option(env='PYTHON', nargs=1, help='Pyth
 # Setup python virtualenv
 # ==============================================================
 @depends('PYTHON', check_build_environment, mozconfig)
 @advanced
 def virtualenv_python(env_python, build_env, mozconfig):
     import os
     import sys
     import subprocess
+    from mozbuild.configure.util import LineIO
     from mozbuild.virtualenv import (
         VirtualenvManager,
         verify_python_version,
     )
 
     python = env_python[0] if env_python else None
 
     # Ideally we'd rely on the mozconfig injection from mozconfig_options,
@@ -180,25 +181,27 @@ def virtualenv_python(env_python, build_
             python = mozconfig['env']['added']['PYTHON']
         elif 'PYTHON' in mozconfig['env']['modified']:
             python = mozconfig['env']['modified']['PYTHON'][1]
         elif 'PYTHON' in mozconfig['vars']['added']:
             python = mozconfig['vars']['added']['PYTHON']
         elif 'PYTHON' in mozconfig['vars']['modified']:
             python = mozconfig['vars']['modified']['PYTHON'][1]
 
-    verify_python_version(sys.stderr)
+    with LineIO(lambda l: log.error(l)) as out:
+        verify_python_version(out)
     topsrcdir, topobjdir = build_env.topsrcdir, build_env.topobjdir
     if topobjdir.endswith('/js/src'):
         topobjdir = topobjdir[:-7]
 
-    manager = VirtualenvManager(
-        topsrcdir, topobjdir,
-        os.path.join(topobjdir, '_virtualenv'), sys.stdout,
-        os.path.join(topsrcdir, 'build', 'virtualenv_packages.txt'))
+    with LineIO(lambda l: log.info(l)) as out:
+        manager = VirtualenvManager(
+            topsrcdir, topobjdir,
+            os.path.join(topobjdir, '_virtualenv'), out,
+            os.path.join(topsrcdir, 'build', 'virtualenv_packages.txt'))
 
     if python:
         # If we're not in the virtualenv, we need the which module for
         # find_program.
         if normsep(sys.executable) != normsep(manager.python_path):
             sys.path.append(os.path.join(topsrcdir, 'python', 'which'))
         found_python = find_program(python)
         if not found_python: