forked from abetlen/llama-cpp-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhook-llama_cpp.py
More file actions
27 lines (22 loc) · 959 Bytes
/
hook-llama_cpp.py
File metadata and controls
27 lines (22 loc) · 959 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# How to use this file
#
# 1. create a folder called "hooks" in your repo
# 2. copy this file there
# 3. add the --additional-hooks-dir flag to your pyinstaller command:
# ex: `pyinstaller --name binary-name --additional-hooks-dir=./hooks entry-point.py`
from PyInstaller.utils.hooks import collect_data_files, get_package_paths
import os, sys
# Get the package path
package_path = get_package_paths('llama_cpp')[0]
# Collect data files
datas = collect_data_files('llama_cpp')
# Append the additional .dll or .so file
if os.name == 'nt': # Windows
dll_path = os.path.join(package_path, 'llama_cpp', 'llama.dll')
datas.append((dll_path, 'llama_cpp'))
elif sys.platform == 'darwin': # Mac
so_path = os.path.join(package_path, 'llama_cpp', 'llama.dylib')
datas.append((so_path, 'llama_cpp'))
elif os.name == 'posix': # Linux
so_path = os.path.join(package_path, 'llama_cpp', 'libllama.so')
datas.append((so_path, 'llama_cpp'))