|
22 | 22 |
|
23 | 23 | from .common import CHUNK_SIZE, ClientError |
24 | 24 | from .merginproject import MerginProject |
25 | | -from .utils import save_to_file |
| 25 | +from .utils import cleanup_tmp_dir, save_to_file |
26 | 26 |
|
27 | 27 |
|
28 | 28 | # status = download_project_async(...) |
@@ -145,7 +145,7 @@ def download_project_async(mc, project_path, directory, project_version=None): |
145 | 145 | mp.log.info("--- version: " + mc.user_agent_info()) |
146 | 146 | mp.log.info(f"--- start download {project_path}") |
147 | 147 |
|
148 | | - tmp_dir = tempfile.TemporaryDirectory(prefix="python-api-client-", ignore_cleanup_errors=True, delete=True) |
| 148 | + tmp_dir = tempfile.TemporaryDirectory(prefix="python-api-client-") |
149 | 149 |
|
150 | 150 | try: |
151 | 151 | # check whether we download the latest version or not |
@@ -250,7 +250,7 @@ def download_project_finalize(job): |
250 | 250 | # final update of project metadata |
251 | 251 | job.mp.update_metadata(job.project_info) |
252 | 252 |
|
253 | | - job.tmp_dir.cleanup() |
| 253 | + cleanup_tmp_dir(job.mp, job.tmp_dir) |
254 | 254 |
|
255 | 255 |
|
256 | 256 | def download_project_cancel(job): |
@@ -424,7 +424,7 @@ def pull_project_async(mc, directory): |
424 | 424 | # then we just download the whole file |
425 | 425 | _pulling_file_with_diffs = lambda f: "diffs" in f and len(f["diffs"]) != 0 |
426 | 426 |
|
427 | | - tmp_dir = tempfile.TemporaryDirectory(prefix="mm-pull-", ignore_cleanup_errors=True, delete=True) |
| 427 | + tmp_dir = tempfile.TemporaryDirectory(prefix="mm-pull-") |
428 | 428 | pull_changes = mp.get_pull_changes(server_info["files"]) |
429 | 429 | mp.log.debug("pull changes:\n" + pprint.pformat(pull_changes)) |
430 | 430 | fetch_files = [] |
@@ -646,7 +646,7 @@ def pull_project_finalize(job: PullJob): |
646 | 646 | else: |
647 | 647 | job.mp.log.info("--- pull finished -- at version " + job.mp.version()) |
648 | 648 |
|
649 | | - job.tmp_dir.cleanup() # delete our temporary dir and all its content |
| 649 | + cleanup_tmp_dir(job.mp, job.tmp_dir) # delete our temporary dir and all its content |
650 | 650 | return conflicts |
651 | 651 |
|
652 | 652 |
|
|
0 commit comments