Skip to content

Commit 633e17f

Browse files
committed
Move darwin special config dir to pip wrapper
1 parent 4d1932f commit 633e17f

File tree

3 files changed

+11
-21
lines changed

3 files changed

+11
-21
lines changed

src/pip/_internal/utils/appdirs.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ def user_cache_dir(appname):
2525

2626
def user_config_dir(appname, roaming=True):
2727
# type: (str, bool) -> str
28-
return _appdirs.user_config_dir(appname, appauthor=False, roaming=roaming)
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
2934

3035

3136
# for the discussion regarding site_config_dir locations

src/pip/_vendor/appdirs.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ def user_data_dir(appname=None, appauthor=None, version=None, roaming=False):
9292
path = os.path.expanduser('~/Library/Application Support/')
9393
if appname:
9494
path = os.path.join(path, appname)
95-
if not os.path.isdir(path):
96-
path = os.path.expanduser('~/.config/')
97-
if appname:
98-
path = os.path.join(path, appname)
9995
else:
10096
path = os.getenv('XDG_DATA_HOME', os.path.expanduser("~/.local/share"))
10197
if appname:

tools/automation/vendoring/patches/appdirs.patch

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,7 @@ index ae67001a..3a52b758 100644
2222
Unix: ~/.local/share/<AppName> # or in $XDG_DATA_HOME, if defined
2323
Win XP (not roaming): C:\Documents and Settings\<username>\Application Data\<AppAuthor>\<AppName>
2424
Win XP (roaming): C:\Documents and Settings\<username>\Local Settings\Application Data\<AppAuthor>\<AppName>
25-
@@ -88,6 +92,10 @@ def user_data_dir(appname=None, appauthor=None, version=None, roaming=False):
26-
path = os.path.expanduser('~/Library/Application Support/')
27-
if appname:
28-
path = os.path.join(path, appname)
29-
+ if not os.path.isdir(path):
30-
+ path = os.path.expanduser('~/.config/')
31-
+ if appname:
32-
+ path = os.path.join(path, appname)
33-
else:
34-
path = os.getenv('XDG_DATA_HOME', os.path.expanduser("~/.local/share"))
35-
if appname:
36-
@@ -150,7 +158,7 @@ def site_data_dir(appname=None, appauthor=None, version=None, multipath=False):
25+
@@ -150,7 +154,7 @@ def site_data_dir(appname=None, appauthor=None, version=None, multipath=False):
3726
if appname:
3827
if version:
3928
appname = os.path.join(appname, version)
@@ -42,7 +31,7 @@ index ae67001a..3a52b758 100644
4231

4332
if multipath:
4433
path = os.pathsep.join(pathlist)
45-
@@ -203,6 +211,8 @@ def user_config_dir(appname=None, appauthor=None, version=None, roaming=False):
34+
@@ -203,6 +203,8 @@ def user_config_dir(appname=None, appauthor=None, version=None, roaming=False):
4635
return path
4736

4837

@@ -51,7 +40,7 @@ index ae67001a..3a52b758 100644
5140
def site_config_dir(appname=None, appauthor=None, version=None, multipath=False):
5241
r"""Return full path to the user-shared data dir for this application.
5342

54-
@@ -238,14 +248,15 @@ def site_config_dir(appname=None, appauthor=None, version=None, multipath=False)
43+
@@ -238,14 +244,15 @@ def site_config_dir(appname=None, appauthor=None, version=None, multipath=False)
5544
if appname and version:
5645
path = os.path.join(path, version)
5746
else:
@@ -71,7 +60,7 @@ index ae67001a..3a52b758 100644
7160

7261
if multipath:
7362
path = os.pathsep.join(pathlist)
74-
@@ -291,6 +304,10 @@ def user_cache_dir(appname=None, appauthor=None, version=None, opinion=True):
63+
@@ -291,6 +300,10 @@ def user_cache_dir(appname=None, appauthor=None, version=None, opinion=True):
7564
if appauthor is None:
7665
appauthor = appname
7766
path = os.path.normpath(_get_win_folder("CSIDL_LOCAL_APPDATA"))
@@ -82,7 +71,7 @@ index ae67001a..3a52b758 100644
8271
if appname:
8372
if appauthor is not False:
8473
path = os.path.join(path, appauthor, appname)
85-
@@ -557,18 +574,32 @@ def _get_win_folder_with_jna(csidl_name):
74+
@@ -557,18 +570,32 @@ def _get_win_folder_with_jna(csidl_name):
8675

8776
if system == "win32":
8877
try:

0 commit comments

Comments
 (0)