feat: update build script to use poetry's venv

This commit is contained in:
jlw_4049 2024-08-25 14:11:31 -04:00
parent d27d3d0653
commit a32b7586d8

@ -1,5 +1,5 @@
from pathlib import Path from pathlib import Path
from subprocess import run from subprocess import run, PIPE
import os import os
import shutil import shutil
import sys import sys
@ -31,11 +31,23 @@ def build_app():
icon_path = project_root / "images" / "icon.ico" icon_path = project_root / "images" / "icon.ico"
additional_hooks_path = Path(Path.cwd() / "hooks") additional_hooks_path = Path(Path.cwd() / "hooks")
# paths to needed vapoursynth files # get poetry venv path
vapoursynth_64 = project_root / ".venv" / "Lib" / "site-packages" / "vapoursynth64" poetry_venv_path = run(
vapoursynth_64_portable = ( ["cmd", "/c", "poetry", "env", "info", "--path"],
project_root / ".venv" / "Lib" / "site-packages" / "portable.vs" stdout=PIPE,
stderr=PIPE,
text=True,
check=True,
) )
if poetry_venv_path.returncode == 0 and poetry_venv_path.stdout:
poetry_venv_path = Path(poetry_venv_path.stdout.strip())
site_packages = poetry_venv_path / "Lib" / "site-packages"
# get paths to needed vapoursynth files in poetry venv
vapoursynth_64 = site_packages / "vapoursynth64"
vapoursynth_64_portable = site_packages / "portable.vs"
else:
raise FileNotFoundError("Cannot find path to poetry venv")
# Change directory so PyInstaller outputs all of its files in its own folder # Change directory so PyInstaller outputs all of its files in its own folder
os.chdir(pyinstaller_folder) os.chdir(pyinstaller_folder)