Windows: Try to build all enabled optional dependencies

From the external library list, only Zlib and libjpeg are required
by default.
However currently only libimagequant and fribidi can be disabled.
For win-arm64 (at the moment) freetype, lcms2, libimagequant and
harfbuzz are failing.
So we can either add disabling attribute for these respectively
or simply falling through and collect the build results at the end.
If disabling attribute would have been extended and the build keeps
terminating if any of them is failing, finding the right list of
disabled libraries should have been found iteratively.
Considering the failing list is being investigated and fixed,
this step is expected to be repeated.

Extra new line by the \r\n is also fixed for Windows.
This commit is contained in:
Gabor Kertesz 2021-11-03 16:45:40 +01:00
parent fcb87ecbe1
commit 1af1b1fcd1

View File

@ -404,7 +404,7 @@ def write_script(name, lines):
lines = [line.format(**prefs) for line in lines] lines = [line.format(**prefs) for line in lines]
print("Writing " + name) print("Writing " + name)
with open(name, "w") as f: with open(name, "w") as f:
f.write("\n\r".join(lines)) f.write("\n".join(lines))
if verbose: if verbose:
for line in lines: for line in lines:
print(" " + line) print(" " + line)
@ -462,9 +462,20 @@ def build_dep_all():
if dep_name in disabled: if dep_name in disabled:
continue continue
script = build_dep(dep_name) script = build_dep(dep_name)
lines.append(fr'cmd.exe /c "{{build_dir}}\{script}"') lines.append(fr"SET {dep_name}=successful")
lines.append(fr'cmd.exe /c "{{build_dir}}\{script}')
if dep_name == "libjpeg" or dep_name == "zlib":
lines.append("if errorlevel 1 echo Build failed! && exit /B 1") lines.append("if errorlevel 1 echo Build failed! && exit /B 1")
lines.append("@echo All Pillow dependencies built successfully!") else:
lines.append(
fr"if errorlevel 1 echo Build failed! && SET {dep_name}=failed"
)
lines.append("")
lines.append("@echo Pillow dependencies build result:")
for dep_name in deps:
if dep_name in disabled:
continue
lines.append(fr"@echo {dep_name}: %{dep_name}%")
write_script("build_dep_all.cmd", lines) write_script("build_dep_all.cmd", lines)