From 1a17213f58df4496a98d42ae1ad07ce4fbc705f0 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Mon, 6 Jun 2022 16:24:55 +0200 Subject: [PATCH] distutils: add build root to libdirs when building uninstalled The distutils test suite builds extensions which need to link to libpython despite it being uninstalled. The code currently assumes that the working directory is the build root, but that is not the case in the tests (it's in some temp dir). Explicitely pass the build root instead where the uninstalled libpython can be found. --- Lib/distutils/command/build_ext.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py index b46ae085afc12d..e87e3ad5d4cbb4 100644 --- a/Lib/distutils/command/build_ext.py +++ b/Lib/distutils/command/build_ext.py @@ -227,7 +227,7 @@ def finalize_options(self): config_dir_name)) else: # building python standard extensions - self.library_dirs.append('.') + self.library_dirs.append(sysconfig.project_base) # For building extensions with a shared Python library, # Python's library directory must be appended to library_dirs @@ -238,7 +238,7 @@ def finalize_options(self): self.library_dirs.append(sysconfig.get_config_var('LIBDIR')) else: # building python standard extensions - self.library_dirs.append('.') + self.library_dirs.append(sysconfig.project_base) # The argument parsing will result in self.define being a string, but # it has to be a list of 2-tuples. All the preprocessor symbols