Path: blob/master/venv/Lib/site-packages/pip/_internal/utils/appdirs.py
811 views
"""1This code wraps the vendored appdirs module to so the return values are2compatible for the current pip code base.34The intention is to rewrite current usages gradually, keeping the tests pass,5and eventually drop this after all usages are changed.6"""78from __future__ import absolute_import910import os1112from pip._vendor import appdirs as _appdirs1314from pip._internal.utils.typing import MYPY_CHECK_RUNNING1516if MYPY_CHECK_RUNNING:17from typing import List181920def user_cache_dir(appname):21# type: (str) -> str22return _appdirs.user_cache_dir(appname, appauthor=False)232425def user_config_dir(appname, roaming=True):26# type: (str, bool) -> str27path = _appdirs.user_config_dir(appname, appauthor=False, roaming=roaming)28if _appdirs.system == "darwin" and not os.path.isdir(path):29path = os.path.expanduser('~/.config/')30if appname:31path = os.path.join(path, appname)32return path333435# for the discussion regarding site_config_dir locations36# see <https://github.com/pypa/pip/issues/1733>37def site_config_dirs(appname):38# type: (str) -> List[str]39dirval = _appdirs.site_config_dir(appname, appauthor=False, multipath=True)40if _appdirs.system not in ["win32", "darwin"]:41# always look in /etc directly as well42return dirval.split(os.pathsep) + ['/etc']43return [dirval]444546