1
1
diff --git a/src/pip/_vendor/appdirs.py b/src/pip/_vendor/appdirs.py
2
- index ae67001a..e9ff1aa4 100644
2
+ index ae67001a..87a1e0a6 100644
3
3
--- a/src/pip/_vendor/appdirs.py
4
4
+++ b/src/pip/_vendor/appdirs.py
5
- @@ -64,7 +64,7 @@ def user_data_dir(appname=None, appauthor=None, version=None, roaming=False):
5
+ @@ -37,6 +37,10 @@ if sys.platform.startswith('java'):
6
+ # are actually checked for and the rest of the module expects
7
+ # *sys.platform* style strings.
8
+ system = 'linux2'
9
+ + elif sys.platform == 'cli' and os.name == 'nt':
10
+ + # Detect Windows in IronPython to match pip._internal.utils.compat.WINDOWS
11
+ + # Discusstion: https://github.com/pypa/pip/pull/7501
12
+ + system = 'win32'
13
+ else:
14
+ system = sys.platform
15
+
16
+ @@ -64,7 +68,7 @@ def user_data_dir(appname=None, appauthor=None, version=None, roaming=False):
6
17
for a discussion of issues.
7
-
18
+
8
19
Typical user data directories are:
9
20
- Mac OS X: ~/Library/Application Support/<AppName>
10
21
+ Mac OS X: ~/Library/Application Support/<AppName> # or ~/.config/<AppName>, if the other does not exist
11
22
Unix: ~/.local/share/<AppName> # or in $XDG_DATA_HOME, if defined
12
23
Win XP (not roaming): C:\Documents and Settings\<username>\Application Data\<AppAuthor>\<AppName>
13
24
Win XP (roaming): C:\Documents and Settings\<username>\Local Settings\Application Data\<AppAuthor>\<AppName>
14
- @@ -88,6 +88 ,10 @@ def user_data_dir(appname=None, appauthor=None, version=None, roaming=False):
25
+ @@ -88,6 +92 ,10 @@ def user_data_dir(appname=None, appauthor=None, version=None, roaming=False):
15
26
path = os.path.expanduser('~/Library/Application Support/')
16
27
if appname:
17
28
path = os.path.join(path, appname)
@@ -22,25 +33,25 @@ index ae67001a..e9ff1aa4 100644
22
33
else:
23
34
path = os.getenv('XDG_DATA_HOME', os.path.expanduser("~/.local/share"))
24
35
if appname:
25
- @@ -150,7 +154 ,7 @@ def site_data_dir(appname=None, appauthor=None, version=None, multipath=False):
36
+ @@ -150,7 +158 ,7 @@ def site_data_dir(appname=None, appauthor=None, version=None, multipath=False):
26
37
if appname:
27
38
if version:
28
39
appname = os.path.join(appname, version)
29
40
- pathlist = [os.sep.join([x, appname]) for x in pathlist]
30
41
+ pathlist = [os.path.join(x, appname) for x in pathlist]
31
-
42
+
32
43
if multipath:
33
44
path = os.pathsep.join(pathlist)
34
- @@ -203,6 +207 ,8 @@ def user_config_dir(appname=None, appauthor=None, version=None, roaming=False):
45
+ @@ -203,6 +211 ,8 @@ def user_config_dir(appname=None, appauthor=None, version=None, roaming=False):
35
46
return path
36
-
37
-
47
+
48
+
38
49
+ # for the discussion regarding site_config_dir locations
39
50
+ # see <https://github.com/pypa/pip/issues/1733>
40
51
def site_config_dir(appname=None, appauthor=None, version=None, multipath=False):
41
52
r"""Return full path to the user-shared data dir for this application.
42
-
43
- @@ -241,11 +247 ,13 @@ def site_config_dir(appname=None, appauthor=None, version=None, multipath=False)
53
+
54
+ @@ -241,11 +251 ,13 @@ def site_config_dir(appname=None, appauthor=None, version=None, multipath=False)
44
55
# XDG default for $XDG_CONFIG_DIRS
45
56
# only first, if multipath is False
46
57
path = os.getenv('XDG_CONFIG_DIRS', '/etc/xdg')
@@ -53,10 +64,10 @@ index ae67001a..e9ff1aa4 100644
53
64
+ pathlist = [os.path.join(x, appname) for x in pathlist]
54
65
+ # always look in /etc directly as well
55
66
+ pathlist.append('/etc')
56
-
67
+
57
68
if multipath:
58
69
path = os.pathsep.join(pathlist)
59
- @@ -291,6 +299 ,10 @@ def user_cache_dir(appname=None, appauthor=None, version=None, opinion=True):
70
+ @@ -291,6 +303 ,10 @@ def user_cache_dir(appname=None, appauthor=None, version=None, opinion=True):
60
71
if appauthor is None:
61
72
appauthor = appname
62
73
path = os.path.normpath(_get_win_folder("CSIDL_LOCAL_APPDATA"))
@@ -67,8 +78,8 @@ index ae67001a..e9ff1aa4 100644
67
78
if appname:
68
79
if appauthor is not False:
69
80
path = os.path.join(path, appauthor, appname)
70
- @@ -557,18 +569 ,32 @@ def _get_win_folder_with_jna(csidl_name):
71
-
81
+ @@ -557,18 +573 ,32 @@ def _get_win_folder_with_jna(csidl_name):
82
+
72
83
if system == "win32":
73
84
try:
74
85
- import win32com.shell
@@ -106,6 +117,6 @@ index ae67001a..e9ff1aa4 100644
106
117
+ except (UnicodeEncodeError, LookupError):
107
118
+ pass
108
119
+ return path
109
-
110
-
120
+
121
+
111
122
#---- self test code
0 commit comments