• Josip Sokcevic's avatar
    Skip Python 2 presubmit step when unneeded · 632bbc0c
    Josip Sokcevic authored
    All of the PRESUBMIT.py files in the Chromium repo are running under
    Python 3. However "git cl presubmit" also works with other repos where
    some PRESUBMIT.py scripts still run under Python 2. This means that
    the Python 2 presubmit commit checks step cannot simply be disabled.
    That meant that Chromium was paying up to a one-minute cost just to
    setup for and look for Python 2 scripts that it doesn't run.
    
    This change runs the Python 3 PRESUBMIT.py scripts first, and keeps
    track of whether any were skipped. If none were skipped then the
    Python 2 PRESUBMIT.py stage can be skipped.
    
    Note that the child scripts of PRESUBMIT.py scripts may still be run
    under Python 2, but that is orthogonal to this change.
    
    Bug: 1313804
    Change-Id: Ib65838223f232f1e78058d6a08ea15a89f442310
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3614453Reviewed-by: 's avatarJosip Sokcevic <sokcevic@google.com>
    Reviewed-by: 's avatarBruce Dawson <brucedawson@chromium.org>
    Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
    632bbc0c
presubmit_unittest.py 127 KB