Skip to content

Commit

Permalink
Merge pull request #3070 from domdfcoding/isue-3063
Browse files Browse the repository at this point in the history
Skip non-string values from sysconfig.get_config_vars()
  • Loading branch information
jaraco committed Feb 2, 2022
2 parents ff9b0a9 + a3bc3d4 commit dc342bb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/3070.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Avoid AttributeError in easy_install.create_home_path when sysconfig.get_config_vars values are not strings.
9 changes: 8 additions & 1 deletion setuptools/command/easy_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,7 @@ def create_home_path(self):
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)
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit dc342bb

Please sign in to comment.