diff options
author | Hedayat Vatankhah <hedayat.fwd@gmail.com> | 2011-07-13 22:09:58 +0430 |
---|---|---|
committer | Hedayat Vatankhah <hedayat.fwd@gmail.com> | 2011-07-13 22:09:58 +0430 |
commit | 6148fe90f9b41eeb37958bbf2727dbeb463f5fa1 (patch) | |
tree | 2b712877a3a3d44e59f554d0b897443e0e7ecaed | |
parent | 694c3152a2fb4bfc97d785d5e182e44336f21cf3 (diff) | |
download | yum-fast-downloader-6148fe90f9b41eeb37958bbf2727dbeb463f5fa1.tar.gz yum-fast-downloader-6148fe90f9b41eeb37958bbf2727dbeb463f5fa1.tar.xz yum-fast-downloader-6148fe90f9b41eeb37958bbf2727dbeb463f5fa1.zip |
Make sure that the file is renamed before proceeding
-rw-r--r-- | yum-fast-downloader.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/yum-fast-downloader.py b/yum-fast-downloader.py index d3aa9cb..9a9ceae 100644 --- a/yum-fast-downloader.py +++ b/yum-fast-downloader.py @@ -28,6 +28,7 @@ import shutil import yum from yum.plugins import TYPE_CORE from yum.yumRepo import YumRepository +from time import sleep requires_api_version = '2.6' plugin_type = (TYPE_CORE,) @@ -65,6 +66,13 @@ def downloadFile(urls, remote_path, local_path, proxies = None): if ret: raise yum.plugins.PluginYumExit( "{0} exited with exit code: {1}".format(downloader_app, ret)) + i=0 + while not os.path.exists(local_path): + sleep(0.1) + i+=1 + if i > 50: + raise yum.plugins.PluginYumExit( + "Error in downloading file: {0}".format(local_path)) def queueDownload(inputFile, urls, remote_path, local_path, proxies = None): if urls[0].startswith("http://") or urls[0].startswith("ftp://"): |