Re: [Server-devel] xs-activation and OS update info

2009-11-04 Thread Martin Langhoff
Hi Daniel,

Working on unrelated code, I found that the iniparse module, which we
ship on our F9 and F11 OSs, knows the ordering of the sections.

   from iniparse import INIConfig
   import os
   c = INIConfig(open(os.path.expanduser('~')+'/.sugar/default/config'))
   list(c) # gives you the sections in order

cheers,



m

On Fri, Oct 30, 2009 at 2:33 AM, Daniel Drake d...@laptop.org wrote:
 2009/10/30 Martin Langhoff martin.langh...@gmail.com:
 It is about avoiding maintaining a bespoke lib. If you say it is a
 variant on a python standard lib, do you think we can subclass it? Or
 is there a reason not to?

 Yeah it can probably be subclassed.

 It is needed up until Python 3.0, unless you know of a python ordered

 I saw a commend mentioning that something wouldn't be needed w 2.6. On
 F11 we have 2.6... but maybe I misunderstood.

 Ah yes, I forgot the specifics. odict is needed until Python 3.0, but
 Python 2.6 adds the dict_type constructor parameter for ConfigParser
 so MyConfigParser is not needed with python 2.6.

 Daniel




-- 
 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
___
Server-devel mailing list
server-de...@lists.laptop.org
http://lists.laptop.org/listinfo/server-devel


Re: [Server-devel] xs-activation and OS update info

2009-11-04 Thread Daniel Drake
2009/11/4 Martin Langhoff martin.langh...@gmail.com:
 Hi Daniel,

 Working on unrelated code, I found that the iniparse module, which we
 ship on our F9 and F11 OSs, knows the ordering of the sections.

Cool, indeed, their site makes it pretty clear that preserving order
is a feature.

Daniel
___
Server-devel mailing list
server-de...@lists.laptop.org
http://lists.laptop.org/listinfo/server-devel


Re: [Server-devel] xs-activation and OS update info

2009-10-29 Thread Daniel Drake
2009/10/27 Martin Langhoff martin.langh...@gmail.com:
 Right... makes sense. I am a bit intrigued with the custom config file
 parser / writer (that is 3x the sloc of the whole xs-activation ;-) ).

It's not really a custom config file parser. It's a trivial change to
Python's own ConfigParser class. The only change is in the constructor
IIRC, which now lets you use a custom dictionary type.

 I am guessing the key motivator is that YAML, JSON and other config
 formats won't preserve ordering correctly, right?

I didn't feel that JSON is appropriate for a config file, especially
so in oatslite (which allows more per-OS configuration). I don't know
anything about YAML.

  - is MyConfigParser used anywhere else?

I don't understand this question. My patch only adds it for
xs-activation purposes.

  - odict is only needed on F9, correct?

It is needed up until Python 3.0, unless you know of a python ordered
dictionary class which is shipped with your distro-of-choice. (I don't
know of any, meaning that it will still be needed even with F12)

It's a bit ugly with these 2 classes but at least their importance is
trivial to explain and they can sit independently, and we have a path
for getting rid of them (Python 3.0).

 What is needed in terms of config parsing is pretty simple -- I
 suspect there are a couple of simple ways we could avoid depending on
 the ordering of the config file, with less code.

Alternative implementations/suggestions welcome :)
In my opinion the ordering is the main purpose of having to use a
config file here.

Daniel
___
Server-devel mailing list
Server-devel@lists.laptop.org
http://lists.laptop.org/listinfo/server-devel


Re: [Server-devel] xs-activation and OS update info

2009-10-29 Thread Martin Langhoff
On Thu, Oct 29, 2009 at 5:09 PM, Daniel Drake d...@laptop.org wrote:
 I don't understand this question. My patch only adds it for
 xs-activation purposes.

It is about avoiding maintaining a bespoke lib. If you say it is a
variant on a python standard lib, do you think we can subclass it? Or
is there a reason not to?

 It is needed up until Python 3.0, unless you know of a python ordered

I saw a commend mentioning that something wouldn't be needed w 2.6. On
F11 we have 2.6... but maybe I misunderstood.

 Alternative implementations/suggestions welcome :)

hmmm. I'll see...



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
___
Server-devel mailing list
Server-devel@lists.laptop.org
http://lists.laptop.org/listinfo/server-devel


Re: [Server-devel] xs-activation and OS update info

2009-10-29 Thread Daniel Drake
2009/10/30 Martin Langhoff martin.langh...@gmail.com:
 It is about avoiding maintaining a bespoke lib. If you say it is a
 variant on a python standard lib, do you think we can subclass it? Or
 is there a reason not to?

Yeah it can probably be subclassed.

 It is needed up until Python 3.0, unless you know of a python ordered

 I saw a commend mentioning that something wouldn't be needed w 2.6. On
 F11 we have 2.6... but maybe I misunderstood.

Ah yes, I forgot the specifics. odict is needed until Python 3.0, but
Python 2.6 adds the dict_type constructor parameter for ConfigParser
so MyConfigParser is not needed with python 2.6.

Daniel
___
Server-devel mailing list
Server-devel@lists.laptop.org
http://lists.laptop.org/listinfo/server-devel


Re: [Server-devel] xs-activation and OS update info

2009-10-27 Thread Martin Langhoff
On Sun, Oct 25, 2009 at 7:09 AM, Daniel Drake d...@laptop.org wrote:
 Here's a patch that makes xs-activation server OS update information
 based on what it has available in xs-rsync.

I like it -- thanks! It was in my TO DO notes with the earlier
xs-activation work, and ended up cutting it.

 I did this by creating
 /etc/xs-activation-updates.cfg, a sample configuration file with
 explanation is attached. This is code from oatslite which is deployed
 in paraguay.

Right... makes sense. I am a bit intrigued with the custom config file
parser / writer (that is 3x the sloc of the whole xs-activation ;-) ).

I am guessing the key motivator is that YAML, JSON and other config
formats won't preserve ordering correctly, right?

 - is MyConfigParser used anywhere else?
 - odict is only needed on F9, correct?

What is needed in terms of config parsing is pretty simple -- I
suspect there are a couple of simple ways we could avoid depending on
the ordering of the config file, with less code.

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
___
Server-devel mailing list
server-de...@lists.laptop.org
http://lists.laptop.org/listinfo/server-devel