From 438eb2eb25000478dfa0211aad07c23756439a2d Mon Sep 17 00:00:00 2001 From: Wagner Macedo Date: Sat, 8 Oct 2022 09:30:31 +0200 Subject: [PATCH] rename Env.{_bin => get_bin_path} --- src/poetry/console/commands/run.py | 2 +- src/poetry/utils/env.py | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/poetry/console/commands/run.py b/src/poetry/console/commands/run.py index 9d8ee3553c8..ffdd7cc823b 100644 --- a/src/poetry/console/commands/run.py +++ b/src/poetry/console/commands/run.py @@ -55,7 +55,7 @@ def run_script(self, script: str | dict[str, str], args: list[str]) -> int: Otherwise (when an entry point script does not exist), ``sys.argv[0]`` is the script name only, i.e. ``poetry run foo`` has ``sys.argv == ['foo']``. """ - args = [self.env._bin(args[0]), *args[1:]] + args = [self.env.get_bin_path(args[0]), *args[1:]] if isinstance(script, dict): script = script["callable"] diff --git a/src/poetry/utils/env.py b/src/poetry/utils/env.py index 7de0d60d2bc..1b6a5fca880 100644 --- a/src/poetry/utils/env.py +++ b/src/poetry/utils/env.py @@ -1249,7 +1249,7 @@ def python(self) -> str: """ Path to current python executable """ - return self._bin(self._executable) + return self.get_bin_path(self._executable) @property def marker_env(self) -> dict[str, Any]: @@ -1317,7 +1317,7 @@ def pip(self) -> str: """ # we do not use as_posix() here due to issues with windows pathlib2 # implementation - path = self._bin(self._pip_executable) + path = self.get_bin_path(self._pip_executable) if not Path(path).exists(): return str(self.pip_embedded) return path @@ -1427,7 +1427,7 @@ def get_marker_env(self) -> dict[str, Any]: raise NotImplementedError() def get_pip_command(self, embedded: bool = False) -> list[str]: - if embedded or not Path(self._bin(self._pip_executable)).exists(): + if embedded or not Path(self.get_bin_path(self._pip_executable)).exists(): return [self.python, self.pip_embedded] # run as module so that pip can update itself on Windows return [self.python, "-m", "pip"] @@ -1457,7 +1457,7 @@ def get_command_from_bin(self, bin: str) -> list[str]: # embedded pip when pip is not available in the environment return self.get_pip_command() - return [self._bin(bin)] + return [self.get_bin_path(bin)] def run(self, bin: str, *args: str, **kwargs: Any) -> str | int: cmd = self.get_command_from_bin(bin) + list(args) @@ -1539,7 +1539,7 @@ def script_dirs(self) -> list[Path]: self._script_dirs.append(self.userbase / self._script_dirs[0].name) return self._script_dirs - def _bin(self, bin: str) -> str: + def get_bin_path(self, bin: str) -> str: """ Return path to the given executable. """ @@ -1898,7 +1898,7 @@ def execute(self, bin: str, *args: str, **kwargs: Any) -> int: return super().execute(bin, *args, **kwargs) return 0 - def _bin(self, bin: str) -> str: + def get_bin_path(self, bin: str) -> str: return bin