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

macOS Big Sur Support #518

Closed
wants to merge 6 commits into from
Closed

macOS Big Sur Support #518

wants to merge 6 commits into from

Conversation

JoelOsler
Copy link

Added macOS Big Sur support, as Big Sur removes access to Apple's Frameworks to the user, making os.path.isfile() fail.
os.path.isfile reads differently than direct file access.
The user doesn't have access to the Frameworks because of this -> https://www.reddit.com/r/MacOSBeta/comments/hfknpa/is_corefoundation_missing_for_everyone_on_big_sur/

Added macOS Big Sur support, as Big Sur removes access to Apple's Frameworks to the user, making os.path.isfile() fail.
os.path.isfile reads differently than direct file access.
The user doesn't have access to the Frameworks because of this -> https://www.reddit.com/r/MacOSBeta/comments/hfknpa/is_corefoundation_missing_for_everyone_on_big_sur/
Added macOS Big Sur support, as Big Sur removes access to Apple's Frameworks to the user, making os.path.isfile() fail.
os.path.isfile reads differently than direct file access.
The user doesn't have access to the Frameworks because of this -> https://www.reddit.com/r/MacOSBeta/comments/hfknpa/is_corefoundation_missing_for_everyone_on_big_sur/
macOS Big Sur Support, as Big Sur removes access to Frameworks to the user, making os.path.isfile() fail.
os.path.isfile reads as the user, but the user doesn't have access to the Frameworks because of this ->
@JoelOsler
Copy link
Author

I made this edit because I am on Big Sur, and I was attempting to use my ESP8266 NodeMCU 1.0 in Arduino IDE, but it was complaining. So I did a deep dive into the python code and learned about the new changes, and added what I learned into the code.

@zsquareplusc
Copy link
Member

Can someone confirm that this will not break support for older MacOS releases? I guess the paths to the libraries did not change, but to be sure...

@ivankravets
Copy link

@zsquareplusc how about to move it under try/except? If

iokit = ctypes.cdll.LoadLibrary(ctypes.util.find_library('IOKit'))
iokit = ctypes.cdll.LoadLibrary("/System/Library/Frameworks/IOKit.framework/Versions/Current/IOKit")
cf = ctypes.cdll.LoadLibrary(ctypes.util.find_library('CoreFoundation'))

does not work, then

iokit = ctypes.cdll.LoadLibrary("/System/Library/Frameworks/IOKit.framework/Versions/Current/IOKit")
cf = ctypes.cdll.LoadLibrary(ctypes.util.find_library('CoreFoundation'))
cf = ctypes.cdll.LoadLibrary("/System/Library/Frameworks/CoreFoundation.framework/Versions/Current/CoreFoundation")

In any case, I don't think that this PR is the best solution for this issue but it's good as a temporary workaround. We have over 1,000,000 developers for @platformio and all macOS users will be affected :(

@ivankravets
Copy link

ivankravets commented Sep 14, 2020

It looks like an issue with CPython python/cpython#21241

@JoelOsler could you adapt your PR to try/except as I described above? It will work on built-in macOS Big Sur' Python 3 and with the future Python versions that have a fix.

Thanks!

@zsquareplusc
Copy link
Member

That PR (21241) has a test that suggests that IOKit can be in one of two locations, so a hardcoded path may not work on all versions of MacOS.

@ivankravets
Copy link

ivankravets commented Sep 14, 2020

Could we also iterate over

        self.assertIn(find_lib('IOKit'),
                             ('/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit',
                             '/System/Library/Frameworks/IOKit.framework/IOKit'))

?

zsquareplusc added a commit that referenced this pull request Sep 15, 2020
try different paths before using find_libary()

related to #518
zsquareplusc added a commit that referenced this pull request Sep 16, 2020
due to a security related change on MacOS, find_library fails. which may
eventually be fixed with a Python update
but it also does not hurt to use the full paths
now, that should work on old and new systems.

related to #509 #518
@zsquareplusc
Copy link
Member

looking at https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/FrameworkAnatomy.html i believe the short form of /path/to/x.framework/x should be sufficient and work across old and new versions of MacOS

@zsquareplusc
Copy link
Member

beta release is available, please see #528

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants