Skip to content

Commit

Permalink
Fix issues on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
sdispater authored and abn committed Mar 30, 2021
1 parent a9ee3a4 commit 2ab6536
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions install-poetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,16 @@ def make_bin(self, version: str) -> None:
if self._bin_dir.joinpath(script).exists():
self._bin_dir.joinpath(script).unlink()

self._bin_dir.joinpath(script).symlink_to(
self._data_dir.joinpath(target_script)
)
try:
self._bin_dir.joinpath(script).symlink_to(
self._data_dir.joinpath(target_script)
)
except OSError:
# This can happen if the user
# does not have the correct permission on Windows
shutil.copy(
self._data_dir.joinpath(target_script), self._bin_dir.joinpath(script)
)

def install_poetry(self, version: str, env_path: Path) -> None:
self._overwrite(
Expand All @@ -553,7 +560,7 @@ def install_poetry(self, version: str, env_path: Path) -> None:
else:
specification = f"poetry=={version}"

subprocess.call(
subprocess.run(
[str(python), "-m", "pip", "install", specification],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
Expand Down

0 comments on commit 2ab6536

Please sign in to comment.