Skip to content

Commit 2ab6536

Browse files
sdispaterabn
authored andcommitted
Fix issues on Windows
1 parent a9ee3a4 commit 2ab6536

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

install-poetry.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,16 @@ def make_bin(self, version: str) -> None:
528528
if self._bin_dir.joinpath(script).exists():
529529
self._bin_dir.joinpath(script).unlink()
530530

531-
self._bin_dir.joinpath(script).symlink_to(
532-
self._data_dir.joinpath(target_script)
533-
)
531+
try:
532+
self._bin_dir.joinpath(script).symlink_to(
533+
self._data_dir.joinpath(target_script)
534+
)
535+
except OSError:
536+
# This can happen if the user
537+
# does not have the correct permission on Windows
538+
shutil.copy(
539+
self._data_dir.joinpath(target_script), self._bin_dir.joinpath(script)
540+
)
534541

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

556-
subprocess.call(
563+
subprocess.run(
557564
[str(python), "-m", "pip", "install", specification],
558565
stdout=subprocess.PIPE,
559566
stderr=subprocess.STDOUT,

0 commit comments

Comments
 (0)