From 100d335e9d6fd8fc980e6f28c23f1d4836c0cb82 Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Mon, 24 May 2021 00:16:15 -0400 Subject: [PATCH] bpo-41282: Fix broken ``make install`` A previous commit broke a check in sysconfig when building cpython itself. This caused builds of the standard library modules to search a wrong location (the installed location rather than the source directory) for header files with the net effect that a ``make install`` incorrectly caused all extension modules to be rebuilt again and with incorrect include file paths. --- Lib/distutils/command/install.py | 3 +++ Lib/sysconfig.py | 6 ++++++ .../next/Build/2021-05-24-03-31-17.bpo-41282.L8nP44.rst | 3 +++ 3 files changed, 12 insertions(+) create mode 100644 Misc/NEWS.d/next/Build/2021-05-24-03-31-17.bpo-41282.L8nP44.rst 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.