diff options
author | Martin Robinson <mrobinson@igalia.com> | 2024-01-17 11:53:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-17 10:53:34 +0000 |
commit | d86e713a9cb5be2555d63bd477d47d440fa8c832 (patch) | |
tree | e7bbc0783b19f4b4500fb350e60654c276ad0b1d /python/servo/command_base.py | |
parent | f76982e2e7f411e2e2fd8e6dbfe92a080acefc54 (diff) | |
download | servo-d86e713a9cb5be2555d63bd477d47d440fa8c832.tar.gz servo-d86e713a9cb5be2555d63bd477d47d440fa8c832.zip |
build: Clean up post-build copy of Windows DLLs (#31092)
* build: Clean up post-build copy of Windows DLLs
- No longer use vcvarsall.bat at all. Instead find the Windows SDK
directory by looking in the registry.
- Split logic for copying Windows dependencies into its own function and
do some minor clean up, such as collecting all MSVC functionality into
visual_studio.py.
- Remove support for Visual Studio 2015 and Visual Studio 2017.
This is a preparatory change in order to support Visual Studio 2022.
* More cleanup of the code
Diffstat (limited to 'python/servo/command_base.py')
-rw-r--r-- | python/servo/command_base.py | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py index a6ea3add044..f6d105e7837 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -15,7 +15,6 @@ from typing import Dict, List, Optional import functools import gzip import itertools -import json import locale import os import platform @@ -477,23 +476,6 @@ class CommandBase(object): def msvc_package_dir(self, package): return servo.platform.windows.get_dependency_dir(package) - def vs_dirs(self): - assert 'windows' in servo.platform.host_triple() - vsinstalldir = os.environ.get('VSINSTALLDIR') - vs_version = os.environ.get('VisualStudioVersion') - if vsinstalldir and vs_version: - msbuild_version = get_msbuild_version(vs_version) - else: - (vsinstalldir, vs_version, msbuild_version) = find_highest_msvc_version() - msbuildinstalldir = os.path.join(vsinstalldir, "MSBuild", msbuild_version, "Bin") - vcinstalldir = os.environ.get("VCINSTALLDIR", "") or os.path.join(vsinstalldir, "VC") - return { - 'msbuild': msbuildinstalldir, - 'vsdir': vsinstalldir, - 'vs_version': vs_version, - 'vcdir': vcinstalldir, - } - def build_env(self): """Return an extended environment dictionary.""" env = os.environ.copy() @@ -1076,57 +1058,3 @@ class CommandBase(object): sys.exit(error) else: print("Clobber not needed.") - - -def find_highest_msvc_version_ext(): - def vswhere(args): - program_files = (os.environ.get('PROGRAMFILES(X86)') - or os.environ.get('PROGRAMFILES')) - if not program_files: - return [] - vswhere = os.path.join(program_files, 'Microsoft Visual Studio', - 'Installer', 'vswhere.exe') - if not os.path.exists(vswhere): - return [] - return json.loads(check_output([vswhere, '-format', 'json'] + args).decode(errors='ignore')) - - for install in vswhere(['-products', '*', '-requires', 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64', - '-requires', 'Microsoft.VisualStudio.Component.Windows10SDK']): - version = install['installationVersion'].split('.')[0] + '.0' - yield (install['installationPath'], version, "Current" if version == '16.0' else version) - - -def find_highest_msvc_version(): - editions = ["Enterprise", "Professional", "Community", "BuildTools"] - prog_files = os.environ.get("ProgramFiles(x86)") - base_vs_path = os.path.join(prog_files, "Microsoft Visual Studio") - - vs_versions = ["2019", "2017"] - versions = { - ("2019", "vs"): "16.0", - ("2017", "vs"): "15.0", - } - - for version in vs_versions: - for edition in editions: - vs_version = versions[version, "vs"] - msbuild_version = get_msbuild_version(vs_version) - - vsinstalldir = os.path.join(base_vs_path, version, edition) - if os.path.exists(vsinstalldir): - return (vsinstalldir, vs_version, msbuild_version) - - versions = sorted(find_highest_msvc_version_ext(), key=lambda tup: float(tup[1])) - if not versions: - print(f"Can't find MSBuild.exe installation under {base_vs_path}. " - "Please set the VSINSTALLDIR and VisualStudioVersion environment variables") - sys.exit(1) - return versions[0] - - -def get_msbuild_version(vs_version): - if vs_version in ("15.0", "14.0"): - msbuild_version = vs_version - else: - msbuild_version = "Current" - return msbuild_version |