Skip to content

Commit 62452bb

Browse files
committed
Support for custom resources
1 parent 5a94d07 commit 62452bb

File tree

1 file changed

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

1 file changed

+13
-1
lines changed

pythonforandroid/bootstraps/common/build/build.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ def make_package(args):
232232
sys.exit(1)
233233

234234
assets_dir = "src/main/assets"
235+
res_dir = "src/main/res"
235236

236237
# Delete the old assets.
237238
shutil.rmtree(assets_dir, ignore_errors=True)
@@ -307,6 +308,14 @@ def make_package(args):
307308
else:
308309
shutil.copytree(realpath(asset_src), join(assets_dir, asset_dest))
309310

311+
for res in args.resources:
312+
res_src, res_dest = res.split(":")
313+
if isfile(realpath(res_src)):
314+
ensure_dir(dirname(join(res_dir, res_dest)))
315+
shutil.copy(realpath(res_src), join(res_dir, res_dest))
316+
else:
317+
shutil.copytree(realpath(res_src), join(res_dir, res_dest))
318+
310319
if args.private or args.launcher:
311320
make_tar(
312321
join(assets_dir, 'private.mp3'), tar_dirs, args.ignore_path,
@@ -319,7 +328,6 @@ def make_package(args):
319328
shutil.rmtree(env_vars_tarpath)
320329

321330
# Prepare some variables for templating process
322-
res_dir = "src/main/res"
323331
default_icon = 'templates/kivy-icon.png'
324332
default_presplash = 'templates/kivy-presplash.jpg'
325333
shutil.copy(
@@ -610,6 +618,10 @@ def parse_args_and_make_package(args=None):
610618
help='Custom key=value to add in application metadata')
611619
ap.add_argument('--uses-library', dest='android_used_libs', action='append', default=[],
612620
help='Used shared libraries included using <uses-library> tag in AndroidManifest.xml')
621+
ap.add_argument('--resource', dest='resources',
622+
action="append", default=[],
623+
metavar="/path/to/res/source:dest",
624+
help='Put this in the resources folder at /dest')
613625
ap.add_argument('--asset', dest='assets',
614626
action="append", default=[],
615627
metavar="/path/to/source:dest",

0 commit comments

Comments
 (0)