hook-gmsh.py 999 B

12345678910111213141516171819202122232425262728
  1. # ------------------------------------------------------------------
  2. # Copyright (c) 2023 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. import os
  13. from PyInstaller.utils.hooks import logger, get_module_attribute
  14. # Query the `libpath` attribute of the `gmsh` module to obtain the path to shared library. This way, we do not need to
  15. # duplicate the discovery logic.
  16. try:
  17. lib_file = get_module_attribute('gmsh', 'libpath')
  18. except Exception:
  19. logger.warning("Failed to query gmsh.libpath!", exc_info=True)
  20. lib_file = None
  21. if lib_file and os.path.isfile(lib_file):
  22. binaries = [(lib_file, '.')]
  23. else:
  24. logger.warning("Could not find gmsh shared library - gmsh will likely fail to load at run-time!")