Merge pull request #508 from SecretObsession/kivy_404_handling

Add 404 status code handling on kivy download
This commit is contained in:
Mathieu Virbel 2017-12-15 16:01:08 +01:00 committed by GitHub
commit 57b18edec6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -60,12 +60,19 @@ class TargetOSX(Target):
else: else:
if not exists(join(cwd, 'Kivy{}.dmg'.format(py_branch))): if not exists(join(cwd, 'Kivy{}.dmg'.format(py_branch))):
self.buildozer.info('Downloading kivy...') self.buildozer.info('Downloading kivy...')
check_call( status_code = check_output(
('curl', '-L', '-o', 'Kivy{}.dmg'.format(py_branch), ('curl', '-L', '--write-out', '%{http_code}', '-o', 'Kivy{}.dmg'.format(py_branch),
'http://kivy.org/downloads/{}/Kivy-{}-osx-python{}.dmg'\ 'http://kivy.org/downloads/{}/Kivy-{}-osx-python{}.dmg'\
.format(current_kivy_vers, current_kivy_vers, py_branch)), .format(current_kivy_vers, current_kivy_vers, py_branch)),
cwd=cwd) 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...') self.buildozer.info('Extracting and installing Kivy...')
check_call(('hdiutil', 'attach', cwd + '/Kivy{}.dmg'.format(py_branch))) check_call(('hdiutil', 'attach', cwd + '/Kivy{}.dmg'.format(py_branch)))
check_call(('cp', '-a', '/Volumes/Kivy/Kivy.app', './Kivy.app'), cwd=cwd) check_call(('cp', '-a', '/Volumes/Kivy/Kivy.app', './Kivy.app'), cwd=cwd)