Skip to content

Commit 3542ae4

Browse files
committed
Add package-level PyInstaller hook.
This mostly matches the uploaded hook. If this hook needs updating then the contributed hook must be removed.
1 parent 055acbc commit 3542ae4

File tree

5 files changed

+28
-1
lines changed

5 files changed

+28
-1
lines changed

CHANGELOG.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ v2.0.0
88

99
Unreleased
1010
------------------
11+
Added
12+
- Added package-level PyInstaller hook.
1113

1214
12.0.0 - 2021-03-05
1315
-------------------

setup.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
[options.entry_points]
2+
pyinstaller40 =
3+
hook-dirs = tcod.__pyinstaller:get_hook_dirs
4+
15
[aliases]
26
test=pytest
37

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def check_sdl_version():
130130
"Forum": "https://github.com/libtcod/python-tcod/discussions",
131131
},
132132
py_modules=["libtcodpy"],
133-
packages=["tcod"],
133+
packages=["tcod", "tcod.__pyinstaller"],
134134
package_data={"tcod": get_package_data()},
135135
python_requires=">=3.6",
136136
install_requires=[

tcod/__pyinstaller/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"""PyInstaller entry point for tcod."""
2+
import os
3+
from typing import List
4+
5+
6+
def get_hook_dirs() -> List[str]:
7+
"""Return the current directory."""
8+
return [os.path.dirname(__file__)]

tcod/__pyinstaller/hook-tcod.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""PyInstaller hook for tcod.
2+
3+
Added here after tcod 12.0.0.
4+
5+
If this hook is modified then the contributed hook needs to be removed from:
6+
https://github.com/pyinstaller/pyinstaller-hooks-contrib
7+
"""
8+
from PyInstaller.utils.hooks import collect_dynamic_libs
9+
10+
hiddenimports = ["_cffi_backend"]
11+
12+
# Install shared libraries to the working directory.
13+
binaries = collect_dynamic_libs("tcod")

0 commit comments

Comments
 (0)