@@ -48,6 +48,8 @@ def main():
4848 module_name = os .environ ["CPYTHON_TEST_EXT_NAME" ]
4949 limited = bool (os .environ .get ("CPYTHON_TEST_LIMITED" , "" ))
5050 internal = bool (int (os .environ .get ("TEST_INTERNAL_C_API" , "0" )))
51+ incdirs = os .environ .get ("CPYTHON_EXTRA_INCDIRS" , "" )
52+ libdirs = os .environ .get ("CPYTHON_EXTRA_LIBDIRS" , "" )
5153
5254 cppflags = list (CPPFLAGS )
5355 cppflags .append (f'-DMODULE_NAME={ module_name } ' )
@@ -90,19 +92,16 @@ def main():
9092 if extra_cflags :
9193 cppflags .extend (shlex .split (extra_cflags ))
9294
93- # On Windows, add PCbuild\amd64\ to include and library directories
95+ # Add additional include and library directories, typically for in-tree
96+ # testing where not all directories are inferred
9497 include_dirs = []
9598 library_dirs = []
96- if support .MS_WINDOWS :
97- srcdir = sysconfig .get_config_var ('srcdir' )
98- machine = platform .uname ().machine
99- pcbuild = os .path .join (srcdir , 'PCbuild' , machine )
100- if os .path .exists (pcbuild ):
101- # pyconfig.h is generated in PCbuild\amd64\
102- include_dirs .append (pcbuild )
103- # python313.lib is generated in PCbuild\amd64\
104- library_dirs .append (pcbuild )
105- print (f"Add PCbuild directory: { pcbuild } " )
99+ if incdirs :
100+ print ("Add incdirs:" , incdirs )
101+ include_dirs .extend (incdirs .split (os .pathsep ))
102+ if libdirs :
103+ print ("Add libdirs:" , libdirs )
104+ library_dirs .extend (libdirs .split (os .pathsep ))
106105
107106 # Display information to help debugging
108107 for env_name in ('CC' , 'CXX' , 'CFLAGS' , 'CPPFLAGS' , 'CXXFLAGS' ):
0 commit comments