Skip to content

Commit

Permalink
fix: support aarch64 platform value for Python
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexox committed Oct 17, 2024
1 parent 9f3f327 commit fd3d1d8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion packaging/pypi/lefthook/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,22 @@
import platform
import subprocess

ISSUE_URL = "https://github.com/evilmartians/lefthook/issues/new/choose"
ARCH_MAPPING = {
'amd64': 'x86_64',
'aarch64': 'arm64',
}

def main():
os_name = platform.system().lower()
arch = platform.machine().lower()
arch = ARCH_MAPPING.get(arch, arch)
ext = os_name == "windows" and ".exe" or ""
arch = platform.machine()
subfolder = f"lefthook-{os_name}-{arch}"
executable = os.path.join(os.path.dirname(__file__), "bin", subfolder, "lefthook"+ext)
if not os.path.isfile(executable):
print(f"Couldn't find binary {executable}. Please create an issue: {ISSUE_URL}")
return 1

result = subprocess.run([executable] + sys.argv[1:])
return result.returncode
2 changes: 1 addition & 1 deletion packaging/pypi/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
author='Evil Martians',
author_email='lefthook@evilmartians.com',
url='https://github.com/evilmartians/lefthook',
description='A single dependency-free binary to manage all your git hooks that works with any language in any environment, and in all common team workflows',
description='Git hooks manager. Fast, powerful, simple.',
long_description=long_description,
long_description_content_type="text/markdown",
packages=find_packages(),
Expand Down

0 comments on commit fd3d1d8

Please sign in to comment.