prependPythonPath returns a copy of env with the given directory prepended to PYTHONPATH.
(env []string, dir string)
| 1243 | |
| 1244 | // prependPythonPath returns a copy of env with the given directory prepended to PYTHONPATH. |
| 1245 | func prependPythonPath(env []string, dir string) []string { |
| 1246 | const prefix = "PYTHONPATH=" |
| 1247 | result := make([]string, len(env)) |
| 1248 | copy(result, env) |
| 1249 | for i, e := range result { |
| 1250 | if strings.HasPrefix(e, prefix) { |
| 1251 | result[i] = prefix + dir + string(os.PathListSeparator) + e[len(prefix):] |
| 1252 | return result |
| 1253 | } |
| 1254 | } |
| 1255 | result = append(result, prefix+dir) |
| 1256 | return result |
| 1257 | } |
| 1258 | |
| 1259 | // reMissingConfig matches Pulumi's "Missing required configuration variable 'ns:key'" message. |
| 1260 | var reMissingConfig = regexp.MustCompile(`Missing required configuration variable '([^']+)'`) |