From b1ae67f7b1fba745a208384582a594a7f5a02f8a Mon Sep 17 00:00:00 2001 From: Ryan Pessa Date: Thu, 12 May 2016 11:50:02 -0500 Subject: [PATCH] throw error early if running in venv --- pythonforandroid/toolchain.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pythonforandroid/toolchain.py b/pythonforandroid/toolchain.py index 028a92a8e8..d457be849e 100755 --- a/pythonforandroid/toolchain.py +++ b/pythonforandroid/toolchain.py @@ -30,7 +30,7 @@ from pythonforandroid.archs import (ArchARM, ArchARMv7_a, Archx86) from pythonforandroid.logger import (logger, info, warning, setup_color, Out_Style, Out_Fore, Err_Style, Err_Fore, - info_notify, info_main, shprint) + info_notify, info_main, shprint, error) from pythonforandroid.util import current_directory, ensure_dir from pythonforandroid.bootstrap import Bootstrap from pythonforandroid.distribution import Distribution, pretty_log_dists @@ -118,6 +118,13 @@ def build_dist_from_args(ctx, dist, args): ctx.recipe_build_order = build_order ctx.python_modules = python_modules + if python_modules and hasattr(sys, 'real_prefix'): + error('virtualenv is needed to install pure-Python modules, but') + error('virtualenv does not support nesting, and you are running') + error('python-for-android in one. Please run p4a outside of a') + error('virtualenv instead.') + exit(1) + info('The selected bootstrap is {}'.format(bs.name)) info_main('# Creating dist with {} bootstrap'.format(bs.name)) bs.distribution = dist