Skip to content

Commit

Permalink
Changed the order of names that regolith uses to search for python ex…
Browse files Browse the repository at this point in the history
…ecutable on windows from [python3, python] to [python, python3].
  • Loading branch information
Nusiq committed Dec 3, 2022
1 parent 1e1807b commit 2358b3d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions regolith/compatibility_other_os.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions regolith/compatibility_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion regolith/filter_python.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2358b3d

Please sign in to comment.