Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hhhrrrttt222111
GitHub Repository: hhhrrrttt222111/Dorkify
Path: blob/master/venv/Lib/site-packages/pip/_internal/utils/appdirs.py
811 views
1
"""
2
This code wraps the vendored appdirs module to so the return values are
3
compatible for the current pip code base.
4
5
The intention is to rewrite current usages gradually, keeping the tests pass,
6
and eventually drop this after all usages are changed.
7
"""
8
9
from __future__ import absolute_import
10
11
import os
12
13
from pip._vendor import appdirs as _appdirs
14
15
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
16
17
if MYPY_CHECK_RUNNING:
18
from typing import List
19
20
21
def user_cache_dir(appname):
22
# type: (str) -> str
23
return _appdirs.user_cache_dir(appname, appauthor=False)
24
25
26
def user_config_dir(appname, roaming=True):
27
# type: (str, bool) -> str
28
path = _appdirs.user_config_dir(appname, appauthor=False, roaming=roaming)
29
if _appdirs.system == "darwin" and not os.path.isdir(path):
30
path = os.path.expanduser('~/.config/')
31
if appname:
32
path = os.path.join(path, appname)
33
return path
34
35
36
# for the discussion regarding site_config_dir locations
37
# see <https://github.com/pypa/pip/issues/1733>
38
def site_config_dirs(appname):
39
# type: (str) -> List[str]
40
dirval = _appdirs.site_config_dir(appname, appauthor=False, multipath=True)
41
if _appdirs.system not in ["win32", "darwin"]:
42
# always look in /etc directly as well
43
return dirval.split(os.pathsep) + ['/etc']
44
return [dirval]
45
46