-
-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4b8185e
commit aa4eb8c
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"""A collection of functions which are triggered automatically by finder when | ||
VTK package is included. | ||
""" | ||
|
||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
from cx_Freeze._compat import IS_WINDOWS | ||
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_vtkmodules(finder: ModuleFinder, module: Module) -> None: | ||
"""The VTK (vtkmodules) package. | ||
Supported pypi versions (tested from 9.2.6 to 9.3.1). | ||
""" | ||
source_dir = module.file.parent.parent / "vtk.libs" | ||
if source_dir.exists(): # vtk >= 9.3.0 | ||
target_dir = f"lib/{source_dir.name}" | ||
if IS_WINDOWS: | ||
finder.include_files(source_dir, target_dir) | ||
replace_delvewheel_patch(module, source_dir.name) | ||
else: | ||
for source in source_dir.iterdir(): | ||
finder.lib_files[source] = f"{target_dir}/{source.name}" | ||
module.ignore_names.add("_vtkmodules_static") | ||
module.ignore_names.add("vtkmodules._build_paths") |