From 60b78468341d52bc033f0ad77e890a656ccb9a72 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 20 Dec 2021 12:01:37 -0500 Subject: [PATCH] Add fallback support for distutils in stdlib. --- setuptools/command/easy_install.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 00b599043b..e815005725 100644 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -252,9 +252,13 @@ def finalize_options(self): # noqa: C901 # is too complex (25) # FIXME # Only python 3.2+ has abiflags 'abiflags': getattr(sys, 'abiflags', ''), 'platlibdir': getattr(sys, 'platlibdir', 'lib'), - 'implementation_lower': install._get_implementation().lower(), - 'implementation': install._get_implementation(), } + with contextlib.suppress(AttributeError): + # only for distutils outside stdlib + self.config_vars.update({ + 'implementation_lower': install._get_implementation().lower(), + 'implementation': install._get_implementation(), + }) if site.ENABLE_USER_SITE: self.config_vars['userbase'] = self.install_userbase @@ -714,7 +718,11 @@ def install_item(self, spec, download, tmpdir, deps, install_needed=False): return dist def select_scheme(self, name): - install._select_scheme(self, name) + try: + install._select_scheme(self, name) + except AttributeError: + # stdlib distutils + install.install.select_scheme(self, name) # FIXME: 'easy_install.process_distribution' is too complex (12) def process_distribution( # noqa: C901