can't use underscore prefix for distutils options

This commit is contained in:
nulano 2021-01-02 12:51:45 +01:00 committed by Andrew Murray
parent 43bde01623
commit 0488a2761a
2 changed files with 7 additions and 7 deletions

View File

@ -317,7 +317,7 @@ class pil_build_ext(build_ext):
+ [(f"disable-{x}", None, f"Disable support for {x}") for x in feature] + [(f"disable-{x}", None, f"Disable support for {x}") for x in feature]
+ [(f"enable-{x}", None, f"Enable support for {x}") for x in feature] + [(f"enable-{x}", None, f"Enable support for {x}") for x in feature]
+ [ + [
(f"_vendor-{x}", None, f"Use vendored version of {x}") (f"vendor-{x}", None, f"Use vendored version of {x}")
for x in ("raqm", "fribidi") for x in ("raqm", "fribidi")
] ]
+ [ + [
@ -335,7 +335,7 @@ class pil_build_ext(build_ext):
setattr(self, f"disable_{x}", None) setattr(self, f"disable_{x}", None)
setattr(self, f"enable_{x}", None) setattr(self, f"enable_{x}", None)
for x in ("raqm", "fribidi"): for x in ("raqm", "fribidi"):
setattr(self, f"_vendor_{x}", None) setattr(self, f"vendor_{x}", None)
def finalize_options(self): def finalize_options(self):
build_ext.finalize_options(self) build_ext.finalize_options(self)
@ -374,14 +374,14 @@ class pil_build_ext(build_ext):
_dbg("--enable-raqm implies --enable-freetype") _dbg("--enable-raqm implies --enable-freetype")
self.feature.required.add("freetype") self.feature.required.add("freetype")
for x in ("raqm", "fribidi"): for x in ("raqm", "fribidi"):
if getattr(self, f"_vendor_{x}"): if getattr(self, f"vendor_{x}"):
if getattr(self, "disable_raqm"): if getattr(self, "disable_raqm"):
raise ValueError( raise ValueError(
f"Conflicting options: --_vendor-{x} and --disable-raqm" f"Conflicting options: --vendor-{x} and --disable-raqm"
) )
if x == "fribidi" and not getattr(self, "_vendor_raqm"): if x == "fribidi" and not getattr(self, "vendor_raqm"):
raise ValueError( raise ValueError(
f"Conflicting options: --_vendor-{x} and not --_vendor-raqm" f"Conflicting options: --vendor-{x} and not --vendor-raqm"
) )
_dbg("Using vendored version of %s", x) _dbg("Using vendored version of %s", x)
self.feature.vendor.add(x) self.feature.vendor.add(x)

View File

@ -472,7 +472,7 @@ def build_pillow():
cmd_set("DISTUTILS_USE_SDK", "1"), # use same compiler to build Pillow cmd_set("DISTUTILS_USE_SDK", "1"), # use same compiler to build Pillow
cmd_set("MSSdk", "1"), # for PyPy3.6 cmd_set("MSSdk", "1"), # for PyPy3.6
cmd_set("py_vcruntime_redist", "true"), # use /MD, not /MT cmd_set("py_vcruntime_redist", "true"), # use /MD, not /MT
r'"{python_dir}\{python_exe}" setup.py build_ext --_vendor-raqm --_vendor-fribidi %*', r'"{python_dir}\{python_exe}" setup.py build_ext --vendor-raqm --vendor-fribidi %*',
] ]
write_script("build_pillow.cmd", lines) write_script("build_pillow.cmd", lines)