Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion poetry/utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -879,9 +879,13 @@ class Env(object):

def __init__(self, path: Path, base: Optional[Path] = None) -> None:
self._is_windows = sys.platform == "win32"
self._is_mingw = sysconfig.get_platform() == "mingw"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self._is_mingw = sysconfig.get_platform() == "mingw"
self._is_mingw = sys.platform == "msys"

This should work here, right? Would be good to keep the usage consistent. I am not too familiar with using mingw, would be good to get a confirmation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abn Thanks for the review, I really appreciate it!

No that won't work:

$ python
Python 3.8.8 (default, Feb 20 2021, 07:16:03)  [GCC 10.2.0 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.platform)
win32


if not self._is_windows or self._is_mingw:
bin_dir = "bin"
else:
bin_dir = "Scripts"
Comment on lines +884 to +887
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if not self._is_windows or self._is_mingw:
bin_dir = "bin"
else:
bin_dir = "Scripts"
bin = {"win32": "Scripts"}.get(sys.platform, "bin")

Would this be slightly better maintainable considering we only care about exceptions?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work:

>>> bin = {"win32": "Scripts"}.get(sys.platform, "bin")
>>> print(bin)
Scripts

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given msys seems to only patch get_platform() , guess that is expected.

self._path = path
bin_dir = "bin" if not self._is_windows else "Scripts"
self._bin_dir = self._path / bin_dir

self._base = base or path
Expand Down