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

Side by Side Diff: vpython/venv/config.go

Issue 2864423002: vpython: Leave "pip" and related tools. (Closed)
Patch Set: new env Created 3 years, 7 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
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 venv 5 package venv
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "os" 9 "os"
10 "path/filepath" 10 "path/filepath"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 } 177 }
178 178
179 // Generate our environment name based on the deterministic hash of its 179 // Generate our environment name based on the deterministic hash of its
180 // fully-resolved specification. 180 // fully-resolved specification.
181 return cfg.envForName(cfg.envNameForSpec(e.Spec), e), nil 181 return cfg.envForName(cfg.envNameForSpec(e.Spec), e), nil
182 } 182 }
183 183
184 // EnvName returns the VirtualEnv environment name for the environment that cfg 184 // EnvName returns the VirtualEnv environment name for the environment that cfg
185 // describes. 185 // describes.
186 func (cfg *Config) envNameForSpec(s *vpython.Spec) string { 186 func (cfg *Config) envNameForSpec(s *vpython.Spec) string {
187 » name := spec.Hash(s) 187 » name := spec.Hash(s, EnvironmentVersion)
188 if cfg.MaxHashLen > 0 && len(name) > cfg.MaxHashLen { 188 if cfg.MaxHashLen > 0 && len(name) > cfg.MaxHashLen {
189 name = name[:cfg.MaxHashLen] 189 name = name[:cfg.MaxHashLen]
190 } 190 }
191 return name 191 return name
192 } 192 }
193 193
194 // Prune performs a pruning round on the environment set described by this 194 // Prune performs a pruning round on the environment set described by this
195 // Config. 195 // Config.
196 func (cfg *Config) Prune(c context.Context) error { 196 func (cfg *Config) Prune(c context.Context) error {
197 if err := prune(c, cfg, nil); err != nil { 197 if err := prune(c, cfg, nil); err != nil {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 if err := filesystem.AbsPath(&cfg.Python); err != nil { 262 if err := filesystem.AbsPath(&cfg.Python); err != nil {
263 return errors.Annotate(err).Reason("could not get absolute path for: %(python)s"). 263 return errors.Annotate(err).Reason("could not get absolute path for: %(python)s").
264 D("python", cfg.Python). 264 D("python", cfg.Python).
265 Err() 265 Err()
266 } 266 }
267 logging.Debugf(c, "Resolved system Python interpreter (%s): %s", s.Pytho nVersion, cfg.Python) 267 logging.Debugf(c, "Resolved system Python interpreter (%s): %s", s.Pytho nVersion, cfg.Python)
268 return nil 268 return nil
269 } 269 }
270 270
271 func (cfg *Config) systemInterpreter() *python.Interpreter { return cfg.si } 271 func (cfg *Config) systemInterpreter() *python.Interpreter { return cfg.si }
OLDNEW
« no previous file with comments | « vpython/spec/spec_test.go ('k') | vpython/venv/venv.go » ('j') | vpython/venv/venv.go » ('J')

Powered by Google App Engine
This is Rietveld 408576698