Chromium Code Reviews| Index: vpython/application/subcommand_verify.go |
| diff --git a/vpython/application/subcommand_verify.go b/vpython/application/subcommand_verify.go |
| index b9c3e43abe278c302a94f8fbe4fc85594c428e78..e2e6855cfadeb53550d66160de30be0bbb128404 100644 |
| --- a/vpython/application/subcommand_verify.go |
| +++ b/vpython/application/subcommand_verify.go |
| @@ -42,13 +42,21 @@ func (cr *verifyCommandRun) Run(app subcommands.Application, args []string, env |
| if err := a.opts.ResolveSpec(c); err != nil { |
| return errors.Annotate(err).Reason("failed to resolve specification").Err() |
| } |
| - if a.opts.EnvConfig.Spec.Virtualenv == nil { |
| - a.opts.EnvConfig.Spec.Virtualenv = &a.opts.EnvConfig.Package |
| + |
| + s := a.opts.EnvConfig.Spec |
| + if s == nil { |
| + s = &vpython.Spec{} |
| } |
| - if err := spec.NormalizeSpec(a.opts.EnvConfig.Spec); err != nil { |
| + if s.Virtualenv == nil { |
| + s.Virtualenv = &a.opts.EnvConfig.Package |
| + } |
| + |
| + // Verify that the spec can be normalized. This may modify it, so we will |
| + // normalizse a clone. |
|
qyearsley
2017/06/05 20:20:08
Nit: spelling
dnj
2017/06/06 13:59:10
Done.
|
| + if err := spec.NormalizeSpec(s.Clone(), nil); err != nil { |
| return errors.Annotate(err).Reason("failed to normalize specification").Err() |
| } |
| - s := a.opts.EnvConfig.Spec |
| + |
| renderedSpec := spec.Render(s) |
| logging.Infof(c, "Successfully verified specification:\n%s", renderedSpec) |
| @@ -69,6 +77,11 @@ func (cr *verifyCommandRun) Run(app subcommands.Application, args []string, env |
| Spec: s.Clone(), |
| Pep425Tag: []*vpython.Pep425Tag{vs}, |
| } |
| + if err := spec.NormalizeEnvironment(&e); err != nil { |
| + logging.Errorf(c, "Failed to normalize environment against %q: %s", vs.TagString(), err) |
| + failures = append(failures, vs.TagString()) |
| + continue |
| + } |
| if err := cfg.PackageLoader.Resolve(c, &e); err != nil { |
| logging.Errorf(c, "Failed to resolve against %q: %s", vs.TagString(), err) |