Repository: pypa/setuptools

Issue:
ValueError: invalid variable 'py_version_nodot_plat' in easy_install
The error persists with `setuptools==60.5.0`: https://github.com/Delgan/win32-setctime/runs/4750681694?check_suite_focus=true

_Originally posted by @Delgan in https://github.com/pypa/distutils/issues/103#issuecomment-1010303322_
ValueError: invalid variable 'py_version_nodot_plat' in easy_install
The error persists with `setuptools==60.5.0`: https://github.com/Delgan/win32-setctime/runs/4750681694?check_suite_focus=true

_Originally posted by @Delgan in https://github.com/pypa/distutils/issues/103#issuecomment-1010303322_


Discussion:

Resolving patch:
diff --git a/setuptools/_distutils/command/install.py b/setuptools/_distutils/command/install.py
--- a/setuptools/_distutils/command/install.py
+++ b/setuptools/_distutils/command/install.py
@@ -397,20 +397,20 @@ def finalize_options(self):
             abiflags = ''
         local_vars = {
             'dist_name': self.distribution.get_name(),
-                            'dist_version': self.distribution.get_version(),
-                            'dist_fullname': self.distribution.get_fullname(),
-                            'py_version': py_version,
-                            'py_version_short': '%d.%d' % sys.version_info[:2],
-                            'py_version_nodot': '%d%d' % sys.version_info[:2],
-                            'sys_prefix': prefix,
-                            'prefix': prefix,
-                            'sys_exec_prefix': exec_prefix,
-                            'exec_prefix': exec_prefix,
-                            'abiflags': abiflags,
-                            'platlibdir': getattr(sys, 'platlibdir', 'lib'),
-                            'implementation_lower': _get_implementation().lower(),
-                            'implementation': _get_implementation(),
-                           }
+            'dist_version': self.distribution.get_version(),
+            'dist_fullname': self.distribution.get_fullname(),
+            'py_version': py_version,
+            'py_version_short': '%d.%d' % sys.version_info[:2],
+            'py_version_nodot': '%d%d' % sys.version_info[:2],
+            'sys_prefix': prefix,
+            'prefix': prefix,
+            'sys_exec_prefix': exec_prefix,
+            'exec_prefix': exec_prefix,
+            'abiflags': abiflags,
+            'platlibdir': getattr(sys, 'platlibdir', 'lib'),
+            'implementation_lower': _get_implementation().lower(),
+            'implementation': _get_implementation(),
+        }
 
         if HAS_USER_SITE:
             local_vars['userbase'] = self.install_userbase
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -39,9 +39,10 @@
 import shlex
 import io
 import configparser
+import sysconfig
 
 
-from sysconfig import get_config_vars, get_path
+from sysconfig import get_path
 
 from setuptools import SetuptoolsDeprecationWarning
 
@@ -236,23 +237,22 @@ def finalize_options(self):  # noqa: C901  # is too complex (25)  # FIXME
         self.version and self._render_version()
 
         py_version = sys.version.split()[0]
-        prefix, exec_prefix = get_config_vars('prefix', 'exec_prefix')
 
-        self.config_vars = {
+        self.config_vars = dict(sysconfig.get_config_vars())
+
+        self.config_vars.update({
             'dist_name': self.distribution.get_name(),
             'dist_version': self.distribution.get_version(),
             'dist_fullname': self.distribution.get_fullname(),
             'py_version': py_version,
             'py_version_short': f'{sys.version_info.major}.{sys.version_info.minor}',
             'py_version_nodot': f'{sys.version_info.major}{sys.version_info.minor}',
-            'sys_prefix': prefix,
-            'prefix': prefix,
-            'sys_exec_prefix': exec_prefix,
-            'exec_prefix': exec_prefix,
+            'sys_prefix': self.config_vars['prefix'],
+            'sys_exec_prefix': self.config_vars['exec_prefix'],
             # Only python 3.2+ has abiflags
             'abiflags': getattr(sys, 'abiflags', ''),
             'platlibdir': getattr(sys, 'platlibdir', 'lib'),
-        }
+        })
         with contextlib.suppress(AttributeError):
             # only for distutils outside stdlib
             self.config_vars.update({


Test patch: