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