diff options
| author | Julian Andres Klode <jak@debian.org> | 2013-10-21 14:35:33 +0200 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2013-10-21 14:35:33 +0200 |
| commit | abc9feb18b268cbc4ddb79aabb30ce352e31b44a (patch) | |
| tree | 5f910a1634905d2b5b2246f48c18451e04785ae5 /doc/examples/config.py | |
| parent | ce50049ebd837697c947ed332a8a81bc56c75fb4 (diff) | |
| download | python-apt-abc9feb18b268cbc4ddb79aabb30ce352e31b44a.tar.gz | |
doc/examples: Start updating to new API
Diffstat (limited to 'doc/examples/config.py')
| -rwxr-xr-x | doc/examples/config.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/doc/examples/config.py b/doc/examples/config.py index 0dff4cac..c364fe16 100755 --- a/doc/examples/config.py +++ b/doc/examples/config.py @@ -26,9 +26,9 @@ Cnf = apt_pkg.Configuration() print "Command line is", sys.argv # Load the default configuration file, InitConfig() does this better.. -Cnf.Set("config-file", "/etc/apt/apt.conf") # or Cnf["config-file"] = ".." -if posixpath.exists(Cnf.FindFile("config-file")): - apt_pkg.ReadConfigFile(Cnf, "/etc/apt/apt.conf") +Cnf.set("config-file", "/etc/apt/apt.conf") # or Cnf["config-file"] = ".." +if posixpath.exists(Cnf.find_file("config-file")): + apt_pkg.read_config_file(Cnf, "/etc/apt/apt.conf") # Merge the command line arguments into the configuration space Arguments = [('h', "help", "help"), @@ -36,17 +36,17 @@ Arguments = [('h', "help", "help"), ('q', "quiet", "quiet", "IntLevel"), ('c', "config-file", "", "ConfigFile"), ('o', "option", "", "ArbItem")] -print "FileNames", apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv) +print "FileNames", apt_pkg.parse_commandline(Cnf, Arguments, sys.argv) -print "Quiet level selected is", Cnf.FindI("quiet", 0) +print "Quiet level selected is", Cnf.find_i("quiet", 0) # Do some stuff with it -if Cnf.FindB("version", 0) == 1: +if Cnf.find_b("version", 0) == 1: print "Version selected - 1.1" -if Cnf.FindB("help", 0) == 1: - print "python-apt", apt_pkg.Version, \ - "compiled on", apt_pkg.Date, apt_pkg.Time +if Cnf.find_b("help", 0) == 1: + print "python-apt", apt_pkg.VERSION, \ + "compiled on", apt_pkg.DATE, apt_pkg.TIME print "Hi, I am the help text for this program" sys.exit(0) |
