Skip to content

Commit 5f7f0c4

Browse files
committed
convert core_serial, version, build_id ando thers to methods
1 parent d0fc9bb commit 5f7f0c4

File tree

3 files changed

+34
-7
lines changed

3 files changed

+34
-7
lines changed

python/__init__.py

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,21 +230,48 @@ def _init_plugins():
230230
_destruct_callbacks = _DestructionCallbackHandler()
231231

232232
def bundled_plugin_path():
233+
"""
234+
``bundled_plugin_path`` returns a string containing the current plugin path inside the `install path <https://docs.binary.ninja/getting-started.html#binary-path>`_
235+
236+
:return: current bundled plugin path
237+
:rtype: str, or None on failure
238+
"""
233239
return core.BNGetBundledPluginDirectory()
234240

235241
def user_plugin_path():
242+
"""
243+
``user_plugin_path`` returns a string containing the current plugin path inside the `user directory <https://docs.binary.ninja/getting-started.html#user-folder>`_
244+
245+
:return: current user plugin path
246+
:rtype: str, or None on failure
247+
"""
236248
return core.BNGetUserPluginDirectory()
237249

238250
def core_version():
239-
'''Core version'''
251+
"""
252+
``core_version`` returns a string containing the current version
253+
254+
:return: current version
255+
:rtype: str, or None on failure
256+
"""
240257
return core.BNGetVersionString()
241258

242259
def core_build_id():
243-
'''Build ID'''
260+
"""
261+
``core_build_id`` returns a string containing the current build id
262+
263+
:return: current build id
264+
:rtype: str, or None on failure
265+
"""
244266
core.BNGetBuildId()
245267

246268
def core_serial():
247-
'''Serial Number'''
269+
"""
270+
``core_serial`` returns a string containing the current serial number
271+
272+
:return: current serial
273+
:rtype: str, or None on failure
274+
"""
248275
return core.BNGetSerialNumber()
249276

250277
def core_expires():

python/examples/version_switcher.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ def select(version):
7272
if are_auto_updates_enabled():
7373
print("Disabling automatic updates.")
7474
set_auto_updates_enabled(False)
75-
if (version.version == core_version):
75+
if (version.version == core_version()):
7676
print("Already running %s" % version.version)
7777
else:
7878
print("version.version %s" % version.version)
79-
print("core_version %s" % core_version)
79+
print("core_version %s" % core_version())
8080
print("Downloading...")
8181
print(version.update())
8282
print("Installing...")
@@ -121,7 +121,7 @@ def main():
121121
while not done:
122122
print("\n\tBinary Ninja Version Switcher")
123123
print("\t\tCurrent Channel:\t%s" % channel.name)
124-
print("\t\tCurrent Version:\t%s" % core_version)
124+
print("\t\tCurrent Version:\t%s" % core_version())
125125
print("\t\tAuto-Updates On:\t%s\n" % are_auto_updates_enabled())
126126
for index, version in enumerate(versions):
127127
date = datetime.datetime.fromtimestamp(version.time).strftime('%c')

scripts/install_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def validate_path(path):
4242

4343
try:
4444
from binaryninja import core_version
45-
print("Found Binary Ninja core version: {}".format(core_version))
45+
print("Found Binary Ninja core version: {}".format(core_version()))
4646
except ImportError:
4747
sys.path = old_path
4848
return False

0 commit comments

Comments
 (0)