From 917046dc70da8c6c5ba87571b0864826085e3659 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 30 Jan 2022 13:12:34 -0500 Subject: [PATCH] Only rely on py_version_nodot_plat where not present (Python 3.9 and earlier). --- distutils/command/install.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/distutils/command/install.py b/distutils/command/install.py index 0c280f1c8c..9fe659131f 100644 --- a/distutils/command/install.py +++ b/distutils/command/install.py @@ -411,17 +411,19 @@ def finalize_options(self): 'implementation_lower': _get_implementation().lower(), 'implementation': _get_implementation(), } - try: - local_vars['py_version_nodot_plat'] = sys.winver.replace('.', '') - except AttributeError: - local_vars['py_version_nodot_plat'] = '' + + # vars for compatibility on older Pythons + compat_vars = dict( + # Python 3.9 and earlier + py_version_nodot_plat=getattr(sys, 'winver', '').replace('.', ''), + ) if HAS_USER_SITE: local_vars['userbase'] = self.install_userbase local_vars['usersite'] = self.install_usersite self.config_vars = _collections.DictStack( - [sysconfig.get_config_vars(), local_vars]) + [compat_vars, sysconfig.get_config_vars(), local_vars]) self.expand_basedirs()