Skip to content

Commit c9f904f

Browse files
randomasciiLUCI CQ
authored and
LUCI CQ
committed
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 <[email protected]> Commit-Queue: Bruce Dawson <[email protected]>
1 parent 2c0a8c7 commit c9f904f

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

presubmit_support.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1740,8 +1740,11 @@ def DoPresubmitChecks(change,
17401740
if not presubmit_files and verbose:
17411741
sys.stdout.write('Warning, no PRESUBMIT.py found.\n')
17421742
results = []
1743-
depot_tools = os.path.dirname(os.path.abspath(__file__))
1744-
python2_usage_log_file = os.path.join(depot_tools, 'python2_usage.txt')
1743+
if sys.platform == 'win32':
1744+
temp = os.environ['TEMP']
1745+
else:
1746+
temp = '/tmp'
1747+
python2_usage_log_file = os.path.join(temp, 'python2_usage.txt')
17451748
if os.path.exists(python2_usage_log_file):
17461749
os.remove(python2_usage_log_file)
17471750
thread_pool = ThreadPool()

vpython

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ base_dir=$(dirname "$0")
4141
source "$base_dir/cipd_bin_setup.sh"
4242
cipd_bin_setup &> /dev/null
4343

44-
echo $@ from $(pwd) >> "$base_dir/python2_usage.txt"
44+
echo $@ from $(pwd) >> "/tmp/python2_usage.txt"
4545

4646
if [[ $(uname -s) = MINGW* || $(uname -s) = CYGWIN* ]]; then
4747
cmd.exe //c $0.bat "$@"

vpython.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
:: See revert instructions in cipd_manifest.txt
77

88
call "%~dp0\cipd_bin_setup.bat" > nul 2>&1
9-
echo %* from %cd% >> "%~dp0\python2_usage.txt"
9+
echo %* from %cd% >> "%TEMP%\python2_usage.txt"
1010
"%~dp0\.cipd_bin\vpython.exe" %*

0 commit comments

Comments
 (0)