Skip to content

Commit

Permalink
meson: import python module
Browse files Browse the repository at this point in the history
- 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 [email protected] 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.
  • Loading branch information
m154k1 authored and Dudemanguy committed Oct 28, 2023
1 parent e76660c commit a57bd8e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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. [email protected] 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
Expand Down

0 comments on commit a57bd8e

Please sign in to comment.