Skip to content

Commit

Permalink
Merge pull request #241 from Bedrock-OSS/python-exe-on-windows
Browse files Browse the repository at this point in the history
Changed the order of names that regolith uses to search for python executable
  • Loading branch information
Nusiq authored Dec 3, 2022
2 parents 1e1807b + 2358b3d commit 4349664
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 4349664

Please sign in to comment.