Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved support for system environment #3107

Merged
merged 3 commits into from
Oct 23, 2020
Merged
Changes from 1 commit
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
Prev Previous commit
utils/env: ensure user directories are created
abn committed Oct 23, 2020
commit 34662ba3a84d4fa27cf70f8051ba180f7c31d4ab
2 changes: 1 addition & 1 deletion poetry/masonry/builders/editable.py
Original file line number Diff line number Diff line change
@@ -131,7 +131,7 @@ def _add_scripts(self):
entry_points = self.convert_entry_points()

for scripts_path in self._env.script_dirs:
if is_dir_writable(scripts_path):
if is_dir_writable(path=scripts_path, create=True):
break
else:
self._io.error_line(
2 changes: 1 addition & 1 deletion poetry/utils/env.py
Original file line number Diff line number Diff line change
@@ -170,7 +170,7 @@ def writable_candidates(self): # type: () -> List[Path]

self._writable_candidates = []
for candidate in self._candidates:
if not is_dir_writable(candidate):
if not is_dir_writable(path=candidate, create=True):
continue
self._writable_candidates.append(candidate)

4 changes: 3 additions & 1 deletion tests/utils/test_env_site.py
Original file line number Diff line number Diff line change
@@ -5,7 +5,9 @@
from poetry.utils.env import SitePackages


def test_env_site_simple(tmp_dir):
def test_env_site_simple(tmp_dir, mocker):
# emulate permission error when creating directory
mocker.patch("poetry.utils._compat.Path.mkdir", side_effect=OSError())
site_packages = SitePackages(Path("/non-existent"), fallbacks=[Path(tmp_dir)])
candidates = site_packages.make_candidates(Path("hello.txt"), writable_only=True)
hello = Path(tmp_dir) / "hello.txt"