Add support for extends cache in python version discovery.