mirror of
https://github.com/python-poetry/install.python-poetry.org.git
synced 2024-11-27 00:10:54 -05:00
Merge a205673b4c
into 290e92f756
This commit is contained in:
commit
91140fce28
1 changed files with 14 additions and 9 deletions
|
@ -557,14 +557,14 @@ class Installer:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.install(version)
|
new_windows_bin = self.install(version)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
raise PoetryInstallationError(
|
raise PoetryInstallationError(
|
||||||
return_code=e.returncode, log=e.output.decode()
|
return_code=e.returncode, log=e.output.decode()
|
||||||
) from e
|
) from e
|
||||||
|
|
||||||
self._write("")
|
self._write("")
|
||||||
self.display_post_message(version)
|
self.display_post_message(version, new_windows_bin)
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
@ -584,7 +584,7 @@ class Installer:
|
||||||
self.version_file.write_text(version)
|
self.version_file.write_text(version)
|
||||||
self._install_comment(version, "Done")
|
self._install_comment(version, "Done")
|
||||||
|
|
||||||
return 0
|
return env.bin_path
|
||||||
|
|
||||||
def uninstall(self) -> int:
|
def uninstall(self) -> int:
|
||||||
if not self.data_dir.exists():
|
if not self.data_dir.exists():
|
||||||
|
@ -691,30 +691,35 @@ class Installer:
|
||||||
}
|
}
|
||||||
self._write(PRE_MESSAGE.format(**kwargs))
|
self._write(PRE_MESSAGE.format(**kwargs))
|
||||||
|
|
||||||
def display_post_message(self, version: str) -> None:
|
def display_post_message(self, version: str, new_windows_bin: str) -> None:
|
||||||
if WINDOWS:
|
if WINDOWS:
|
||||||
return self.display_post_message_windows(version)
|
return self.display_post_message_windows(version, new_windows_bin)
|
||||||
|
|
||||||
if SHELL == "fish":
|
if SHELL == "fish":
|
||||||
return self.display_post_message_fish(version)
|
return self.display_post_message_fish(version)
|
||||||
|
|
||||||
return self.display_post_message_unix(version)
|
return self.display_post_message_unix(version)
|
||||||
|
|
||||||
def display_post_message_windows(self, version: str) -> None:
|
def display_post_message_windows(self, version: str, new_windows_bin: str) -> None:
|
||||||
path = self.get_windows_path_var()
|
path = self.get_windows_path_var()
|
||||||
|
|
||||||
message = POST_MESSAGE_NOT_IN_PATH
|
message = POST_MESSAGE_NOT_IN_PATH
|
||||||
if path and str(self.bin_dir) in path:
|
if path and str(self.bin_dir) in path:
|
||||||
message = POST_MESSAGE
|
message = POST_MESSAGE
|
||||||
|
|
||||||
|
if new_windows_bin != self.bin_dir:
|
||||||
|
final_path = new_windows_bin
|
||||||
|
else:
|
||||||
|
final_path = self.bin_dir
|
||||||
|
|
||||||
self._write(
|
self._write(
|
||||||
message.format(
|
message.format(
|
||||||
poetry=colorize("info", "Poetry"),
|
poetry=colorize("info", "Poetry"),
|
||||||
version=colorize("b", version),
|
version=colorize("b", version),
|
||||||
poetry_home_bin=colorize("comment", self.bin_dir),
|
poetry_home_bin=colorize("comment", final_path),
|
||||||
poetry_executable=colorize("b", self.bin_dir.joinpath("poetry")),
|
poetry_executable=colorize("b", final_path.joinpath("poetry")),
|
||||||
configure_message=POST_MESSAGE_CONFIGURE_WINDOWS.format(
|
configure_message=POST_MESSAGE_CONFIGURE_WINDOWS.format(
|
||||||
poetry_home_bin=colorize("comment", self.bin_dir)
|
poetry_home_bin=colorize("comment", final_path)
|
||||||
),
|
),
|
||||||
test_command=colorize("b", "poetry --version"),
|
test_command=colorize("b", "poetry --version"),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue