From ae3afa4401c77920c652a7169ab2fe7db5df5f92 Mon Sep 17 00:00:00 2001 From: Samuel Cormier-Iijima Date: Tue, 13 Feb 2024 19:33:55 -0500 Subject: [PATCH] Adjust tests further to accommodate C++ support. --- distutils/sysconfig.py | 2 +- distutils/tests/test_sysconfig.py | 4 ++-- distutils/tests/test_unixccompiler.py | 6 +++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/distutils/sysconfig.py b/distutils/sysconfig.py index bc579163..4e1cd3ac 100644 --- a/distutils/sysconfig.py +++ b/distutils/sysconfig.py @@ -335,7 +335,7 @@ def customize_compiler(compiler): # noqa: C901 ldshared = ldshared + ' ' + os.environ['LDFLAGS'] ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS'] if 'CFLAGS' in os.environ: - cflags = os.environ['CFLAGS'] + cflags = cflags + ' ' + os.environ['CFLAGS'] ldshared = ldshared + ' ' + os.environ['CFLAGS'] if 'CXXFLAGS' in os.environ: cxxflags = os.environ['CXXFLAGS'] diff --git a/distutils/tests/test_sysconfig.py b/distutils/tests/test_sysconfig.py index 6cbf5168..3177c6e1 100644 --- a/distutils/tests/test_sysconfig.py +++ b/distutils/tests/test_sysconfig.py @@ -133,7 +133,7 @@ def test_customize_compiler(self): assert comp.exes['compiler_so'] == ( 'env_cc --sc-cflags ' '--env-cflags ' '--env-cppflags --sc-ccshared' ) - assert comp.exes['compiler_cxx'] == 'env_cxx --env-cxx-flags' + assert comp.exes['compiler_cxx'] == 'env_cxx --env-cxx-flags --sc-cflags --env-cppflags' assert comp.exes['linker_exe'] == 'env_cc' assert comp.exes['linker_so'] == ( 'env_ldshared --env-ldflags --env-cflags' ' --env-cppflags' @@ -161,7 +161,7 @@ def test_customize_compiler(self): assert comp.exes['preprocessor'] == 'sc_cc -E' assert comp.exes['compiler'] == 'sc_cc --sc-cflags' assert comp.exes['compiler_so'] == 'sc_cc --sc-cflags --sc-ccshared' - assert comp.exes['compiler_cxx'] == 'sc_cxx' + assert comp.exes['compiler_cxx'] == 'sc_cxx --sc-cflags' assert comp.exes['linker_exe'] == 'sc_cc' assert comp.exes['linker_so'] == 'sc_ldshared' assert comp.shared_lib_extension == 'sc_shutil_suffix' diff --git a/distutils/tests/test_unixccompiler.py b/distutils/tests/test_unixccompiler.py index c1e57a01..165d9944 100644 --- a/distutils/tests/test_unixccompiler.py +++ b/distutils/tests/test_unixccompiler.py @@ -247,9 +247,13 @@ def test_cc_overrides_ldshared_for_cxx_correctly(self): def gcv(v): if v == 'LDSHARED': return 'gcc-4.2 -bundle -undefined dynamic_lookup ' + elif v == 'LDCXXSHARED': + return 'g++-4.2 -bundle -undefined dynamic_lookup ' elif v == 'CXX': return 'g++-4.2' - return 'gcc-4.2' + elif v == 'CC': + return 'gcc-4.2' + return '' def gcvs(*args, _orig=sysconfig.get_config_vars): if args: