Skip to content

Ouya support #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 16, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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('.'):
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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')
Expand Down
9 changes: 9 additions & 0 deletions src/templates/AndroidManifest.tmpl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,15 @@
</intent-filter>
{% endif %}

{%if args.ouya_category %}
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="tv.ouya.intent.category.{{ args.ouya_category }}"/>
</intent-filter>

{% endif %}

{%if args.intent_filters %}
{{ intent_filters }}
{% endif %}
Expand Down
Binary file added src/templates/kivy-ouya-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.