Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion pythonforandroid/bootstraps/sdl2/build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import print_function

from os.path import dirname, join, isfile, realpath, relpath, split, exists
from os import makedirs
from os import makedirs, remove
import os
import tarfile
import time
Expand Down Expand Up @@ -362,6 +362,12 @@ def make_package(args):
'custom_rules.xml',
args=args)

if args.sign:
render('build.properties', 'build.properties')
else:
if exists('build.properties'):
os.remove('build.properties')

with open(join(dirname(__file__), 'res',
'values', 'strings.xml')) as fileh:
lines = fileh.read()
Expand Down Expand Up @@ -461,6 +467,9 @@ def parse_args(args=None):
help='Include additional source dirs in Java build')
ap.add_argument('--no-compile-pyo', dest='no_compile_pyo', action='store_true',
help='Do not optimise .py files to .pyo.')
ap.add_argument('--sign', action='store_true',
help=('Try to sign the APK with your credentials. You must set '
'the appropriate environment variables.'))

if args is None:
args = sys.argv[1:]
Expand Down
5 changes: 4 additions & 1 deletion pythonforandroid/toolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,10 @@ def apk(self, args):

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