@@ -222,13 +222,15 @@ def make_package(args):
222
222
# print('Your PATH must include android tools.')
223
223
# sys.exit(-1)
224
224
225
- if not (exists (join (realpath (args .private ), 'main.py' )) or
226
- exists (join (realpath (args .private ), 'main.pyo' ))):
227
- print ('''BUILD FAILURE: No main.py(o) found in your app directory. This
225
+ # Ignore warning if the launcher is in args
226
+ if not args .launcher :
227
+ if not (exists (join (realpath (args .private ), 'main.py' )) or
228
+ exists (join (realpath (args .private ), 'main.pyo' ))):
229
+ print ('''BUILD FAILURE: No main.py(o) found in your app directory. This
228
230
file must exist to act as the entry point for you app. If your app is
229
231
started by a file with a different name, rename it to main.py or add a
230
232
main.py that loads it.''' )
231
- exit (1 )
233
+ exit (1 )
232
234
233
235
# Delete the old assets.
234
236
if exists ('assets/public.mp3' ):
@@ -248,8 +250,13 @@ def make_package(args):
248
250
tar_dirs .append ('private' )
249
251
if exists ('crystax_python' ):
250
252
tar_dirs .append ('crystax_python' )
253
+
251
254
if args .private :
252
255
make_tar ('assets/private.mp3' , tar_dirs , args .ignore_path )
256
+ elif args .launcher :
257
+ # clean 'None's as a result of main.py path absence
258
+ tar_dirs = [tdir for tdir in tar_dirs if tdir ]
259
+ make_tar ('assets/private.mp3' , tar_dirs , args .ignore_path )
253
260
# else:
254
261
# make_tar('assets/private.mp3', ['private'])
255
262
@@ -267,12 +274,18 @@ def make_package(args):
267
274
# sys.exit(-1)
268
275
269
276
270
- # Prepare some variables for templating process
277
+ # folder name for launcher
278
+ url_scheme = 'kivy'
271
279
272
- default_icon = 'templates/kivy-icon.png'
280
+ # Prepare some variables for templating process
281
+ if args .launcher :
282
+ default_icon = 'templates/launcher-icon.png'
283
+ default_presplash = 'templates/launcher-presplash.jpg'
284
+ else :
285
+ default_icon = 'templates/kivy-icon.png'
286
+ default_presplash = 'templates/kivy-presplash.jpg'
273
287
shutil .copy (args .icon or default_icon , 'res/drawable/icon.png' )
274
288
275
- default_presplash = 'templates/kivy-presplash.jpg'
276
289
shutil .copy (args .presplash or default_presplash ,
277
290
'res/drawable/presplash.jpg' )
278
291
@@ -312,9 +325,10 @@ def make_package(args):
312
325
args .extra_source_dirs = []
313
326
314
327
service = False
315
- service_main = join (realpath (args .private ), 'service' , 'main.py' )
316
- if exists (service_main ) or exists (service_main + 'o' ):
317
- service = True
328
+ if args .private :
329
+ service_main = join (realpath (args .private ), 'service' , 'main.py' )
330
+ if exists (service_main ) or exists (service_main + 'o' ):
331
+ service = True
318
332
319
333
service_names = []
320
334
for sid , spec in enumerate (args .services ):
@@ -344,6 +358,7 @@ def make_package(args):
344
358
args = args ,
345
359
service = service ,
346
360
service_names = service_names ,
361
+ url_scheme = url_scheme ,
347
362
)
348
363
349
364
render (
@@ -355,7 +370,9 @@ def make_package(args):
355
370
render (
356
371
'strings.tmpl.xml' ,
357
372
'res/values/strings.xml' ,
358
- args = args )
373
+ args = args ,
374
+ url_scheme = url_scheme ,
375
+ )
359
376
360
377
render (
361
378
'custom_rules.tmpl.xml' ,
@@ -391,8 +408,9 @@ def parse_args(args=None):
391
408
''' )
392
409
393
410
ap .add_argument ('--private' , dest = 'private' ,
394
- help = 'the dir of user files' ,
395
- required = True )
411
+ help = 'the dir of user files' )
412
+ # , required=True) for launcher, crashes in make_package
413
+ # if not mentioned (and the check is there anyway)
396
414
ap .add_argument ('--package' , dest = 'package' ,
397
415
help = ('The name of the java package the project will be'
398
416
' packaged under.' ),
@@ -414,6 +432,9 @@ def parse_args(args=None):
414
432
help = ('The orientation that the game will display in. '
415
433
'Usually one of "landscape", "portrait" or '
416
434
'"sensor"' ))
435
+ ap .add_argument ('--launcher' , dest = 'launcher' , action = 'store_true' ,
436
+ help = ('Provide this argument to build a multi-app '
437
+ 'launcher, rather than a single app.' ))
417
438
ap .add_argument ('--icon' , dest = 'icon' ,
418
439
help = 'A png file to use as the icon for the application.' )
419
440
ap .add_argument ('--permission' , dest = 'permissions' , action = 'append' ,
@@ -499,6 +520,9 @@ def parse_args(args=None):
499
520
PYTHON = None
500
521
BLACKLIST_PATTERNS .remove ('*.py' )
501
522
523
+ if args .launcher :
524
+ WHITELIST_PATTERNS += ['pyconfig.h' ]
525
+
502
526
if args .blacklist :
503
527
with open (args .blacklist ) as fd :
504
528
patterns = [x .strip () for x in fd .read ().splitlines ()
0 commit comments