installing a package with xml based configuration in python

Posted by saminny on Stack Overflow See other posts from Stack Overflow or by saminny
Published on 2010-05-15T19:26:12Z Indexed on 2010/05/15 19:34 UTC
Read the original article Hit count: 160

Filed under:
|

Hi, I am planning to write a generic python module for installing a package. This script should retrieve the module from a remote machine or locally and install it on a given host and user. However, there needs to be changes made to the package files based on the host, user and given environment.

My approach is to use XML to describe changes to be made to package files based on environment. It will first extract the package to the user directory and then using an xml configuration file, it should replace the file values in the package directory. The xml would look something like this:

<package version="1.3.3">
    <environment type="prod">
        <file dir="d1/d2" name="f1">
            <var id="RECV_HOST" value="santo">  
            <var id="RECV_PORT" value="RECV_PORT_SERVICE" type="service">
            <var id="JEPL_SERVICE_NAME" value="val_omgact">
        </file>
            <var dir="d4/d3/s2" name="f2">
            <var id="PRECISION" value="true">   
            <var id="SEND_STATUS_CODE" value="323">
            <var id="JEPL_SERVICE_NAME" value="val_omgact">
        </file>
    </environment>
    <environment type="qa">
            <file dir="d1/d2" name="f1">
        <var id="RECV_HOST" value="test">   
        <var id="RECV_PORT" value="1444">
        <var id="JEPL_SERVICE_NAME" value="val_tsdd">
    </file>
    <file dir="d4/d3/s2" name="f2">
        <var id="PRECISION" value="false">  
        <var id="SEND_STATUS_CODE" value="323">
        <var id="JEPL_SERVICE_NAME" value="val_dsd">
            </file>
    </environment>
</package>

What are your thoughts on this approach? Is there an existing python module, package or script that I could use for this purpose since this seems fairly generic and can be used for any installation.

Thanks!

Sam

© Stack Overflow or respective owner

Related posts about python

Related posts about package