Skip to content

Commit

Permalink
hooks: improve hook for pillow [macos] (#1952)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelotduarte authored Jul 7, 2023
1 parent bd25e07 commit 5ba5144
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
5 changes: 0 additions & 5 deletions cx_Freeze/hooks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,6 @@ def load_pikepdf(finder: ModuleFinder, module: Module) -> None:
finder.include_package("pikepdf")


def load_PIL(finder: ModuleFinder, module: Module) -> None:
"""The Pillow must be loaded as a package."""
finder.include_package("PIL")


def load_plotly(finder: ModuleFinder, module: Module) -> None:
"""The plotly must be loaded as a package."""
finder.include_package("plotly")
Expand Down
20 changes: 20 additions & 0 deletions cx_Freeze/hooks/pil.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""A collection of functions which are triggered automatically by finder when
Pillow (PIL) package is included.
"""

from __future__ import annotations

from .._compat import IS_MACOS
from ..finder import ModuleFinder
from ..module import Module


def load_pil(finder: ModuleFinder, module: Module) -> None:
"""The Pillow must be loaded as a package."""
finder.include_package("PIL")

# [macos] copy dependent files when using zip_include_packages
if IS_MACOS:
source_dir = module.file.parent / ".dylibs"
if source_dir.exists() and module.in_file_system == 0:
finder.include_files(source_dir, "lib/.dylibs")

0 comments on commit 5ba5144

Please sign in to comment.