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

AppVeyor: Workaround for PermissionError during shutil.rmtree #17

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
14 changes: 13 additions & 1 deletion recipe/upload_or_check_non_existence.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@
import subprocess
import sys
import tempfile
import time

from binstar_client.utils import get_server_api
import binstar_client.errors
from conda_build.conda_interface import subdir as conda_subdir
from conda_build.conda_interface import get_index
import conda_build.api

on_win = (sys.platform == "win32")


@contextlib.contextmanager
def get_temp_token(token):
Expand All @@ -24,7 +27,16 @@ def get_temp_token(token):
with open(fn, "w") as fh:
fh.write(token)
yield fn
shutil.rmtree(dn)
try:
shutil.rmtree(dn)
except OSError:
if on_win:
# On Windows, rmtree might have failed due to something else
# accessing the directory -- just wait a bit and try again.
time.sleep(0.1)
shutil.rmtree(dn)
else:
raise


def built_distribution_already_exists(cli, meta, fname, owner):
Expand Down