Skip to content

Commit

Permalink
Update hiddenimports for pymssql 2.2.0+ (#315)
Browse files Browse the repository at this point in the history
* hook: fix pymssql._mssql hidden cython extension import
* Add decimal as an hidden import
  • Loading branch information
eric15342335 committed Sep 7, 2021
1 parent 5d5bca6 commit 86a6eb7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions news/315.update.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update hiddenimports for ``pymssql > 2.1.5``.
1 change: 1 addition & 0 deletions requirements-test-libraries.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pyexcelerate==0.10.0
pylint==2.10.2
pyusb==1.2.1
pynput==1.7.3
pymssql==2.2.2
pystray==0.17.3
pyzmq==22.2.1
PyQt5==5.15.4
Expand Down
11 changes: 9 additions & 2 deletions src/_pyinstaller_hooks_contrib/hooks/stdhooks/hook-pymssql.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ------------------------------------------------------------------
# Copyright (c) 2020 PyInstaller Development Team.
# Copyright (c) 2020-2021 PyInstaller Development Team.
#
# This file is distributed under the terms of the GNU General Public
# License (version 2.0 or later).
Expand All @@ -10,4 +10,11 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# ------------------------------------------------------------------

hiddenimports = ['_mssql']
from PyInstaller.utils.hooks import is_module_satisfies

hiddenimports = ["decimal"]
# In newer versions of pymssql, the _mssql was under pymssql
if is_module_satisfies("pymssql > 2.1.5"):
hiddenimports += ["pymssql._mssql", "uuid"]
else:
hiddenimports += ["_mssql"]
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 @@ -787,3 +787,10 @@ def test_tableauhyperapi(pyi_builder):
pyi_builder.test_source("""
import tableauhyperapi
""")


@importorskip("pymssql")
def test_pymssql(pyi_builder):
pyi_builder.test_source("""
import pymssql
""")

0 comments on commit 86a6eb7

Please sign in to comment.