[Sugar-devel] [PATCH sugar] Find activities in the xdg system dirs

Daniel Narvaez dwnarvaez at gmail.com
Fri Dec 7 08:58:52 EST 2012


config.py.in gets in the way when writing unit tests. The generated
config.py is not in the right place when building out-of-source and it
references stuff in the system that I can't assume is there (because
running make test should not require a make install).

In any case I think following the freedesktop specs is a good idea,
and this is a pretty clear case where we are not.

I'll try to be more verbose in the logs but if you see any other patch
where the reason is unclear please point them out and I'll elaborate!

On 7 December 2012 14:38, Gonzalo Odiard <gonzalo at laptop.org> wrote:
> Daniel,
> Can you explain a little more in your patches, what is the problem you are
> trying to solve,
> and/or why is the change proposed?
> Thanks
>
> Gonzalo
>
> On Fri, Dec 7, 2012 at 10:15 AM, Daniel Narvaez <dwnarvaez at gmail.com> wrote:
>>
>> From: Daniel Narvaez <dwnarvaez at gmail.com>
>>
>> Instead of hardcoding our prefix.
>> ---
>>  src/jarabe/config.py.in            |    1 -
>>  src/jarabe/model/bundleregistry.py |    9 +++++++--
>>  2 files changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/jarabe/config.py.in b/src/jarabe/config.py.in
>> index bfcc2e5..f2a66a2 100644
>> --- a/src/jarabe/config.py.in
>> +++ b/src/jarabe/config.py.in
>> @@ -19,6 +19,5 @@
>>  data_path = '@prefix@/share/sugar/data'
>>  locale_path = '@prefix@/share/locale'
>>  ext_path = '@prefix@/share/sugar/extensions'
>> -activities_path = "@prefix@/share/sugar/activities"
>>  version = '@SUCROSE_VERSION@'
>>
>> diff --git a/src/jarabe/model/bundleregistry.py
>> b/src/jarabe/model/bundleregistry.py
>> index e441122..8a1fa37 100644
>> --- a/src/jarabe/model/bundleregistry.py
>> +++ b/src/jarabe/model/bundleregistry.py
>> @@ -20,6 +20,7 @@ import logging
>>
>>  from gi.repository import GConf
>>  from gi.repository import GObject
>> +from gi.repository import GLib
>>  from gi.repository import Gio
>>  import simplejson
>>
>> @@ -60,8 +61,12 @@ class BundleRegistry(GObject.GObject):
>>          # hold a reference to the monitors so they don't get disposed
>>          self._gio_monitors = []
>>
>> -        user_path = env.get_user_activities_path()
>> -        for activity_dir in [user_path, config.activities_path]:
>> +        dirs = [env.get_user_activities_path()]
>> +
>> +        for data_dir in GLib.get_system_data_dirs():
>> +            dirs.append(os.path.join(data_dir, "sugar", "activities"))
>> +
>> +        for activity_dir in dirs:
>>              self._scan_directory(activity_dir)
>>              directory = Gio.File.new_for_path(activity_dir)
>>              monitor = directory.monitor_directory( \
>> --
>> 1.7.10.4
>>
>> _______________________________________________
>> Sugar-devel mailing list
>> Sugar-devel at lists.sugarlabs.org
>> http://lists.sugarlabs.org/listinfo/sugar-devel
>
>



-- 
Daniel Narvaez


More information about the Sugar-devel mailing list