build.py 477 B

1234567891011121314151617181920
  1. import site
  2. import os
  3. from PyInstaller.__main__ import run as pyi_run
  4. # Get the directory of site-packages and llama_cpp
  5. site_packages_dir = site.getsitepackages()[0]
  6. llama_cpp_dir = os.path.join(site_packages_dir, "llama_cpp")
  7. # Prepare the arguments for PyInstaller
  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)