| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. |
| 4 |
| 5 package application |
| 6 |
| 7 import ( |
| 8 "github.com/luci/luci-go/common/cli" |
| 9 "github.com/luci/luci-go/common/errors" |
| 10 "github.com/luci/luci-go/common/logging" |
| 11 "github.com/luci/luci-go/vpython/venv" |
| 12 |
| 13 "github.com/maruel/subcommands" |
| 14 "golang.org/x/net/context" |
| 15 ) |
| 16 |
| 17 var subcommandInstall = &subcommands.Command{ |
| 18 UsageLine: "install", |
| 19 ShortDesc: "installs the configured VirtualEnv", |
| 20 LongDesc: "installs the configured VirtualEnv, but doesn't run any asso
ciated commands", |
| 21 Advanced: false, |
| 22 CommandRun: func() subcommands.CommandRun { |
| 23 return &installCommandRun{} |
| 24 }, |
| 25 } |
| 26 |
| 27 type installCommandRun struct { |
| 28 subcommands.CommandRunBase |
| 29 } |
| 30 |
| 31 func (cr *installCommandRun) Run(app subcommands.Application, args []string, env
subcommands.Env) int { |
| 32 c := cli.GetContext(app, cr, env) |
| 33 cfg := getConfig(c) |
| 34 |
| 35 return run(c, func(c context.Context) error { |
| 36 err := venv.With(c, cfg.Opts.EnvConfig, false, func(context.Cont
ext, *venv.Env) error { |
| 37 return nil |
| 38 }) |
| 39 if err != nil { |
| 40 return errors.Annotate(err).Reason("failed to setup the
environment").Err() |
| 41 } |
| 42 |
| 43 logging.Infof(c, "Successfully setup the enviornment.") |
| 44 return nil |
| 45 }) |
| 46 } |
| OLD | NEW |