Skip to content

Commit 71dbaa2

Browse files
committed
script
1 parent 1372e4f commit 71dbaa2

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

scripts/hook-llama_cpp.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# How to use this file
2+
#
3+
# 1. create a folder called "hooks" in your repo
4+
# 2. copy this file there
5+
# 3. add the --additional-hooks-dir flag to your pyinstaller command:
6+
# ex: `pyinstaller --name binary-name --additional-hooks-dir=./hooks entry-point.py`
7+
8+
9+
from PyInstaller.utils.hooks import collect_data_files, get_package_paths
10+
import os
11+
12+
# Get the package path
13+
package_path = get_package_paths('llama_cpp')[0]
14+
15+
# Collect data files
16+
datas = collect_data_files('llama_cpp')
17+
18+
# Append the additional .dll or .so file
19+
if os.name == 'nt': # Windows
20+
dll_path = os.path.join(package_path, 'llama_cpp', 'llama.dll')
21+
datas.append((dll_path, 'llama_cpp'))
22+
elif os.name == 'posix': # Linux/Mac
23+
so_path = os.path.join(package_path, 'llama_cpp', 'llama.so')
24+
datas.append((so_path, 'llama_cpp'))

0 commit comments

Comments
 (0)