Chromium Code Reviews| Index: vpython/application/application.go |
| diff --git a/vpython/application/application.go b/vpython/application/application.go |
| index 0fcfcbfdb634419348e4f990ae75b560a3379ee6..0961460b411b986bb2e2ca2c3ffbb98dfcb83fb0 100644 |
| --- a/vpython/application/application.go |
| +++ b/vpython/application/application.go |
| @@ -42,6 +42,10 @@ const ( |
| // Like "-root", if this value is present but empty, a tempdir will be used |
| // for the VirtualEnv root. |
| VirtualEnvRootENV = "VPYTHON_VIRTUALENV_ROOT" |
| + |
| + // DefaultSpecENV is an enviornment variable that, if set, will be used as the |
| + // default VirtualEnv spec file if none is provided or found through probing. |
| + DefaultSpecENV = "VPYTHON_DEFAULT_SPEC" |
| ) |
| // ReturnCodeError is an error wrapping a return code value. |
| @@ -177,10 +181,19 @@ func (a *application) mainImpl(c context.Context, args []string) error { |
| if a.specPath != "" { |
| var err error |
| if a.opts.EnvConfig.Spec, err = spec.Load(a.specPath); err != nil { |
| - return errors.Annotate(err).Reason("failed to load specification file (-spec) from: %(path)s"). |
| + return errors.Annotate(err). |
| + Reason("failed to load specification file (%(source)s) from: %(path)s"). |
| D("path", a.specPath). |
|
iannucci
2017/06/05 19:46:36
no D for source?
dnj
2017/06/06 13:40:39
oops, "source" is old.
|
| Err() |
| } |
| + } else if specPath := a.opts.Environ.GetEmpty(DefaultSpecENV); specPath != "" { |
| + var err error |
| + if a.opts.DefaultSpec, err = spec.Load(specPath); err != nil { |
| + return errors.Annotate(err). |
| + Reason("failed to load default specification file ("+DefaultSpecENV+"from: %(path)s"). |
| + D("path", specPath). |
| + Err() |
| + } |
| } |
| // If an empty BaseDir was specified, use a temporary directory and clean it |