From a57bd8e2b8a1871dc2613984b7ca93dd7bcb5419 Mon Sep 17 00:00:00 2001 From: m154k1 <139042094+m154k1@users.noreply.github.com> Date: Sat, 28 Oct 2023 12:16:44 +0300 Subject: [PATCH] meson: import python module - Use import to find Python installation. - Run macos-sdk-version.py with Python provided by meson. This fixes an error when meson and python-packaging are installed from Homebrew. Currently, the Python executable from python@3.12 is installed as python3.12 so python3 is referring to system installation, which may not have packaging module. meson can provide the correct executable via import. --- meson.build | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 345b591a8c5c0..94c05ed101004 100644 --- a/meson.build +++ b/meson.build @@ -13,7 +13,7 @@ project('mpv', build_root = meson.project_build_root() source_root = meson.project_source_root() -python = find_program('python3') +python = import('python').find_installation() # ffmpeg libavcodec = dependency('libavcodec', version: '>= 58.134.100') @@ -1475,7 +1475,10 @@ endif macos_sdk_path = '' macos_sdk_version = '0.0' if darwin and macos_sdk_version_py.found() - macos_sdk_info = run_command(macos_sdk_version_py, check: true).stdout().split(',') + # Execute macos-sdk-version.py with Python provided by meson. + # In some cases, Python executable with the necessary modules might not refer to python3 + # (e.g. python@3.12 and python-packaging Homebrew packages). + macos_sdk_info = run_command(python, macos_sdk_version_py, check: true).stdout().split(',') macos_sdk_path = macos_sdk_info[0].strip() macos_sdk_version = macos_sdk_info[1] endif