mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 16:34:02 +01:00
* Set PYTHONPATH environment variable for Python script scrapers * Convert PYTHONPATH to absolute * Generalise and apply to plugins --------- Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
15 lines
349 B
Go
15 lines
349 B
Go
package python
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"os/exec"
|
|
)
|
|
|
|
func AppendPythonPath(cmd *exec.Cmd, path string) {
|
|
// Respect the users PYTHONPATH if set
|
|
if currentValue, set := os.LookupEnv("PYTHONPATH"); set {
|
|
path = fmt.Sprintf("%s%c%s", currentValue, os.PathListSeparator, path)
|
|
}
|
|
cmd.Env = append(os.Environ(), fmt.Sprintf("PYTHONPATH=%s", path))
|
|
}
|