Skip to content

Commit 394ab53

Browse files
pipcl.py: fix finding python-config on macos python-3.12 builds.
Reorder things so when we select the last matching candidate, it is the best match.
1 parent 585d3e3 commit 394ab53

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pipcl.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -1778,26 +1778,30 @@ def __init__(self):
17781778
# Basic install of dev tools with `xcode-select --install` doesn't
17791779
# seem to provide a `python3-config` or similar, but there is a
17801780
# `python-config.py` accessible via sysconfig.
1781+
#
1782+
# We try different possibilities and use the last one that
1783+
# works.
1784+
#
17811785
python_config = None
17821786
for pc in (
1783-
f'{python_exe}-config',
1784-
f'{sys.executable} {sysconfig.get_config_var("srcdir")}/python-config.py',
17851787
f'python3-config',
1788+
f'{sys.executable} {sysconfig.get_config_var("srcdir")}/python-config.py',
1789+
f'{python_exe}-config',
17861790
):
1787-
log2(f'Trying: {pc=}')
17881791
e = subprocess.run(
17891792
f'{pc} --includes',
17901793
shell=1,
17911794
stdout=subprocess.DEVNULL,
17921795
stderr=subprocess.DEVNULL,
17931796
check=0,
17941797
).returncode
1795-
log2(f'{e=}')
1798+
log1(f'{e=} from {pc!r}.')
17961799
if e == 0:
17971800
python_config = pc
17981801
assert python_config, f'Cannot find python-config'
17991802
else:
18001803
python_config = f'{python_exe}-config'
1804+
log1(f'Using {python_config=}.')
18011805
self.includes = run( f'{python_config} --includes', capture=1).strip()
18021806
#if darwin():
18031807
# self.ldflags =

0 commit comments

Comments
 (0)