User:Jlew/XO Workflow

From Sugar Labs
Jump to navigation Jump to search

This is a jump-start/summery to the Activity tutorial with also some workflow suggestions. Reading the activity tutorial could be beneficial to you as well.

Git Directory Setup

  • ProjectRoot/
    • In this top level directory, I put files like Documentation, Builds, and other files that do not need to be in the activity but could be useful to other developers.
    • ActivityName.activity/ (Name must contain no spaces and end in .activity)
      • activity/
        • activity-icon.svg (any name works)
      • MANIFEST
      • (any name, this is your main activity file, must extend Activity)


The file allows you to easily build your manifest and xo bundles. To build manifest files or xo builds, just type in python on your xo (or a computer that has the python sugar.activity module. It will provide you with a usage information message.

I have provided a copy of the basic file here:

from sugar.activity import bundlebuilder
if __name__ == "__main__":

This file is found in the activity folder of your activity. Here is a minimum file.

See Development_Team/Almanac/Activity_Bundles#.info_file_format for more documentation.

service_name = org.laptop.sugar.ACTIVITY_NAME
activity_version = 1
icon = activity-icon
class = ActivityMain.ActivityMain
show_launcher = yes

Every time you release a new build, increment the activity_version by one (this is the sugar standard)


More info coming soon. See Making Sugar Icons

This can be named anything, but to keep it simple, have it the name of the activity, inside should be a python class with the same name (without the extension) that extends the Activity class found in sugar.activity.activity


The manifest file can be built with the file

Work Flow on the XO

There are two or three work flows that I have been working with on the xo, which one you use is up to you.

Setup Git folder

  1. First start off by opening terminal and making a directory, I'll call it git.
  2. In this directory clone from your git repo using your push url.
    • If you haven't started coding yet, now would be a good time to build all the files mentioned above and get a skeleton activity set up. I suggest looking at the Activity tutorial for more detailed instructions. Once you have the activity set up, continue.
    • You should see your git directory structure in the git folder. Something like git/ProjectRoot/ActivityName.activity
  3. Next cd into the activity folder (cd ~/Activities/)
  4. Make a simlink to your activity in your git folder in the activity folder
    • ln -s ~/git/ProjectRoot/ActivityName.activity ActivityName.activity
  5. Reboot your xo.
    • When the xo has returned, you should see your activity on the wheel (or it may be in the list as it is not a favorite)


Now that git has been set up, you simply have to work in your git folder and because of the simlink, every time you run your activity it will be working with your newest code. This is the easiest setup.

Because it is using git, you can also write your code on another system and use git to share your files. The disadvantage to this is you get a lot of bug fix commits. If you do this and you are familiar with git, then I would recommend you using branches or cloned repositories and merge with the main when you have finished working out bugs and the feature is stable.

I personally use the same setup except I don't use git to transfer the files. Because I work in a linux environment, I use git on my primary computer and then just pull it over to the xo using scp. The advantage to this is you don't need to use git to transfer test commits which means my git repo is always in a fairly stable state.

Building XO Release

When you are ready to package your activity into an xo release.

  1. From your activity folder, run python fix_manifest
  2. If you have set your system up for localization, next run python genpot
  3. If this is a new xo release, update the activity version in your file.
    • You only need to update the activity version if you have released an xo file to the public.
    • When testing, it can be useful to build activity bundles every now and then to test on other xo's.
  4. Finally build the file running python dist_xo
    • Your xo file will be build and put into a dist directory with a name like ActivityName-1.xo.