Bug 1289641 - Allow spaces in MIDL and FXC paths. r=firefox-build-system-reviewers,nalexander

On CI, 8.3 filenames are not generated, so the canonicalization of
program paths in `windows kits` doesn't work. But the build system can
actually deal with spaces in the specific case of MIDL and FXC.

Differential Revision: https://phabricator.services.mozilla.com/D143258
This commit is contained in:
Mike Hommey 2022-04-11 23:00:10 +00:00
Родитель 0aa3c95daa
Коммит 9d89241f64
3 изменённых файлов: 20 добавлений и 5 удалений

Просмотреть файл

@ -117,6 +117,7 @@ def check_prog(
input=None,
allow_missing=False,
paths=None,
allow_spaces=False,
bootstrap=None,
when=None,
validate=None,
@ -190,7 +191,7 @@ def check_prog(
for prog in value or progs:
log.debug("%s: Looking for %s", var.lower(), quote(prog))
result = find_program(prog, paths)
result = find_program(prog, paths, allow_spaces)
if validate and result and not validate(result):
log.debug("%s: %s found but didn't work", var.lower(), quote(result))
continue

Просмотреть файл

@ -167,7 +167,7 @@ normalize_path = normalize_path()
@imports(_from="os", _import="pathsep")
@imports(_from="os", _import="environ")
@imports(_from="mozfile", _import="which")
def find_program(file, paths=None):
def find_program(file, paths=None, allow_spaces=False):
# The following snippet comes from `which` itself, with a slight
# modification to use lowercase extensions, because it's confusing rustup
# (on top of making results not really appealing to the eye).
@ -184,7 +184,9 @@ def find_program(file, paths=None):
if is_absolute_or_relative(file):
path = which(os.path.basename(file), path=os.path.dirname(file), exts=exts)
return normalize_path(path) if path else None
if not allow_spaces:
return normalize_path(path) if path else None
return normsep(path)
if paths:
if not isinstance(paths, (list, tuple)):
@ -195,7 +197,9 @@ def find_program(file, paths=None):
paths = pathsep.join(paths)
path = which(file, path=paths, exts=exts)
return normalize_path(path) if path else None
if not allow_spaces:
return normalize_path(path) if path else None
return normsep(path)
@imports("os")

Просмотреть файл

@ -1503,7 +1503,14 @@ def check_for_midl(target, compile_environment):
midl = check_prog(
"MIDL", midl_names, when=check_for_midl, allow_missing=True, paths=sdk_bin_path
"MIDL",
midl_names,
when=check_for_midl,
allow_missing=True,
paths=sdk_bin_path,
# MIDL being used from a python wrapper script, we can live with it
# having spaces.
allow_spaces=True,
)
option(env="MIDL_FLAGS", nargs=1, help="Extra flags to pass to MIDL")
@ -1812,6 +1819,9 @@ with only_when(compile_environment):
("fxc.exe", "fxc2.exe"),
when=depends(target)(lambda t: t.kernel == "WINNT"),
paths=sdk_bin_path,
# FXC being used from a python wrapper script, we can live with it
# having spaces.
allow_spaces=True,
)