Merge pull request #316 from derPinguin/fix_osx_kivy_install

trying to fix Kivy install for OS X builds
This commit is contained in:
Mathieu Virbel 2017-04-17 12:13:35 +02:00 committed by GitHub
commit 75d2730a4c
2 changed files with 46 additions and 37 deletions

View file

@ -64,6 +64,12 @@ orientation = portrait
#
# author = © Copyright Info
# change the major version of python used by the app
osx.python_version = 3
# Kivy version to use
osx.kivy_version = 1.9.1
#
# Android specific
#

View file

@ -47,53 +47,56 @@ class TargetOSX(Target):
check_call(('unzip', 'master.zip'), cwd=platdir)
check_call(('rm', 'master.zip'), cwd=platdir)
def download_kivy(self, cwd, kivy='Kivy2'):
self.buildozer.info('Downloading kivy...')
if not exists(cwd+'/'+kivy+'.7z'):
def download_kivy(self, cwd, py_branch=2):
current_kivy_vers = self.buildozer.config.get('app', 'osx.kivy_version')
if exists('/Applications/Kivy{}.app'.format(py_branch)):
self.buildozer.info('Kivy found in Applications dir...')
check_call(
('curl', '-O', '-L',
'http://kivy.org/downloads/tests/{}.7z'.format(kivy)),
cwd=cwd)
if not exists(cwd+'/Keka.app'):
if exists('/Applications/Keka.app'):
('cp', '-a', '/Applications/Kivy{}.app'.format(py_branch),
'Kivy.app'), cwd=cwd)
else:
if not exists(join(cwd, 'Kivy{}.7z'.format(py_branch))):
self.buildozer.info('Downloading kivy...')
check_call(
('cp', '-a', '/Applications/Keka.app', './Keka.app'),
cwd=cwd)
else:
check_call(('curl', '-o',
'http://www.kekaosx.com/release/Keka-1.0.4-intel.dmg'),
('curl', '-L', '-o', 'Kivy{}.7z'.format(py_branch),
'http://kivy.org/downloads/{}/Kivy-{}-osx-python{}.7z'\
.format(current_kivy_vers, current_kivy_vers, py_branch)),
cwd=cwd)
if not exists(join(cwd, 'Keka.app')):
self.buildozer.info(
'Downloading Keka as dependency (to install Kivy)')
check_call(
('hdiutil', 'attach', 'Keka-1.0.4-intel.dmg'),
('curl', '-O', 'http://www.kekaosx.com/release/Keka-1.0.4-intel.dmg'),
cwd=cwd)
check_call(
('cp', '-a','/Volumes/Keka/Keka.app',
'./Keka.app'), cwd=cwd)
check_call(('hdutil', 'detach', '/Volumes/Keka'))
check_call(
('Keka.app/Contents/Resources/keka7z',
'x', '{}.7z'.format(kivy)), cwd=cwd)
check_call(('rm', '-rf', '{}.7z'.format('Kivy2')), cwd=cwd)
check_call(('mv', '{}.app'.format(kivy), 'Kivy.app'),cwd=cwd)
check_call(('hdiutil', 'attach', 'Keka-1.0.4-intel.dmg'), cwd=cwd)
check_call(('cp', '-a','/Volumes/Keka/Keka.app', './Keka.app'), cwd=cwd)
check_call(('hdiutil', 'detach', '/Volumes/Keka'))
self.buildozer.info('Extracting and installing Kivy...')
check_call(
(join(cwd, 'Keka.app/Contents/MacOS/Keka'),
join(cwd, 'Kivy{}.7z').format(py_branch)), cwd=cwd)
check_call(('rm', 'Kivy{}.7z'.format(py_branch)), cwd=cwd)
check_call(('mv', 'Kivy{}.app'.format(py_branch), 'Kivy.app'),cwd=cwd)
def ensure_kivyapp(self):
self.buildozer.info('check if Kivy.app exists in local dir')
kivy_app_dir = join(
self.buildozer.platform_dir,
'kivy-sdk-packager-master', 'osx')
kivy_app_dir = join(self.buildozer.platform_dir, 'kivy-sdk-packager-master', 'osx')
py_branch = self.buildozer.config.get('app', 'osx.python_version')
if not int(py_branch) in (2, 3):
self.buildozer.error('incompatible python version... aborting')
sys.exit(1)
if exists(join(kivy_app_dir, 'Kivy.app')):
self.buildozer.info('Kivy.app found at ' + kivy_app_dir)
return
# check if Kivy.app exists in /Applications
if not exists('/Applications/Kivy.app'):
self.download_kivy(kivy_app_dir)
return
self.buildozer.info('Kivy.app found at ' + kivy_app_dir)
else:
self.buildozer.info('Kivy.app found at /Applications/Kivy.app')
self.buildozer.info('copying it to platform dir')
check_call(
('cp', '-a', '/Applications/Kivy.app',
join(kivy_app_dir, 'Kivy.app')))
self.download_kivy(kivy_app_dir, py_branch)
return
def check_requirements(self):