mirror of
https://github.com/jamiepine/voicebox.git
synced 2026-10-03 09:05:17 -07:00
fix(build): pass PyInstaller hook paths relative so .spec is portable
Absolute paths ended up in the auto-regenerated voicebox-server.spec because build_binary.py prefixed every --runtime-hook and --additional-hooks-dir with str(backend_dir / ...). That broke builds on any machine whose checkout wasn't at /Users/jamie/... and anyone invoking pyinstaller voicebox-server.spec directly. os.chdir(backend_dir) already runs before PyInstaller (same reason server.py works as a bare filename), so the backend_dir prefix is unnecessary. Drop it so the generated spec references pyi_hooks/, pyi_rth_numpy_compat.py, pyi_rth_torch_compiler_disable.py as repo- relative paths. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
6548c7e65a
commit
60110eeb0a
@@ -55,20 +55,23 @@ def build_server(cuda=False):
|
|||||||
# numpy 2.x / torch ABI mismatch fix: install memmove fallback for
|
# numpy 2.x / torch ABI mismatch fix: install memmove fallback for
|
||||||
# torch.from_numpy() before the app starts. Runtime hooks run after
|
# torch.from_numpy() before the app starts. Runtime hooks run after
|
||||||
# FrozenImporter is registered so frozen torch/numpy are importable.
|
# FrozenImporter is registered so frozen torch/numpy are importable.
|
||||||
|
# Paths are passed relative to backend_dir because os.chdir(backend_dir)
|
||||||
|
# runs before PyInstaller. Absolute paths would get baked into the
|
||||||
|
# generated .spec, breaking reproducible builds on other machines / CI.
|
||||||
args.extend(
|
args.extend(
|
||||||
[
|
[
|
||||||
"--runtime-hook",
|
"--runtime-hook",
|
||||||
str(backend_dir / "pyi_rth_numpy_compat.py"),
|
"pyi_rth_numpy_compat.py",
|
||||||
# Stub torch.compiler.disable before transformers imports
|
# Stub torch.compiler.disable before transformers imports
|
||||||
# flex_attention, which otherwise triggers torch._dynamo →
|
# flex_attention, which otherwise triggers torch._dynamo →
|
||||||
# torch._numpy._ufuncs and crashes at module load under
|
# torch._numpy._ufuncs and crashes at module load under
|
||||||
# PyInstaller. See pyi_rth_torch_compiler_disable.py.
|
# PyInstaller. See pyi_rth_torch_compiler_disable.py.
|
||||||
"--runtime-hook",
|
"--runtime-hook",
|
||||||
str(backend_dir / "pyi_rth_torch_compiler_disable.py"),
|
"pyi_rth_torch_compiler_disable.py",
|
||||||
# Per-module collection overrides (e.g. forcing scipy.stats._distn_infrastructure
|
# Per-module collection overrides (e.g. forcing scipy.stats._distn_infrastructure
|
||||||
# to bundle .py source alongside .pyc so the runtime hook can source-patch it).
|
# to bundle .py source alongside .pyc so the runtime hook can source-patch it).
|
||||||
"--additional-hooks-dir",
|
"--additional-hooks-dir",
|
||||||
str(backend_dir / "pyi_hooks"),
|
"pyi_hooks",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -58,9 +58,9 @@ a = Analysis(
|
|||||||
binaries=binaries,
|
binaries=binaries,
|
||||||
datas=datas,
|
datas=datas,
|
||||||
hiddenimports=hiddenimports,
|
hiddenimports=hiddenimports,
|
||||||
hookspath=['/Users/jamie/Projects/spacedriveapp/voicebox/backend/pyi_hooks'],
|
hookspath=['pyi_hooks'],
|
||||||
hooksconfig={},
|
hooksconfig={},
|
||||||
runtime_hooks=['/Users/jamie/Projects/spacedriveapp/voicebox/backend/pyi_rth_numpy_compat.py', '/Users/jamie/Projects/spacedriveapp/voicebox/backend/pyi_rth_torch_compiler_disable.py'],
|
runtime_hooks=['pyi_rth_numpy_compat.py', 'pyi_rth_torch_compiler_disable.py'],
|
||||||
excludes=['nvidia', 'nvidia.cublas', 'nvidia.cuda_cupti', 'nvidia.cuda_nvrtc', 'nvidia.cuda_runtime', 'nvidia.cudnn', 'nvidia.cufft', 'nvidia.curand', 'nvidia.cusolver', 'nvidia.cusparse', 'nvidia.nccl', 'nvidia.nvjitlink', 'nvidia.nvtx'],
|
excludes=['nvidia', 'nvidia.cublas', 'nvidia.cuda_cupti', 'nvidia.cuda_nvrtc', 'nvidia.cuda_runtime', 'nvidia.cudnn', 'nvidia.cufft', 'nvidia.curand', 'nvidia.cusolver', 'nvidia.cusparse', 'nvidia.nccl', 'nvidia.nvjitlink', 'nvidia.nvtx'],
|
||||||
noarchive=False,
|
noarchive=False,
|
||||||
optimize=0,
|
optimize=0,
|
||||||
|
|||||||
Reference in New Issue
Block a user