diff --git a/src/build.py b/src/build.py index 73f6925af6..b9ec0e9f1d 100755 --- a/src/build.py +++ b/src/build.py @@ -197,6 +197,7 @@ def make_package(args): url_scheme = 'kivy' default_icon = 'templates/kivy-icon.png' default_presplash = 'templates/kivy-presplash.jpg' + default_ouya_icon = 'templates/kivy-ouya-icon.png' # Figure out the version code, if necessary. if not args.numeric_version: for i in args.version.split('.'): @@ -238,6 +239,13 @@ def make_package(args): if os.path.exists(service_main): service = True + # Check if OUYA support is enabled + if args.ouya_category: + args.ouya_category = args.ouya_category.upper() + if args.ouya_category not in ('GAME', 'APP'): + print 'Invalid --ouya-category argument. should be one of GAME or APP' + sys.exit(-1) + # Render the various templates into control files. render( 'AndroidManifest.tmpl.xml', @@ -296,6 +304,12 @@ def make_package(args): shutil.copy(args.icon or default_icon, 'res/drawable/icon.png') shutil.copy(args.presplash or default_presplash, 'res/drawable/presplash.jpg') + # If OUYA support was requested, copy over the OUYA icon + if args.ouya_category: + if not os.path.isdir('res/drawable-xhdpi'): + os.mkdir('res/drawable-xhdpi') + shutil.copy(args.ouya_icon or default_ouya_icon, 'res/drawable-xhdpi/ouya_icon.png') + # Build. try: map(lambda arg: subprocess.call([ANT, arg]), args.command) @@ -329,6 +343,8 @@ def make_package(args): ap.add_argument('--ignore-path', dest='ignore_path', action='append', help='Ignore path when building the app') ap.add_argument('--icon', dest='icon', help='A png file to use as the icon for the application.') ap.add_argument('--presplash', dest='presplash', help='A jpeg file to use as a screen while the application is loading.') + ap.add_argument('--ouya-category', dest='ouya_category', help='Valid values are GAME and APP. This must be specified to enable OUYA console support.') + ap.add_argument('--ouya-icon', dest='ouya_icon', help='A png file to use as the icon for the application if it is installed on an OUYA console.') ap.add_argument('--install-location', dest='install_location', default='auto', help='The default install location. Should be "auto", "preferExternal" or "internalOnly".') ap.add_argument('--compile-pyo', dest='compile_pyo', action='store_true', help='Compile all .py files to .pyo, and only distribute the compiled bytecode.') ap.add_argument('--intent-filters', dest='intent_filters', help='Add intent-filters xml rules to AndroidManifest.xml') diff --git a/src/templates/AndroidManifest.tmpl.xml b/src/templates/AndroidManifest.tmpl.xml index 7911f62759..dd194450e4 100644 --- a/src/templates/AndroidManifest.tmpl.xml +++ b/src/templates/AndroidManifest.tmpl.xml @@ -35,6 +35,15 @@ {% endif %} + {%if args.ouya_category %} + + + + + + + {% endif %} + {%if args.intent_filters %} {{ intent_filters }} {% endif %} diff --git a/src/templates/kivy-ouya-icon.png b/src/templates/kivy-ouya-icon.png new file mode 100644 index 0000000000..1919040a27 Binary files /dev/null and b/src/templates/kivy-ouya-icon.png differ