summaryrefslogtreecommitdiff
path: root/python/enterprise.py
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2022-11-03 16:23:36 -0400
committerPeter LaFosse <peter@vector35.com>2022-11-10 16:19:13 -0500
commitd67d5b63f3a17d10b7b7ca722b7192220447209a (patch)
treeaa585f8a801b25a52c266c71a44cbe2453968532 /python/enterprise.py
parent45b94b961b0776339d258194fdab1555227c8d02 (diff)
[Enterprise] Python: Allow LicenseCheckout(release=False)
Diffstat (limited to 'python/enterprise.py')
-rw-r--r--python/enterprise.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/python/enterprise.py b/python/enterprise.py
index df5f8dd2..b95ff1e0 100644
--- a/python/enterprise.py
+++ b/python/enterprise.py
@@ -287,11 +287,18 @@ class LicenseCheckout:
with open_view("/bin/ls") as bv: # e.g.
print(hex(bv.start))
# License is released at end of scope
-
"""
- def __init__(self, duration=900, _cache=True):
+ def __init__(self, duration=900, _cache=True, release=True):
+ """
+ Get a new license checkout
+ :param duration: Duration between refreshes
+ :param _cache: Deprecated but left in for compatibility
+ :param release: If the license should be released at the end of scope. If False, you
+ can either manually release it later or it will expire after `duration`.
+ """
self.desired_duration = duration
self.acquired_license = False
+ self.desired_release = release
def __enter__(self):
# UI builds have their own license manager
@@ -335,5 +342,5 @@ class LicenseCheckout:
if binaryninja.core_ui_enabled():
return
# Don't release if we got one from keychain
- if self.acquired_license:
+ if self.acquired_license and self.desired_release:
release_license()