Skip to content

Apply distutils fix for parsing linker parameters#4959

Merged
jaraco merged 8 commits intomainfrom
bugfix/distutils-356
Apr 23, 2025
Merged

Apply distutils fix for parsing linker parameters#4959
jaraco merged 8 commits intomainfrom
bugfix/distutils-356

Conversation

@jaraco
Copy link
Member

@jaraco jaraco commented Apr 23, 2025

  • Remove latent comment.
  • Respect CXX when parsing linker parameters for UNIX c++ targets
  • Add test for argument parsing for CXX targets on UNIX
  • Fix new test case
  • Add news fragment.

Summary of changes

Closes

Pull Request Checklist

jaraco and others added 8 commits April 13, 2025 16:21
Previously, when parsing linker parameters for C++ targets, the CC
variable was used to determine what the "prefix" of the command was in
order to determine what the linker arguments were.

If the value of LDCXXSHARED did not match CC, the first argument would
be dropped as it was assumed to be the linker command.

However, if the command was a wrapper, such as ccache, it could lead to
compile problems as the generated command would be incorrect.

In the following scenario:
  LDCXXSHARED="ccache g++ -shared -Wl,--enable-new-dtags"
  CC="ccache gcc"
  CXX="ccache g++"

The command would be incorrectly parsed to:
  ccache g++ g++ -shared -Wl,--enable-new-dtags

Now, the CXX value is used to improve the chances of parsing the linker
arguments correctly to generate:
  ccache g++ -shared -Wl,--enable-new-dtags

LDCXXSHARED and CXX still need to be in sync either in the environment
or within the sysconfig variables in the CPython build for parsing to
work correctly.

The CXX value is now also respected when linking executable binaries.

Signed-off-by: Vincent Fazio <vfazio@gmail.com>
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
Address the following:

  * use the compiler's executable extension in asserts
  * remove any environment variables that may have been injected by CI
  * add a pragma to ignore a line without coverage

Signed-off-by: Vincent Fazio <vfazio@gmail.com>
…arg-parse

Respect CXX when parsing linker parameters for UNIX c++ targets.

Closes pypa/distutils#355
@jaraco jaraco merged commit 07d05da into main Apr 23, 2025
41 of 44 checks passed
@jaraco jaraco deleted the bugfix/distutils-356 branch April 23, 2025 21:59
@jaraco
Copy link
Member Author

jaraco commented Apr 23, 2025

Releasing as v79.0.1.

@vfazio
Copy link
Contributor

vfazio commented Apr 23, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants