Skip to content

Commit

Permalink
pipcl.py: fix finding python-config on macos python-3.12 builds.
Browse files Browse the repository at this point in the history
Reorder things so when we select the last matching candidate, it is the best
match.
  • Loading branch information
julian-smith-artifex-com committed Oct 12, 2023
1 parent 585d3e3 commit 394ab53
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pipcl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1778,26 +1778,30 @@ def __init__(self):
# Basic install of dev tools with `xcode-select --install` doesn't
# seem to provide a `python3-config` or similar, but there is a
# `python-config.py` accessible via sysconfig.
#
# We try different possibilities and use the last one that
# works.
#
python_config = None
for pc in (
f'{python_exe}-config',
f'{sys.executable} {sysconfig.get_config_var("srcdir")}/python-config.py',
f'python3-config',
f'{sys.executable} {sysconfig.get_config_var("srcdir")}/python-config.py',
f'{python_exe}-config',
):
log2(f'Trying: {pc=}')
e = subprocess.run(
f'{pc} --includes',
shell=1,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
check=0,
).returncode
log2(f'{e=}')
log1(f'{e=} from {pc!r}.')
if e == 0:
python_config = pc
assert python_config, f'Cannot find python-config'
else:
python_config = f'{python_exe}-config'
log1(f'Using {python_config=}.')
self.includes = run( f'{python_config} --includes', capture=1).strip()
#if darwin():
# self.ldflags =
Expand Down

0 comments on commit 394ab53

Please sign in to comment.