Skip to content

Formatting Not Working - M1 Macs (darwin/arm64) Unsupported #95

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
JHumphreyJr opened this issue Nov 17, 2021 · 8 comments
Open

Formatting Not Working - M1 Macs (darwin/arm64) Unsupported #95

JHumphreyJr opened this issue Nov 17, 2021 · 8 comments

Comments

@JHumphreyJr
Copy link

JHumphreyJr commented Nov 17, 2021

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:

  1. 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.
  2. Open the plugin's pyastyle directory:
    open "~/Library/Application Support/Sublime Text/Packages/SublimeAStyleFormatter/pyastyle/python3"
    
  3. Create a new directory named _darwin.
  4. Create an empty __init__.py in the new _darwin directory.
  5. 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
  6. 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.")
    
@JHumphreyJr JHumphreyJr changed the title Formatting Not Working - M1 Macs (Darwin Architecture) Unsupported Formatting Not Working - M1 Macs (darwin/arm64) Unsupported Nov 17, 2021
@vipenl26
Copy link

Thanks, it works.

@Yachint
Copy link

Yachint commented Mar 20, 2022

Thanks, works on the M1 chip now.

@berrymoor
Copy link

in step5 i think it must be "pyastyle.so" insted of "pyastayle.so"

For half an hour I thought I was doing something wrong ))

@JHumphreyJr
Copy link
Author

Fixed @berrymoor, thanks, and sorry about that.

@bhushankorg
Copy link

Thanks you are a saviour, Now I can live peacefully!

@hockyy
Copy link

hockyy commented Jan 3, 2023

I've made the patch PR, try pulling from mine if you're too lazy to set up

@rajat-shahi
Copy link

I've made the patch PR, try pulling from mine if you're too lazy to set up

Thanks a lot !

@DopplerXD
Copy link

good solution and thx!

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

No branches or pull requests

8 participants