diff --git a/.gitignore b/.gitignore index 26a73b6..e38a05e 100644 --- a/.gitignore +++ b/.gitignore @@ -235,3 +235,5 @@ cython_debug/ marimo/_static/ marimo/_lsp/ __marimo__/ +/unshackle/binaries +/.idea diff --git a/unshackle/core/binaries.py b/unshackle/core/binaries.py index da31fb5..878a36f 100644 --- a/unshackle/core/binaries.py +++ b/unshackle/core/binaries.py @@ -3,6 +3,8 @@ import sys from pathlib import Path from typing import Optional +from mypy.types import names + __shaka_platform = {"win32": "win", "darwin": "osx"}.get(sys.platform, sys.platform) @@ -15,16 +17,17 @@ def find(*names: str) -> Optional[Path]: for name in names: # First check local binaries folder if local_binaries_dir.exists(): - local_path = local_binaries_dir / name - if local_path.is_file() and local_path.stat().st_mode & 0o111: # Check if executable - return local_path - - # Also check with .exe extension on Windows + # On Windows, check for .exe extension first if sys.platform == "win32": - local_path_exe = local_binaries_dir / f"{name}.exe" + local_path_exe = local_binaries_dir / f"{name}" / f"{name}.exe" if local_path_exe.is_file(): return local_path_exe + # Check for exact name match with executable bit on Unix-like systems + local_path = local_binaries_dir / f"{name}" / f"{name}" + if local_path.is_file() and local_path.stat().st_mode & 0o111: # Check if executable + return local_path + # Fall back to system PATH path = shutil.which(name) if path: