From d631a9355c3469d43e5fcf8d8093276906abca7f Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Thu, 24 Oct 2019 11:59:22 +0100 Subject: [PATCH] Allow for use_user_site being set to an integer This can come from tox config, see: https://github.com/pypa/pip/pull/7002#issuecomment-545108292 --- src/pip/_internal/commands/install.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pip/_internal/commands/install.py b/src/pip/_internal/commands/install.py index e50155c2709..9bc9f1e9b37 100644 --- a/src/pip/_internal/commands/install.py +++ b/src/pip/_internal/commands/install.py @@ -616,11 +616,13 @@ def decide_user_install( If use_user_site is None, the default behaviour depends on the environment, which is provided by the other arguments. """ - if use_user_site is False: + # In some cases (config from tox), use_user_site can be set to an integer + # rather than a bool. Comparing == True/False instead of 'is' allows this. + if use_user_site == False: # noqa: E712 logger.debug("Non-user install by explicit request") return False - if use_user_site is True: + if use_user_site == True: # noqa: E712 if prefix_path: raise CommandError( "Can not combine '--user' and '--prefix' as they imply "