idalib: remove custom idalib loading

This commit is contained in:
Willi Ballenthin
2026-05-11 08:52:47 +02:00
committed by Willi Ballenthin
parent b5f81e30f0
commit 9ba497f6f7
5 changed files with 25 additions and 129 deletions
+2 -5
View File
@@ -894,11 +894,8 @@ def get_idalib_extractor(path: Path):
import capa.features.extractors.ida.idalib as idalib
import capa.features.extractors.ida.extractor
if not idalib.has_idalib():
raise RuntimeError("cannot find IDA idalib module.")
if not idalib.load_idalib():
raise RuntimeError("failed to load IDA idalib module.")
if not idalib.is_idalib_installed():
raise RuntimeError("idalib is not available.")
_check_stale_idalib_files(path)
+13 -17
View File
@@ -16,30 +16,26 @@ import logging
import pytest
import fixtures
import capa.features.extractors.ida.idalib as idalib
from capa.features.file import FunctionName
from capa.features.insn import API
from capa.features.common import Characteristic
logger = logging.getLogger(__name__)
idalib_present = idalib.has_idalib()
if idalib_present:
try:
if True:
# in order to use idalib, we have to import the idapro package
# which manipulates the search path as a side effect.
# we have to do this before importing ida_* packages.
# but isort wants to put idapro after ida_kernwin, so we use
# this dumb branch to keep the ordering correct.
import idapro # noqa: F401 [imported but unused]
import ida_kernwin
try:
if True:
# in order to use idalib, we have to import the idapro package
# which manipulates the search path as a side effect.
# we have to do this before importing ida_* packages.
# but isort wants to put idapro after ida_kernwin, so we use
# this dumb branch to keep the ordering correct.
import idapro # noqa: F401 [imported but unused]
import ida_kernwin
kernel_version: str = ida_kernwin.get_kernel_version()
except ImportError:
idalib_present = False
kernel_version = "0.0"
else:
kernel_version: str = ida_kernwin.get_kernel_version()
idalib_present = True
except ImportError:
idalib_present = False
kernel_version = "0.0"