build.py 525 B

12345678910111213141516171819202122
  1. import site
  2. import os
  3. import shutil
  4. from PyInstaller.__main__ import run as pyi_run
  5. # the llama_cpp directory is not included if not explicitly added
  6. site_packages_dir = site.getsitepackages()[0]
  7. llama_cpp_dir = os.path.join(site_packages_dir, "llama_cpp")
  8. args = [
  9. "server.py",
  10. "--paths",
  11. site_packages_dir,
  12. "--add-data",
  13. f"{llama_cpp_dir}{os.pathsep}llama_cpp",
  14. "--onefile",
  15. ]
  16. # generate the .spec file and run PyInstaller
  17. pyi_run(args)
  18. shutil.copy2("dist/server", "../client/resources/server")