Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/3595.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added the ability for Windows users to enable emojis by setting ``PIPENV_HIDE_EMOJIS=0``.
2 changes: 1 addition & 1 deletion pipenv/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ def batch_install(deps_list, procs, failed_deps_queue,
from .vendor.requirementslib.models.utils import strip_extras_markers_from_requirement
failed = (not retry)
if not failed:
label = INSTALL_LABEL if os.name != "nt" else ""
label = INSTALL_LABEL if not PIPENV_HIDE_EMOJIS else ""
else:
label = INSTALL_LABEL2

Expand Down
21 changes: 15 additions & 6 deletions pipenv/environments.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
# I hope I can remove this one day.
os.environ["PYTHONDONTWRITEBYTECODE"] = fs_str("1")


def _is_env_truthy(name):
"""An environment variable is truthy if it exists and isn't one of (0, false, no, off)
"""
if name not in os.environ:
return False
return os.environ.get(name).lower() not in ("0", "false", "no", "off")


PIPENV_IS_CI = bool("CI" in os.environ or "TF_BUILD" in os.environ)

# HACK: Prevent invalid shebangs with Homebrew-installed Python:
Expand Down Expand Up @@ -70,13 +79,15 @@
emulator, e.g. Cmder, cannot be detected correctly.
"""

PIPENV_HIDE_EMOJIS = bool(os.environ.get("PIPENV_HIDE_EMOJIS"))
PIPENV_HIDE_EMOJIS = (
os.environ.get("PIPENV_HIDE_EMOJIS") is None
and (os.name == "nt" or PIPENV_IS_CI)
or _is_env_truthy("PIPENV_HIDE_EMOJIS")
)
"""Disable emojis in output.

Default is to show emojis. This is automatically set on Windows.
"""
if os.name == "nt" or PIPENV_IS_CI:
PIPENV_HIDE_EMOJIS = True

PIPENV_IGNORE_VIRTUALENVS = bool(os.environ.get("PIPENV_IGNORE_VIRTUALENVS"))
"""If set, Pipenv will always assign a virtual environment for this project.
Expand Down Expand Up @@ -295,9 +306,7 @@ def is_in_virtualenv():
if not pipenv_active and not ignore_virtualenvs:
virtual_env = os.environ.get("VIRTUAL_ENV")
use_system = bool(virtual_env)
return (use_system or virtual_env) and not (
pipenv_active or ignore_virtualenvs
)
return (use_system or virtual_env) and not (pipenv_active or ignore_virtualenvs)


PIPENV_SPINNER_FAIL_TEXT = fix_utf8(u"✘ {0}") if not PIPENV_HIDE_EMOJIS else ("{0}")
Expand Down
29 changes: 12 additions & 17 deletions pipenv/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,20 @@
STREAM = sys.stderr
MILL_TEMPLATE = "%s %s %i/%i\r"
DOTS_CHAR = "."
if os.name != "nt":
if PIPENV_HIDE_EMOJIS:
if PIPENV_COLORBLIND:
BAR_FILLED_CHAR = "="
BAR_EMPTY_CHAR = "-"
else:
BAR_FILLED_CHAR = str(crayons.green("=", bold=True))
BAR_EMPTY_CHAR = str(crayons.black("-"))
if PIPENV_HIDE_EMOJIS:
if PIPENV_COLORBLIND:
BAR_FILLED_CHAR = "="
BAR_EMPTY_CHAR = "-"
else:
if PIPENV_COLORBLIND:
BAR_FILLED_CHAR = "▉"
BAR_EMPTY_CHAR = " "
else:
BAR_FILLED_CHAR = str(crayons.green("▉", bold=True))
BAR_EMPTY_CHAR = str(crayons.black("▉"))

BAR_FILLED_CHAR = str(crayons.green("=", bold=True))
BAR_EMPTY_CHAR = str(crayons.black("-"))
else:
BAR_FILLED_CHAR = "="
BAR_EMPTY_CHAR = "-"
if PIPENV_COLORBLIND:
BAR_FILLED_CHAR = "▉"
BAR_EMPTY_CHAR = " "
else:
BAR_FILLED_CHAR = str(crayons.green("▉", bold=True))
BAR_EMPTY_CHAR = str(crayons.black("▉"))

if (sys.version_info[0] >= 3) and (os.name != "nt"):
BAR_TEMPLATE = u" %s%s%s %i/%i — {0}\r".format(crayons.black("%s"))
Expand Down