diff --git a/regolith/compatibility_other_os.go b/regolith/compatibility_other_os.go index 2f904e56..cc2d6c09 100644 --- a/regolith/compatibility_other_os.go +++ b/regolith/compatibility_other_os.go @@ -5,6 +5,12 @@ package regolith import "github.com/Bedrock-OSS/go-burrito/burrito" +// pythonExeNames is the list of strings with possible names of the Python +// executable. The order of the names determines the order in which they are +// tried. +var pythonExeNames = []string{"python3", "python"} + + // venvScriptsPath is a folder name between "venv" and "python" that leads to // the python executable. const venvScriptsPath = "bin" diff --git a/regolith/compatibility_windows.go b/regolith/compatibility_windows.go index 37809684..c1f7ee56 100644 --- a/regolith/compatibility_windows.go +++ b/regolith/compatibility_windows.go @@ -12,6 +12,11 @@ import ( "golang.org/x/sys/windows" ) +// pythonExeNames is the list of strings with possible names of the Python +// executable. The order of the names determines the order in which they are +// tried. +var pythonExeNames = []string{"python", "python3"} + // venvScriptsPath is a folder name between "venv" and "python" that leads to // the python executable. const venvScriptsPath = "Scripts" diff --git a/regolith/filter_python.go b/regolith/filter_python.go index 74d62679..786ec52a 100644 --- a/regolith/filter_python.go +++ b/regolith/filter_python.go @@ -239,7 +239,7 @@ func needsVenv(requirementsFilePath string) bool { func findPython() (string, error) { var err error - for _, c := range []string{"python3", "python"} { + for _, c := range pythonExeNames { _, err = exec.LookPath(c) if err == nil { return c, nil