Skip to content

Commit

Permalink
hooks: add hook for sspilib
Browse files Browse the repository at this point in the history
Add hook for `sspilib` that collects submodules of `sspilib.raw`,
most of which are cythonized extensions.
  • Loading branch information
rokm committed Dec 11, 2023
1 parent 95a6577 commit b009dee
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
2 changes: 2 additions & 0 deletions news/669.new.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Add hook for ``sspilib`` that collects submodules of ``sspilib.raw``,
most of which are cythonized extensions.
1 change: 1 addition & 0 deletions requirements-test-libraries.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ wxPython==4.2.1; sys_platform == 'darwin' or sys_platform == 'win32' # PyPI pro
laonlp==1.1.3
pythainlp==4.1.0b5
gmsh==4.11.1
sspilib==0.1.0

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

Expand Down
20 changes: 20 additions & 0 deletions src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-sspilib.raw.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# ------------------------------------------------------------------
# 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
# ------------------------------------------------------------------

from PyInstaller.utils.hooks import collect_submodules

# This seems to be required in python <= 3.9; in later versions, the `dataclasses` module ends up included via a
# different import chain. But for the sake of consistency, keep the hiddenimport for all python versions.
hiddenimports = ['dataclasses']

# Collect submodules of `sspilib.raw` - most of which are cythonized extensions.
hiddenimports += collect_submodules('sspilib.raw')
19 changes: 19 additions & 0 deletions src/_pyinstaller_hooks_contrib/tests/test_libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -1881,3 +1881,22 @@ def test_gmsh(pyi_builder):
pyi_builder.test_source("""
import gmsh
""")


@importorskip('sspilib')
def test_sspilib(pyi_builder):
pyi_builder.test_source("""
import sspilib
cred = sspilib.UserCredential(
"username@DOMAIN.COM",
"password",
)
ctx = sspilib.ClientSecurityContext(
"host/server.domain.com",
credential=cred,
)
print(ctx)
""")

0 comments on commit b009dee

Please sign in to comment.