Move python2_usage.txt from depot_tools to temp

The initial version of detecting Python 2 usage in presubmit child
scripts used a text file in depot_tools to record Python 2 usage. This
caused problems in chromeos so this change moves to the file to the temp
directory, which is where it should have been in the first place.

Bug: 1366661
Change-Id: I003b813d7bd5f70956dd3418f86e8ed6edf88220
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3954470
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
changes/70/3954470/2
Bruce Dawson 3 years ago committed by LUCI CQ
parent 2c0a8c736a
commit c9f904f205

@ -1740,8 +1740,11 @@ def DoPresubmitChecks(change,
if not presubmit_files and verbose:
sys.stdout.write('Warning, no PRESUBMIT.py found.\n')
results = []
depot_tools = os.path.dirname(os.path.abspath(__file__))
python2_usage_log_file = os.path.join(depot_tools, 'python2_usage.txt')
if sys.platform == 'win32':
temp = os.environ['TEMP']
else:
temp = '/tmp'
python2_usage_log_file = os.path.join(temp, 'python2_usage.txt')
if os.path.exists(python2_usage_log_file):
os.remove(python2_usage_log_file)
thread_pool = ThreadPool()

@ -41,7 +41,7 @@ base_dir=$(dirname "$0")
source "$base_dir/cipd_bin_setup.sh"
cipd_bin_setup &> /dev/null
echo $@ from $(pwd) >> "$base_dir/python2_usage.txt"
echo $@ from $(pwd) >> "/tmp/python2_usage.txt"
if [[ $(uname -s) = MINGW* || $(uname -s) = CYGWIN* ]]; then
cmd.exe //c $0.bat "$@"

@ -6,5 +6,5 @@
:: See revert instructions in cipd_manifest.txt
call "%~dp0\cipd_bin_setup.bat" > nul 2>&1
echo %* from %cd% >> "%~dp0\python2_usage.txt"
echo %* from %cd% >> "%TEMP%\python2_usage.txt"
"%~dp0\.cipd_bin\vpython.exe" %*

Loading…
Cancel
Save