diff --git a/diskimage_builder/elements/pip-and-virtualenv/post-install.d/89-clean-up-pip-cache b/diskimage_builder/elements/pip-and-virtualenv/post-install.d/89-clean-up-pip-cache new file mode 100755 index 00000000..1e464a1d --- /dev/null +++ b/diskimage_builder/elements/pip-and-virtualenv/post-install.d/89-clean-up-pip-cache @@ -0,0 +1,13 @@ +#!/bin/bash + +if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then + set -x +fi +set -eu +set -o pipefail + +# TODO(johnsom) Fix this when https://github.com/pypa/pip/issues/4685 is +# available. +if [ "${DIB_DISABLE_PIP_CLEANUP:-0}" != "1" ]; then + rm -rf ~/.cache/pip +fi