From 9b2428e01af87f48c14d21bc8d26f3e3aeee1734 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Fri, 5 Aug 2022 18:37:28 -0400 Subject: [PATCH] Improve handling of CI varaible for build systems that set it to a string like azure. --- pipenv/environments.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pipenv/environments.py b/pipenv/environments.py index 5b5e49f4..ed0d1664 100644 --- a/pipenv/environments.py +++ b/pipenv/environments.py @@ -81,7 +81,15 @@ def normalize_pipfile_path(p): os.environ.pop("__PYVENV_LAUNCHER__", None) # Internal, to tell whether the command line session is interactive. SESSION_IS_INTERACTIVE = _isatty(sys.stdout) -PIPENV_IS_CI = env_to_bool(os.environ.get("CI") or os.environ.get("TF_BUILD") or False) + +# TF_BUILD indicates to Azure pipelines it is a build step +PIPENV_IS_CI = os.environ.get("CI") or os.environ.get("TF_BUILD") +try: + PIPENV_IS_CI = env_to_bool(PIPENV_IS_CI) +except ValueError: + # CI variable detected and it did not evaluate to a false value + PIPENV_IS_CI = True + NO_COLOR = False if os.getenv("NO_COLOR") or os.getenv("PIPENV_COLORBLIND"): NO_COLOR = True