MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/buildpacks / cacheExpired

Function cacheExpired

pkg/python/python.go:430–441  ·  view source on GitHub ↗

cacheExpired returns true when the cache is past expiration.

(ctx *gcp.Context, l *libcnb.Layer)

Source from the content-addressed store, hash-verified

428
429// cacheExpired returns true when the cache is past expiration.
430func 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/),

Callers 2

prepareDependenciesLayerFunction · 0.85
PipInstallPyprojectFunction · 0.85

Calls 2

GetMetadataMethod · 0.80
DebugfMethod · 0.80

Tested by

no test coverage detected