[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Tool for generating pungi comps.xml from anaconda kickstart files

On Wed, 2007-06-06 at 14:29 -0600, Orion Poplawski wrote:
> I'd a tool that will take an anaconda kickstart file as input (along 
> with the standard released comps-f7.xml) and generate a new comps.xml 
> file with only the groups and packages specified in the kickstart file 
> present in the output comps.xml.
> I've started working on this but my python sucks (and it makes sense for 
> this to be in python since all the other distro tools are).  Is anyone 
> interested in helping with this?  I think the main thing I need is some 
> example code that uses libxml2 (or something) to read in the comps.xml, 
> make changes, and then write out a new one.
I've found the xml.dom API to be easier to use than libxml2.  Try
something like this:

import xml.dom.minidom
import xml.dom.ext

# load the file
xmlDoc = xml.dom.minidom.parse(filename)

# do stuff to xmlDoc here

# write the file back
xml.dom.ext.PrettyPrint(xmlDoc, open(filename, "w"))

Hope this helps

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]