osx: install requirements from requirements.txt

This commit is contained in:
akshayaurora 2018-06-18 03:51:27 +05:30
parent a8f764f786
commit b154b7d84e

View file

@ -121,7 +121,7 @@ class TargetOSX(Target):
package_name = bcg('app', 'package.name') package_name = bcg('app', 'package.name')
domain = bcg('app', 'package.domain') domain = bcg('app', 'package.domain')
title = bcg('app', 'title') title = bcg('app', 'title')
app_deps = bcgl('app', 'requirements', '') app_deps = open('requirements.txt').read()
garden_deps = bcgl('app', 'garden_requirements', '') garden_deps = bcgl('app', 'garden_requirements', '')
icon = bc.getdefault('app', 'icon.filename', '') icon = bc.getdefault('app', 'icon.filename', '')
version = self.buildozer.get_version() version = self.buildozer.get_version()
@ -134,15 +134,22 @@ class TargetOSX(Target):
self.buildozer.info('Create {}.app'.format(package_name)) self.buildozer.info('Create {}.app'.format(package_name))
cwd = join(self.buildozer.platform_dir,'kivy-sdk-packager-master', 'osx') cwd = join(self.buildozer.platform_dir,'kivy-sdk-packager-master', 'osx')
# remove kivy from app_deps # remove kivy from app_deps
app_deps = ','.join( app_deps = [a for a in app_deps.split('\n') if not a.startswith('#') and a not in ['kivy', '']]
[word for word in app_deps if 'kivy' not in word])
cmd = [
'Kivy.app/Contents/Resources/script',
'-m', 'pip', 'install',
]
cmd.extend(app_deps)
check_output(cmd, cwd=cwd)
cmd = [ cmd = [
'python', 'package_app.py', self.buildozer.app_dir, 'python', 'package_app.py', self.buildozer.app_dir,
'--appname={}'.format(package_name), '--appname={}'.format(package_name),
'--bundlename={}'.format(title), '--bundlename={}'.format(title),
'--bundleid={}'.format(domain), '--bundleid={}'.format(domain),
'--bundleversion={}'.format(version), '--bundleversion={}'.format(version),
#'--deps={}'.format(app_deps), #'--deps={}'.format(','.join(app_deps)),
'--displayname={}'.format(title) '--displayname={}'.format(title)
] ]
if icon: if icon:
@ -151,6 +158,7 @@ class TargetOSX(Target):
cmd.append('--author={}'.format(author)) cmd.append('--author={}'.format(author))
check_output(cmd, cwd=cwd) check_output(cmd, cwd=cwd)
self.buildozer.info('{}.app created.'.format(package_name)) self.buildozer.info('{}.app created.'.format(package_name))
self.buildozer.info('Creating {}.dmg'.format(package_name)) self.buildozer.info('Creating {}.dmg'.format(package_name))
check_output( check_output(
@ -264,3 +272,4 @@ class TargetOSX(Target):
def get_target(buildozer): def get_target(buildozer):
return TargetOSX(buildozer) return TargetOSX(buildozer)