Bug 831081 - kill VirtualenvManager._check_output() now that we require python 2.7;r=gps
authorJeff Hammel <jhammel@mozilla.com>
Wed, 16 Jan 2013 16:52:21 -0800
changeset 119089 8b9ecdf2995d689b93488ca893a17f5fb4b0c50b
parent 119088 2f28e36cd272a8d4fcf0fa28d9c6fca9f958bd3c
child 119090 836eb526e5fe74ab70e5342789a5f2699b9e973c
push id21456
push userjhammel@mozilla.com
push dateThu, 17 Jan 2013 00:52:31 +0000
treeherdermozilla-inbound@8b9ecdf2995d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs831081
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 831081 - kill VirtualenvManager._check_output() now that we require python 2.7;r=gps
build/virtualenv/populate_virtualenv.py
--- a/build/virtualenv/populate_virtualenv.py
+++ b/build/virtualenv/populate_virtualenv.py
@@ -240,22 +240,18 @@ class VirtualenvManager(object):
         program = [sys.executable, setup]
         program.extend(arguments)
 
         # We probably could call the contents of this file inside the context
         # of this interpreter using execfile() or similar. However, if global
         # variables like sys.path are adjusted, this could cause all kinds of
         # havoc. While this may work, invoking a new process is safer.
 
-        # TODO Use check_output when we require Python 2.7.
-        fn = getattr(subprocess, 'check_output',
-                VirtualenvManager._check_output)
-
         try:
-            output = fn(program, cwd=directory, stderr=subprocess.STDOUT)
+            output = subprocess.check_output(program, cwd=directory, stderr=subprocess.STDOUT)
             print(output)
         except subprocess.CalledProcessError as e:
             if 'Python.h: No such file or directory' in e.output:
                 print('WARNING: Python.h not found. Install Python development headers.')
             else:
                 print(e.output)
 
             raise Exception('Error installing package: %s' % directory)
@@ -289,31 +285,16 @@ class VirtualenvManager(object):
 
         If you run a random Python script and wish to "activate" the
         virtualenv, you can simply instantiate an instance of this class
         and call .ensure() and .activate() to make the virtualenv active.
         """
 
         execfile(self.activate_path, dict(__file__=self.activate_path))
 
-    # TODO Eliminate when we require Python 2.7.
-    @staticmethod
-    def _check_output(*args, **kwargs):
-        """Python 2.6 compatible implementation of subprocess.check_output."""
-        proc = subprocess.Popen(stdout=subprocess.PIPE, *args, **kwargs)
-        output, unused_err = proc.communicate()
-        retcode = proc.poll()
-        if retcode:
-            cmd = kwargs.get('args', args[0])
-            e = subprocess.CalledProcessError(retcode, cmd)
-            e.output = output
-            raise e
-
-        return output
-
 
 def verify_python_version(log_handle):
     """Ensure the current version of Python is sufficient."""
     major, minor = sys.version_info[:2]
 
     if major != MINIMUM_PYTHON_MAJOR or minor < MINIMUM_PYTHON_MINOR:
         log_handle.write('Python %d.%d or greater (but not Python 3) is '
             'required to build. ' %