diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2009-01-13 17:49:44 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2009-01-13 17:49:44 +0100 |
| commit | 9e13c9a669959cac7ff4983f36eeede8039cb6eb (patch) | |
| tree | 3778f55d63c20956cbb7ddee790d6ef69d26e267 /doc/examples/configisc.py | |
| parent | c906abf5f25479483041636813117c48556f389b (diff) | |
| parent | 85839f4f241c99f9e4ebb0a6a8847a2d433f1160 (diff) | |
| download | python-apt-9e13c9a669959cac7ff4983f36eeede8039cb6eb.tar.gz | |
merge from the debian branch
Diffstat (limited to 'doc/examples/configisc.py')
| -rwxr-xr-x | doc/examples/configisc.py | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/doc/examples/configisc.py b/doc/examples/configisc.py index 1773a919..de8ec6be 100755 --- a/doc/examples/configisc.py +++ b/doc/examples/configisc.py @@ -8,32 +8,37 @@ # doc/examples/ftp-archive.conf # or a bind8 config file.. -import apt_pkg,sys,posixpath; +import apt_pkg +import sys +import posixpath -ConfigFile = apt_pkg.ParseCommandLine(apt_pkg.Config,[],sys.argv); +ConfigFile = apt_pkg.ParseCommandLine(apt_pkg.Config, [], sys.argv) if len(ConfigFile) != 1: - print "Must have exactly 1 file name"; - sys.exit(0); + print "Must have exactly 1 file name" + sys.exit(0) -Cnf = apt_pkg.newConfiguration(); -apt_pkg.ReadConfigFileISC(Cnf,ConfigFile[0]); +Cnf = apt_pkg.newConfiguration() +apt_pkg.ReadConfigFileISC(Cnf, ConfigFile[0]) # Print the configuration space -#print "The Configuration space looks like:"; +#print "The Configuration space looks like:" #for I in Cnf.keys(): -# print "%s \"%s\";"%(I,Cnf[I]); +# print "%s \"%s\";" % (I, Cnf[I]) # bind8 config file.. -if Cnf.has_key("Zone"): - print "Zones: ",Cnf.SubTree("zone").List(); - for I in Cnf.List("zone"): - SubCnf = Cnf.SubTree(I); - if SubCnf.Find("type") == "slave": - print "Masters for %s: %s"%(SubCnf.MyTag(),SubCnf.ValueList("masters")); +if Cnf.Exists("Zone"): + print "Zones: ", Cnf.SubTree("zone").List() + for I in Cnf.List("zone"): + SubCnf = Cnf.SubTree(I) + if SubCnf.Find("type") == "slave": + print "Masters for %s: %s" % ( + SubCnf.MyTag(), SubCnf.ValueList("masters")) else: - print "Tree definitions:"; - for I in Cnf.List("tree"): - SubCnf = Cnf.SubTree(I); - # This could use Find which would eliminate the possibility of exceptions. - print "Subtree %s with sections '%s' and architectures '%s'"%(SubCnf.MyTag(),SubCnf["Sections"],SubCnf["Architectures"]); + print "Tree definitions:" + for I in Cnf.List("tree"): + SubCnf = Cnf.SubTree(I) + # This could use Find which would eliminate the possibility of + # exceptions. + print "Subtree %s with sections '%s' and architectures '%s'" % ( + SubCnf.MyTag(), SubCnf["Sections"], SubCnf["Architectures"]) |
