diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2013-09-23 21:18:43 -0400 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2013-09-23 21:18:43 -0400 |
| commit | b77de7a697926a3b1d757062f8c2bae35f6e915b (patch) | |
| tree | a239a87cb94761b9bc2116b93209186cce8d9ea3 /ez_setup.py | |
| parent | 0d7e10fd181ad260256be32cb86125211cf46be9 (diff) | |
| parent | 9e4208becb775a69014c2e02b6a10f899efde1e7 (diff) | |
| download | python-setuptools-git-b77de7a697926a3b1d757062f8c2bae35f6e915b.tar.gz | |
Merged in sureshvv/setuptools (pull request #17)
Don't leave junk file behind
Diffstat (limited to 'ez_setup.py')
| -rw-r--r-- | ez_setup.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/ez_setup.py b/ez_setup.py index 9f2bd461..16b8016d 100644 --- a/ez_setup.py +++ b/ez_setup.py @@ -162,7 +162,12 @@ def download_file_powershell(url, target): '-Command', "(new-object System.Net.WebClient).DownloadFile(%(url)r, %(target)r)" % vars(), ] - subprocess.check_call(cmd) + try: + subprocess.check_call(cmd) + except subprocess.CalledProcessError: + if os.access(target, os.F_OK): + os.unlink(target) + raise def has_powershell(): if platform.system() != 'Windows': @@ -182,7 +187,12 @@ download_file_powershell.viable = has_powershell def download_file_curl(url, target): cmd = ['curl', url, '--silent', '--output', target] - subprocess.check_call(cmd) + try: + subprocess.check_call(cmd) + except subprocess.CalledProcessError: + if os.access(target, os.F_OK): + os.unlink(target) + raise def has_curl(): cmd = ['curl', '--version'] @@ -200,7 +210,12 @@ download_file_curl.viable = has_curl def download_file_wget(url, target): cmd = ['wget', url, '--quiet', '--output-document', target] - subprocess.check_call(cmd) + try: + subprocess.check_call(cmd) + except subprocess.CalledProcessError: + if os.access(target, os.F_OK): + os.unlink(target) + raise def has_wget(): cmd = ['wget', '--version'] |
