summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorBen Demick <45530187+3pidemix@users.noreply.github.com>2020-04-15 17:34:44 -0400
committerJordan <jordan@psifertex.com>2020-04-15 17:40:58 -0400
commit44ef370ab0e2ae9cc785072978f943ac41e6d477 (patch)
treebacc9f9deb47c12a447214b03937b2419eb94b89 /scripts
parent5449449fb4a7fdd53a19adf54ea2f5974f94d858 (diff)
Improved installation process for venv
Added the -v option to make the venv installation explicit. This should eliminate any confusion about normal installation and leaves the original functionality intact.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/install_api.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/scripts/install_api.py b/scripts/install_api.py
index 84c5e6de..3c10f789 100644
--- a/scripts/install_api.py
+++ b/scripts/install_api.py
@@ -20,6 +20,14 @@ INTERACTIVE = True
if '-s' in sys.argv[1:]:
INTERACTIVE = False
+INSTALL_VENV = False
+if '-v' in sys.argv[1:]:
+ if os.environ.get('VIRTUAL_ENV'):
+ INSTALL_VENV = True
+ else:
+ print("Error: venv installation requested without an active python3 venv.")
+ sys.exit(1)
+
try:
import binaryninja
import binaryninjaui #To better detect if migrating from a version without UI plugin support
@@ -80,9 +88,7 @@ if ( len(sys.argv) > 1 and sys.argv[1].lower() == "root" ):
if not os.access(install_path, os.W_OK):
print("Root install specified but cannot write to {}".format(install_path))
sys.exit(1)
-elif os.environ.get('VIRTUAL_ENV'):
- print("Virtual environment detected - installing API in virtual environment.\n\
- Deactivate environment and re-run this script to perform normal installation.")
+elif INSTALL_VENV:
install_path = getsitepackages()[0]
else:
if check_enableusersite():