Pygame games can be distributed through the Android Market. To do this, you’ll need the following tools installed on your system.
You’ll want to download and uncompress pygame-package-<version>.tar.bz2.
The pygame package tool contains the build.py script. Given a game directory and options, this script creates all of the files needed to create an android package, and then uses ant to build that package.
build.py expects that Python, Java, Ant, and the tools directory of the Android SDK are in your path. You should be able to run python, javac, ant, and android without having to give a path explicitly.
Note
On Windows, some of the names are different. You’ll want to be able to run ant.bat and android.bat.
build.py expects you to change into the directory that contains it before running it. It takes the following options:
build.py options
A directory containing project files that will be installed to the SD card.
Note
These files will wind up on the sdcard, where it is trivially easy for users to get at them.
A directory containing project files that will be installed to a private directory on the device’s internal storage.
One of –private or –dir must be given.
Note
Despite the name, these files aren’t all that private, since root users can get to them.
The name of the java package the project will be packaged under.
The human-readable name of the project.
The name that will be used for the project icon that is displayed in the launcher.
The version of the project. This should be human-readable. A numeric version is generated from this, but the generation is sensitive to the number of groups of digits, so the versions should always contain the same number of groups of digits.
For example, 1.0 and 2.1 are fine. 1.1.2 is also fine, but shouldn’t be mixed in a project with 1.0
The numeric version of the project. This is optional, and if given, this overrides the version number that build.py would compute automatically.
If given, this should be a PNG file that contains the icon that will be used for the application. If not present, a default icon is used.
If given, this should be a JPEG file that is used as a pre-splash screen that’s displayed as the application starts up. If not present, a default screen will be used.
The orientation that the application will be displayed in. This should be one of “portrait” or “landscape”. Defaults to landscape.
The default install location for the application. This should be one of “auto”, “preferExternal” or “internalOnly”. Defaults to auto.
An android permission that will be given to the packaged applications. Currently-useful permissions include:
Includes the sqlite module as part of the package.
Includes the Python Imaging Library as part of the package.
build.py expects one positional argument, which is the command to run. Useful commands include:
A command that builds the example package is:
./build.py --dir example --package com.domain.example \
--name "Pygame Example" --version 1.0 --orientation portrait \
debug
Once a release version of the package is built, it needs to be signed and zipaligned before it can be released to the Android Market. Please see the Android documentation for more details.