diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py index d33a889afe4a81..8fa2a3adf2feac 100644 --- a/Lib/distutils/command/install.py +++ b/Lib/distutils/command/install.py @@ -316,6 +316,9 @@ def finalize_options(self): self.config_vars['userbase'] = self.install_userbase self.config_vars['usersite'] = self.install_usersite + if sysconfig.is_python_build(True): + self.config_vars['srcdir'] = sysconfig.get_config_var('srcdir') + self.expand_basedirs() self.dump_dirs("post-expand_basedirs()") diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py index e8869af0b5cc94..2e8d6d9ac32e2f 100644 --- a/Lib/sysconfig.py +++ b/Lib/sysconfig.py @@ -182,6 +182,12 @@ def is_python_build(check_home=False): _PYTHON_BUILD = is_python_build(True) +if _PYTHON_BUILD: + for scheme in ('posix_prefix', 'posix_home'): + _INSTALL_SCHEMES[scheme]['include'] = '{srcdir}/Include' + _INSTALL_SCHEMES[scheme]['platinclude'] = '{projectbase}/.' + + def _subst_vars(s, local_vars): try: return s.format(**local_vars) diff --git a/Misc/NEWS.d/next/Build/2021-05-24-03-31-17.bpo-41282.L8nP44.rst b/Misc/NEWS.d/next/Build/2021-05-24-03-31-17.bpo-41282.L8nP44.rst new file mode 100644 index 00000000000000..cc6eadefc6cba7 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2021-05-24-03-31-17.bpo-41282.L8nP44.rst @@ -0,0 +1,3 @@ +Fix broken ``make install`` that caused standard library extension modules +to be unnecessarily and incorrectly rebuilt during the install phase of +cpython.