Skip to content

Commit 9153a61

Browse files
author
Dos Moonen
committed
Applied review suggestions
1 parent 9c24f29 commit 9153a61

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/pip/_internal/network/auth.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Contains interface (MultiDomainBasicAuth) and associated glue code for
44
providing credentials in the context of network requests.
55
"""
6+
import logging
67
import os
78
import shutil
89
import subprocess
@@ -169,7 +170,7 @@ def get_keyring_provider(provider: str) -> KeyRingBaseProvider:
169170
msg = "Installed copy of keyring fails with exception %s"
170171
if provider == "auto":
171172
msg = msg + ", trying to find a keyring executable as a fallback"
172-
logger.warning(msg, str(exc))
173+
logger.warning(msg, exc, exc_info=logger.isEnabledFor(logging.DEBUG))
173174
if provider in ["subprocess", "auto"]:
174175
cli = shutil.which("keyring")
175176
if cli and cli.startswith(sysconfig.get_path("scripts")):
@@ -188,13 +189,16 @@ def PATH_as_shutil_which_determines_it() -> str:
188189

189190
return path
190191

191-
scripts = Path(sysconfig.get_path("scripts")).resolve()
192+
scripts = Path(sysconfig.get_path("scripts"))
192193

193194
paths = []
194195
for path in PATH_as_shutil_which_determines_it().split(os.pathsep):
195196
p = Path(path)
196-
if p.exists() and not p.resolve().samefile(scripts):
197-
paths.append(path)
197+
try:
198+
if not p.samefile(scripts):
199+
paths.append(path)
200+
except FileNotFoundError:
201+
pass
198202

199203
path = os.pathsep.join(paths)
200204

0 commit comments

Comments
 (0)