10000 Merge pull request #552 from kived/blacklist-support · meliht/python-for-android@1a394ac · GitHub
[go: up one dir, main page]

Skip to content

Commit 1a394ac

Browse files
committed
Merge pull request kivy#552 from kived/blacklist-support
add custom blacklist/whitelist support to sdl2 bootstrap
2 parents 3688bb9 + 9a4592d commit 1a394ac

File tree

1 file changed

+21
-0
lines changed
  • pythonforandroid/bootstraps/sdl2/build

1 file changed

+21
-0
lines changed

pythonforandroid/bootstraps/sdl2/build/build.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ def make_package(args):
292292

293293

294294
def parse_args(args=None):
295+
global BLACKLIST_PATTERNS, WHITELIST_PATTERNS
295296
import argparse
296297
ap = argparse.ArgumentParser(description='''\
297298
Package a Python application for Android.
@@ -336,6 +337,14 @@ def parse_args(args=None):
336337
ap.add_argument('--wakelock', dest='wakelock', action='store_true',
337338
help=('Indicate if the application needs the device '
338339
'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'))
339348

340349
if args is None:
341350
args = sys.argv[1:]
@@ -348,6 +357,18 @@ def parse_args(args=None):
348357
if args.meta_data is None:
349358
args.meta_data = []
350359

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+
351372
make_package(args)
352373

353374
if __name__ == "__main__":

0 commit comments

Comments
 (0)
0