Skip to content

Commit 64374db

Browse files
committed
Merge pull request kivy#119 from bob-the-hamster/ouya-support
Ouya support
2 parents 33f10f2 + 1106705 commit 64374db

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

src/build.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ def make_package(args):
197197
url_scheme = 'kivy'
198198
default_icon = 'templates/kivy-icon.png'
199199
default_presplash = 'templates/kivy-presplash.jpg'
200+
default_ouya_icon = 'templates/kivy-ouya-icon.png'
200201
# Figure out the version code, if necessary.
201202
if not args.numeric_version:
202203
for i in args.version.split('.'):
@@ -238,6 +239,13 @@ def make_package(args):
238239
if os.path.exists(service_main):
239240
service = True
240241

242+
# Check if OUYA support is enabled
243+
if args.ouya_category:
244+
args.ouya_category = args.ouya_category.upper()
245+
if args.ouya_category not in ('GAME', 'APP'):
246+
print 'Invalid --ouya-category argument. should be one of GAME or APP'
247+
sys.exit(-1)
248+
241249
# Render the various templates into control files.
242250
render(
243251
'AndroidManifest.tmpl.xml',
@@ -296,6 +304,12 @@ def make_package(args):
296304
shutil.copy(args.icon or default_icon, 'res/drawable/icon.png')
297305
shutil.copy(args.presplash or default_presplash, 'res/drawable/presplash.jpg')
298306

307+
# If OUYA support was requested, copy over the OUYA icon
308+
if args.ouya_category:
309+
if not os.path.isdir('res/drawable-xhdpi'):
310+
os.mkdir('res/drawable-xhdpi')
311+
shutil.copy(args.ouya_icon or default_ouya_icon, 'res/drawable-xhdpi/ouya_icon.png')
312+
299313
# Build.
300314
try:
301315
map(lambda arg: subprocess.call([ANT, arg]), args.command)
@@ -329,6 +343,8 @@ def make_package(args):
329343
ap.add_argument('--ignore-path', dest='ignore_path', action='append', help='Ignore path when building the app')
330344
ap.add_argument('--icon', dest='icon', help='A png file to use as the icon for the application.')
331345
ap.add_argument('--presplash', dest='presplash', help='A jpeg file to use as a screen while the application is loading.')
346+
ap.add_argument('--ouya-category', dest='ouya_category', help='Valid values are GAME and APP. This must be specified to enable OUYA console support.')
347+
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.')
332348
ap.add_argument('--install-location', dest='install_location', default='auto', help='The default install location. Should be "auto", "preferExternal" or "internalOnly".')
333349
ap.add_argument('--compile-pyo', dest='compile_pyo', action='store_true', help='Compile all .py files to .pyo, and only distribute the compiled bytecode.')
334350
ap.add_argument('--intent-filters', dest='intent_filters', help='Add intent-filters xml rules to AndroidManifest.xml')

src/templates/AndroidManifest.tmpl.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@
3535
</intent-filter>
3636
{% endif %}
3737

38+
{%if args.ouya_category %}
39+
<intent-filter>
40+
<action android:name="android.intent.action.MAIN"/>
41+
<category android:name="android.intent.category.LAUNCHER"/>
42+
<category android:name="tv.ouya.intent.category.{{ args.ouya_category }}"/>
43+
</intent-filter>
44+
45+
{% endif %}
46+
3847
{%if args.intent_filters %}
3948
{{ intent_filters }}
4049
{% endif %}

src/templates/kivy-ouya-icon.png

156 KB
Loading

0 commit comments

Comments
 (0)