| OLD | NEW |
| 1 // Copyright 2017 The LUCI Authors. All rights reserved. | 1 // Copyright 2017 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package venv | 5 package venv |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "encoding/json" | 8 "encoding/json" |
| 9 "flag" | 9 "flag" |
| 10 "fmt" | 10 "fmt" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 return c | 40 return c |
| 41 } | 41 } |
| 42 | 42 |
| 43 type resolvedInterpreter struct { | 43 type resolvedInterpreter struct { |
| 44 py *python.Interpreter | 44 py *python.Interpreter |
| 45 version python.Version | 45 version python.Version |
| 46 } | 46 } |
| 47 | 47 |
| 48 func resolveFromPath(vers python.Version) *resolvedInterpreter { | 48 func resolveFromPath(vers python.Version) *resolvedInterpreter { |
| 49 c := testContext() | 49 c := testContext() |
| 50 » py, err := python.Find(c, vers) | 50 » py, err := python.Find(c, vers, nil) |
| 51 if err != nil { | 51 if err != nil { |
| 52 return nil | 52 return nil |
| 53 } | 53 } |
| 54 if err := filesystem.AbsPath(&py.Python); err != nil { | 54 if err := filesystem.AbsPath(&py.Python); err != nil { |
| 55 panic(err) | 55 panic(err) |
| 56 } | 56 } |
| 57 | 57 |
| 58 ri := resolvedInterpreter{ | 58 ri := resolvedInterpreter{ |
| 59 py: py, | 59 py: py, |
| 60 } | 60 } |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 path := actual.(string) | 279 path := actual.(string) |
| 280 switch _, err := os.Stat(path); { | 280 switch _, err := os.Stat(path); { |
| 281 case err == nil: | 281 case err == nil: |
| 282 return fmt.Sprintf("Path %q should not exist, but it does.", pat
h) | 282 return fmt.Sprintf("Path %q should not exist, but it does.", pat
h) |
| 283 case os.IsNotExist(err): | 283 case os.IsNotExist(err): |
| 284 return "" | 284 return "" |
| 285 default: | 285 default: |
| 286 return fmt.Sprintf("Couldn't check if %q exists: %s", path, err) | 286 return fmt.Sprintf("Couldn't check if %q exists: %s", path, err) |
| 287 } | 287 } |
| 288 } | 288 } |
| OLD | NEW |