Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace halo spinner with rich #2086

Merged
merged 4 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 5 additions & 3 deletions capa/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from typing import Set, Dict, List, Optional
from pathlib import Path

import halo
from rich.console import Console
from typing_extensions import assert_never

import capa.perf
Expand Down Expand Up @@ -176,6 +176,8 @@ def get_extractor(
UnsupportedArchError
UnsupportedOSError
"""
console = Console(stderr=True, quiet=disable_progress)
fariss marked this conversation as resolved.
Show resolved Hide resolved

if backend == BACKEND_CAPE:
import capa.features.extractors.cape.extractor

Expand Down Expand Up @@ -222,7 +224,7 @@ def get_extractor(
if os_ == OS_AUTO and not is_supported_os(input_path):
raise UnsupportedOSError()

with halo.Halo(text="analyzing program", spinner="simpleDots", stream=sys.stderr, enabled=not disable_progress):
with console.status("Analyzing program...", spinner="dots"):
fariss marked this conversation as resolved.
Show resolved Hide resolved
bv: BinaryView = binaryninja.load(str(input_path))
if bv is None:
raise RuntimeError(f"Binary Ninja cannot open file {input_path}")
Expand All @@ -247,7 +249,7 @@ def get_extractor(
if os_ == OS_AUTO and not is_supported_os(input_path):
raise UnsupportedOSError()

with halo.Halo(text="analyzing program", spinner="simpleDots", stream=sys.stderr, enabled=not disable_progress):
with console.status("Analyzing program...", spinner="dots"):
fariss marked this conversation as resolved.
Show resolved Hide resolved
vw = get_workspace(input_path, input_format, sigpaths)

if should_save_workspace:
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ dependencies = [
"dncil==1.0.2",
"pydantic==2.7.1",
"protobuf==5.26.1",
"rich==13.4.2"
fariss marked this conversation as resolved.
Show resolved Hide resolved
]
dynamic = ["version"]

Expand Down
Loading