-
Notifications
You must be signed in to change notification settings - Fork 257
macOS: Fix yt-dlp launch through mpv #791
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
Open
Et0h
wants to merge
1
commit into
master
Choose a base branch
from
macOS-ytdlp-fix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this necessary?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to address the macOS yt-dlp/mpv problem discussed in #585 and #785, while making the fix work more universally rather than depending on a particular yt-dlp/Python installation.
For context, I'm doing my best to get something workable while not being a macOS user let alone developer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know what you're trying to accomplish, I authored that PR :)
my question is about the addition in this PR relative to mine (extending PATH with 'common' paths) - what makes you think PATH is not sufficiently populated therefore needs to be extended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair question. The PATH change isn't needed for the "PYTHONHOME"/"PYTHONPATH" fix itself. I added it because removing the old workaround also removes its explicit "/opt/homebrew/bin:/usr/local/bin:/usr/bin" PATH handling.
My concern is the normal DMG/Finder-launched use case: py2app documents that applications launched normally get a minimal environment and don't pick up changes from the user's shell profile. This was also discussed in #276, where it was noted that macOS GUI apps may not have "/usr/local/bin" in PATH and the suggestion was to append it rather than replace the existing PATH.
So the intention was to preserve the old code's ability to find a Homebrew-installed downloader, while avoiding overwriting any PATH that is already present. "/opt/homebrew/bin" covers current Apple Silicon Homebrew and "/usr/local/bin" covers Intel Homebrew.
On reflection, I think the patch can be narrower here: rather than adding all of the standard system paths, it could just preserve the inherited PATH and append "/opt/homebrew/bin" and "/usr/local/bin" if missing.
What's your thoughts on it being tweaked to:
if isMacOS():
env.pop('PYTHONHOME', None)
env.pop('PYTHONPATH', None)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
macos applications, launched from dock, finder, or as login items generally don't pick up the PATH from the user's shell profile as you have noted.
this is intended by apple and not specific to py2app. the proper mechanism to configure this is via
/etc/pathsand/etc/paths.d(seeman path_helper).if homebrew users have not added homebrew to the system-wide path, then that is indicative of a misconfigured system, in my opinion. now, whether this is common or not, I wouldn't be able to tell you - I do not use homebrew (and am most knowledgeable about Linux too). and I'm not installing homebrew just to try this, but it's worth noting that some package managers (and proprietary software packages) install their paths into
/etc/paths.dautomatically.should syncplay accommodate for this misconfiguration of unknown commonness? probably not. but it's not a hill I'm willing to die on. so, your call :)