zlh-agent/internal/provision/devcontainer/python/verify.go

36 lines
682 B
Go

package python
import (
"fmt"
"os/exec"
"zlh-agent/internal/state"
)
/*
Verify validates that the Python dev container runtime is usable.
Responsibilities:
- Ensure `python3` is present and executable
- Ensure `pip3` is present and executable
IMPORTANT:
- No installation here
- No state mutation
- Safe to call multiple times
*/
func Verify(cfg state.Config) error {
// Check python3 binary
if _, err := exec.LookPath("python3"); err != nil {
return fmt.Errorf("python3 binary not found in PATH")
}
// Check pip3 binary
if _, err := exec.LookPath("pip3"); err != nil {
return fmt.Errorf("pip3 binary not found in PATH")
}
return nil
}