diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 1d9c0919..f5d18dac 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -88,6 +88,9 @@ jobs: sudo apt-get install -y libcairo2 # Install libdiscid (dependency of discid python package). sudo apt-get install -y libdiscid0 + # These are dependencies of gmsh + sudo apt-get install -y libglu1 libgl1 libxrender1 libxcursor1 libxft2 \ + libxinerama1 libgomp1 - name: Install brew dependencies if: startsWith(matrix.os, 'macos') diff --git a/news/650.new.rst b/news/650.new.rst new file mode 100644 index 00000000..5daa7333 --- /dev/null +++ b/news/650.new.rst @@ -0,0 +1 @@ +Add hook for ``gmsh``. diff --git a/requirements-test-libraries.txt b/requirements-test-libraries.txt index fb091ee8..541c87c9 100644 --- a/requirements-test-libraries.txt +++ b/requirements-test-libraries.txt @@ -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 diff --git a/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-gmsh.py b/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-gmsh.py new file mode 100644 index 00000000..2bed023f --- /dev/null +++ b/src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-gmsh.py @@ -0,0 +1,28 @@ +# ------------------------------------------------------------------ +# 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. This way, we do not need to +# duplicate the discovery logic. +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!") diff --git a/src/_pyinstaller_hooks_contrib/tests/test_libraries.py b/src/_pyinstaller_hooks_contrib/tests/test_libraries.py index b79f0c79..eab87e34 100644 --- a/src/_pyinstaller_hooks_contrib/tests/test_libraries.py +++ b/src/_pyinstaller_hooks_contrib/tests/test_libraries.py @@ -1849,3 +1849,10 @@ def test_pythainlp(pyi_builder): pyi_builder.test_source(""" import pythainlp """) + + +@importorskip('gmsh') +def test_gmsh(pyi_builder): + pyi_builder.test_source(""" + import gmsh + """)