Skip to content

Commit c04798f

Browse files
authored
Merge pull request #7786 from xavfernandez/appdirs_patch
vendoring: move /etc appdir patch to pip wrapper
2 parents 0d7f5d1 + db377ce commit c04798f

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

src/pip/_internal/utils/appdirs.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,12 @@ def user_data_dir(appname, roaming=False):
3333
return _appdirs.user_data_dir(appname, appauthor=False, roaming=roaming)
3434

3535

36+
# for the discussion regarding site_config_dir locations
37+
# see <https://github.com/pypa/pip/issues/1733>
3638
def site_config_dirs(appname):
3739
# type: (str) -> List[str]
3840
dirval = _appdirs.site_config_dir(appname, appauthor=False, multipath=True)
3941
if _appdirs.system not in ["win32", "darwin"]:
40-
return dirval.split(os.pathsep)
42+
# always look in /etc directly as well
43+
return dirval.split(os.pathsep) + ['/etc']
4144
return [dirval]

src/pip/_vendor/appdirs.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,6 @@ def site_config_dir(appname=None, appauthor=None, version=None, multipath=False)
257257
if version:
258258
appname = os.path.join(appname, version)
259259
pathlist = [os.path.join(x, appname) for x in pathlist]
260-
# always look in /etc directly as well
261-
pathlist.append('/etc')
262260

263261
if multipath:
264262
path = os.pathsep.join(pathlist)

tools/automation/vendoring/patches/appdirs.patch

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ index ae67001a..3a52b758 100644
5151
def site_config_dir(appname=None, appauthor=None, version=None, multipath=False):
5252
r"""Return full path to the user-shared data dir for this application.
5353

54-
@@ -238,14 +248,17 @@ def site_config_dir(appname=None, appauthor=None, version=None, multipath=False)
54+
@@ -238,14 +248,15 @@ def site_config_dir(appname=None, appauthor=None, version=None, multipath=False)
5555
if appname and version:
5656
path = os.path.join(path, version)
5757
else:
@@ -68,8 +68,6 @@ index ae67001a..3a52b758 100644
6868
appname = os.path.join(appname, version)
6969
- pathlist = [os.sep.join([x, appname]) for x in pathlist]
7070
+ pathlist = [os.path.join(x, appname) for x in pathlist]
71-
+ # always look in /etc directly as well
72-
+ pathlist.append('/etc')
7371

7472
if multipath:
7573
path = os.pathsep.join(pathlist)

0 commit comments

Comments
 (0)