2022-12-02 21:15:34 +01:00
|
|
|
--- Pillow.orig/setup.py 2021-11-01 14:50:48.000000000 +0100
|
|
|
|
+++ Pillow/setup.py 2021-11-01 14:51:31.000000000 +0100
|
|
|
|
@@ -125,7 +125,7 @@
|
|
|
|
"codec_fd",
|
|
|
|
)
|
2019-03-30 21:58:45 +01:00
|
|
|
|
2022-12-02 21:15:34 +01:00
|
|
|
-DEBUG = False
|
|
|
|
+DEBUG = True # So we can easely triage user issues.
|
2019-03-30 21:58:45 +01:00
|
|
|
|
|
|
|
|
2022-12-02 21:15:34 +01:00
|
|
|
class DependencyException(Exception):
|
|
|
|
@@ -411,46 +411,6 @@
|
|
|
|
include_dirs = []
|
2019-03-30 21:58:45 +01:00
|
|
|
|
2022-12-02 21:15:34 +01:00
|
|
|
pkg_config = None
|
|
|
|
- if _cmd_exists(os.environ.get("PKG_CONFIG", "pkg-config")):
|
|
|
|
- pkg_config = _pkg_config
|
|
|
|
-
|
|
|
|
- #
|
|
|
|
- # add configured kits
|
|
|
|
- for root_name, lib_name in dict(
|
|
|
|
- JPEG_ROOT="libjpeg",
|
|
|
|
- JPEG2K_ROOT="libopenjp2",
|
|
|
|
- TIFF_ROOT=("libtiff-5", "libtiff-4"),
|
|
|
|
- ZLIB_ROOT="zlib",
|
|
|
|
- FREETYPE_ROOT="freetype2",
|
|
|
|
- HARFBUZZ_ROOT="harfbuzz",
|
|
|
|
- FRIBIDI_ROOT="fribidi",
|
|
|
|
- LCMS_ROOT="lcms2",
|
|
|
|
- IMAGEQUANT_ROOT="libimagequant",
|
|
|
|
- ).items():
|
|
|
|
- root = globals()[root_name]
|
|
|
|
-
|
|
|
|
- if root is None and root_name in os.environ:
|
|
|
|
- prefix = os.environ[root_name]
|
|
|
|
- root = (os.path.join(prefix, "lib"), os.path.join(prefix, "include"))
|
|
|
|
-
|
|
|
|
- if root is None and pkg_config:
|
|
|
|
- if isinstance(lib_name, tuple):
|
|
|
|
- for lib_name2 in lib_name:
|
|
|
|
- _dbg(f"Looking for `{lib_name2}` using pkg-config.")
|
|
|
|
- root = pkg_config(lib_name2)
|
|
|
|
- if root:
|
|
|
|
- break
|
|
|
|
- else:
|
|
|
|
- _dbg(f"Looking for `{lib_name}` using pkg-config.")
|
|
|
|
- root = pkg_config(lib_name)
|
|
|
|
-
|
|
|
|
- if isinstance(root, tuple):
|
|
|
|
- lib_root, include_root = root
|
|
|
|
- else:
|
|
|
|
- lib_root = include_root = root
|
|
|
|
-
|
|
|
|
- _add_directory(library_dirs, lib_root)
|
|
|
|
- _add_directory(include_dirs, include_root)
|
2019-03-30 21:58:45 +01:00
|
|
|
|
2022-12-02 21:15:34 +01:00
|
|
|
# respect CFLAGS/CPPFLAGS/LDFLAGS
|
|
|
|
for k in ("CFLAGS", "CPPFLAGS", "LDFLAGS"):
|
|
|
|
@@ -471,137 +431,6 @@
|
|
|
|
for d in os.environ[k].split(os.path.pathsep):
|
|
|
|
_add_directory(library_dirs, d)
|
|
|
|
|
|
|
|
- _add_directory(library_dirs, os.path.join(sys.prefix, "lib"))
|
|
|
|
- _add_directory(include_dirs, os.path.join(sys.prefix, "include"))
|
|
|
|
-
|
|
|
|
- #
|
|
|
|
- # add platform directories
|
|
|
|
-
|
|
|
|
- if self.disable_platform_guessing:
|
|
|
|
- pass
|
|
|
|
-
|
|
|
|
- elif sys.platform == "cygwin":
|
|
|
|
- # pythonX.Y.dll.a is in the /usr/lib/pythonX.Y/config directory
|
|
|
|
- _add_directory(
|
|
|
|
- library_dirs,
|
|
|
|
- os.path.join(
|
|
|
|
- "/usr/lib", "python{}.{}".format(*sys.version_info), "config"
|
|
|
|
- ),
|
|
|
|
- )
|
|
|
|
-
|
|
|
|
- elif sys.platform == "darwin":
|
|
|
|
- # attempt to make sure we pick freetype2 over other versions
|
|
|
|
- _add_directory(include_dirs, "/sw/include/freetype2")
|
|
|
|
- _add_directory(include_dirs, "/sw/lib/freetype2/include")
|
|
|
|
- # fink installation directories
|
|
|
|
- _add_directory(library_dirs, "/sw/lib")
|
|
|
|
- _add_directory(include_dirs, "/sw/include")
|
|
|
|
- # darwin ports installation directories
|
|
|
|
- _add_directory(library_dirs, "/opt/local/lib")
|
|
|
|
- _add_directory(include_dirs, "/opt/local/include")
|
|
|
|
-
|
|
|
|
- # if Homebrew is installed, use its lib and include directories
|
|
|
|
- try:
|
|
|
|
- prefix = (
|
|
|
|
- subprocess.check_output(["brew", "--prefix"])
|
|
|
|
- .strip()
|
|
|
|
- .decode("latin1")
|
|
|
|
- )
|
|
|
|
- except Exception:
|
|
|
|
- # Homebrew not installed
|
|
|
|
- prefix = None
|
|
|
|
-
|
|
|
|
- ft_prefix = None
|
|
|
|
-
|
|
|
|
- if prefix:
|
|
|
|
- # add Homebrew's include and lib directories
|
|
|
|
- _add_directory(library_dirs, os.path.join(prefix, "lib"))
|
|
|
|
- _add_directory(include_dirs, os.path.join(prefix, "include"))
|
|
|
|
- _add_directory(
|
|
|
|
- include_dirs, os.path.join(prefix, "opt", "zlib", "include")
|
|
|
|
- )
|
|
|
|
- ft_prefix = os.path.join(prefix, "opt", "freetype")
|
|
|
|
-
|
|
|
|
- if ft_prefix and os.path.isdir(ft_prefix):
|
|
|
|
- # freetype might not be linked into Homebrew's prefix
|
|
|
|
- _add_directory(library_dirs, os.path.join(ft_prefix, "lib"))
|
|
|
|
- _add_directory(include_dirs, os.path.join(ft_prefix, "include"))
|
|
|
|
- else:
|
|
|
|
- # fall back to freetype from XQuartz if
|
|
|
|
- # Homebrew's freetype is missing
|
|
|
|
- _add_directory(library_dirs, "/usr/X11/lib")
|
|
|
|
- _add_directory(include_dirs, "/usr/X11/include")
|
2019-03-30 21:58:45 +01:00
|
|
|
-
|
2022-12-02 21:15:34 +01:00
|
|
|
- # SDK install path
|
|
|
|
- sdk_path = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
|
|
|
|
- if not os.path.exists(sdk_path):
|
2019-03-30 21:58:45 +01:00
|
|
|
- try:
|
2022-12-02 21:15:34 +01:00
|
|
|
- sdk_path = (
|
|
|
|
- subprocess.check_output(["xcrun", "--show-sdk-path"])
|
|
|
|
- .strip()
|
|
|
|
- .decode("latin1")
|
|
|
|
- )
|
2019-03-30 21:58:45 +01:00
|
|
|
- except Exception:
|
2022-12-02 21:15:34 +01:00
|
|
|
- sdk_path = None
|
|
|
|
- if sdk_path:
|
|
|
|
- _add_directory(library_dirs, os.path.join(sdk_path, "usr", "lib"))
|
|
|
|
- _add_directory(include_dirs, os.path.join(sdk_path, "usr", "include"))
|
|
|
|
- elif (
|
|
|
|
- sys.platform.startswith("linux")
|
|
|
|
- or sys.platform.startswith("gnu")
|
|
|
|
- or sys.platform.startswith("freebsd")
|
|
|
|
- ):
|
|
|
|
- for dirname in _find_library_dirs_ldconfig():
|
|
|
|
- _add_directory(library_dirs, dirname)
|
|
|
|
- if sys.platform.startswith("linux") and os.environ.get(
|
|
|
|
- "ANDROID_ROOT", None
|
|
|
|
- ):
|
|
|
|
- # termux support for android.
|
|
|
|
- # system libraries (zlib) are installed in /system/lib
|
|
|
|
- # headers are at $PREFIX/include
|
|
|
|
- # user libs are at $PREFIX/lib
|
|
|
|
- _add_directory(
|
|
|
|
- library_dirs, os.path.join(os.environ["ANDROID_ROOT"], "lib")
|
|
|
|
- )
|
|
|
|
-
|
|
|
|
- elif sys.platform.startswith("netbsd"):
|
|
|
|
- _add_directory(library_dirs, "/usr/pkg/lib")
|
|
|
|
- _add_directory(include_dirs, "/usr/pkg/include")
|
|
|
|
-
|
|
|
|
- elif sys.platform.startswith("sunos5"):
|
|
|
|
- _add_directory(library_dirs, "/opt/local/lib")
|
|
|
|
- _add_directory(include_dirs, "/opt/local/include")
|
|
|
|
-
|
|
|
|
- # FIXME: check /opt/stuff directories here?
|
|
|
|
-
|
|
|
|
- # standard locations
|
|
|
|
- if not self.disable_platform_guessing:
|
|
|
|
- _add_directory(library_dirs, "/usr/local/lib")
|
|
|
|
- _add_directory(include_dirs, "/usr/local/include")
|
|
|
|
-
|
|
|
|
- _add_directory(library_dirs, "/usr/lib")
|
|
|
|
- _add_directory(include_dirs, "/usr/include")
|
|
|
|
- # alpine, at least
|
|
|
|
- _add_directory(library_dirs, "/lib")
|
|
|
|
-
|
|
|
|
- if sys.platform == "win32":
|
|
|
|
- # on Windows, look for the OpenJPEG libraries in the location that
|
|
|
|
- # the official installer puts them
|
|
|
|
- program_files = os.environ.get("ProgramFiles", "")
|
|
|
|
- best_version = (0, 0)
|
|
|
|
- best_path = None
|
|
|
|
- for name in os.listdir(program_files):
|
|
|
|
- if name.startswith("OpenJPEG "):
|
|
|
|
- version = tuple(int(x) for x in name[9:].strip().split("."))
|
|
|
|
- if version > best_version:
|
|
|
|
- best_version = version
|
|
|
|
- best_path = os.path.join(program_files, name)
|
|
|
|
-
|
|
|
|
- if best_path:
|
|
|
|
- _dbg("Adding %s to search list", best_path)
|
|
|
|
- _add_directory(library_dirs, os.path.join(best_path, "lib"))
|
|
|
|
- _add_directory(include_dirs, os.path.join(best_path, "include"))
|
|
|
|
-
|
|
|
|
#
|
|
|
|
# insert new dirs *before* default libs, to avoid conflicts
|
|
|
|
# between Python PYD stub libs and real libraries
|