Skip to content
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
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,7 @@ warn_unused_ignores = true

[[tool.mypy.overrides]]
module = "dwarffi._version"
ignore_missing_imports = true
ignore_missing_imports = true

[project.scripts]
dwarf2json = "dwarffi.cli:main"
25 changes: 25 additions & 0 deletions src/dwarffi/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# src/dwarffi/cli.py
import subprocess
import sys
from pathlib import Path


def main() -> None:
"""Entry point for the dwarf2json command line wrapper."""
# Resolve the path to the bundled binary relative to this Python file
package_dir = Path(__file__).parent

# Handle the `.exe` extension for Windows environments
exe_name = "dwarf2json.exe" if sys.platform == "win32" else "dwarf2json"
binary_path = package_dir / "bin" / exe_name

if not binary_path.exists():
print(f"Error: Bundled dwarf2json binary not found at {binary_path}", file=sys.stderr)
sys.exit(1)

# Execute the binary, passing all arguments provided by the user
try:
result = subprocess.run([str(binary_path)] + sys.argv[1:])
sys.exit(result.returncode)
except KeyboardInterrupt:
sys.exit(130)
Loading