Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ldcxxshared contains ccache #4749

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions newsfragments/4749.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fix c++ linker arguments if CPython is compiled with ccache
10 changes: 6 additions & 4 deletions setuptools/_distutils/sysconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import re
import sys
import sysconfig
import shlex

from jaraco.functools import pass_none

Expand Down Expand Up @@ -64,7 +65,6 @@ def _is_parent(dir_a, dir_b):


if os.name == 'nt':

@pass_none
def _fix_pcbuild(d):
# In a venv, sys._home will be inside BASE_PREFIX rather than PREFIX.
Expand All @@ -88,7 +88,6 @@ def _python_build():

python_build = _python_build()


# Calculate the build qualifier flags if they are defined. Adding the flags
# to the include and lib directories only makes sense for an installation, not
# an in-source build.
Expand Down Expand Up @@ -328,11 +327,14 @@ def customize_compiler(compiler):
if 'LDSHARED' not in os.environ and ldshared.startswith(cc):
# If CC is overridden, use that as the default
# command for LDSHARED as well
ldshared = newcc + ldshared[len(cc) :]
ldshared = newcc + ldshared[len(cc):]
cc = newcc
cxx = os.environ.get('CXX', cxx)
ldshared = os.environ.get('LDSHARED', ldshared)
ldcxxshared = os.environ.get('LDCXXSHARED', ldcxxshared)
ldcxxshared_s = shlex.split(ldcxxshared)
if ldcxxshared_s[0] in {'ccache', 'sccache'}:
ldcxxshared = shlex.join(ldcxxshared_s[1:])
cpp = os.environ.get(
'CPP',
cc + " -E", # not always
Expand Down Expand Up @@ -481,7 +483,7 @@ def parse_makefile(fn, g=None): # noqa: C901
else:
done[n] = item = ""
if found:
after = value[m.end() :]
after = value[m.end():]
value = value[: m.start()] + item + after
if "$" in after:
notdone[name] = value
Expand Down