Skip to content

Commit

Permalink
hooks: add rasterio (#2455)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelotduarte authored Jun 13, 2024
1 parent de7a013 commit c97ad4c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions cx_Freeze/hooks/rasterio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""A collection of functions which are triggered automatically by finder when
rasterio package is included.
"""

from __future__ import annotations

from typing import TYPE_CHECKING

from cx_Freeze.hooks._libs import replace_delvewheel_patch

if TYPE_CHECKING:
from cx_Freeze.finder import ModuleFinder
from cx_Freeze.module import Module


def load_rasterio(finder: ModuleFinder, module: Module) -> None:
"""The rasterio package loads items within itself in a way that causes
problems without libs and data being present.
"""
finder.include_package("rasterio")
distribution = module.distribution
if distribution:
for file in distribution.binary_files:
finder.include_files(
file.locate().resolve(), f"lib/{file.as_posix()}"
)
replace_delvewheel_patch(module)

0 comments on commit c97ad4c

Please sign in to comment.