Skip to content

Commit

Permalink
rename Env.{_bin => get_bin_path}
Browse files Browse the repository at this point in the history
  • Loading branch information
wagnerluis1982 committed Nov 3, 2022
1 parent 6bbe6a8 commit 24e047e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/poetry/console/commands/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
12 changes: 6 additions & 6 deletions src/poetry/utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"]
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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.
"""
Expand Down Expand Up @@ -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


Expand Down

0 comments on commit 24e047e

Please sign in to comment.