@@ -292,6 +292,7 @@ def make_package(args):
292
292
293
293
294
294
def parse_args (args = None ):
295
+ global BLACKLIST_PATTERNS , WHITELIST_PATTERNS
295
296
import argparse
296
297
ap = argparse .ArgumentParser (description = '''\
297
298
Package a Python application for Android.
@@ -336,6 +337,14 @@ def parse_args(args=None):
336
337
ap .add_argument ('--wakelock' , dest = 'wakelock' , action = 'store_true' ,
337
338
help = ('Indicate if the application needs the device '
338
339
'to stay on' ))
340
+ ap .add_argument ('--blacklist' , dest = 'blacklist' ,
341
+ default = join (curdir , 'blacklist.txt' ),
342
+ help = ('Use a blacklist file to match unwanted file in '
343
+ 'the final APK' ))
344
+ ap .add_argument ('--whitelist' , dest = 'whitelist' ,
345
+ default = join (curdir , 'whitelist.txt' ),
346
+ help = ('Use a whitelist file to prevent blacklisting of '
347
+ 'file in the final APK' ))
339
348
340
349
if args is None :
341
350
args = sys .argv [1 :]
@@ -348,6 +357,18 @@ def parse_args(args=None):
348
357
if args .meta_data is None :
349
358
args .meta_data = []
350
359
360
+ if args .blacklist :
361
+ with open (args .blacklist ) as fd :
362
+ patterns = [x .strip () for x in fd .read ().splitlines ()
363
+ if x .strip () and not x .strip ().startswith ('#' )]
364
+ BLACKLIST_PATTERNS += patterns
365
+
366
+ if args .whitelist :
367
+ with open (args .whitelist ) as fd :
368
+ patterns = [x .strip () for x in fd .read ().splitlines ()
369
+ if x .strip () and not x .strip ().startswith ('#' )]
370
+ WHITELIST_PATTERNS += patterns
371
+
351
372
make_package (args )
352
373
353
374
if __name__ == "__main__" :
0 commit comments