fix(build): fetch the dependency bundle when its Python is missing
dependencies/ is gitignored, so a fresh clone has none, but a working tree can keep the folder with only the cached tarball. Checking for the folder skipped the download and the build then died with a cryptic missing-Python error. Check the bundle Python itself so an incomplete bundle is fetched.
This commit is contained in:
1 file changed
+18
-4
+18
-4
@@ -367,6 +367,18 @@ func prepend(env_var, path string) {
|
||||
os.Setenv(env_var, path+val)
|
||||
}
|
||||
|
||||
func python_exe() string {
|
||||
switch runtime.GOOS {
|
||||
case "linux":
|
||||
return filepath.Join(root_dir(), "bin", "python")
|
||||
case `darwin`:
|
||||
return filepath.Join(root_dir(), macos_python)
|
||||
default:
|
||||
exit("Building is only supported on Linux and macOS")
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func setup_to_run_python() (python string) {
|
||||
root := root_dir()
|
||||
for _, x := range os.Environ() {
|
||||
@@ -379,18 +391,20 @@ func setup_to_run_python() (python string) {
|
||||
case "linux":
|
||||
prepend("LD_LIBRARY_PATH", filepath.Join(root, "lib"))
|
||||
os.Setenv("PYTHONHOME", root)
|
||||
python = filepath.Join(root, "bin", "python")
|
||||
case `darwin`:
|
||||
python = filepath.Join(root, macos_python)
|
||||
default:
|
||||
exit("Building is only supported on Linux and macOS")
|
||||
}
|
||||
return
|
||||
return python_exe()
|
||||
}
|
||||
|
||||
func build(args []string) {
|
||||
chdir_to_base()
|
||||
if _, err := os.Stat(folder); err != nil {
|
||||
// Check the Python binary instead of the dependencies folder: the folder
|
||||
// survives a git pull (it is gitignored, so a clone has none) but can
|
||||
// contain only the cached tarball, which used to fail later with a
|
||||
// cryptic missing Python error instead of downloading the bundle.
|
||||
if _, err := os.Stat(python_exe()); err != nil {
|
||||
dependencies(nil)
|
||||
}
|
||||
root := root_dir()
|
||||
|
||||
Reference in new issue
Block a user