Skip to content

Commit b17894a

Browse files
authored
Merge pull request kivy#949 from inclement/fix_release_mode
Fixed release mode (--release) with sdl2
2 parents a4c2a88 + 779c1d9 commit b17894a

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

pythonforandroid/bootstraps/sdl2/build/build.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import print_function
44

55
from os.path import dirname, join, isfile, realpath, relpath, split, exists
6-
from os import makedirs
6+
from os import makedirs, remove
77
import os
88
import tarfile
99
import time
@@ -362,6 +362,12 @@ def make_package(args):
362362
'custom_rules.xml',
363363
args=args)
364364

365+
if args.sign:
366+
render('build.properties', 'build.properties')
367+
else:
368+
if exists('build.properties'):
369+
os.remove('build.properties')
370+
365371
with open(join(dirname(__file__), 'res',
366372
'values', 'strings.xml')) as fileh:
367373
lines = fileh.read()
@@ -461,6 +467,9 @@ def parse_args(args=None):
461467
help='Include additional source dirs in Java build')
462468
ap.add_argument('--no-compile-pyo', dest='no_compile_pyo', action='store_true',
463469
help='Do not optimise .py files to .pyo.')
470+
ap.add_argument('--sign', action='store_true',
471+
help=('Try to sign the APK with your credentials. You must set '
472+
'the appropriate environment variables.'))
464473

465474
if args is None:
466475
args = sys.argv[1:]

pythonforandroid/toolchain.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,10 @@ def apk(self, args):
706706

707707
if not apk_file:
708708
info_main('# APK filename not found in build output, trying to guess')
709-
apks = glob.glob(join(dist.dist_dir, 'bin', '*-*-{}.apk'.format(args.build_mode)))
709+
suffix = args.build_mode
710+
if suffix == 'release':
711+
suffix = suffix + '-unsigned'
712+
apks = glob.glob(join(dist.dist_dir, 'bin', '*-*-{}.apk'.format(suffix)))
710713
if len(apks) == 0:
711714
raise ValueError('Couldn\'t find the built APK')
712715
if len(apks) > 1:

0 commit comments

Comments
 (0)