Commit 041e10f7 by Sébastien Eustace

Fix generic environments command execution

parent c7342e45
...@@ -33,8 +33,6 @@ class EnvInfoCommand(Command): ...@@ -33,8 +33,6 @@ class EnvInfoCommand(Command):
self._display_complete_info(env) self._display_complete_info(env)
def _display_complete_info(self, env: "Env") -> None: def _display_complete_info(self, env: "Env") -> None:
from poetry.utils.env import GenericEnv
env_python_version = ".".join(str(s) for s in env.version_info[:3]) env_python_version = ".".join(str(s) for s in env.version_info[:3])
self.line("") self.line("")
self.line("<b>Virtualenv</b>") self.line("<b>Virtualenv</b>")
...@@ -60,7 +58,7 @@ class EnvInfoCommand(Command): ...@@ -60,7 +58,7 @@ class EnvInfoCommand(Command):
self.line("") self.line("")
system_env = GenericEnv(env.base) system_env = env.parent_env
self.line("<b>System</b>") self.line("<b>System</b>")
self.line( self.line(
"\n".join( "\n".join(
......
...@@ -762,7 +762,7 @@ class EnvManager: ...@@ -762,7 +762,7 @@ class EnvManager:
self.remove_venv(venv) self.remove_venv(venv)
return VirtualEnv(venv) return VirtualEnv(venv, venv)
def create_venv( def create_venv(
self, self,
...@@ -1741,6 +1741,21 @@ class GenericEnv(VirtualEnv): ...@@ -1741,6 +1741,21 @@ class GenericEnv(VirtualEnv):
return json.loads(output) return json.loads(output)
def execute(self, bin: str, *args: str, **kwargs: Any) -> Optional[int]:
command = self.get_command_from_bin(bin) + list(args)
env = kwargs.pop("env", {k: v for k, v in os.environ.items()})
if not self._is_windows:
return os.execvpe(command[0], command, env=env)
else:
exe = subprocess.Popen([command[0]] + command[1:], env=env, **kwargs)
exe.communicate()
return exe.returncode
def _run(self, cmd: List[str], **kwargs: Any) -> Optional[int]:
return super(VirtualEnv, self)._run(cmd, **kwargs)
def is_venv(self) -> bool: def is_venv(self) -> bool:
return self._path != self._base return self._path != self._base
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment