--cache-dir does not support relative paths to non-existent directory · Issue #7541 · pypa/pip (original) (raw)

Environment

Description

When running pip install --cache-dir=cache one expects pip to use $PWD/cache as cache directory. It works when the directory exists but not when it does not exist yet.

With pip 19.3, we get a warning about the cache directory not being writable, but the cache directory is created anyway.

With pip master, we get the warning and the cache is not created (following the fix for #7488). Providing an absolute directory for --cache-dir works correctly.

Expected behavior

When the cache directory does not exist, it should be created without warning.

How to Reproduce

pip install --cache-dir=cache flit.

With pip master, notice the cache directory is not created.

pip install --cache-dir=$PWD/cache flit.

With pip master, notice the cache directory is created correctly.