summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/__init__.py1
-rw-r--r--python/pluginmanager.py15
2 files changed, 7 insertions, 9 deletions
diff --git a/python/__init__.py b/python/__init__.py
index 02703972..ebd7a331 100644
--- a/python/__init__.py
+++ b/python/__init__.py
@@ -250,7 +250,6 @@ def _init_plugins():
if _enable_default_log and is_headless_init_once and min_level in LogLevel.__members__ and not core_ui_enabled(
) and sys.stderr.isatty():
log_to_stderr(LogLevel[min_level])
- core.BNInitRepoPlugins()
if core.BNIsLicenseValidated():
_plugin_init = True
else:
diff --git a/python/pluginmanager.py b/python/pluginmanager.py
index 62066397..8f6eaa6c 100644
--- a/python/pluginmanager.py
+++ b/python/pluginmanager.py
@@ -34,7 +34,7 @@ class RepoPlugin:
``RepoPlugin`` is mostly read-only, however you can install/uninstall enable/disable plugins. RepoPlugins are
created by parsing the plugins.json in a plugin repository.
"""
- def __init__(self, handle: core.BNRepoPluginHandle):
+ def __init__(self, handle: core.BNPluginHandle):
self.handle = handle
def __del__(self):
@@ -289,7 +289,7 @@ class Repository:
for plugin in self.plugins:
if plugin_path == plugin.path:
return plugin
- raise KeyError()
+ raise KeyError(plugin_path)
@property
def url(self) -> str:
@@ -337,24 +337,23 @@ class RepositoryManager:
"""
def __init__(self):
binaryninja._init_plugins()
- self.handle = core.BNGetRepositoryManager()
def __getitem__(self, repo_path: str) -> Repository:
for repo in self.repositories:
if repo_path == repo.path:
return repo
- raise KeyError()
+ raise KeyError(repo_path)
def check_for_updates(self) -> bool:
"""Check for updates for all managed Repository objects"""
- return core.BNRepositoryManagerCheckForUpdates(self.handle)
+ return core.BNRepositoryManagerCheckForUpdates()
@property
def repositories(self) -> List[Repository]:
"""List of Repository objects being managed"""
result = []
count = ctypes.c_ulonglong(0)
- repos = core.BNRepositoryManagerGetRepositories(self.handle, count)
+ repos = core.BNRepositoryManagerGetRepositories(count)
assert repos is not None, "core.BNRepositoryManagerGetRepositories returned None"
try:
for i in range(count.value):
@@ -376,7 +375,7 @@ class RepositoryManager:
@property
def default_repository(self) -> Repository:
"""Gets the default Repository"""
- repo_handle = core.BNRepositoryManagerGetDefaultRepository(self.handle)
+ repo_handle = core.BNRepositoryManagerGetDefaultRepository()
assert repo_handle is not None, "core.BNRepositoryManagerGetDefaultRepository returned None"
repo_handle_ref = core.BNNewRepositoryReference(repo_handle)
assert repo_handle_ref is not None, "core.BNNewRepositoryReference returned None"
@@ -406,4 +405,4 @@ class RepositoryManager:
if not isinstance(url, str) or not isinstance(repopath, str):
raise ValueError("Expected url or repopath to be of type str.")
- return core.BNRepositoryManagerAddRepository(self.handle, url, repopath)
+ return core.BNRepositoryManagerAddRepository(url, repopath)