diff --git a/bypy/linux/__main__.py b/bypy/linux/__main__.py index 20d5d40dd..5dde2c911 100644 --- a/bypy/linux/__main__.py +++ b/bypy/linux/__main__.py @@ -19,7 +19,11 @@ from bypy.freeze import ( from bypy.utils import get_dll_path, mkdtemp, py_compile, walk j = os.path.join -arch = 'x86_64' if is64bit else 'i686' +machine = (os.uname()[4] or '').lower() +if machine.startswith('arm64') or machine.startswith('aarch64'): + arch = 'arm64' +else: + arch = 'x86_64' if is64bit else 'i686' self_dir = os.path.dirname(os.path.abspath(__file__)) py_ver = '.'.join(map(str, python_major_minor_version())) iv = globals()['init_env'] diff --git a/docs/installer.py b/docs/installer.py index 4d3f0d012..4e2ba15a8 100644 --- a/docs/installer.py +++ b/docs/installer.py @@ -20,10 +20,16 @@ import tempfile py3 = sys.version_info[0] > 2 is64bit = platform.architecture()[0] == '64bit' is_macos = 'darwin' in sys.platform.lower() +is_linux_arm = is_linux_arm64 = False if is_macos: mac_ver = tuple(map(int, platform.mac_ver()[0].split('.'))) if mac_ver[:2] < (10, 12): raise SystemExit('Your version of macOS is too old, at least 10.12 is required') +else: + machine = (os.uname()[4] or '').lower() + if machine.startswith('arm') or machine.startswith('aarch64'): + is_linux_arm = True + is_linux_arm64 = machine.startswith('arm64') or machine.startswith('aarch64') try: __file__ @@ -92,7 +98,8 @@ def get_release_data(relname='latest'): else: if name.endswith('.txz'): if is64bit: - if name.endswith('-x86_64.txz'): + q = '-arm64.txz' if is_linux_arm64 else '-x86_64.txz' + if name.endswith(q): return html_url + '/' + name, asset['size'] else: if name.endswith('-i686.txz'): @@ -186,11 +193,10 @@ def main(dest=None, launch=True, installer=None): dest = '/Applications' else: dest = os.path.expanduser('~/.local') - machine = os.uname()[4] - if not is_macos and machine and machine.lower().startswith('arm'): + if is_linux_arm and not is_linux_arm64: raise SystemExit( - 'You are running on an ARM system. The kitty binaries are only' - ' available for x86 systems. You will have to build from' + 'You are running on a 32-bit ARM system. The kitty binaries are only' + ' available for 64 bit ARM systems. You will have to build from' ' source.') if not installer: url, size = get_release_data() diff --git a/docs/installer.sh b/docs/installer.sh index 90eb11c93..579c18304 100644 --- a/docs/installer.sh +++ b/docs/installer.sh @@ -47,10 +47,16 @@ import tempfile py3 = sys.version_info[0] > 2 is64bit = platform.architecture()[0] == '64bit' is_macos = 'darwin' in sys.platform.lower() +is_linux_arm = is_linux_arm64 = False if is_macos: mac_ver = tuple(map(int, platform.mac_ver()[0].split('.'))) if mac_ver[:2] < (10, 12): raise SystemExit('Your version of macOS is too old, at least 10.12 is required') +else: + machine = (os.uname()[4] or '').lower() + if machine.startswith('arm') or machine.startswith('aarch64'): + is_linux_arm = True + is_linux_arm64 = machine.startswith('arm64') or machine.startswith('aarch64') try: __file__ @@ -119,7 +125,8 @@ def get_release_data(relname='latest'): else: if name.endswith('.txz'): if is64bit: - if name.endswith('-x86_64.txz'): + q = '-arm64.txz' if is_linux_arm64 else '-x86_64.txz' + if name.endswith(q): return html_url + '/' + name, asset['size'] else: if name.endswith('-i686.txz'): @@ -213,11 +220,10 @@ def main(dest=None, launch=True, installer=None): dest = '/Applications' else: dest = os.path.expanduser('~/.local') - machine = os.uname()[4] - if not is_macos and machine and machine.lower().startswith('arm'): + if is_linux_arm and not is_linux_arm64: raise SystemExit( - 'You are running on an ARM system. The kitty binaries are only' - ' available for x86 systems. You will have to build from' + 'You are running on a 32-bit ARM system. The kitty binaries are only' + ' available for 64 bit ARM systems. You will have to build from' ' source.') if not installer: url, size = get_release_data() diff --git a/publish.py b/publish.py index d9ac23eee..44082e5fb 100755 --- a/publish.py +++ b/publish.py @@ -373,6 +373,7 @@ def files_for_upload() -> Dict[str, str]: 'macos/dist/kitty-{}.dmg': 'macOS dmg', 'linux/64/dist/kitty-{}-x86_64.txz': 'Linux amd64 binary bundle', 'linux/32/dist/kitty-{}-i686.txz': 'Linux x86 binary bundle', + 'linux/arm64/dist/kitty-{}-arm64.txz': 'Linux arm64 binary bundle', }.items(): path = os.path.join('bypy', 'b', f.format(version)) if not os.path.exists(path): diff --git a/setup.py b/setup.py index 0535f5565..f061f47a2 100755 --- a/setup.py +++ b/setup.py @@ -1438,6 +1438,7 @@ def main() -> None: subprocess.check_call(cmd + ['linux'] + dest) subprocess.check_call(cmd + ['macos'] + dest) subprocess.check_call(cmd + ['linux', '32'] + dest) + subprocess.check_call(cmd + ['linux', 'arm64'] + dest) if __name__ == '__main__':