2024-05-06 18:29:44 +00:00
|
|
|
package plugin
|
|
|
|
|
|
|
|
import (
|
2024-05-17 19:49:52 +00:00
|
|
|
"os"
|
|
|
|
|
|
|
|
plugin_exec "github.com/thegeeklab/wp-plugin-go/v3/exec"
|
2024-05-06 18:29:44 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
const pipBin = "/usr/local/bin/pip"
|
|
|
|
|
|
|
|
// PipInstall returns a command to install Python packages from a requirements file.
|
|
|
|
// The command will upgrade any existing packages and install the packages specified in the given requirements file.
|
2024-05-17 19:49:52 +00:00
|
|
|
func PipInstall(req string) *plugin_exec.Cmd {
|
2024-05-06 18:29:44 +00:00
|
|
|
args := []string{
|
|
|
|
"install",
|
|
|
|
"--upgrade",
|
|
|
|
"--requirement",
|
|
|
|
req,
|
|
|
|
}
|
|
|
|
|
2024-05-17 19:49:52 +00:00
|
|
|
cmd := plugin_exec.Command(pipBin, args...)
|
|
|
|
cmd.Stdout = os.Stdout
|
|
|
|
cmd.Stderr = os.Stderr
|
|
|
|
|
|
|
|
return cmd
|
2024-05-06 18:29:44 +00:00
|
|
|
}
|