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

This commit is contained in:
Mathieu Virbel 2014-04-08 22:03:28 +02:00
commit 9b4db49f02
2 changed files with 16 additions and 6 deletions

View file

@ -78,7 +78,7 @@ class BuildozerCommandException(BuildozerException):
class Buildozer(object):
standard_cmds = ('clean', 'update', 'debug', 'release',
standard_cmds = ('distclean', 'update', 'debug', 'release',
'deploy', 'run', 'serve')
def __init__(self, filename='buildozer.spec', target=None):
@ -333,7 +333,7 @@ class Buildozer(object):
adderror('[app] "title" is missing')
if not get('app', 'source.dir', ''):
adderror('[app] "source.dir" is missing')
package_name = get('app', 'package.name', '')
if not package_name:
adderror('[app] "package.name" is missing')
@ -926,10 +926,17 @@ class Buildozer(object):
copyfile(join(dirname(__file__), 'default.spec'), 'buildozer.spec')
print 'File buildozer.spec created, ready to customize!'
def cmd_clean(self, *args):
def cmd_distclean(self, *args):
'''Clean the whole Buildozer environment.
'''
pass
import sys
print("Warning: Your ndk, sdk and all other cached packages will be"+\
" removed. Continue? (y/n)")
if sys.stdin.readline().lower()[0] == 'y':
self.info('Clean the global build directory')
if not exists(self.global_buildozer_dir):
return
rmtree(self.global_buildozer_dir)
def cmd_help(self, *args):
'''Show the Buildozer help.

View file

@ -22,7 +22,7 @@ from sys import platform, executable
from buildozer import BuildozerException
from buildozer.target import Target
from os import environ
from os.path import join, realpath, expanduser, basename, relpath
from os.path import exists, join, realpath, expanduser, basename, relpath
from shutil import copyfile
from glob import glob
@ -396,7 +396,8 @@ class TargetAndroid(Target):
need_compile = 1
dist_name = self.buildozer.config.get('app', 'package.name')
if not self.buildozer.file_exists(self.pa_dir, 'dist', dist_name, 'build.py'):
dist_dir = join(self.pa_dir, 'dist', dist_name)
if not exists(dist_dir):
need_compile = 1
if not need_compile:
@ -406,6 +407,8 @@ class TargetAndroid(Target):
modules_str = ' '.join(android_requirements)
cmd = self.buildozer.cmd
self.buildozer.debug('Clean and build python-for-android')
self.buildozer.rmdir(dist_dir) # Delete existing distribution to stop
# p4a complaining
cmd('./distribute.sh -m "{0}" -d "{1}"'.format(modules_str, dist_name),
cwd=self.pa_dir)
self.buildozer.debug('Remove temporary build files')