Chromium Code Reviews| Index: vpython/options.go |
| diff --git a/vpython/options.go b/vpython/options.go |
| index f24b3ff69f074305fef4d86ac515e30154b9ae90..dd026afd111fb80573941dce786f42adab7dba7e 100644 |
| --- a/vpython/options.go |
| +++ b/vpython/options.go |
| @@ -26,6 +26,10 @@ type Options struct { |
| // EnvConfig is the VirtualEnv configuration to run from. |
| EnvConfig venv.Config |
| + // DefaultSpec is the default specification to use, if no specification was |
| + // supplied or probed. |
| + DefaultSpec *vpython.Spec |
| + |
| // SpecLoader is the spec.Loader to use to load a specification file for a |
| // given script. |
| // |
| @@ -154,6 +158,12 @@ func (o *Options) ResolveSpec(c context.Context) error { |
| return nil |
| } |
| + // If standard resolution doesn't yield a spec, fall back on our default spec. |
| + if o.DefaultSpec != nil { |
| + o.EnvConfig.Spec = o.DefaultSpec |
|
iannucci
2017/06/05 19:46:36
would it make sense to have this be by-value, then
dnj
2017/06/06 13:40:39
Yeah I suppose it would. Done.
|
| + return nil |
| + } |
| + |
| // Unable to load a spec. |
| logging.Infof(c, "Unable to resolve specification path. Using empty specification.") |
| o.EnvConfig.Spec = &vpython.Spec{} |