From 1af1b1fcd10e802486fd9013cf7466e59dd5143c Mon Sep 17 00:00:00 2001 From: Gabor Kertesz Date: Wed, 3 Nov 2021 16:45:40 +0100 Subject: [PATCH] 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. --- winbuild/build_prepare.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/winbuild/build_prepare.py b/winbuild/build_prepare.py index cafb3ea23..f3bd203de 100644 --- a/winbuild/build_prepare.py +++ b/winbuild/build_prepare.py @@ -404,7 +404,7 @@ def write_script(name, lines): lines = [line.format(**prefs) for line in lines] print("Writing " + name) with open(name, "w") as f: - f.write("\n\r".join(lines)) + f.write("\n".join(lines)) if verbose: for line in lines: print(" " + line) @@ -462,9 +462,20 @@ def build_dep_all(): if dep_name in disabled: continue script = build_dep(dep_name) - lines.append(fr'cmd.exe /c "{{build_dir}}\{script}"') - lines.append("if errorlevel 1 echo Build failed! && exit /B 1") - lines.append("@echo All Pillow dependencies built successfully!") + 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") + 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)