cacheExpired returns true when the cache is past expiration.
(ctx *gcp.Context, l *libcnb.Layer)
| 428 | |
| 429 | // cacheExpired returns true when the cache is past expiration. |
| 430 | func cacheExpired(ctx *gcp.Context, l *libcnb.Layer) bool { |
| 431 | t := time.Now() |
| 432 | expiry := ctx.GetMetadata(l, expiryTimestampKey) |
| 433 | if expiry != "" { |
| 434 | var err error |
| 435 | t, err = time.Parse(dateFormat, expiry) |
| 436 | if err != nil { |
| 437 | ctx.Debugf("Could not parse expiration date %q, assuming now: %v", expiry, err) |
| 438 | } |
| 439 | } |
| 440 | return !t.After(time.Now()) |
| 441 | } |
| 442 | |
| 443 | // requiresVirtualEnv returns true for runtimes that require a virtual environment to be created before pip install. |
| 444 | // We cannot use Python per-user site-packages (https://www.python.org/dev/peps/pep-0370/), |
no test coverage detected