Changelog: bv.write and bv.insert require a bytes object in python3 Architecture.assemble outputs a bytes object in python3, a str in python2 Architecture.assemble will throw a value error if it cannot assemble the given instruction API install script should be run in the version of python you want it installed in Fundamental python changes to be aware of: Unicode-type strings are now just str, consequently anything that came out as a unicode string before (annotations) are now just str. Longs no longer exist. They're just ints.
Diffstat (limited to 'python/pluginmanager.py')
-rw-r--r--python/pluginmanager.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/python/pluginmanager.py b/python/pluginmanager.py
index 0cc43aca..c7a0c83a 100644
--- a/python/pluginmanager.py
+++ b/python/pluginmanager.py
@@ -21,9 +21,10 @@
import ctypes
# Binary Ninja components
-import _binaryninjacore as core
-from .enums import PluginType, PluginUpdateStatus
-import startup
+from binaryninja import _binaryninjacore as core
+
+# 2-3 compatibility
+from binaryninja import range
class RepoPlugin(object):
@@ -31,6 +32,7 @@ class RepoPlugin(object):
``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.
"""
+ from binaryninja.enums import PluginType, PluginUpdateStatus
def __init__(self, handle):
raise Exception("RepoPlugin temporarily disabled!")
self.handle = core.handle_of_type(handle, core.BNRepoPlugin)
@@ -111,7 +113,7 @@ class RepoPlugin(object):
result = []
count = ctypes.c_ulonglong(0)
plugintypes = core.BNPluginGetPluginTypes(self.handle, count)
- for i in xrange(count.value):
+ for i in range(count.value):
result.append(PluginType(plugintypes[i]))
core.BNFreePluginTypes(plugintypes)
return result
@@ -183,7 +185,7 @@ class Repository(object):
pluginlist = []
count = ctypes.c_ulonglong(0)
result = core.BNRepositoryGetPlugins(self.handle, count)
- for i in xrange(count.value):
+ for i in range(count.value):
pluginlist.append(RepoPlugin(handle=result[i]))
core.BNFreeRepositoryPluginList(result, count.value)
del result
@@ -220,7 +222,7 @@ class RepositoryManager(object):
result = []
count = ctypes.c_ulonglong(0)
repos = core.BNRepositoryManagerGetRepositories(self.handle, count)
- for i in xrange(count.value):
+ for i in range(count.value):
result.append(Repository(handle=repos[i]))
core.BNFreeRepositoryManagerRepositoriesList(repos)
return result
@@ -236,7 +238,7 @@ class RepositoryManager(object):
@property
def default_repository(self):
"""Gets the default Repository"""
- startup._init_plugins()
+ binaryninja._init_plugins()
return Repository(handle=core.BNRepositoryManagerGetDefaultRepository(self.handle))
def enable_plugin(self, plugin, install=True, repo=None):