~ubuntu-branches/ubuntu/vivid/python-apt/vivid-proposed

« back to all changes in this revision

Viewing changes to doc/examples/configisc.py

  • Committer: Package Import Robot
  • Author(s): Julian Andres Klode, Michael Vogt, Julian Andres Klode, Jeremy Bicha, Jakub Wilk, Daniel Hartwig
  • Date: 2013-10-21 20:53:17 UTC
  • mfrom: (2.3.36 sid)
  • Revision ID: package-import@ubuntu.com-20131021205317-n8gtc4wsnw3qmo4v
Tags: 0.9.0
[ Michael Vogt ]
* some fixes from the "coverity" scan
* merge from Ubuntu:
  - data/templates/Ubuntu.info.in: add "Saucy Salamander" to 
  - debian/control: add "Multi-Arch: allowed"

[ Julian Andres Klode ]
* Completely remove all old-API support code
* Accept bytes object for file names (Closes: #680971)
* aptsources/sourceslist.py
  - Document correct use of uniq and hide it using __all__ (Closes: #723815)
  - Correctly parse multiple options (LP: #1103200)
* python/apt_pkgmodule.cc:
  - Fix documentation of version_compare (Closes: #680891)
* python/cache.cc:
  - Set NoDelete=true when creating Policy, fixes segfault in destructor
* apt/package.py:
  - Add a Package.has_config_files property (Closes: #712749)
* tests:
  - Do not set dir::etc::sourceparts to /tmp
* apt, aptsources:
  - Only call init_config() if not already initialized (Closes: #686403)
* apt/debfile.py:
  - Pass strip_multi_arch=False to parse_depends. Patch by Michael, tests
    derived from the ones provided by the reporter.
    Closes: #717859. Closes: #717861.
* doc/source/examples/dpkg-info.py:
  - Use apt_inst.DebFile (Closes: #671784)
* doc/examples/*.py:
  - Update examples to the new API (Closes: #639022)
* tests/old/*.py:
  - Update to new API as well
* data/templates/Ubuntu.info.in:
  - Add "Trusty Thar"
* debian/control:
  - Set Standards-Version to 3.9.4

[ Jeremy Bicha ]
* data/templates/Ubuntu.info.in: add 'devel' series (Closes: #722961)

[ Jakub Wilk ]
* python-apt: formatting error in library/index.rst (Closes: #692484)

[ Daniel Hartwig ]
* apt/package.py:
  - mark_upgrade misuses FromUser to set auto-installed (Closes: #686726)

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
import apt_pkg
12
12
import sys
13
13
 
14
 
ConfigFile = apt_pkg.ParseCommandLine(apt_pkg.Config, [], sys.argv)
 
14
ConfigFile = apt_pkg.parse_commandline(apt_pkg.config, [], sys.argv)
15
15
 
16
16
if len(ConfigFile) != 1:
17
17
    print "Must have exactly 1 file name"
18
18
    sys.exit(0)
19
19
 
20
20
Cnf = apt_pkg.Configuration()
21
 
apt_pkg.ReadConfigFileISC(Cnf, ConfigFile[0])
 
21
apt_pkg.read_config_file_isc(Cnf, ConfigFile[0])
22
22
 
23
23
# Print the configuration space
24
24
#print "The Configuration space looks like:"
26
26
#   print "%s \"%s\";" % (I, Cnf[I])
27
27
 
28
28
# bind8 config file..
29
 
if Cnf.Exists("Zone"):
30
 
    print "Zones: ", Cnf.SubTree("zone").List()
31
 
    for I in Cnf.List("zone"):
32
 
        SubCnf = Cnf.SubTree(I)
33
 
        if SubCnf.Find("type") == "slave":
 
29
if "Zone" in Cnf:
 
30
    print "Zones: ", Cnf.sub_tree("zone").list()
 
31
    for I in Cnf.list("zone"):
 
32
        SubCnf = Cnf.sub_tree(I)
 
33
        if SubCnf.find("type") == "slave":
34
34
            print "Masters for %s: %s" % (
35
 
                SubCnf.MyTag(), SubCnf.ValueList("masters"))
 
35
                SubCnf.my_tag(), SubCnf.value_list("masters"))
36
36
else:
37
37
    print "Tree definitions:"
38
 
    for I in Cnf.List("tree"):
39
 
        SubCnf = Cnf.SubTree(I)
 
38
    for I in Cnf.list("tree"):
 
39
        SubCnf = Cnf.sub_tree(I)
40
40
        # This could use Find which would eliminate the possibility of
41
41
        # exceptions.
42
42
        print "Subtree %s with sections '%s' and architectures '%s'" % (
43
 
            SubCnf.MyTag(), SubCnf["Sections"], SubCnf["Architectures"])
 
43
            SubCnf.my_tag(), SubCnf["Sections"], SubCnf["Architectures"])