| 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 application | 5 package application |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "strings" | 8 "strings" |
| 9 | 9 |
| 10 "github.com/maruel/subcommands" | 10 "github.com/maruel/subcommands" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 func (cr *verifyCommandRun) Run(app subcommands.Application, args []string, env
subcommands.Env) int { | 36 func (cr *verifyCommandRun) Run(app subcommands.Application, args []string, env
subcommands.Env) int { |
| 37 c := cli.GetContext(app, cr, env) | 37 c := cli.GetContext(app, cr, env) |
| 38 a := getApplication(c, args) | 38 a := getApplication(c, args) |
| 39 | 39 |
| 40 return run(c, func(c context.Context) error { | 40 return run(c, func(c context.Context) error { |
| 41 // Make sure that we can resolve the referenced specifiction. | 41 // Make sure that we can resolve the referenced specifiction. |
| 42 if err := a.opts.ResolveSpec(c); err != nil { | 42 if err := a.opts.ResolveSpec(c); err != nil { |
| 43 return errors.Annotate(err).Reason("failed to resolve sp
ecification").Err() | 43 return errors.Annotate(err).Reason("failed to resolve sp
ecification").Err() |
| 44 } | 44 } |
| 45 » » if err := spec.Normalize(a.opts.EnvConfig.Spec, &a.opts.EnvConfi
g.Package); err != nil { | 45 » » if a.opts.EnvConfig.Spec.Virtualenv == nil { |
| 46 » » » a.opts.EnvConfig.Spec.Virtualenv = &a.opts.EnvConfig.Pac
kage |
| 47 » » } |
| 48 » » if err := spec.NormalizeSpec(a.opts.EnvConfig.Spec); err != nil
{ |
| 46 return errors.Annotate(err).Reason("failed to normalize
specification").Err() | 49 return errors.Annotate(err).Reason("failed to normalize
specification").Err() |
| 47 } | 50 } |
| 48 s := a.opts.EnvConfig.Spec | 51 s := a.opts.EnvConfig.Spec |
| 49 renderedSpec := spec.Render(s) | 52 renderedSpec := spec.Render(s) |
| 50 logging.Infof(c, "Successfully verified specification:\n%s", ren
deredSpec) | 53 logging.Infof(c, "Successfully verified specification:\n%s", ren
deredSpec) |
| 51 | 54 |
| 52 // Run our Verification generator and verify each generated envi
ronment. | 55 // Run our Verification generator and verify each generated envi
ronment. |
| 53 if a.WithVerificationConfig != nil { | 56 if a.WithVerificationConfig != nil { |
| 54 err := a.WithVerificationConfig(c, func(cfg Config, veri
ficationScenarios []*vpython.Pep425Tag) error { | 57 err := a.WithVerificationConfig(c, func(cfg Config, veri
ficationScenarios []*vpython.Pep425Tag) error { |
| 55 if len(s.VerifyPep425Tag) > 0 { | 58 if len(s.VerifyPep425Tag) > 0 { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 83 return nil | 86 return nil |
| 84 }) | 87 }) |
| 85 if err != nil { | 88 if err != nil { |
| 86 return err | 89 return err |
| 87 } | 90 } |
| 88 } | 91 } |
| 89 | 92 |
| 90 return nil | 93 return nil |
| 91 }) | 94 }) |
| 92 } | 95 } |
| OLD | NEW |