Skip to content

Commit

Permalink
Fix environment variable encoding for python 2
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Ryan <[email protected]>
  • Loading branch information
techalchemy committed Oct 7, 2018
1 parent c3303d5 commit 5ea800a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pipenv/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2037,7 +2037,7 @@ def do_shell(three=None, python=False, fancy=False, shell_args=None, pypi_mirror
# Ensure that virtualenv is available.
ensure_project(three=three, python=python, validate=False, pypi_mirror=pypi_mirror)
# Set an environment variable, so we know we're in the environment.
os.environ["PIPENV_ACTIVE"] = "1"
os.environ["PIPENV_ACTIVE"] = fs_str("1")
# Support shell compatibility mode.
if PIPENV_SHELL_FANCY:
fancy = True
Expand Down Expand Up @@ -2114,7 +2114,7 @@ def inline_activate_virtual_environment():
else:
_inline_activate_virtualenv()
if "VIRTUAL_ENV" not in os.environ:
os.environ["VIRTUAL_ENV"] = root
os.environ["VIRTUAL_ENV"] = fs_str(root)


def _launch_windows_subprocess(script):
Expand Down
5 changes: 3 additions & 2 deletions pipenv/environments.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import os
import sys
from appdirs import user_cache_dir
from utils import fs_str


# HACK: avoid resolver.py uses the wrong byte code files.
# I hope I can remove this one day.
os.environ["PYTHONDONTWRITEBYTECODE"] = "1"
os.environ["PYTHONDONTWRITEBYTECODE"] = fs_str("1")

# HACK: Prevent invalid shebangs with Homebrew-installed Python:
# https://bugs.python.org/issue22490
os.environ.pop("__PYVENV_LAUNCHER__", None)

# Load patched pip instead of system pip
os.environ["PIP_SHIMS_BASE_MODULE"] = "pipenv.patched.notpip"
os.environ["PIP_SHIMS_BASE_MODULE"] = fs_str("pipenv.patched.notpip")

PIPENV_CACHE_DIR = os.environ.get("PIPENV_CACHE_DIR", user_cache_dir("pipenv"))
"""Location for Pipenv to store it's package cache.
Expand Down

0 comments on commit 5ea800a

Please sign in to comment.