@@ -69,8 +69,8 @@ def get_bootstrap_name():
69
69
BLACKLIST_PATTERNS .append ('*.py' )
70
70
71
71
WHITELIST_PATTERNS = []
72
- if get_bootstrap_name () == " sdl2" :
73
- WHITELIST_PATTERNS .append (" pyconfig.h" )
72
+ if get_bootstrap_name () in ( ' sdl2' , 'webview' , 'service_only' ) :
73
+ WHITELIST_PATTERNS .append (' pyconfig.h' )
74
74
75
75
python_files = []
76
76
@@ -265,8 +265,6 @@ def make_package(args):
265
265
sys .exit (1 )
266
266
267
267
assets_dir = "src/main/assets"
268
- if get_bootstrap_name () != "sdl2" :
269
- assets_dir = "assets"
270
268
271
269
# Delete the old assets.
272
270
try_unlink (join (assets_dir , 'public.mp3' ))
@@ -293,15 +291,13 @@ def make_package(args):
293
291
294
292
# Prepare some variables for templating process
295
293
res_dir = "src/main/res"
296
- if get_bootstrap_name () == "webview" :
297
- res_dir = "res"
298
294
default_icon = 'templates/kivy-icon.png'
299
295
default_presplash = 'templates/kivy-presplash.jpg'
296
+ shutil .copy (
297
+ args .icon or default_icon ,
298
+ join (res_dir , 'drawable/icon.png' )
299
+ )
300
300
if get_bootstrap_name () != "service_only" :
301
- shutil .copy (
302
- args .icon or default_icon ,
303
- join (res_dir , 'drawable/icon.png' )
304
- )
305
301
shutil .copy (
306
302
args .presplash or default_presplash ,
307
303
join (res_dir , 'drawable/presplash.jpg' )
@@ -342,9 +338,9 @@ def make_package(args):
342
338
with open (args .intent_filters ) as fd :
343
339
args .intent_filters = fd .read ()
344
340
345
- if get_bootstrap_name () == "sdl2" :
346
- args .add_activity = args .add_activity or []
347
- args .activity_launch_mode = args .activity_launch_mode or ''
341
+ # if get_bootstrap_name() == "sdl2":
342
+ args .add_activity = args .add_activity or []
343
+ args .activity_launch_mode = args .activity_launch_mode or ''
348
344
349
345
if args .extra_source_dirs :
350
346
esd = []
@@ -376,17 +372,11 @@ def make_package(args):
376
372
sticky = 'sticky' in options
377
373
378
374
service_names .append (name )
379
- service_target_path = ""
380
- if get_bootstrap_name () != "sdl2" :
381
- service_target_path = \
382
- 'src/{}/Service{}.java' .format (args .package .replace ("." , "/" ),
383
- name .capitalize ())
384
- else :
385
- service_target_path = \
386
- 'src/main/java/{}/Service{}.java' .format (
387
- args .package .replace ("." , "/" ),
388
- name .capitalize ()
389
- )
375
+ service_target_path = \
376
+ 'src/main/java/{}/Service{}.java' .format (
377
+ args .package .replace ("." , "/" ),
378
+ name .capitalize ()
379
+ )
390
380
render (
391
381
'Service.tmpl.java' ,
392
382
service_target_path ,
@@ -426,8 +416,6 @@ def make_package(args):
426
416
427
417
# Render out android manifest:
428
418
manifest_path = "src/main/AndroidManifest.xml"
429
- if get_bootstrap_name () != "sdl2" :
430
- manifest_path = "AndroidManifest.xml"
431
419
render_args = {
432
420
"args" : args ,
433
421
"service" : service ,
@@ -443,45 +431,39 @@ def make_package(args):
443
431
444
432
# Copy the AndroidManifest.xml to the dist root dir so that ant
445
433
# can also use it
446
- if get_bootstrap_name () == "sdl2" :
447
- if exists (
57AE
9;AndroidManifest.xml' ):
448
- remove ('AndroidManifest.xml' )
449
- shutil .copy (manifest_path , 'AndroidManifest.xml' )
434
+ if exists ('AndroidManifest.xml' ):
435
+ remove ('AndroidManifest.xml' )
436
+ shutil .copy (manifest_path , 'AndroidManifest.xml' )
450
437
451
438
# gradle build templates
452
- if get_bootstrap_name () != "webview" :
453
- # HISTORICALLY NOT SUPPORTED FOR WEBVIEW. Needs review? -JonasT
454
- render (
455
- 'build.tmpl.gradle' ,
456
- 'build.gradle' ,
457
- args = args ,
458
- aars = aars ,
459
- jars = jars ,
460
- android_api = android_api ,
461
- build_tools_version = build_tools_version )
439
+ render (
440
+ 'build.tmpl.gradle' ,
441
+ 'build.gradle' ,
442
+ args = args ,
443
+ aars = aars ,
444
+ jars = jars ,
445
+ android_api = android_api ,
446
+ build_tools_version = build_tools_version
447
+ )
462
448
463
449
# ant build templates
464
- if get_bootstrap_name () != "service_only" :
465
- # Historically, service_only doesn't support ant anymore.
466
- # Maybe we should also drop this for the others? -JonasT
467
- render (
468
- 'build.tmpl.xml' ,
469
- 'build.xml' ,
470
- args = args ,
471
- versioned_name = versioned_name )
450
+ render (
451
+ 'build.tmpl.xml' ,
452
+ 'build.xml' ,
453
+ args = args ,
454
+ versioned_name = versioned_name )
472
455
473
456
# String resources:
474
- if get_bootstrap_name () != "service_only" :
475
- render_args = {
476
- "args" : args ,
477
- "private_version" : str (time .time())
478
- }
479
- if get_bootstrap_name () == "sdl2" :
480
- render_args ["url_scheme" ] = url_scheme
481
- render (
482
- 'strings.tmpl.xml' ,
483
- join (res_dir , 'values/strings.xml' ),
484
- ** render_args )
457
+ render_args = {
458
+ "args" : args ,
459
+ "private_version" : str (time .time ())
460
+ }
461
+ if get_bootstrap_name () == "sdl2" :
462
+ render_args ["url_scheme" ] = url_scheme
463
+ render (
464
+ 'strings.tmpl.xml' ,
465
+ join (res_dir , 'values/strings.xml' ),
466
+ ** render_args )
485
467
486
468
if exists ("custom_rules.tmpl.xml" ):
487
469
render (
@@ -491,7 +473,7 @@ def make_package(args):
491
473
492
474
if get_bootstrap_name () == "webview" :
493
475
render ('WebViewLoader.tmpl.java' ,
494
- 'src/org/kivy/android/WebViewLoader.java' ,
476
+ 'src/main/java/ org/kivy/android/WebViewLoader.java' ,
495
477
args = args )
496
478
497
479
if args .sign :
@@ -553,6 +535,9 @@ def parse_args(args=None):
553
535
help = 'The permissions to give this app.' , nargs = '+' )
554
536
ap .add_argument ('--meta-data' , dest = 'meta_data' , action = 'append' ,
555
537
help = 'Custom key=value to add in application metadata' )
538
+ ap .add_argument ('--icon' , dest = 'icon' ,
539
+ help = ('A png file to use as the icon for '
540
+ 'the application.' ))
556
541
if get_bootstrap_name () != "service_only" :
557
542
ap .add_argument ('--presplash' , dest = 'presplash' ,
558
543
help = ('A jpeg file to use as a screen while the '
@@ -568,9 +553,6 @@ def parse_args(args=None):
568
553
ap .add_argument ('--window' , dest = 'window' , action = 'store_true' ,
569
554
default = False ,
570
555
help = 'Indicate if the application will be windowed' )
571
- ap .add_argument ('--icon' , dest = 'icon' ,
572
- help = ('A png file to use as the icon for '
573
- 'the application.' ))
574
556
ap .add_argument ('--orientation' , dest = 'orientation' ,
575
557
default = 'portrait' ,
576
558
help = ('The orientation that the game will '
@@ -628,9 +610,6 @@ def parse_args(args=None):
628
610
'directory' ))
629
611
ap .add_argument ('--with-billing' , dest = 'billing_pubkey' ,
630
612
help = 'If set, the billing service will be added (not implemented)' )
631
- ap .add_argument ('--service' , dest = 'services' , action = 'append' ,
632
- help = 'Declare a new service entrypoint: '
633
- 'NAME:PATH_TO_PY[:foreground]' )
634
613
ap .add_argument ('--add-source' , dest = 'extra_source_dirs' , action = 'append' ,
635
614
help = 'Include additional source dirs in Java build' )
636
615
if get_bootstrap_name () == "webview" :
@@ -710,7 +689,7 @@ def _read_configuration():
710
689
if args .meta_data is None :
711
690
args .meta_data = []
712
691
713
- if args .services is None :
692
+ if ( not hasattr ( args , 'services' )) or args .services is None :
714
693
args .services = []
715
694
716
695
if args .try_system_python_compile :
@@ -741,10 +720,8 @@ def _read_configuration():
741
720
if x .strip () and not x .strip ().startswith ('#' )]
742
721
WHITELIST_PATTERNS += patterns
743
722
744
- if args .private is None and (
745
- get_bootstrap_name () != "sdl2" or
746
- args .launcher is None
747
- ):
723
+ if args .private is None and \
724
+ get_bootstrap_name () == 'sdl2' and args .launcher is None :
748
725
print ('Need --private directory or ' +
749
726
'--launcher (SDL2 bootstrap only)' +
750
727
'to have something to launch inside the .apk!' )
0 commit comments