Skip to content
This repository was archived by the owner on Mar 27, 2019. It is now read-only.

Commit d346750

Browse files
committed
HACK: force pipenv to create venvs (right now for tests)
1 parent e5807b2 commit d346750

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

langserver/clone_workspace.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from functools import lru_cache
77
from enum import Enum
88
from pathlib import Path
9+
import os
910

1011
log = logging.getLogger(__name__)
1112

@@ -183,8 +184,17 @@ def run_command(self, command, no_prefix=False, **kwargs):
183184
'''
184185
kwargs["cwd"] = self.CLONED_PROJECT_PATH
185186

186-
# add pipenv prefix
187187
if not no_prefix:
188+
189+
# HACK: this is to get our spawned pipenv to keep creating
190+
# venvs even if the language server itself is running inside one
191+
# See:
192+
# https://github.com/pypa/pipenv/blob/4e8deda9cbf2a658ab40ca31cc6e249c0b53d6f4/pipenv/environments.py#L58
193+
194+
env = kwargs.get("env", os.environ.copy())
195+
env["VIRTUAL_ENV"] = ""
196+
kwargs["env"] = env
197+
188198
if type(command) is str:
189199
command = "pipenv run {}".format(command)
190200
else:

0 commit comments

Comments
 (0)