@@ -3111,23 +3111,6 @@ def test_python_build_config_extensions(self):
31113111 py3library = sysconfig .get_config_var ('PY3LIBRARY' )
31123112 if py3library is not None :
31133113 python_build_config ['libpython' ]['dynamic_stableabi' ] = py3library
3114- libpc = sysconfig .get_config_var ('LIBPC' )
3115- if libpc is not None :
3116- python_build_config ['c_api' ]['pkgconfig_path' ] = libpc
3117-
3118- with tempfile .NamedTemporaryFile (mode = 'w' , delete = False , encoding = 'utf-8' ) as python_build_config_file :
3119- json .dump (python_build_config , fp = python_build_config_file )
3120- with tempfile .NamedTemporaryFile (mode = 'w' , delete = False , encoding = 'utf-8' ) as cross_file :
3121- cross_file .write (
3122- textwrap .dedent (f'''
3123- [binaries]
3124- pkg-config = 'pkg-config'
3125-
3126- [built-in options]
3127- python.build_config = '{ python_build_config_file .name } '
3128- ''' .strip ())
3129- )
3130- cross_file .flush ()
31313114
31323115 intro_installed_file = os .path .join (self .builddir , 'meson-info' , 'intro-installed.json' )
31333116 expected_files = [
@@ -3140,16 +3123,38 @@ def test_python_build_config_extensions(self):
31403123 os .path .join (self .builddir , 'foo_stable' + STABLE_ABI_SUFFIX .replace ('.so' , '.dll.a' )),
31413124 ]
31423125
3143- for extra_args in (
3144- ['--python.build-config' , python_build_config_file .name ],
3145- ['--cross-file' , cross_file .name ],
3146- ):
3147- with self .subTest (extra_args = extra_args ):
3148- self .init (testdir , extra_args = extra_args )
3149- with open (intro_installed_file ) as f :
3150- intro_installed = json .load (f )
3151- self .assertEqual (expected_files , list (intro_installed ))
3152- self .wipe ()
3126+ for with_pkgconfig in (False , True ):
3127+ with self .subTest (with_pkgconfig = with_pkgconfig ):
3128+ if with_pkgconfig :
3129+ libpc = sysconfig .get_config_var ('LIBPC' )
3130+ if libpc is None :
3131+ continue
3132+ python_build_config ['c_api' ]['pkgconfig_path' ] = libpc
3133+
3134+ with tempfile .NamedTemporaryFile (mode = 'w' , delete = False , encoding = 'utf-8' ) as python_build_config_file :
3135+ json .dump (python_build_config , fp = python_build_config_file )
3136+ with tempfile .NamedTemporaryFile (mode = 'w' , delete = False , encoding = 'utf-8' ) as cross_file :
3137+ cross_file .write (
3138+ textwrap .dedent (f'''
3139+ [binaries]
3140+ pkg-config = 'pkg-config'
3141+
3142+ [built-in options]
3143+ python.build_config = '{ python_build_config_file .name } '
3144+ ''' .strip ())
3145+ )
3146+ cross_file .flush ()
3147+
3148+ for extra_args in (
3149+ ['--python.build-config' , python_build_config_file .name ],
3150+ ['--cross-file' , cross_file .name ],
3151+ ):
3152+ with self .subTest (extra_args = extra_args ):
3153+ self .init (testdir , extra_args = extra_args )
3154+ with open (intro_installed_file ) as f :
3155+ intro_installed = json .load (f )
3156+ self .assertEqual (expected_files , list (intro_installed ))
3157+ self .wipe ()
31533158
31543159 def __reconfigure (self ):
31553160 # Set an older version to force a reconfigure from scratch
0 commit comments