diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2006-02-02 15:50:23 +0000 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2006-02-02 15:50:23 +0000 |
| commit | 0f3e83010710cf3493c0c9f2bab16e5f028c114c (patch) | |
| tree | cbc4290f4582fc81eb4147f75502357d4e0cb348 /DistUpgrade/DistUpgradeConfigParser.py | |
| parent | 442066f04db10be923c15455d16155358a6d5321 (diff) | |
| download | python-apt-0f3e83010710cf3493c0c9f2bab16e5f028c114c.tar.gz | |
* make the Config-File more usable
Diffstat (limited to 'DistUpgrade/DistUpgradeConfigParser.py')
| -rw-r--r-- | DistUpgrade/DistUpgradeConfigParser.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/DistUpgrade/DistUpgradeConfigParser.py b/DistUpgrade/DistUpgradeConfigParser.py new file mode 100644 index 00000000..449e67b2 --- /dev/null +++ b/DistUpgrade/DistUpgradeConfigParser.py @@ -0,0 +1,20 @@ +from ConfigParser import ConfigParser, NoOptionError + + +class DistUpgradeConfigParser(ConfigParser): + def __init__(self): + ConfigParser.__init__(self) + self.read(['DistUpgrade.cfg']) + def getlist(self, section, option): + try: + tmp = self.get(section, option) + except NoOptionError: + return [] + items = [x.strip() for x in tmp.split(",")] + return items + + +if __name__ == "__main__": + c = DistUpgradeConfigParser() + print c.getlist("Distro","MetaPkgs") + print c.getlist("Distro","ForcedPurges") |
