diff options
author | Mukilan Thiyagarajan <mukilan@igalia.com> | 2024-08-05 20:12:21 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-05 14:42:21 +0000 |
commit | 0ce9ce8dc02a9812795174890b507a7a7fb72fd4 (patch) | |
tree | 3823340289ceee598f11ec477b487786aa728614 /python/servo | |
parent | f1602005a085ec279a7280ccae1ea3ceffdb0eca (diff) | |
download | servo-0ce9ce8dc02a9812795174890b507a7a7fb72fd4.tar.gz servo-0ce9ce8dc02a9812795174890b507a7a7fb72fd4.zip |
mach: Add support for paths with spaces on Windows (#32936)
The default user name in Windows installations is of the form "FirstName
LastName", so it seems likely that there will be spaces in the user's
path. Based on my testing on Windows 11, the only Servo's bootstrap
script has trouble dealing with spaces in paths. This patch fixes that
by quoting such paths correctly. Our direct and indirect dependencies
seem to handle these without issue and Servo does build and run
correctly with this patch.
In this patch, the logic for gstreamer bootstrap now uses powershell
instead of directly invoking msiexec.exe via cmd.exe as I was unable to
get the installer to run correctly, even with quoting. Some extra hacks
were necessary to propagate the exit code correctly to mach.
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Diffstat (limited to 'python/servo')
-rw-r--r-- | python/servo/platform/windows.py | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/python/servo/platform/windows.py b/python/servo/platform/windows.py index 394dc649493..dced63a8fb5 100644 --- a/python/servo/platform/windows.py +++ b/python/servo/platform/windows.py @@ -17,14 +17,13 @@ import zipfile from .. import util from .base import Base -DEPS_URL = "https://github.com/servo/servo-build-deps/releases/download/msvc-deps/" +DEPS_URL = "https://github.com/servo/servo-build-deps/releases/download/msvc-deps" DEPENDENCIES = { "moztools": "4.0", } -URL_BASE = "https://github.com/servo/servo-build-deps/releases/download/msvc-deps/" -GSTREAMER_URL = f"{URL_BASE}/gstreamer-1.0-msvc-x86_64-1.22.8.msi" -GSTREAMER_DEVEL_URL = f"{URL_BASE}/gstreamer-1.0-devel-msvc-x86_64-1.22.8.msi" +GSTREAMER_URL = f"{DEPS_URL}/gstreamer-1.0-msvc-x86_64-1.22.8.msi" +GSTREAMER_DEVEL_URL = f"{DEPS_URL}/gstreamer-1.0-devel-msvc-x86_64-1.22.8.msi" DEPENDENCIES_DIR = os.path.join(util.get_target_dir(), "dependencies") @@ -44,7 +43,7 @@ class Windows(Base): @classmethod def download_and_extract_dependency(cls, zip_path: str, full_spec: str): if not os.path.isfile(zip_path): - zip_url = f"{DEPS_URL}{urllib.parse.quote(full_spec)}.zip" + zip_url = f"{DEPS_URL}/{urllib.parse.quote(full_spec)}.zip" util.download_file(full_spec, zip_url, zip_path) zip_dir = os.path.dirname(zip_path) @@ -65,7 +64,7 @@ class Windows(Base): choco_config = os.path.join(util.SERVO_ROOT, "support", "windows", "chocolatey.config") # This is the format that PowerShell wants arguments passed to it. - cmd_exe_args = f"'/K','choco','install','-y','{choco_config}'" + cmd_exe_args = f"'/K','choco','install','-y', '\"{choco_config}\"'" if force: cmd_exe_args += ",'-f'" @@ -158,12 +157,19 @@ class Windows(Base): print(f"Installing GStreamer packages to {DEPENDENCIES_DIR}...") os.makedirs(DEPENDENCIES_DIR, exist_ok=True) - common_args = [ - f"TARGETDIR={DEPENDENCIES_DIR}", # Install destination - "/qn", # Quiet mode - ] - subprocess.check_call(["msiexec", "/a", libs_msi] + common_args) - subprocess.check_call(["msiexec", "/a", devel_msi] + common_args) + + for installer in [libs_msi, devel_msi]: + arguments = [ + "/a", + f'"{installer}"' + f'TARGETDIR="{DEPENDENCIES_DIR}"', # Install destination + "/qn", # Quiet mode + ] + quoted_arguments = ",".join((f"'{arg}'" for arg in arguments)) + subprocess.check_call([ + "powershell", "exit (Start-Process", "-PassThru", "-Wait", "-verb", "runAs", + "msiexec.exe", "-ArgumentList", f"@({quoted_arguments})", ").ExitCode" + ]) assert self.is_gstreamer_installed(cross_compilation_target=None) return True |