From fba3a306848ce2867cfa1d29c5242ddb61b01d66 Mon Sep 17 00:00:00 2001 From: Chris Blume Date: Wed, 9 Mar 2022 23:11:22 +0000 Subject: [PATCH] Only call GetVSPath() once Currently, GetVSPath() is called twice. The result if that call is used locally in both situations. This commit makes only one call, passing the result to where it is needed. Change-Id: I186bd7f0387091ad16c2791de99d1de8a89f266c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3510528 Auto-Submit: Chris Blume Reviewed-by: Bruce Dawson Commit-Queue: Bruce Dawson --- win_toolchain/package_from_installed.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/win_toolchain/package_from_installed.py b/win_toolchain/package_from_installed.py index fe8ac29ea..6719e3a64 100644 --- a/win_toolchain/package_from_installed.py +++ b/win_toolchain/package_from_installed.py @@ -97,7 +97,7 @@ def BuildRepackageFileList(src_dir): return result -def BuildFileList(override_dir, include_arm): +def BuildFileList(override_dir, include_arm, vs_path): result = [] # Subset of VS corresponding roughly to VC. @@ -149,8 +149,6 @@ def BuildFileList(override_dir, include_arm): 'sysarm64'), ] - vs_path = GetVSPath() - for path in paths: src = path[0] if isinstance(path, tuple) else path # Note that vs_path is ignored if src is an absolute path. @@ -505,7 +503,7 @@ def main(): _vc_tools = temp_tools_path[len(vs_path) + 1:].replace('\\', '/') print('Building file list for VS %s Windows %s...' % (_vs_version, _win_version)) - files = BuildFileList(options.override_dir, options.arm) + files = BuildFileList(options.override_dir, options.arm, vs_path) AddEnvSetup(files, options.arm)