Merge branch 'master' of ssh://github.com/kivy/buildozer

This commit is contained in:
Mathieu Virbel 2013-01-08 17:38:30 +01:00
commit cf8ed00b9f
4 changed files with 34 additions and 5 deletions

View file

@ -17,6 +17,7 @@ import zipfile
import sys
import fcntl
import os
import re
from select import select
from sys import stdout, stderr, exit
from urllib import urlretrieve
@ -80,6 +81,7 @@ class Buildozer(object):
fromlist=['buildozer'])
self.target = m.get_target(self)
self.check_build_layout()
self.check_configuration_tokens()
self.target.check_configuration_tokens()
def prepare_for_build(self):
@ -427,6 +429,12 @@ class Buildozer(object):
self.debug('Copy {0}'.format(sfn))
copyfile(sfn, rfn)
def namify(self, name):
'''Return a "valid" name from a name with lot of invalid chars
(allowed characters: a-z, A-Z, 0-9, -, _)
'''
return re.sub('[^a-zA-Z0-9_\-]', '_', name)
@property
def buildozer_dir(self):
return realpath(join(

View file

@ -24,6 +24,9 @@ class Target(object):
def compile_platform(self):
pass
def install_platform(self):
pass
def get_custom_commands(self):
result = []
for x in dir(self):

View file

@ -317,6 +317,7 @@ class TargetAndroid(Target):
'Cannot package the app cause of the missing'
' requirements in python-for-android: {0}'.format(
missing_requirements))
exit(1)
need_compile = 0
if last_requirements != android_requirements:

View file

@ -1,7 +1,9 @@
'''
iOS target, based on kivy-ios project. (not working yet.)
'''
from buildozer.target import Target
from os.path import join
class TargetIos(Target):
@ -13,7 +15,7 @@ class TargetIos(Target):
checkbin('Xcode xcode-select', 'xcode-select')
checkbin('Git git', 'git')
print 'Check availability of a iPhone SDK'
self.buildozer.debug('Check availability of a iPhone SDK')
sdk = cmd('xcodebuild -showsdks | fgrep "iphoneos" | tail -n 1 | awk \'{print $2}\'')[0]
if not sdk:
raise Exception(
@ -21,18 +23,33 @@ class TargetIos(Target):
else:
print ' -> found %r' % sdk
print 'Check Xcode path'
self.buildozer.debug('Check Xcode path')
xcode = cmd('xcode-select -print-path')[0]
if not xcode:
raise Exception('Unable to get xcode path')
print ' -> found %r' % xcode
self.buildozer.debug(' -> found {0}'.format(xcode))
def install_platform(self):
cmd = self.buildozer.cmd
cmd('git clone git://github.com/kivy/kivy-ios',
cwd=self.buildozer.platform_dir)
self.ios_dir = ios_dir = join(self.buildozer.platform_dir, 'kivy-ios')
if not self.buildozer.file_exists(ios_dir):
cmd('git clone git://github.com/kivy/kivy-ios',
cwd=self.buildozer.platform_dir)
elif self.platform_update:
cmd('git clean -dxf', cwd=ios_dir)
cmd('git pull origin master', cwd=ios_dir)
def compile_platform(self):
self.buildozer.cmd('tools/build-all.sh', cwd=self.ios_dir)
def build_package(self):
# create the project
app_name = self.buildozer.namify(self.config.get('app', 'title'))
self.app_project_dir = join(self.ios_dir, 'app-{0}'.format(app_name))
self.buildozer.cmd('tools/create-xcode-project.sh {0} {1}'.format(
app_name, self.buildozer.app_dir),
cwd=self.ios_dir)
def get_target(buildozer):