@@ -68,8 +68,8 @@ def get_bootstrap_name():
6868 BLACKLIST_PATTERNS .append ('*.py' )
6969
7070WHITELIST_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' )
7373
7474python_files = []
7575
@@ -263,8 +263,6 @@ def make_package(args):
263263 sys .exit (1 )
264264
265265 assets_dir = "src/main/assets"
266- if get_bootstrap_name () != "sdl2" :
267- assets_dir = "assets"
268266
269267 # Delete the old assets.
270268 try_unlink (join (assets_dir , 'public.mp3' ))
@@ -291,15 +289,13 @@ def make_package(args):
291289
292290 # Prepare some variables for templating process
293291 res_dir = "src/main/res"
294- if get_bootstrap_name () == "webview" :
295- res_dir = "res"
296292 default_icon = 'templates/kivy-icon.png'
297293 default_presplash = 'templates/kivy-presplash.jpg'
294+ shutil .copy (
295+ args .icon or default_icon ,
296+ join (res_dir , 'drawable/icon.png' )
297+ )
298298 if get_bootstrap_name () != "service_only" :
299- shutil .copy (
300- args .icon or default_icon ,
301- join (res_dir , 'drawable/icon.png' )
302- )
303299 shutil .copy (
304300 args .presplash or default_presplash ,
305301 join (res_dir , 'drawable/presplash.jpg' )
@@ -340,9 +336,9 @@ def make_package(args):
340336 with open (args .intent_filters ) as fd :
341337 args .intent_filters = fd .read ()
342338
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 ''
346342
347343 if args .extra_source_dirs :
348344 esd = []
@@ -374,17 +370,11 @@ def make_package(args):
374370 sticky = 'sticky' in options
375371
376372 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+ )
388378 render (
389379 'Service.tmpl.java' ,
390380 service_target_path ,
@@ -424,8 +414,6 @@ def make_package(args):
424414
425415 # Render out android manifest:
426416 manifest_path = "src/main/AndroidManifest.xml"
427- if get_bootstrap_name () != "sdl2" :
428- manifest_path = "AndroidManifest.xml"
429417 render_args = {
430418 "args" : args ,
431419 "service" : service ,
@@ -441,45 +429,39 @@ def make_package(args):
441429
442430 # Copy the AndroidManifest.xml to the dist root dir so that ant
443431 # 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' )
448435
449436 # 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+ )
460446
461447 # 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 )
470453
471454 # 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 )
483465
484466 if exists (join ("templates" , "custom_rules.tmpl.xml" )):
485467 render (
@@ -489,7 +471,7 @@ def make_package(args):
489471
490472 if get_bootstrap_name () == "webview" :
491473 render ('WebViewLoader.tmpl.java' ,
492- 'src/org/kivy/android/WebViewLoader.java' ,
474+ 'src/main/java/ org/kivy/android/WebViewLoader.java' ,
493475 args = args )
494476
495477 if args .sign :
@@ -551,6 +533,9 @@ def parse_args(args=None):
551533 help = 'The permissions to give this app.' , nargs = '+' )
552534 ap .add_argument ('--meta-data' , dest = 'meta_data' , action = 'append' ,
553535 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.' ))
554539 if get_bootstrap_name () != "service_only" :
555540 ap .add_argument ('--presplash' , dest = 'presplash' ,
556541 help = ('A jpeg file to use as a screen while the '
@@ -566,9 +551,6 @@ def parse_args(args=None):
566551 ap .add_argument ('--window' , dest = 'window' , action = 'store_true' ,
567552 default = False ,
568553 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.' ))
572554 ap .add_argument ('--orientation' , dest = 'orientation' ,
573555 default = 'portrait' ,
574556 help = ('The orientation that the game will '
@@ -626,9 +608,6 @@ def parse_args(args=None):
626608 'directory' ))
627609 ap .add_argument ('--with-billing' , dest = 'billing_pubkey' ,
628610 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]' )
632611 ap .add_argument ('--add-source' , dest = 'extra_source_dirs' , action = 'append' ,
633612 help = 'Include additional source dirs in Java build' )
634613 if get_bootstrap_name () == "webview" :
@@ -708,7 +687,7 @@ def _read_configuration():
708687 if args .meta_data is None :
709688 args .meta_data = []
710689
711- if args .services is None :
690+ if ( not hasattr ( args , 'services' )) or args .services is None :
712691 args .services = []
713692
714693 if args .try_system_python_compile :
@@ -739,10 +718,8 @@ def _read_configuration():
739718 if x .strip () and not x .strip ().startswith ('#' )]
740719 WHITELIST_PATTERNS += patterns
741720
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 :
746723 print ('Need --private directory or ' +
747724 '--launcher (SDL2 bootstrap only)' +
748725 'to have something to launch inside the .apk!' )
0 commit comments