Re: [Sugar-devel] How is the 'default' string in '.sugar/default' determined?

2009-08-18 Thread Bert Freudenberg

On 18.08.2009, at 10:52, Martin Langhoff wrote:

> On Tue, Aug 18, 2009 at 10:43 AM, Tomeu Vizoso  
> wrote:
>> On Tue, Aug 11, 2009 at 17:24, Martin Langhoff> > wrote:
>>> In the Sugar internals, how do you obtain the Sugar config storage
>>> directory? Moreover, what is the /correct/, recommended way to do  
>>> it,
>>> one that will work on .82, .84 & .86 from activities, Sugar Shell
>>> code... and cronjobs (that run under the same user, but different  
>>> ENV,
>>> and not spawned by sugar shell).
>>
>> 'default' is the name of the profile. If you want to use a different
>> profile, you can set the env var SUGAR_PROFILE.
>
> Cool.
>
>> You can use sugar.env.get_profile_path() in all those Sugar versions.
>
> How can I get that safely from a cronjob?


Why would you? $SUGAR_PROFILE is never set except by developers, and  
rarely even by them. How they set it you cannot guess - .xsession is a  
common place, but there isn't even a recommendation for it I think.  
And since I doubt you want to run .xsession from your cronjob, you  
will not get the same environment as Sugar anyways.

So IMHO you should just use "default".

- Bert -


___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] How is the 'default' string in '.sugar/default' determined?

2009-08-18 Thread Sascha Silbe

On Tue, Aug 18, 2009 at 10:52:16AM +0200, Martin Langhoff wrote:


You can use sugar.env.get_profile_path() in all those Sugar versions.

How can I get that safely from a cronjob?

You could try the following:

PROFILE_PATH="$(python -c 'import sugar.env ; print 
sugar.env.get_profile_path()')"


Verified to work inside sugar-jhbuild. Should work for distro packages 
as well, but don't have any installation to test that.


CU Sascha

--
http://sascha.silbe.org/
http://www.infra-silbe.de/

signature.asc
Description: Digital signature
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] How is the 'default' string in '.sugar/default' determined?

2009-08-18 Thread Martin Langhoff
On Tue, Aug 18, 2009 at 10:55 AM, Tomeu Vizoso wrote:
> I don't think I can answer that for you, but the implementation is
> really simple:
>
> http://git.sugarlabs.org/projects/sugar-toolkit/repos/mainline/blobs/master/src/sugar/env.py#line31

That's super clear - thanks!


m
-- 
 martin.langh...@gmail.com
 mar...@laptop.org -- School Server Architect
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] How is the 'default' string in '.sugar/default' determined?

2009-08-18 Thread Tomeu Vizoso
On Tue, Aug 18, 2009 at 10:52, Martin Langhoff wrote:
> On Tue, Aug 18, 2009 at 10:43 AM, Tomeu Vizoso wrote:
>> On Tue, Aug 11, 2009 at 17:24, Martin Langhoff 
>> wrote:
>>> In the Sugar internals, how do you obtain the Sugar config storage
>>> directory? Moreover, what is the /correct/, recommended way to do it,
>>> one that will work on .82, .84 & .86 from activities, Sugar Shell
>>> code... and cronjobs (that run under the same user, but different ENV,
>>> and not spawned by sugar shell).
>>
>> 'default' is the name of the profile. If you want to use a different
>> profile, you can set the env var SUGAR_PROFILE.
>
> Cool.
>
>> You can use sugar.env.get_profile_path() in all those Sugar versions.
>
> How can I get that safely from a cronjob?

I don't think I can answer that for you, but the implementation is
really simple:

http://git.sugarlabs.org/projects/sugar-toolkit/repos/mainline/blobs/master/src/sugar/env.py#line31

I don't think we are going to change the path of that dir any time soon.

Regards,

Tomeu

> cheers,
>
>
>
> m
> --
>  martin.langh...@gmail.com
>  mar...@laptop.org -- School Server Architect
>  - ask interesting questions
>  - don't get distracted with shiny stuff  - working code first
>  - http://wiki.laptop.org/go/User:Martinlanghoff
>



-- 
«Sugar Labs is anyone who participates in improving and using Sugar.
What Sugar Labs does is determined by the participants.» - David
Farning
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] How is the 'default' string in '.sugar/default' determined?

2009-08-18 Thread Martin Langhoff
On Tue, Aug 18, 2009 at 10:43 AM, Tomeu Vizoso wrote:
> On Tue, Aug 11, 2009 at 17:24, Martin Langhoff 
> wrote:
>> In the Sugar internals, how do you obtain the Sugar config storage
>> directory? Moreover, what is the /correct/, recommended way to do it,
>> one that will work on .82, .84 & .86 from activities, Sugar Shell
>> code... and cronjobs (that run under the same user, but different ENV,
>> and not spawned by sugar shell).
>
> 'default' is the name of the profile. If you want to use a different
> profile, you can set the env var SUGAR_PROFILE.

Cool.

> You can use sugar.env.get_profile_path() in all those Sugar versions.

How can I get that safely from a cronjob?

cheers,



m
-- 
 martin.langh...@gmail.com
 mar...@laptop.org -- School Server Architect
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


Re: [Sugar-devel] How is the 'default' string in '.sugar/default' determined?

2009-08-18 Thread Tomeu Vizoso
On Tue, Aug 11, 2009 at 17:24, Martin Langhoff wrote:
> In the Sugar internals, how do you obtain the Sugar config storage
> directory? Moreover, what is the /correct/, recommended way to do it,
> one that will work on .82, .84 & .86 from activities, Sugar Shell
> code... and cronjobs (that run under the same user, but different ENV,
> and not spawned by sugar shell).

'default' is the name of the profile. If you want to use a different
profile, you can set the env var SUGAR_PROFILE.

You can use sugar.env.get_profile_path() in all those Sugar versions.

Regards,

Tomeu

> cheers,
>
>
>
>
> m
> --
>  martin.langh...@gmail.com
>  mar...@laptop.org -- School Server Architect
>  - ask interesting questions
>  - don't get distracted with shiny stuff  - working code first
>  - http://wiki.laptop.org/go/User:Martinlanghoff
> ___
> Sugar-devel mailing list
> Sugar-devel@lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>



-- 
«Sugar Labs is anyone who participates in improving and using Sugar.
What Sugar Labs does is determined by the participants.» - David
Farning
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel