From fed2cb39c320aa37367e009a37813da869f4d529 Mon Sep 17 00:00:00 2001 From: Bruce Dawson Date: Tue, 11 Dec 2018 01:34:39 +0000 Subject: [PATCH] Fix ucrt source path when packaging the Windows toolchain Recent versions of the 10.0.17763 SDK have rearranged the redist directory. This change adjusts the packaging so that we can package the SDK with and without this change. The script looks first in the versioned directory and if that doesn't exist then it falls back to the unversioned directory. See also http://crrev.com/c/1371017 for the build\vs_toolchain.py version of this change. Change-Id: I835bf45f613a0aebb56eb1e8e63e6ffa5252edf0 Reviewed-on: https://chromium-review.googlesource.com/c/1370609 Reviewed-by: Dirk Pranke Commit-Queue: Bruce Dawson --- win_toolchain/package_from_installed.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/win_toolchain/package_from_installed.py b/win_toolchain/package_from_installed.py index 42a4091a0..074b2c20a 100644 --- a/win_toolchain/package_from_installed.py +++ b/win_toolchain/package_from_installed.py @@ -207,8 +207,13 @@ def BuildFileList(override_dir): result.append((combined, to)) # Copy the x86 ucrt DLLs to all directories with x86 binaries that are - # added to the path by SetEnv.cmd, and to sys32. - ucrt_paths = glob.glob(os.path.join(sdk_path, r'redist\ucrt\dlls\x86\*')) + # added to the path by SetEnv.cmd, and to sys32. Starting with the 17763 + # SDK the ucrt files are in WIN_VERSION\ucrt instead of just ucrt. + ucrt_dir = os.path.join(sdk_path, 'redist', WIN_VERSION, r'ucrt\dlls\x86') + if not os.path.exists(ucrt_dir): + ucrt_dir = os.path.join(sdk_path, r'redist\ucrt\dlls\x86') + ucrt_paths = glob.glob(ucrt_dir + r'\*') + assert(len(ucrt_paths) > 0) for ucrt_path in ucrt_paths: ucrt_file = os.path.split(ucrt_path)[1] for dest_dir in [ r'win_sdk\bin\x86', 'sys32' ]: @@ -216,7 +221,11 @@ def BuildFileList(override_dir): # Copy the x64 ucrt DLLs to all directories with x64 binaries that are # added to the path by SetEnv.cmd, and to sys64. - ucrt_paths = glob.glob(os.path.join(sdk_path, r'redist\ucrt\dlls\x64\*')) + ucrt_dir = os.path.join(sdk_path, 'redist', WIN_VERSION, r'ucrt\dlls\x64') + if not os.path.exists(ucrt_dir): + ucrt_dir = os.path.join(sdk_path, r'redist\ucrt\dlls\x64') + ucrt_paths = glob.glob(ucrt_dir + r'\*') + assert(len(ucrt_paths) > 0) for ucrt_path in ucrt_paths: ucrt_file = os.path.split(ucrt_path)[1] for dest_dir in [ r'VC\bin\amd64_x86', r'VC\bin\amd64',