diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2006-04-27 18:24:02 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2006-04-27 18:24:02 +0200 |
| commit | 158add49781967e83b951816a81fe70517643d1c (patch) | |
| tree | 8064c7017653427b53b92d6777d3508aab72774a /DistUpgrade/DistUpgradeConfigParser.py | |
| parent | caca5e2d382ef3a0e5d00dc888f0448620372ee0 (diff) | |
| download | python-apt-158add49781967e83b951816a81fe70517643d1c.tar.gz | |
* DistUpgrade/mirrors.txt: added (based on https://wiki.ubuntu.com/Archive)
* DistUpgrade/DistUpgradeConfigParser.py: added getListFromFile
* DistUpgrade/DistUpgradeControler.py: use the more complete mirror list
Diffstat (limited to 'DistUpgrade/DistUpgradeConfigParser.py')
| -rw-r--r-- | DistUpgrade/DistUpgradeConfigParser.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/DistUpgrade/DistUpgradeConfigParser.py b/DistUpgrade/DistUpgradeConfigParser.py index c87e2f1b..a4c55080 100644 --- a/DistUpgrade/DistUpgradeConfigParser.py +++ b/DistUpgrade/DistUpgradeConfigParser.py @@ -12,9 +12,17 @@ class DistUpgradeConfig(ConfigParser): return [] items = [x.strip() for x in tmp.split(",")] return items + def getListFromFile(self, section, option): + try: + filename = self.get(section, option) + except NoOptionError: + return [] + items = [x.strip() for x in open(filename)] + return filter(lambda s: not s.startswith("#") and not s == "", items) if __name__ == "__main__": - c = DistUpgradeConfigParser() + c = DistUpgradeConfig() print c.getlist("Distro","MetaPkgs") print c.getlist("Distro","ForcedPurges") + print c.getListFromFile("Sources","ValidMirrors") |
