summaryrefslogtreecommitdiff
path: root/doc/source/examples
diff options
context:
space:
mode:
Diffstat (limited to 'doc/source/examples')
-rw-r--r--doc/source/examples/cache-packages.py16
-rw-r--r--doc/source/examples/cache-pkgfile.py14
-rw-r--r--doc/source/examples/dpkg-contents.py4
-rw-r--r--doc/source/examples/dpkg-extract.py2
-rw-r--r--doc/source/examples/dpkg-info.py4
-rw-r--r--doc/source/examples/missing-deps.py30
6 files changed, 35 insertions, 35 deletions
diff --git a/doc/source/examples/cache-packages.py b/doc/source/examples/cache-packages.py
index 0af96f7d..72534303 100644
--- a/doc/source/examples/cache-packages.py
+++ b/doc/source/examples/cache-packages.py
@@ -6,17 +6,17 @@ import apt_pkg
def main():
"""Main."""
- apt_pkg.InitConfig()
- apt_pkg.InitSystem()
+ apt_pkg.init_config()
+ apt_pkg.init_system()
cache = apt_pkg.Cache()
print "Essential packages:"
- for pkg in cache.Packages:
- if pkg.Essential:
- print " ", pkg.Name
+ for pkg in cache.packages:
+ if pkg.essential:
+ print " ", pkg.name
print "Important packages:"
- for pkg in cache.Packages:
- if pkg.Important:
- print " ", pkg.Name
+ for pkg in cache.packages:
+ if pkg.important:
+ print " ", pkg.name
if __name__ == "__main__":
main()
diff --git a/doc/source/examples/cache-pkgfile.py b/doc/source/examples/cache-pkgfile.py
index a7c22c97..1300a55c 100644
--- a/doc/source/examples/cache-pkgfile.py
+++ b/doc/source/examples/cache-pkgfile.py
@@ -6,19 +6,19 @@ def main():
"""Example for PackageFile()"""
apt_pkg.init()
cache = apt_pkg.Cache()
- for pkgfile in cache.FileList:
- print 'Package-File:', pkgfile.FileName
- print 'Index-Type:', pkgfile.IndexType # 'Debian Package Index'
- if pkgfile.NotSource:
+ for pkgfile in cache.file_list:
+ print 'Package-File:', pkgfile.file_name
+ print 'Index-Type:', pkgfile.index_type # 'Debian Package Index'
+ if pkgfile.not_source:
print 'Source: None'
else:
- if pkgfile.Site:
+ if pkgfile.site:
# There is a source, and a site, print the site
- print 'Source:', pkgfile.Site
+ print 'Source:', pkgfile.site
else:
# It seems to be a local repository
print 'Source: Local package file'
- if pkgfile.NotAutomatic:
+ if pkgfile.not_automatic:
# The system won't be updated automatically (eg. experimental)
print 'Automatic: No'
else:
diff --git a/doc/source/examples/dpkg-contents.py b/doc/source/examples/dpkg-contents.py
index 99d1596f..24d7ce98 100644
--- a/doc/source/examples/dpkg-contents.py
+++ b/doc/source/examples/dpkg-contents.py
@@ -28,7 +28,7 @@ def format_mode(what, mode):
def callback(what, name, link, mode, uid, gid, size, mtime, major, minor):
- """callback for debExtract"""
+ """callback for deb_extract"""
s_mode = format_mode(what, mode)
s_owner = "%s/%s" % (pwd.getpwuid(uid)[0], grp.getgrgid(gid)[0])
s_size = "%9d" % size
@@ -47,7 +47,7 @@ def main():
fobj = open(sys.argv[1])
try:
- apt_inst.debExtract(fobj, callback, "data.tar.gz")
+ apt_inst.deb_extract(fobj, callback, "data.tar.gz")
finally:
fobj.close()
diff --git a/doc/source/examples/dpkg-extract.py b/doc/source/examples/dpkg-extract.py
index ced8652f..8d144029 100644
--- a/doc/source/examples/dpkg-extract.py
+++ b/doc/source/examples/dpkg-extract.py
@@ -17,7 +17,7 @@ def main():
fobj = open(sys.argv[1])
try:
- apt_inst.debExtractArchive(fobj, sys.argv[2])
+ apt_inst.deb_extract_archive(fobj, sys.argv[2])
finally:
fobj.close()
diff --git a/doc/source/examples/dpkg-info.py b/doc/source/examples/dpkg-info.py
index ff98d8b1..6be8595c 100644
--- a/doc/source/examples/dpkg-info.py
+++ b/doc/source/examples/dpkg-info.py
@@ -2,7 +2,7 @@
"""Emulate dpkg --info package.deb control-file"""
import sys
-from apt_inst import debExtractControl
+from apt_inst import deb_extract_control
def main():
@@ -12,7 +12,7 @@ def main():
sys.exit(0)
fobj = open(sys.argv[1])
try:
- print debExtractControl(fobj, sys.argv[2])
+ print deb_extract_control(fobj, sys.argv[2])
finally:
fobj.close()
diff --git a/doc/source/examples/missing-deps.py b/doc/source/examples/missing-deps.py
index dd5eeb8a..7af18128 100644
--- a/doc/source/examples/missing-deps.py
+++ b/doc/source/examples/missing-deps.py
@@ -5,9 +5,9 @@ import apt_pkg
def fmt_dep(dep):
"""Format a Dependency object [of apt_pkg] as a string."""
- ret = dep.TargetPkg.Name
- if dep.TargetVer:
- ret += " (%s %s)" % (dep.CompType, dep.TargetVer)
+ ret = dep.target_pkg.name
+ if dep.target_ver:
+ ret += " (%s %s)" % (dep.comp_type, dep.target_ver)
return ret
@@ -15,15 +15,15 @@ def check_version(pkgver):
"""Check the version of the package"""
missing = []
- for or_group in pkgver.DependsList.get("Pre-Depends", []) + \
- pkgver.DependsList.get("Depends", []):
- if not any(dep.AllTargets() for dep in or_group):
+ for or_group in pkgver.depends_list.get("Pre-Depends", []) + \
+ pkgver.depends_list.get("Depends", []):
+ if not any(dep.all_targets() for dep in or_group):
# If none of the or-choices can be satisfied, add it to missing
missing.append(or_group)
if missing:
- print "Package:", pkgver.ParentPkg.Name
- print "Version:", pkgver.VerStr
+ print "Package:", pkgver.parent_pkg.name
+ print "Version:", pkgver.ver_str
print "Missing:",
print ", ".join(" | ".join(fmt_dep(dep) for dep in or_group)
for or_group in missing)
@@ -32,18 +32,18 @@ def check_version(pkgver):
def main():
"""The main function."""
- apt_pkg.InitConfig()
- apt_pkg.InitSystem()
+ apt_pkg.init_config()
+ apt_pkg.init_system()
cache = apt_pkg.Cache()
- for pkg in sorted(cache.Packages, key=lambda pkg: pkg.Name):
+ for pkg in sorted(cache.packages, key=lambda pkg: pkg.name):
# pkg is from a list of packages, sorted by name.
- for version in pkg.VersionList:
+ for version in pkg.version_list:
# Check every version
- for pfile, _ in version.FileList:
- if (pfile.Origin == "Debian" and pfile.Component == "main" and
- pfile.Archive == "unstable"):
+ for pfile, _ in version.file_list:
+ if (pfile.origin == "Debian" and pfile.component == "main" and
+ pfile.archive == "unstable"):
# We only want packages from Debian unstable main.
check_version(version)
break