Skip to content

Commit

Permalink
Feature/apple m1 (#101)
Browse files Browse the repository at this point in the history
* add support for the apple m1 chip

* extract getting architecture into its own function

* check for apple m1 and return "arm64" architecture

* comment

Co-authored-by: Jamie van Dyke <jamie@fearoffish.com>
  • Loading branch information
amircodota and fearoffish committed Jan 14, 2021
1 parent 252b4f8 commit f4831af
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 3 deletions.
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

0 comments on commit f4831af

Please sign in to comment.