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

Feature/apple m1 #101

Merged
merged 5 commits into from
Jan 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
binaries/*
!binaries/3.2.80
!binaries/3.2.84

**.DS_Store

Expand Down
Binary file removed binaries/3.2.80/x86_64-apple-darwin/TabNine
Binary file not shown.
Binary file not shown.
Binary file added binaries/3.2.84/i686-pc-windows-gnu/TabNine.exe
Binary file not shown.
Binary file not shown.
Binary file added binaries/3.2.84/x86_64-apple-darwin/TabNine
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 2 additions & 1 deletion dl_binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ targets='i686-pc-windows-gnu
i686-unknown-linux-musl
x86_64-apple-darwin
x86_64-pc-windows-gnu
x86_64-unknown-linux-musl'
x86_64-unknown-linux-musl
aarch64-apple-darwin'

rm -rf ./binaries

Expand Down
17 changes: 16 additions & 1 deletion lib/tab_nine_process.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import platform
import sublime
import subprocess
from imp import reload
Expand Down Expand Up @@ -37,6 +38,19 @@ def parse_semver(s):
return []


def get_arch():
try:
# handle a case of m1 running under roseeta
if sublime.platform() == "osx":
if "ARM64" in platform.version().upper():
return "arm64"
except Exception as e:
print("Error checking if apple m1:", e)
pass

return sublime.arch()


def get_tabnine_path(binary_dir):
def join_path(*args):
return os.path.join(binary_dir, *args)
Expand All @@ -46,11 +60,12 @@ def join_path(*args):
("linux", "x64"): "x86_64-unknown-linux-musl/TabNine",
("osx", "x32"): "i686-apple-darwin/TabNine",
("osx", "x64"): "x86_64-apple-darwin/TabNine",
("osx", "arm64"): "aarch64-apple-darwin/TabNine",
("windows", "x32"): "i686-pc-windows-gnu/TabNine.exe",
("windows", "x64"): "x86_64-pc-windows-gnu/TabNine.exe",
}

platform_key = sublime.platform(), sublime.arch()
platform_key = sublime.platform(), get_arch()
platform = translation[platform_key]

versions = []
Expand Down