Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 6 additions & 29 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,6 @@ def get_version() -> str:


PILLOW_VERSION = get_version()
AVIF_ROOT = None
FREETYPE_ROOT = None
HARFBUZZ_ROOT = None
FRIBIDI_ROOT = None
IMAGEQUANT_ROOT = None
JPEG2K_ROOT = None
JPEG_ROOT = None
LCMS_ROOT = None
RAQM_ROOT = None
TIFF_ROOT = None
WEBP_ROOT = None
ZLIB_ROOT = None
FUZZING_BUILD = "LIB_FUZZING_ENGINE" in os.environ

if sys.platform == "win32" and sys.version_info >= (3, 16):
Expand Down Expand Up @@ -517,36 +505,25 @@ def build_extensions(self) -> None:
"LCMS_ROOT": "lcms2",
"IMAGEQUANT_ROOT": "libimagequant",
}.items():
root = globals()[root_name]

if root is None and root_name in os.environ:
root = None
if root_name in os.environ:
root_prefix = os.environ[root_name]
root = (
os.path.join(root_prefix, "lib"),
os.path.join(root_prefix, "include"),
[os.path.join(root_prefix, "lib")],
[os.path.join(root_prefix, "include")],
)

if root is None and pkg_config:
elif pkg_config:
for lib_name2 in (
[lib_name] if isinstance(lib_name, str) else lib_name
):
_dbg("Looking for `%s` using pkg-config.", lib_name2)
if root := pkg_config(lib_name2):
break

if isinstance(root, tuple):
if root is not None:
lib_root, include_root = root
else:
lib_root = include_root = root

if lib_root is not None:
if not isinstance(lib_root, (tuple, list)):
lib_root = (lib_root,)
for lib_dir in lib_root:
_add_directory(library_dirs, lib_dir)
if include_root is not None:
if not isinstance(include_root, (tuple, list)):
include_root = (include_root,)
for include_dir in include_root:
_add_directory(include_dirs, include_dir)

Expand Down
Loading