2023-06-23 21:18:47 +00:00
|
|
|
import site
|
|
|
|
import os
|
|
|
|
from PyInstaller.__main__ import run as pyi_run
|
|
|
|
|
2023-06-23 22:38:22 +00:00
|
|
|
# the llama_cpp directory is not included if not explicitly added
|
2023-06-23 21:18:47 +00:00
|
|
|
site_packages_dir = site.getsitepackages()[0]
|
|
|
|
llama_cpp_dir = os.path.join(site_packages_dir, "llama_cpp")
|
|
|
|
|
|
|
|
args = [
|
2023-06-25 17:08:03 +00:00
|
|
|
"proto.py",
|
2023-06-23 21:18:47 +00:00
|
|
|
"--paths",
|
|
|
|
site_packages_dir,
|
|
|
|
"--add-data",
|
|
|
|
f"{llama_cpp_dir}{os.pathsep}llama_cpp",
|
2023-06-25 04:30:02 +00:00
|
|
|
"--onefile"
|
2023-06-23 21:18:47 +00:00
|
|
|
]
|
|
|
|
|
2023-06-23 22:38:22 +00:00
|
|
|
# generate the .spec file and run PyInstaller
|
2023-06-23 21:18:47 +00:00
|
|
|
pyi_run(args)
|