• Bruce Dawson's avatar
    Report when vpython (Python 2) is run during presubmits · f2b0421f
    Bruce Dawson authored
    While all Chromium PRESUBMIT.py scripts have been running on Python 2
    for a long time they continue to invoke child scripts under Python 2.
    Part of the reason for slow progress on this transition is that it is
    not easy to tell that this is happening, and most developers probably
    assume that Python 3 presubmits implies a lack of Python 2.
    
    This change adds a warning when it detects Python 2 scripts being run.
    Typical output (edited for clarity) looks like this:
    
      git cl presubmit --files "chrome/updater/tools/*;ppapi/generators/*"
    ...
      Python 2 scripts were run during Python 3 presubmits. Please ask ??? if help is needed in preventing this.
       "depot_tools\pylint-1.5" --args-on-stdin from chrome\updater\tools \
       "depot_tools\pylint-1.5" --args-on-stdin from chrome\updater\tools \
       idl_tests.py from ppapi\generators
    
    If Python 2 scripts launch child scripts, especially if they use
    sys.executable, then they will not be reported. However this is a good
    thing because it means that the report focuses on the top-level scripts
    that drive Python 2 usage.
    
    This change works by modifying vpython.bat to write invocation
    information to a text file. The data in this text file is picked up by
    presubmit_support.py when it finishes running a set of presubmits.
    
    Bug: 1313804
    Change-Id: Ic632b38eae07eca2e02e94358305cc9c998818e9
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3699002Reviewed-by: 's avatarGavin Mak <gavinmak@google.com>
    Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
    f2b0421f
vpython.bat 398 Bytes