Skip to content

Commit

Permalink
hooks: add hook for gmsh
Browse files Browse the repository at this point in the history
  • Loading branch information
rokm committed Oct 5, 2023
1 parent 104c8dc commit 0b25453
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions news/650.new.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add hook for ``gmsh``.
1 change: 1 addition & 0 deletions requirements-test-libraries.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ sudachidict-full==20230927
wxPython==4.2.1; sys_platform == 'darwin' or sys_platform == 'win32' # PyPI provides binary wheels for Windows and macOS
laonlp==1.1.2
pythainlp==4.1.0b5
gmsh==4.11.1

# ------------------- Platform (OS) specifics

Expand Down
27 changes: 27 additions & 0 deletions src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-gmsh.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# ------------------------------------------------------------------
# Copyright (c) 2023 PyInstaller Development Team.
#
# This file is distributed under the terms of the GNU General Public
# License (version 2.0 or later).
#
# The full license is available in LICENSE.GPL.txt, distributed with
# this software.
#
# SPDX-License-Identifier: GPL-2.0-or-later
# ------------------------------------------------------------------

import os

from PyInstaller.utils.hooks import logger, get_module_attribute

# Query the `libpath` attribute of the `gmsh` module to obtain the path to shared library.
try:
lib_file = get_module_attribute('gmsh', 'libpath')
except Exception:
logger.warning("Failed to query gmsh.libpath!", exc_info=True)
lib_file = None

if lib_file and os.path.isfile(lib_file):
binaries = [(lib_file, '.')]
else:
logger.warning("Could not find gmsh shared library - gmsh will likely fail to load at run-time!")
7 changes: 7 additions & 0 deletions src/_pyinstaller_hooks_contrib/tests/test_libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -1849,3 +1849,10 @@ def test_pythainlp(pyi_builder):
pyi_builder.test_source("""
import pythainlp
""")


@importorskip
def test_gmsh(pyi_builder):
pyi_builder.test_source("""
import gmsh
""")

0 comments on commit 0b25453

Please sign in to comment.