For M1 Macs, the issue is the new Darwin architecture is missing. The architecture directory on this repository has not been updated in 7 years so I will also include a workaround:
- Run
pip3 install pyastyle in your favorite pyenv. I have not confirmed the compatibility between the latest version of pyastyle and the one used in this 7 year old library so YMMV.
- Open the plugin's pyastyle directory:
open "~/Library/Application Support/Sublime Text/Packages/SublimeAStyleFormatter/pyastyle/python3"
- Create a new directory named
_darwin.
- Create an empty
__init__.py in the new _darwin directory.
- Link or Copy & Rename the darwin binary installed in step 1 to
_darwin with the name pyastyle.so. If you pip3 installed this globally, this might be located in a path similar to: ~/Library/Python/3.8/lib/python/site-packages/pyastyle.cpython-38-darwin.so
- Modify
"~/Library/Application Support/Sublime Text/Packages/SublimeAStyleFormatter/pyastyle/python3/__init__.py" to only include the following:
try:
from ._darwin.pyastyle import *
platform = "MacOS X Darwin"
except ImportError:
raise ImportError("Could not find a suitable pyastyle binary for your platform and architecture.")
For M1 Macs, the issue is the new Darwin architecture is missing. The architecture directory on this repository has not been updated in 7 years so I will also include a workaround:
pip3 install pyastylein your favorite pyenv. I have not confirmed the compatibility between the latest version of pyastyle and the one used in this 7 year old library so YMMV._darwin.__init__.pyin the new_darwindirectory._darwinwith the namepyastyle.so. If you pip3 installed this globally, this might be located in a path similar to:~/Library/Python/3.8/lib/python/site-packages/pyastyle.cpython-38-darwin.so"~/Library/Application Support/Sublime Text/Packages/SublimeAStyleFormatter/pyastyle/python3/__init__.py"to only include the following: