• Robert Iannucci's avatar
    [presubmit_support] Prevent depot_tools' virtualenv from leaking into other repos. · 5025893c
    Robert Iannucci authored
    Currently in LUCI `git cl` is invoked on chromium_presubmit using vpython. This
    means that it operates under the depot_tools .vpython environment (which is
    blank).
    
    Some features in presubmit_support allow invocation of python subprocesses, and
    previously they would use `sys.executable` (especially on windows, but
    occasionally on non-windows as well).
    
    In non-vpython environments, this just picks up the system python and whatever
    modules happen to be installed there. Some python unittests work around this on
    non-windows systems by having a shebang line which explicitly invokes vpython.
    
    This CL changes presubmit_support so that invocations of 'python', or executions
    of '.py' scripts will always end up invoking vpython. In the best case, this will
    pick up the invoked scripts' vpython environment. In the worst case, this will
    invoke the script under an empty vpython environment (aka "stock python").
    
    R=dpranke@chromium.org, jbudorick@chromium.org, tandrii@chromium.org, tikuta@chromium.org
    
    Bug: 821669
    Change-Id: I5d2d5dfd0364022d56833c2c8af4983553a29c7a
    Reviewed-on: https://chromium-review.googlesource.com/961865Reviewed-by: 's avatarDirk Pranke <dpranke@chromium.org>
    Reviewed-by: 's avatarAndrii Shyshkalov <tandrii@chromium.org>
    Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
    5025893c
presubmit_support.py 59.6 KB