summaryrefslogtreecommitdiff
path: root/doc/examples
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2009-04-19 17:30:57 +0200
committerJulian Andres Klode <jak@debian.org>2009-04-19 17:30:57 +0200
commitd19943ea8489e06a1f5cd0bd545e0a0aeb4b8551 (patch)
treea41904c7fbeb9065be976b5dd15661c931e644b2 /doc/examples
parenta7026989dd1ea3b70cbfc80cf92077efb2f52ba3 (diff)
downloadpython-apt-d19943ea8489e06a1f5cd0bd545e0a0aeb4b8551.tar.gz
* Update the code to use the new classes.
Diffstat (limited to 'doc/examples')
-rw-r--r--doc/examples/acquire.py26
-rw-r--r--doc/examples/action.py4
-rwxr-xr-xdoc/examples/build-deps.py8
-rw-r--r--doc/examples/cdrom.py2
-rwxr-xr-xdoc/examples/checkstate.py2
-rwxr-xr-xdoc/examples/config.py2
-rwxr-xr-xdoc/examples/configisc.py2
-rwxr-xr-xdoc/examples/deb_inspect.py2
-rw-r--r--doc/examples/depcache.py4
-rw-r--r--doc/examples/desc.py6
-rw-r--r--doc/examples/indexfile.py6
-rw-r--r--doc/examples/metaindex.py2
-rwxr-xr-xdoc/examples/print_uris.py2
-rwxr-xr-xdoc/examples/recommends.py2
-rw-r--r--doc/examples/sources.py6
-rwxr-xr-xdoc/examples/tagfile.py2
16 files changed, 39 insertions, 39 deletions
diff --git a/doc/examples/acquire.py b/doc/examples/acquire.py
index 41a38588..96426a32 100644
--- a/doc/examples/acquire.py
+++ b/doc/examples/acquire.py
@@ -4,10 +4,10 @@ import apt_pkg
import os
-def get_file(fetcher, uri, destFile):
+def get_file(fetcher, uri, destfile):
# get the file
- af = apt_pkg.GetPkgAcqFile(fetcher, uri=uri, descr="sample descr",
- destFile=destFile)
+ af = apt_pkg.AcquireFile(fetcher, uri=uri, descr="sample descr",
+ destfile=destfile)
res = fetcher.Run()
if res != fetcher.ResultContinue:
return False
@@ -19,21 +19,21 @@ apt_pkg.init()
#apt_pkg.Config.Set("Debug::pkgPackageManager","1");
#apt_pkg.Config.Set("Debug::pkgDPkgProgressReporting","1");
-cache = apt_pkg.GetCache()
-depcache = apt_pkg.GetDepCache(cache)
+cache = apt_pkg.Cache()
+depcache = apt_pkg.DepCache(cache)
-recs = apt_pkg.GetPkgRecords(cache)
-list = apt_pkg.GetPkgSourceList()
+recs = apt_pkg.PackageRecords(cache)
+list = apt_pkg.SourceList()
list.ReadMainList()
# show the amount fetch needed for a dist-upgrade
depcache.Upgrade(True)
progress = apt.progress.TextFetchProgress()
-fetcher = apt_pkg.GetAcquire(progress)
-pm = apt_pkg.GetPackageManager(depcache)
+fetcher = apt_pkg.Acquire(progress)
+pm = apt_pkg.PackageManager(depcache)
pm.GetArchives(fetcher, list, recs)
print "%s (%s)" % (apt_pkg.SizeToStr(fetcher.FetchNeeded), fetcher.FetchNeeded)
-actiongroup = apt_pkg.GetPkgActionGroup(depcache)
+actiongroup = apt_pkg.ActionGroup(depcache)
for pkg in cache.Packages:
depcache.MarkKeep(pkg)
@@ -48,9 +48,9 @@ pkg = cache["3ddesktop"]
depcache.MarkInstall(pkg)
progress = apt.progress.TextFetchProgress()
-fetcher = apt_pkg.GetAcquire(progress)
-#fetcher = apt_pkg.GetAcquire()
-pm = apt_pkg.GetPackageManager(depcache)
+fetcher = apt_pkg.Acquire(progress)
+#fetcher = apt_pkg.Acquire()
+pm = apt_pkg.PackageManager(depcache)
print pm
print fetcher
diff --git a/doc/examples/action.py b/doc/examples/action.py
index 8ee86eb7..512945df 100644
--- a/doc/examples/action.py
+++ b/doc/examples/action.py
@@ -10,7 +10,7 @@ from progress import TextFetchProgress
apt_pkg.init()
progress = OpTextProgress()
-cache = apt_pkg.GetCache(progress)
+cache = apt_pkg.Cache(progress)
print "Available packages: %s " % cache.PackageCount
print "Fetching"
@@ -25,7 +25,7 @@ print "example package iter: %s" % iter
# get depcache
print "\n\n depcache"
-depcache = apt_pkg.GetDepCache(cache, progress)
+depcache = apt_pkg.DepCache(cache, progress)
depcache.ReadPinFile()
print "got a depcache: %s " % depcache
print "Marked for install: %s " % depcache.InstCount
diff --git a/doc/examples/build-deps.py b/doc/examples/build-deps.py
index b5ac88a2..656f1361 100755
--- a/doc/examples/build-deps.py
+++ b/doc/examples/build-deps.py
@@ -21,11 +21,11 @@ def get_source_pkg(pkg, records, depcache):
# main
apt_pkg.init()
-cache = apt_pkg.GetCache()
-depcache = apt_pkg.GetDepCache(cache)
+cache = apt_pkg.Cache()
+depcache = apt_pkg.DepCache(cache)
depcache.Init()
-records = apt_pkg.GetPkgRecords(cache)
-srcrecords = apt_pkg.GetPkgSrcRecords()
+records = apt_pkg.PackageRecords(cache)
+srcrecords = apt_pkg.SourceRecords()
# base package that we use for build-depends calculation
if len(sys.argv) < 2:
diff --git a/doc/examples/cdrom.py b/doc/examples/cdrom.py
index 408bd720..78f2a8af 100644
--- a/doc/examples/cdrom.py
+++ b/doc/examples/cdrom.py
@@ -10,7 +10,7 @@ from progress import TextCdromProgress
# init
apt_pkg.init()
-cdrom = apt_pkg.GetCdrom()
+cdrom = apt_pkg.Cdrom()
print cdrom
progress = TextCdromProgress()
diff --git a/doc/examples/checkstate.py b/doc/examples/checkstate.py
index 3368d500..41040b6c 100755
--- a/doc/examples/checkstate.py
+++ b/doc/examples/checkstate.py
@@ -8,7 +8,7 @@
import apt_pkg
apt_pkg.init()
-cache = apt_pkg.GetCache()
+cache = apt_pkg.Cache()
packages = cache.Packages
uninstalled, updated, upgradable = {}, {}, {}
diff --git a/doc/examples/config.py b/doc/examples/config.py
index 9d4e51fc..0dff4cac 100755
--- a/doc/examples/config.py
+++ b/doc/examples/config.py
@@ -21,7 +21,7 @@ import posixpath
# 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.newConfiguration()
+Cnf = apt_pkg.Configuration()
print "Command line is", sys.argv
diff --git a/doc/examples/configisc.py b/doc/examples/configisc.py
index 8da1ad0a..fe3d161b 100755
--- a/doc/examples/configisc.py
+++ b/doc/examples/configisc.py
@@ -17,7 +17,7 @@ if len(ConfigFile) != 1:
print "Must have exactly 1 file name"
sys.exit(0)
-Cnf = apt_pkg.newConfiguration()
+Cnf = apt_pkg.Configuration()
apt_pkg.ReadConfigFileISC(Cnf, ConfigFile[0])
# Print the configuration space
diff --git a/doc/examples/deb_inspect.py b/doc/examples/deb_inspect.py
index cc0d04be..54c52b7b 100755
--- a/doc/examples/deb_inspect.py
+++ b/doc/examples/deb_inspect.py
@@ -25,7 +25,7 @@ if __name__ == "__main__":
print "Now extracting the control file:"
control = apt_inst.debExtractControl(open(file))
- sections = apt_pkg.ParseSection(control)
+ sections = apt_pkg.TagSection(control)
print "Maintainer is: "
print sections["Maintainer"]
diff --git a/doc/examples/depcache.py b/doc/examples/depcache.py
index de038fe8..858e45a4 100644
--- a/doc/examples/depcache.py
+++ b/doc/examples/depcache.py
@@ -9,7 +9,7 @@ from progress import TextProgress
apt_pkg.init()
progress = TextProgress()
-cache = apt_pkg.GetCache(progress)
+cache = apt_pkg.Cache(progress)
print "Available packages: %s " % cache.PackageCount
iter = cache["base-config"]
@@ -17,7 +17,7 @@ print "example package iter: %s" % iter
# get depcache
print "\n\n depcache"
-depcache = apt_pkg.GetDepCache(cache)
+depcache = apt_pkg.DepCache(cache)
depcache.ReadPinFile()
# init is needed after the creation/pin file reading
depcache.Init(progress)
diff --git a/doc/examples/desc.py b/doc/examples/desc.py
index 2febf348..d50aa0ce 100644
--- a/doc/examples/desc.py
+++ b/doc/examples/desc.py
@@ -6,8 +6,8 @@ apt_pkg.init()
apt_pkg.Config.Set("APT::Acquire::Translation", "de")
-cache = apt_pkg.GetCache()
-depcache = apt_pkg.GetDepCache(cache)
+cache = apt_pkg.Cache()
+depcache = apt_pkg.DepCache(cache)
pkg = cache["gcc"]
cand = depcache.GetCandidateVer(pkg)
@@ -18,7 +18,7 @@ print desc
print desc.FileList
(f, index) = desc.FileList.pop(0)
-records = apt_pkg.GetPkgRecords(cache)
+records = apt_pkg.PackageRecords(cache)
records.Lookup((f, index))
desc = records.LongDesc
print len(desc)
diff --git a/doc/examples/indexfile.py b/doc/examples/indexfile.py
index 2f1f27f8..cc5070aa 100644
--- a/doc/examples/indexfile.py
+++ b/doc/examples/indexfile.py
@@ -4,11 +4,11 @@ import apt_pkg
apt_pkg.init()
-sources = apt_pkg.GetPkgSourceList()
+sources = apt_pkg.SourceList()
sources.ReadMainList()
-cache = apt_pkg.GetCache()
-depcache = apt_pkg.GetDepCache(cache)
+cache = apt_pkg.Cache()
+depcache = apt_pkg.DepCache(cache)
pkg = cache["libimlib2"]
cand = depcache.GetCandidateVer(pkg)
for (f, i) in cand.FileList:
diff --git a/doc/examples/metaindex.py b/doc/examples/metaindex.py
index 816a3fd7..bbb4ac47 100644
--- a/doc/examples/metaindex.py
+++ b/doc/examples/metaindex.py
@@ -4,7 +4,7 @@ import apt_pkg
apt_pkg.init()
-sources = apt_pkg.GetPkgSourceList()
+sources = apt_pkg.SourceList()
sources.ReadMainList()
diff --git a/doc/examples/print_uris.py b/doc/examples/print_uris.py
index 3b678e83..c64a4b54 100755
--- a/doc/examples/print_uris.py
+++ b/doc/examples/print_uris.py
@@ -13,7 +13,7 @@ upgradable = filter(lambda p: p.isUpgradable, cache)
for pkg in upgradable:
pkg._lookupRecord(True)
- path = apt_pkg.ParseSection(pkg._records.Record)["Filename"]
+ path = apt_pkg.TagSection(pkg._records.Record)["Filename"]
cand = pkg._depcache.GetCandidateVer(pkg._pkg)
for (packagefile, i) in cand.FileList:
indexfile = cache._list.FindIndex(packagefile)
diff --git a/doc/examples/recommends.py b/doc/examples/recommends.py
index f0b3b1be..0ecd5882 100755
--- a/doc/examples/recommends.py
+++ b/doc/examples/recommends.py
@@ -3,7 +3,7 @@
import apt_pkg
apt_pkg.init()
-cache = apt_pkg.GetCache()
+cache = apt_pkg.Cache()
class Wanted:
diff --git a/doc/examples/sources.py b/doc/examples/sources.py
index 49652982..bc08ad69 100644
--- a/doc/examples/sources.py
+++ b/doc/examples/sources.py
@@ -4,10 +4,10 @@ import apt_pkg
apt_pkg.init()
-#cache = apt_pkg.GetCache()
-#sources = apt_pkg.GetPkgSrcRecords(cache)
+#cache = apt_pkg.Cache()
+#sources = apt_pkg.SourceRecords(cache)
-sources = apt_pkg.GetPkgSrcRecords()
+sources = apt_pkg.SourceRecords()
sources.Restart()
while sources.Lookup('hello'):
print sources.Package, sources.Version, sources.Maintainer, \
diff --git a/doc/examples/tagfile.py b/doc/examples/tagfile.py
index 4faf08ac..770e40de 100755
--- a/doc/examples/tagfile.py
+++ b/doc/examples/tagfile.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
import apt_pkg
-Parse = apt_pkg.ParseTagFile(open("/var/lib/dpkg/status", "r"))
+Parse = apt_pkg.TagFile(open("/var/lib/dpkg/status", "r"))
while Parse.Step() == 1:
print Parse.Section.get("Package")