hook-pymeshlab.py 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # ------------------------------------------------------------------
  2. # Copyright (c) 2025 PyInstaller Development Team.
  3. #
  4. # This file is distributed under the terms of the GNU General Public
  5. # License (version 2.0 or later).
  6. #
  7. # The full license is available in LICENSE, distributed with
  8. # this software.
  9. #
  10. # SPDX-License-Identifier: GPL-2.0-or-later
  11. # ------------------------------------------------------------------
  12. from PyInstaller import compat
  13. from PyInstaller.utils.hooks import collect_dynamic_libs, collect_data_files
  14. if compat.is_win:
  15. # On Windows, pymeshlab wheel seems to include Qt libraries and plugins (and their dependencies, as well as meshlab
  16. # plugins), as well as some of data files (such as translation files); all in the top-level package directory.
  17. binaries = collect_dynamic_libs('pymeshlab')
  18. datas = collect_data_files('pymeshlab')
  19. elif compat.is_linux:
  20. # On linux, only Qt libraries and plugins (and their dependencies, as well as meshlab plugins) seem to be included;
  21. # all in lib subdir.
  22. # NOTE: collect_dynamic_libs() does not collect versioned .so files; those are picked up by collect_data_files().
  23. binaries = collect_dynamic_libs('pymeshlab.lib') + collect_data_files('pymeshlab.lib')
  24. elif compat.is_darwin:
  25. # On macOS, Frameworks sub-directory contains Qt .framework bundles and other shared libraries, all of which seem
  26. # to be picked up by binary dependency analysis. Avoid explicitly collecting anything from there to avoid
  27. # interfering with PyInstaller's attempts to fix-up .framework bundle structure (see pyinstaller/pyinstaller#9335).
  28. # The plugins for both meshlab and Qt are in PlugIns directory, and we need to collect those.
  29. binaries = collect_dynamic_libs('pymeshlab.PlugIns')
  30. # On linux, prevent binary dependency analysis from generating symbolic links for bundles shared libraries to the
  31. # top-level application directory. For some god-forsaken reason, the wheel includes a copy of python shared library,
  32. # which might actually be ABI incompatible with version of python that frozen application is built with (for example,
  33. # libpython3.13.so.1.0 shipped with pymeshlab 2025.7 causes `undefined symbol: _Py_GetExecutor` in `_opcode` extension
  34. # collected from Fedora-provided python 3.13.11).
  35. if compat.is_linux:
  36. bindepend_symlink_suppression = [
  37. '**/pymeshlab/lib/*',
  38. ]