[CentOS] Scriptable way to edit yum .repo files?

Amos Shapira amos.shapira at gmail.com
Thu Jan 8 02:41:26 UTC 2009


2009/1/8 Filipe Brandenburger <filbranden at gmail.com>:
> On Wed, Jan 7, 2009 at 19:11, Amos Shapira <amos.shapira at gmail.com> wrote:
>> I found Perl's Conf::INI module but it expects comments beginning with
>> ";", not "#".
>
> Why don't you use Python's ConfigParser? That's what yum itself
> actually uses (AFAIK).
> http://docs.python.org/library/configparser.html
>
> With that module, you can read a file, modify the objects, and then
> write it to a new file.

That's exactly (well, 99%) what I was hoping to find. I guessed that
there are tools already around used by Yum but wouldn't know where to
start looking. I looked for a more yum-specific code.
I'll try to wrap the Python thing with something I can call from Perl.

Cheers,

--Amos



More information about the CentOS mailing list