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

fix: Gracefully handle read-only sdists #1140

Merged
merged 1 commit into from
Jun 2, 2020
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
17 changes: 8 additions & 9 deletions poetry/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,18 @@ def normalize_version(version): # type: (str) -> str
return str(Version(version))


def _del_ro(action, name, exc):
os.chmod(name, stat.S_IWRITE)
os.remove(name)


@contextmanager
def temporary_directory(*args, **kwargs):
try:
from tempfile import TemporaryDirectory

with TemporaryDirectory(*args, **kwargs) as name:
yield name
except ImportError:
name = tempfile.mkdtemp(*args, **kwargs)
name = tempfile.mkdtemp(*args, **kwargs)

yield name
yield name

shutil.rmtree(name)
shutil.rmtree(name, onerror=_del_ro)


def parse_requires(requires): # type: (str) -> List[str]
Expand Down