[sugar] Update.1 activities download script

Bert Freudenberg bert
Tue Mar 18 09:57:38 EDT 2008


On Mar 17, 2008, at 17:22 , Tomeu Vizoso wrote:
>>
>>>> And finally, there is a trick in the script so it connects to the
>>>> current Sugar session even if run from the console or via ssh - may
>>>> be  useful to somebody:
>>>>
>>>> if not 'SUGAR_PREFIX' in os.environ:
>>>>  """Connect to running Sugar session"""
>>>>  cp = ConfigParser()
>>>>  cp.read(env.get_profile_path('session.info'))
>>>>  os.environ['DBUS_SESSION_BUS_ADDRESS'] = cp.get('Session',
>>>> 'dbus_address')
>>>>  dbus.set_default_main_loop(dbus.mainloop.NULL_MAIN_LOOP)
>>>
>>> Thanks a lot, this is really useful for me already! Maybe also put
>>> it somewhere in the wiki... [[Programming Tricks]] :)
>>
>>
>> I actually have no idea how evil that snippet really is ;) Wold be
>> nice if some Sugar/DBus expert could comment.
>
> Don't really know why that file is there, but from this comment from
> the code that creates it, it's not something you can rely in the long
> term:
>
> http://dev.laptop.org/git?p=sugar;a=blob;f=src/main.py;h=e78570769e8138c827e04c1a6af820c6ce712955;hb=HEAD#l53
>
> Perhaps in the xo you could rely on this hardcoded value?
>
> os.environ['DBUS_SESSION_BUS_ADDRESS'] = 'unix:path=/tmp/olpc- 
> session-bus'


That is more elegant, thanks. I updated the script.

It now also switches to the olpc user if run as root, is case- 
insensitive to the listed activities, and supports excluding  
activities (because, e.g., OurStories and XaoS are broken).

Ah, I need to stop working on this ;)

- Bert -





More information about the Sugar-devel mailing list