From 6aeb4601c8301704b6bd71bf0787f4beac4a9c2a Mon Sep 17 00:00:00 2001 From: Alexander Taylor Date: Sat, 8 Feb 2014 17:47:06 +0000 Subject: [PATCH] Delete dist dir if running distribute.sh --- buildozer/targets/android.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py index c2bb15d..1a0a919 100644 --- a/buildozer/targets/android.py +++ b/buildozer/targets/android.py @@ -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 @@ -359,7 +359,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: @@ -369,6 +370,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')