Rewrite Environment.sys_path

Use `pipenv.utils.shell.load_path`

instead of using `vistir.misc.run`
This commit is contained in:
Oz N Tiram
2022-10-21 13:37:20 +02:00
parent eaeef7df43
commit b5045155a7
2 changed files with 5 additions and 13 deletions
+4 -11
View File
@@ -311,19 +311,12 @@ class Environment:
return sys.path
elif any([sys.prefix == self.prefix, not self.is_venv]):
return sys.path
cmd_args = [self.python, "-c", "import json, sys; print(json.dumps(sys.path))"]
path, _ = vistir.misc.run(
cmd_args,
return_object=False,
nospin=True,
block=True,
combine_stderr=False,
write_to_stdout=False,
)
try:
path = json.loads(path.strip())
except json.JSONDecodeError:
path = pipenv.utils.shell.load_path(self.python)
except json.decoder.JSONDecodeError:
path = sys.path
return path
def build_command(
+1 -2
View File
@@ -73,8 +73,7 @@ def load_path(python):
from pathlib import Path
python = Path(python).as_posix()
json_dump_commmand = '"import json, sys; print(json.dumps(sys.path));"'
c = subprocess_run([python, "-c", json_dump_commmand])
c = subprocess_run([python, "-c", "import json, sys; print(json.dumps(sys.path))"])
if c.returncode == 0:
return json.loads(c.stdout.strip())
else: