summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2022-02-01 20:14:06 -0500
committerGitHub <noreply@github.com>2022-02-01 20:14:06 -0500
commitdc342bb40c637992eeeb841cd7000f65bc86281d (patch)
treec38d8f08a6e81b6e486c1dc8e3d08c9be1a882e0
parentff9b0a9cd8c29a342f947a0a864b4761fab29c67 (diff)
parenta3bc3d44fb0ad669d75e674218078752de7bb24d (diff)
downloadpython-setuptools-git-dc342bb40c637992eeeb841cd7000f65bc86281d.tar.gz
Merge pull request #3070 from domdfcoding/isue-3063
Skip non-string values from sysconfig.get_config_vars()
-rw-r--r--changelog.d/3070.misc.rst1
-rw-r--r--setuptools/command/easy_install.py9
2 files changed, 9 insertions, 1 deletions
diff --git a/changelog.d/3070.misc.rst b/changelog.d/3070.misc.rst
new file mode 100644
index 00000000..871b5d00
--- /dev/null
+++ b/changelog.d/3070.misc.rst
@@ -0,0 +1 @@
+Avoid AttributeError in easy_install.create_home_path when sysconfig.get_config_vars values are not strings.
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index e25090b8..ef1a9b23 100644
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -1334,7 +1334,7 @@ class easy_install(Command):
if not self.user:
return
home = convert_path(os.path.expanduser("~"))
- for name, path in self.config_vars.items():
+ for path in only_strs(self.config_vars.values()):
if path.startswith(home) and not os.path.isdir(path):
self.debug_print("os.makedirs('%s', 0o700)" % path)
os.makedirs(path, 0o700)
@@ -2304,6 +2304,13 @@ def current_umask():
return tmp
+def only_strs(values):
+ """
+ Exclude non-str values. Ref #3063.
+ """
+ return filter(lambda val: isinstance(val, str), values)
+
+
class EasyInstallDeprecationWarning(SetuptoolsDeprecationWarning):
"""
Warning for EasyInstall deprecations, bypassing suppression.