diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2015-07-05 22:06:22 +0300 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2015-07-05 22:06:22 +0300 |
commit | 622812485150fa7864910ee2f710d5aab2fa9e6d (patch) | |
tree | b3bc4fd72bb80e74ba5a60d8b3d47e610dff012e /doc/examples/config.py | |
parent | 798846ab8337471998b0a4d796d6d409453faa7d (diff) | |
parent | fdd173dd444098ed533cbcd541a7f10f228bc47e (diff) | |
download | python-apt-622812485150fa7864910ee2f710d5aab2fa9e6d.tar.gz |
Merge git://anonscm.debian.org/apt/python-apt
Conflicts:
debian/changelog
python/apt_pkgmodule.cc
Diffstat (limited to 'doc/examples/config.py')
-rwxr-xr-x | doc/examples/config.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/doc/examples/config.py b/doc/examples/config.py index 0dff4cac..c3330a5b 100755 --- a/doc/examples/config.py +++ b/doc/examples/config.py @@ -18,17 +18,17 @@ import sys import posixpath # Create a new empty Configuration object - there is also the system global -# configuration object apt_pkg.Config which is used interally by apt-pkg +# configuration object apt_pkg.config which is used interally by apt-pkg # routines to control unusual situations. I recommend using the sytem global # whenever possible.. 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") +# Load the default configuration file, init_config() does this better.. +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) |