Skip to main content

Module location

Module location 

Source
Expand description

The location of the cache directory.

The cache is KIZZ_CACHE_DIR when set, otherwise $XDG_CACHE_HOME/kizz, otherwise ~/.cache/kizz. cache_dir computes it from the three values, so that callers and tests never need to change the process environment; cache_dir_from_env reads them from the environment of the process.

The rules for unusual values:

  • An empty KIZZ_CACHE_DIR counts as unset, as an empty XDG_CACHE_HOME does.
  • A relative KIZZ_CACHE_DIR is an error: the cache serves every build on the machine wherever it starts, and a relative path would name a different cache in every directory.
  • An empty or relative XDG_CACHE_HOME is ignored, as the XDG Base Directory Specification requires.
  • When HOME is needed and is unset, empty, or relative, there is no cache location, and the error says which variables can provide one.

Enums§

LocationError
Why the cache directory cannot be located.

Constants§

HOME
The variable that names the home directory of the user.
KIZZ_CACHE_DIR
The variable that names the cache directory directly.
XDG_CACHE_HOME
The XDG Base Directory variable for user cache files.

Functions§

cache_dir
The cache directory from the values of KIZZ_CACHE_DIR, XDG_CACHE_HOME, and HOME, each None when the variable is unset.
cache_dir_from_env
The cache directory from the environment of this process.