[Sugar-devel] Build broken, sugar
Miguel González
migonzalvar at activitycentral.com
Mon Jul 29 04:44:20 EDT 2013
Here is my patch: it checks if language code is not defined and use default
values in that case.
[https://github.com/sugarlabs/sugar/pull/71]
diff --git a/extensions/cpsection/modemconfiguration/model.py
b/extensions/cpsection/modemconfiguration/model.py
index c4e354d..a87cb03 100755
--- a/extensions/cpsection/modemconfiguration/model.py
+++ b/extensions/cpsection/modemconfiguration/model.py
@@ -119,10 +119,15 @@ class ServiceProvidersError(Exception):
def _get_name(el):
language_code = locale.getdefaultlocale()[0]
- lang = language_code.split('_')[0]
- lang_ns_attr = '{http://www.w3.org/XML/1998/namespace}lang'
- tag = el.find('name[@%s="%s"]' % (lang_ns_attr, lang))
+ if language_code is None:
+ tag = None
+ else:
+ lang = language_code.split('_')[0]
+ lang_ns_attr = '{http://www.w3.org/XML/1998/namespace}lang'
+
+ tag = el.find('name[@%s="%s"]' % (lang_ns_attr, lang))
+
if tag is None:
tag = el.find('name')
@@ -296,8 +301,11 @@ def __init__(self):
def _guess_country_code(self):
"""Return country based on locale lang attribute."""
language_code = locale.getdefaultlocale()[0]
- lc_list = language_code.split('_')
- country_code = lc_list[1].lower() if len(lc_list) >= 2 else ''
+ if language_code is None:
+ country_code = ''
+ else:
+ lc_list = language_code.split('_')
+ country_code = lc_list[1].lower() if len(lc_list) >= 2 else ''
return country_code
def _get_initials(self):
On Mon, Jul 29, 2013 at 10:00 AM, Daniel Narvaez <dwnarvaez at gmail.com>wrote:
> Hi Miguel,
>
> I think I misunderstood your analysis of the issue. sugar-build sets LANG
> to C and I think that's something that should be supported... So I think we
> should go with 2 in your list of alternatives.
>
>
> On Monday, 29 July 2013, Miguel González wrote:
>
>> Hi Daniel,
>>
>> Could you give some hint on how to change locale for test runner in
>> buildbolt? I was looking where to patch but I didn't find the correct
>> place. I guess is sugar-build but I admit I'm completely lost.
>>
>> Sorry about not asking for help before.
>>
>> On Sun, Jul 28, 2013 at 4:21 PM, Daniel Narvaez <dwnarvaez at gmail.com>wrote:
>>
>> Miguel,
>>
>> can you please send a patch for this as soon as possible? The build has
>> been broken for a few days now...
>>
>>
>> On 24 July 2013 08:59, Daniel Narvaez <dwnarvaez at gmail.com> wrote:
>>
>> Being shell code I think it's fine to assume the locale has been set. So
>> I'd go for 1.
>>
>>
>> On Wednesday, 24 July 2013, Miguel González wrote:
>>
>> In this case in extensions/cpsection/modemconfiguration/model.py:299
>>
>> language_code = locale.getdefaultlocale()[0]
>>
>> returns None
>>
>> so one of the test fails:
>>
>> ======================================================================
>> ERROR: test_go_trough_all_combo_options
>> (test_modemconfiguration.ServiceProvidersTest)
>> ----------------------------------------------------------------------
>> Traceback (most recent call last):
>> File "/home/broot/sugar-build/sugar/tests/test_modemconfiguration.py",
>> line 128, in setUp
>> self.db = ServiceProviders()
>> File
>> "/home/broot/sugar-build/build/out/install/share/sugar/extensions/cpsection/modemconfiguration/model.py",
>> line 274, in __init__
>> country_code, provider_name, plan_idx = self._get_initials()
>> File
>> "/home/broot/sugar-build/build/out/install/share/sugar/extensions/cpsection/modemconfiguration/model.py",
>> line 309, in _get_initials
>> country_code = self._guess_country_code()
>> File
>> "/home/broot/sugar-build/build/out/install/share/sugar/extensions/cpsection/modemconfiguration/model.py",
>> line 299, in _guess_country_code
>> lc_list = language_code.split('_')
>> AttributeError: 'NoneType' object has no attribute 'split'
>>
>> ----------------------------------------------------------------------
>>
>> So:
>>
>> 1) Must set a locale in test environment?
>>
>> 2) Make code handle this scenario?
>>
>> 3) Both?
>>
>>
>>
>>
>> On Tue, Jul 23, 2013 at 11:56 PM, Daniel Narvaez <dwnarvaez at gmail.com>wrote:
>>
>> Still failing. Could that error be due to non functional gconf?
>>
>>
>> http://buildbot.sugarlabs.org/builders/quick/builds/46/steps/shell_2/logs/log
>>
>> I see a gconf error earlier in the log. I haven't yet looked at what is
>> going on with it. Maybe just a missing dependency.
>>
>>
>> On Tuesday, 23 July 2013, Miguel González wrote:
>>
>> https://github.com/sugarlabs/sugar-build/pull/22
>>
>> diff --git a/build/root.json b/build/root.json
>> index dd496e2..5a72922 100644
>> --- a/build/root.json
>> +++ b/build/root.json
>> @@ -67,6 +67,7 @@
>> "gstreamer-plugins-espeak",
>> "telepathy-salut",
>> "telepathy-gabble",
>> + "mobile-broadband-provider-info",
>> "gnome-themes-standard",
>> "xorg-x11-drv-evdev",
>> "xorg-x11-drv-modesetting",
>>
>>
>>
>>
>> On Tue, Jul 23, 2013 at 12:53 PM, Daniel Narvaez <dwnarvaez at gmail.com>wrote:
>>
>> Yes!
>>
>>
>> On Tuesday, 23 July 2013, Miguel González wrote:
>>
>> It fails again [1] because does not find
>> /usr/share/mobile-broadband-provider-info/serviceproviders.xml.
>>
>> It seems this file is included in package mobile-broadband-pro
>>
>>
>
> --
> Daniel Narvaez
>
>
--
Miguel González
Activity Central: http://www.activitycentral.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20130729/7b1191b5/attachment.html>
More information about the Sugar-devel
mailing list