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

Side by Side Diff: vpython/python/find.go

Issue 2905943002: [vpython] Incorporate interpreter path/hash. (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « vpython/api/vpython/env.pb.go ('k') | vpython/python/interpreter.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 python 5 package python
6 6
7 import ( 7 import (
8 "os/exec" 8 "os/exec"
9 9
10 "github.com/luci/luci-go/common/errors" 10 "github.com/luci/luci-go/common/errors"
(...skipping 27 matching lines...) Expand all
38 if e, ok := err.(*exec.Error); ok && e.Err == exec.ErrNo tFound { 38 if e, ok := err.(*exec.Error); ok && e.Err == exec.ErrNo tFound {
39 // Not found is okay. 39 // Not found is okay.
40 continue 40 continue
41 } 41 }
42 return nil, errors.Annotate(err).Reason("failed to searc h PATH for: %(interp)q"). 42 return nil, errors.Annotate(err).Reason("failed to searc h PATH for: %(interp)q").
43 D("interp", s). 43 D("interp", s).
44 Err() 44 Err()
45 } 45 }
46 46
47 i := Interpreter{Python: p} 47 i := Interpreter{Python: p}
48 if err := i.Normalize(); err != nil {
49 return nil, err
50 }
51
48 iv, err := i.GetVersion(c) 52 iv, err := i.GetVersion(c)
49 if err != nil { 53 if err != nil {
50 return nil, errors.Annotate(err).Reason("failed to get v ersion for: %(interp)q"). 54 return nil, errors.Annotate(err).Reason("failed to get v ersion for: %(interp)q").
51 » » » » D("interp", p). 55 » » » » D("interp", i.Python).
52 Err() 56 Err()
53 } 57 }
54 if vers.IsSatisfiedBy(iv) { 58 if vers.IsSatisfiedBy(iv) {
55 return &i, nil 59 return &i, nil
56 } 60 }
57 } 61 }
58 62
59 return nil, errors.New("no Python found") 63 return nil, errors.New("no Python found")
60 } 64 }
OLDNEW
« no previous file with comments | « vpython/api/vpython/env.pb.go ('k') | vpython/python/interpreter.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698