Skip to content

Commit

Permalink
handle 404 status code on kivy download
Browse files Browse the repository at this point in the history
  • Loading branch information
BeardedUnicorn authored and EturiMike committed Jun 5, 2017
1 parent 480e726 commit 8a4db79
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions buildozer/targets/osx.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,19 @@ def download_kivy(self, cwd, py_branch=2):
else:
if not exists(join(cwd, 'Kivy{}.dmg'.format(py_branch))):
self.buildozer.info('Downloading kivy...')
check_call(
('curl', '-L', '-o', 'Kivy{}.dmg'.format(py_branch),
status_code = check_output(
('curl', '-L', '--write-out', '%{http_code}', '-o', 'Kivy{}.dmg'.format(py_branch),
'http://kivy.org/downloads/{}/Kivy-{}-osx-python{}.dmg'\
.format(current_kivy_vers, current_kivy_vers, py_branch)),
cwd=cwd)

if status_code == "404":
self.buildozer.error(
"Unable to download the Kivy App. Check osx.kivy_version in your buildozer.spec, and verify "
"Kivy servers are accessible. http://kivy.org/downloads/")
check_call(("rm", "Kivy{}.dmg".format(py_branch)), cwd=cwd)
exit(1)

self.buildozer.info('Extracting and installing Kivy...')
check_call(('hdiutil', 'attach', cwd + '/Kivy{}.dmg'.format(py_branch)))
check_call(('cp', '-a', '/Volumes/Kivy/Kivy.app', './Kivy.app'), cwd=cwd)
Expand Down

0 comments on commit 8a4db79

Please sign in to comment.