Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(474)

Unified Diff: vpython/venv/config.go

Issue 2925723004: [vpython] Implement smart probing. (Closed)
Patch Set: sentinel text Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « vpython/python/interpreter.go ('k') | vpython/venv/venv_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vpython/venv/config.go
diff --git a/vpython/venv/config.go b/vpython/venv/config.go
index 1a086754ecd00b26c98dd5f0c39a7140b9941b49..e68ad324df28fad6313b4169f8f86485410bd12a 100644
--- a/vpython/venv/config.go
+++ b/vpython/venv/config.go
@@ -49,6 +49,10 @@ type Config struct {
// based on the Spec and the current PATH.
Python string
+ // LookPathFunc, if not nil, will be used instead of exec.LookPath to find the
+ // underlying Python interpreter.
+ LookPathFunc python.LookPathFunc
+
// Spec is the specification file to use to construct the VirtualEnv. If
// nil, or if fields are missing, they will be filled in by probing the system
// PATH.
@@ -254,7 +258,7 @@ func (cfg *Config) resolvePythonInterpreter(c context.Context, s *vpython.Spec)
if cfg.Python == "" {
// No explicitly-specified Python path. Determine one based on the
// specification.
- if cfg.si, err = python.Find(c, specVers); err != nil {
+ if cfg.si, err = python.Find(c, specVers, cfg.LookPathFunc); err != nil {
return errors.Annotate(err).Reason("could not find Python for: %(vers)s").
D("vers", specVers).
Err()
« no previous file with comments | « vpython/python/interpreter.go ('k') | vpython/venv/venv_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698