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

Unified Diff: vpython/application/subcommand_install.go

Issue 2918623003: [vpython] Verify environment, named installs. (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « vpython/application/subcommand_delete.go ('k') | vpython/application/subcommand_verify.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vpython/application/subcommand_install.go
diff --git a/vpython/application/subcommand_install.go b/vpython/application/subcommand_install.go
index b9549f84e848090da73f0f26cbc11f5bad79bc6d..8e60d9a8dbeb1df0d6f62223ee6b6f5935fb8f1b 100644
--- a/vpython/application/subcommand_install.go
+++ b/vpython/application/subcommand_install.go
@@ -21,17 +21,29 @@ var subcommandInstall = &subcommands.Command{
LongDesc: "installs the configured VirtualEnv, but doesn't run any associated commands",
Advanced: false,
CommandRun: func() subcommands.CommandRun {
- return &installCommandRun{}
+ var cr installCommandRun
+
+ fs := cr.GetFlags()
+ fs.StringVar(&cr.name, "name", cr.name,
+ "Use this VirtualEnv name, instead of generating one via hash. This will force specification "+
+ "validation, causing any existing VirtualEnv with this name to be deleted and reprovisioned "+
+ "if it doesn't match.")
+
+ return &cr
},
}
type installCommandRun struct {
subcommands.CommandRunBase
+
+ name string
}
func (cr *installCommandRun) Run(app subcommands.Application, args []string, env subcommands.Env) int {
c := cli.GetContext(app, cr, env)
a := getApplication(c, args)
+ a.opts.EnvConfig.PruneThreshold = 0 // Don't prune on install.
+ a.opts.EnvConfig.OverrideName = cr.name
return run(c, func(c context.Context) error {
err := venv.With(c, a.opts.EnvConfig, false, func(context.Context, *venv.Env) error {
« no previous file with comments | « vpython/application/subcommand_delete.go ('k') | vpython/application/subcommand_verify.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698