ollama/server/build.py

23 lines
525 B
Python
Raw Normal View History

2023-06-23 21:18:47 +00:00
import site
import os
2023-06-23 22:38:22 +00:00
import shutil
2023-06-23 21:18:47 +00:00
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 = [
"server.py",
"--paths",
site_packages_dir,
"--add-data",
f"{llama_cpp_dir}{os.pathsep}llama_cpp",
"--onefile",
]
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)
2023-06-23 22:38:22 +00:00
shutil.copy2("dist/server", "../client/resources/server")