Skip to content

Commit 31cbc2e

Browse files
ramboShyamQt
authored andcommitted
Add option for copying arbitratry xml files to src/main/res/xml without touching manifest
1 parent 438090b commit 31cbc2e

File tree

1 file changed

+11
-1
lines changed
  • pythonforandroid/bootstraps/common/build

1 file changed

+11
-1
lines changed

pythonforandroid/bootstraps/common/build/build.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,12 +508,20 @@ def make_package(args):
508508
url_scheme = 'kivy'
509509

510510
# Copy backup rules file if specified and update the argument
511+
res_xml_dir = join(res_dir, 'xml')
511512
if args.backup_rules:
512-
res_xml_dir = join(res_dir, 'xml')
513513
ensure_dir(res_xml_dir)
514514
shutil.copy(join(args.private, args.backup_rules), res_xml_dir)
515515
args.backup_rules = split(args.backup_rules)[1][:-4]
516516

517+
# Copy res_xml files to src/main/res/xml
518+
if args.res_xmls:
519+
ensure_dir(res_xml_dir)
520+
for xmlpath in args.res_xmls:
521+
if not os.path.exists(xmlpath):
522+
xmlpath = join(args.private, xmlpath)
523+
shutil.copy(xmlpath, res_xml_dir)
524+
517525
# Render out android manifest:
518526
manifest_path = "src/main/AndroidManifest.xml"
519527
render_args = {
@@ -803,6 +811,8 @@ def parse_args_and_make_package(args=None):
803811
'filename containing xml. The filename should be '
804812
'located relative to the python-for-android '
805813
'directory'))
814+
ap.add_argument('--res_xml', dest='res_xmls', action='append', default=[],
815+
help='Add files to res/xml directory (for example device-filters)', nargs='+')
806816
ap.add_argument('--with-billing', dest='billing_pubkey',
807817
help='If set, the billing service will be added (not implemented)')
808818
ap.add_argument('--add-source', dest='extra_source_dirs', action='append',

0 commit comments

Comments
 (0)