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

meson configure fail with Python 3.12 #12762

Closed
xanadu6291 opened this issue Oct 27, 2023 · 2 comments
Closed

meson configure fail with Python 3.12 #12762

xanadu6291 opened this issue Oct 27, 2023 · 2 comments
Labels

Comments

@xanadu6291
Copy link

Important Information

Provide following Information:

  • mpv version
    0.36.0-UNKNOWN and 0.36 stable release

  • macOS Version
    macOS 14.0

  • Source of the mpv binary or bundle
    Git head / tag 0.36

  • If known which version of mpv introduced the problem
    Not sure

  • Possible screenshot or video of visual glitches
    Unrelated

If you're not using git master or the latest release, update.
Releases are listed here: https://github.com/mpv-player/mpv/releases

Reproduction steps

Try to reproduce your issue with --no-config first. If it isn't reproducible
with --no-config try to first find out which option or script causes your issue.

Describe the reproduction steps as precise as possible. It's very likely that
the bug you experience wasn't reproduced by the developer because the workflow
differs from your own.

Install Python 3.12

meson setup build

or

meson setup --prefix ${TARGET}
--default-library=static
-Dswift-flags="-target arm64-apple-macosx14.0"
build

Expected behavior

build mpv successfully

Actual behavior

Program /Volumes/mpv_compile/compile/mpv/TOOLS/macos-sdk-version.py found: YES (/Volumes/mpv_compile/compile/mpv/TOOLS/macos-sdk-version.py)

meson.build:1478:21: ERROR: Command /Volumes/mpv_compile/compile/mpv/TOOLS/macos-sdk-version.py failed with status 1.

Log file

Make a log file made with -v -v or --log-file=output.txt. If you use the Bundle
from a version later than 0.32 a default log is created for your last run at
~/Library/Logs/mpv.log. You can jump to that file via the Help > Show log File…
menu. Paste the log to https://0x0.st/ or attach it to the github issue, and
replace this text with a link to it.

In the case of a crash please provide the macOS Crash Report (Backtrace).

The issue will be closed for ignoring the issue template.

Program /Volumes/mpv_compile/compile/mpv/TOOLS/macos-sdk-version.py found: YES (/Volumes/mpv_compile/compile/mpv/TOOLS/macos-sdk-version.py)
Running command: /Volumes/mpv_compile/compile/mpv/TOOLS/macos-sdk-version.py
--- stdout ---

--- stderr ---
/Volumes/mpv_compile/compile/mpv/TOOLS/macos-sdk-version.py:46: SyntaxWarning: invalid escape sequence '\d'
verRe = re.compile("(\d+)(\D+)(\d+)")
Traceback (most recent call last):
File "/Volumes/mpv_compile/compile/mpv/TOOLS/macos-sdk-version.py", line 11, in
from distutils.version import StrictVersion
ModuleNotFoundError: No module named 'distutils'

meson.build:1478:21: ERROR: Command /Volumes/mpv_compile/compile/mpv/TOOLS/macos-sdk-version.py failed with status 1.

Might be the issue is caused by Python 3.12. It removed distutils. Does mpv supports python 3.12?

Full meson log is:
meson-log.txt

Sample files

Sample files needed to reproduce this issue can be uploaded to https://0x0.st/
or similar sites. (Only needed if the issue cannot be reproduced without it.)
Do not use garbage like "cloud storage", especially not Google Drive.
Unrelated

@Dudemanguy
Copy link
Member

Evidently that particular script is just using something that's legacy. Does this diff work for you?

diff --git a/TOOLS/macos-sdk-version.py b/TOOLS/macos-sdk-version.py
index e3a973e857..ae1d355539 100755
--- a/TOOLS/macos-sdk-version.py
+++ b/TOOLS/macos-sdk-version.py
@@ -8,7 +8,7 @@ import re
 import os
 import string
 import sys
-from distutils.version import StrictVersion
+from packaging import version
 from shutil import which
 from subprocess import check_output
 
@@ -56,7 +56,7 @@ def find_macos_sdk():
         sdk_version = '10.10.0'
 
     # pick the higher version, always pick sdk over build if newer
-    if StrictVersion(build_version) > StrictVersion(sdk_version):
+    if version.parse(build_version) > version.parse(sdk_version):
         return sdk,build_version
     else:
         return sdk,sdk_version

@xanadu6291
Copy link
Author

Thank you very much. The diff works perfectly. Even though I need to install packaging module, it's perfect!!

Ref: packaging install command:
pip3 install packaging

Dudemanguy added a commit to Dudemanguy/mpv that referenced this issue Oct 27, 2023
Python 3.10 deprecated disutils and then removed it in 3.12. The macos
sdk check uses the version compare from there, so it needs to be
replaced with something else. So instead use the API from the packaging
module which is also widely available and a fit replacement.

Fixes mpv-player#12762.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants