diff options
Diffstat (limited to 'doc')
42 files changed, 725 insertions, 853 deletions
diff --git a/doc/examples/acquire.py b/doc/examples/acquire.py index 96426a32..942d0686 100644 --- a/doc/examples/acquire.py +++ b/doc/examples/acquire.py @@ -1,5 +1,6 @@ #!/usr/bin/python import apt +import apt.progress.text import apt_pkg import os @@ -8,46 +9,48 @@ def get_file(fetcher, uri, destfile): # get the file af = apt_pkg.AcquireFile(fetcher, uri=uri, descr="sample descr", destfile=destfile) - res = fetcher.Run() - if res != fetcher.ResultContinue: + print "desc_uri: %s -> %s" % (af.desc_uri, af.destfile) + res = fetcher.run() + if res != fetcher.RESULT_CONTINUE: return False return True apt_pkg.init() -#apt_pkg.Config.Set("Debug::pkgDPkgPM","1"); -#apt_pkg.Config.Set("Debug::pkgPackageManager","1"); -#apt_pkg.Config.Set("Debug::pkgDPkgProgressReporting","1"); +#apt_pkg.config.set("Debug::pkgDPkgPM","1"); +#apt_pkg.config.set("Debug::pkgPackageManager","1"); +#apt_pkg.config.set("Debug::pkgDPkgProgressReporting","1"); cache = apt_pkg.Cache() depcache = apt_pkg.DepCache(cache) recs = apt_pkg.PackageRecords(cache) list = apt_pkg.SourceList() -list.ReadMainList() +list.read_main_list() # show the amount fetch needed for a dist-upgrade -depcache.Upgrade(True) -progress = apt.progress.TextFetchProgress() +depcache.upgrade(True) +progress = apt.progress.text.AcquireProgress() 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) +pm.get_archives(fetcher, list, recs) +print "%s (%s)" % ( + apt_pkg.size_to_str(fetcher.fetch_needed), fetcher.fetch_needed) actiongroup = apt_pkg.ActionGroup(depcache) -for pkg in cache.Packages: - depcache.MarkKeep(pkg) +for pkg in cache.packages: + depcache.mark_keep(pkg) try: os.mkdir("/tmp/pyapt-test") os.mkdir("/tmp/pyapt-test/partial") except OSError: pass -apt_pkg.Config.Set("Dir::Cache::archives", "/tmp/pyapt-test") +apt_pkg.config.set("Dir::Cache::archives", "/tmp/pyapt-test") -pkg = cache["3ddesktop"] -depcache.MarkInstall(pkg) +pkg = cache["2vcard"] +depcache.mark_install(pkg) -progress = apt.progress.TextFetchProgress() +progress = apt.progress.text.AcquireProgress() fetcher = apt_pkg.Acquire(progress) #fetcher = apt_pkg.Acquire() pm = apt_pkg.PackageManager(depcache) @@ -57,20 +60,20 @@ print fetcher get_file(fetcher, "ftp://ftp.debian.org/debian/dists/README", "/tmp/lala") -pm.GetArchives(fetcher, list, recs) +pm.get_archives(fetcher, list, recs) -for item in fetcher.Items: +for item in fetcher.items: print item - if item.Status == item.StatError: - print "Some error ocured: '%s'" % item.ErrorText - if item.Complete == False: - print "No error, still nothing downloaded (%s)" % item.ErrorText + if item.status == item.STAT_ERROR: + print "Some error ocured: '%s'" % item.error_text + if not item.complete: + print "No error, still nothing downloaded (%s)" % item.error_text print -res = fetcher.Run() +res = fetcher.run() print "fetcher.Run() returned: %s" % res print "now runing pm.DoInstall()" -res = pm.DoInstall(1) -print "pm.DoInstall() returned: %s"% res +res = pm.do_install(1) +print "pm.DoInstall() returned: %s" % res diff --git a/doc/examples/action.py b/doc/examples/action.py index 512945df..b395adc6 100644 --- a/doc/examples/action.py +++ b/doc/examples/action.py @@ -1,110 +1,112 @@ #!/usr/bin/python -# example how to deal with the depcache +# +# LOW LEVEL example how to deal with the depcache +# +# you probably do not want to use this low level code and use +# the high level "apt" interface instead that can do all this +# but with a nicer API import apt_pkg -import sys -from apt.progress import OpTextProgress +from apt.progress.text import OpProgress from progress import TextFetchProgress # init apt_pkg.init() -progress = OpTextProgress() +progress = OpProgress() cache = apt_pkg.Cache(progress) -print "Available packages: %s " % cache.PackageCount +print("Available packages: %s " % cache.package_count) -print "Fetching" +print("Fetching") progress = TextFetchProgress() -cache.Update(progress) - -print "Exiting" -sys.exit(0) +source = apt_pkg.SourceList() +cache.update(progress, source) iter = cache["base-config"] -print "example package iter: %s" % iter +print("example package iter: %s" % iter) # get depcache -print "\n\n depcache" -depcache = apt_pkg.DepCache(cache, progress) -depcache.ReadPinFile() -print "got a depcache: %s " % depcache -print "Marked for install: %s " % depcache.InstCount +print("\n\n depcache") +depcache = apt_pkg.DepCache(cache) +depcache.read_pinfile() +print("got a depcache: %s " % depcache) +print("Marked for install: %s " % depcache.inst_count) -print "\n\n Reinit" -depcache.Init(progress) +print("\n\n Reinit") +depcache.init(progress) #sys.exit() # get a canidate version -ver= depcache.GetCandidateVer(iter) -print "Candidate version: %s " % ver - -print "\n\nQuerry interface" -print "%s.IsUpgradable(): %s" % (iter.Name, depcache.IsUpgradable(iter)) - -print "\nMarking interface" -print "Marking '%s' for install" % iter.Name -depcache.MarkInstall(iter) -print "Install count: %s " % depcache.InstCount -print "%s.MarkedInstall(): %s" % (iter.Name, depcache.MarkedInstall(iter)) -print "%s.MarkedUpgrade(): %s" % (iter.Name, depcache.MarkedUpgrade(iter)) -print "%s.MarkedDelete(): %s" % (iter.Name, depcache.MarkedDelete(iter)) - -print "Marking %s for delete" % iter.Name -depcache.MarkDelete(iter) -print "DelCount: %s " % depcache.DelCount -print "%s.MarkedDelete(): %s" % (iter.Name, depcache.MarkedDelete(iter)) - -iter = cache["3dchess"] -print "\nMarking '%s' for install" % iter.Name -depcache.MarkInstall(iter) -print "Install count: %s " % depcache.InstCount -print "%s.MarkedInstall(): %s" % (iter.Name, depcache.MarkedInstall(iter)) -print "%s.MarkedUpgrade(): %s" % (iter.Name, depcache.MarkedUpgrade(iter)) -print "%s.MarkedDelete(): %s" % (iter.Name, depcache.MarkedDelete(iter)) - -print "Marking %s for keep" % iter.Name -depcache.MarkKeep(iter) -print "Install: %s " % depcache.InstCount - -iter = cache["3dwm-server"] -print "\nMarking '%s' for install" % iter.Name -depcache.MarkInstall(iter) -print "Install: %s " % depcache.InstCount -print "Broken count: %s" % depcache.BrokenCount -print "FixBroken() " -depcache.FixBroken() -print "Broken count: %s" % depcache.BrokenCount - -print "\nPerforming Upgrade" -depcache.Upgrade() -print "Keep: %s " % depcache.KeepCount -print "Install: %s " % depcache.InstCount -print "Delete: %s " % depcache.DelCount -print "UsrSize: %s " % apt_pkg.SizeToStr(depcache.UsrSize) -print "DebSize: %s " % apt_pkg.SizeToStr(depcache.DebSize) - -for pkg in cache.Packages: - if pkg.CurrentVer is not None and not depcache.MarkedInstall(pkg) \ - and depcache.IsUpgradable(pkg): - print "Upgrade didn't upgrade (kept): %s" % pkg.Name - -print "\nPerforming DistUpgrade" -depcache.Upgrade(True) -print "Keep: %s " % depcache.KeepCount -print "Install: %s " % depcache.InstCount -print "Delete: %s " % depcache.DelCount -print "UsrSize: %s " % apt_pkg.SizeToStr(depcache.UsrSize) -print "DebSize: %s " % apt_pkg.SizeToStr(depcache.DebSize) +ver = depcache.get_candidate_ver(iter) +print("Candidate version: %s " % ver) + +print("\n\nQuerry interface") +print("%s.is_upgradable(): %s" % (iter.name, depcache.is_upgradable(iter))) + +print("\nMarking interface") +print("Marking '%s' for install" % iter.name) +depcache.mark_install(iter) +print("Install count: %s " % depcache.inst_count) +print("%s.marked_install(): %s" % (iter.name, depcache.marked_install(iter))) +print("%s.marked_upgrade(): %s" % (iter.name, depcache.marked_upgrade(iter))) +print("%s.marked_delete(): %s" % (iter.name, depcache.marked_delete(iter))) + +print("Marking %s for delete" % iter.name) +depcache.mark_delete(iter) +print("del_count: %s " % depcache.del_count) +print("%s.marked_delete(): %s" % (iter.name, depcache.marked_delete(iter))) + +iter = cache["apt"] +print("\nMarking '%s' for install" % iter.name) +depcache.mark_install(iter) +print("Install count: %s " % depcache.inst_count) +print("%s.marked_install(): %s" % (iter.name, depcache.marked_install(iter))) +print("%s.marked_upgrade(): %s" % (iter.name, depcache.marked_upgrade(iter))) +print("%s.marked_delete(): %s" % (iter.name, depcache.marked_delete(iter))) + +print("Marking %s for keep" % iter.name) +depcache.mark_keep(iter) +print("Install: %s " % depcache.inst_count) + +iter = cache["python-apt"] +print("\nMarking '%s' for install" % iter.name) +depcache.mark_install(iter) +print("Install: %s " % depcache.inst_count) +print("Broken count: %s" % depcache.broken_count) +print("fix_broken() ") +depcache.fix_broken() +print("Broken count: %s" % depcache.broken_count) + +print("\nPerforming upgrade") +depcache.upgrade() +print("Keep: %s " % depcache.keep_count) +print("Install: %s " % depcache.inst_count) +print("Delete: %s " % depcache.del_count) +print("usr_size: %s " % apt_pkg.size_to_str(depcache.usr_size)) +print("deb_size: %s " % apt_pkg.size_to_str(depcache.deb_size)) + +for pkg in cache.packages: + if pkg.current_ver is not None and not depcache.marked_install(pkg) \ + and depcache.is_upgradable(pkg): + print("upgrade didn't upgrade (kept): %s" % pkg.name) + +print("\nPerforming Distupgrade") +depcache.upgrade(True) +print("Keep: %s " % depcache.keep_count) +print("Install: %s " % depcache.inst_count) +print("Delete: %s " % depcache.del_count) +print("usr_size: %s " % apt_pkg.size_to_str(depcache.usr_size)) +print("deb_size: %s " % apt_pkg.size_to_str(depcache.deb_size)) # overview about what would happen -for pkg in cache.Packages: - if depcache.MarkedInstall(pkg): - if pkg.CurrentVer is not None: - print "Marked upgrade: %s " % pkg.Name +for pkg in cache.packages: + if depcache.marked_install(pkg): + if pkg.current_ver is not None: + print("Marked upgrade: %s " % pkg.name) else: - print "Marked install: %s" % pkg.Name - elif depcache.MarkedDelete(pkg): - print "Marked delete: %s" % pkg.Name - elif depcache.MarkedKeep(pkg): - print "Marked keep: %s" % pkg.Name + print("Marked install: %s" % pkg.name) + elif depcache.marked_delete(pkg): + print("Marked delete: %s" % pkg.name) + elif depcache.marked_keep(pkg): + print("Marked keep: %s" % pkg.name) diff --git a/doc/examples/all_deps.py b/doc/examples/all_deps.py index 992e98d8..6ce264bb 100644 --- a/doc/examples/all_deps.py +++ b/doc/examples/all_deps.py @@ -6,19 +6,19 @@ import apt def dependencies(cache, pkg, deps, key="Depends"): #print "pkg: %s (%s)" % (pkg.name, deps) - candver = cache._depcache.GetCandidateVer(pkg._pkg) + candver = cache._depcache.get_candidate_ver(pkg._pkg) if candver is None: return deps - dependslist = candver.DependsList + dependslist = candver.depends_list if key in dependslist: for depVerList in dependslist[key]: for dep in depVerList: - if dep.TargetPkg.Name in cache: - if pkg.name != dep.TargetPkg.Name and \ - not dep.TargetPkg.Name in deps: - deps.add(dep.TargetPkg.Name) + if dep.target_pkg.name in cache: + if (pkg.name != dep.target_pkg.name and + dep.target_pkg.name not in deps): + deps.add(dep.target_pkg.name) dependencies( - cache, cache[dep.TargetPkg.Name], deps, key) + cache, cache[dep.target_pkg.name], deps, key) return deps diff --git a/doc/examples/architecture.py b/doc/examples/architecture.py index 75afb2d1..421c79a7 100644 --- a/doc/examples/architecture.py +++ b/doc/examples/architecture.py @@ -6,7 +6,7 @@ def main(): print "Native architecture:", apt_pkg.config["APT::Architecture"] print "All architectures:", apt_pkg.config.value_list("APT::Architectures") - + if __name__ == '__main__': main() diff --git a/doc/examples/build-deps-old.py b/doc/examples/build-deps-old.py index 656f1361..4e7e4350 100755 --- a/doc/examples/build-deps-old.py +++ b/doc/examples/build-deps-old.py @@ -7,15 +7,15 @@ import sys def get_source_pkg(pkg, records, depcache): """ get the source package name of a given package """ - version = depcache.GetCandidateVer(pkg) + version = depcache.get_candidate_ver(pkg) if not version: return None - file, index = version.FileList.pop(0) - records.Lookup((file, index)) - if records.SourcePkg != "": - srcpkg = records.SourcePkg + file, index = version.file_list.pop(0) + records.lookup((file, index)) + if records.source_pkg != "": + srcpkg = records.source_pkg else: - srcpkg = pkg.Name + srcpkg = pkg.name return srcpkg @@ -23,7 +23,7 @@ def get_source_pkg(pkg, records, depcache): apt_pkg.init() cache = apt_pkg.Cache() depcache = apt_pkg.DepCache(cache) -depcache.Init() +depcache.init() records = apt_pkg.PackageRecords(cache) srcrecords = apt_pkg.SourceRecords() @@ -42,29 +42,29 @@ all_build_depends = set() srcpkg_name = get_source_pkg(base, records, depcache) print "srcpkg_name: %s " % srcpkg_name if not srcpkg_name: - print "Can't find source package for '%s'" % pkg.Name -srcrec = srcrecords.Lookup(srcpkg_name) + print "Can't find source package for '%s'" % pkg.mame +srcrec = srcrecords.lookup(srcpkg_name) if srcrec: print "Files:" - print srcrecords.Files - bd = srcrecords.BuildDepends + print srcrecords.files + bd = srcrecords.build_depends print "build-depends of the package: %s " % bd for b in bd: all_build_depends.add(b[0]) # calculate the build depends for all dependencies -depends = depcache.GetCandidateVer(base).DependsList -for dep in depends["Depends"]: # FIXME: do we need to consider PreDepends? - pkg = dep[0].TargetPkg +depends = depcache.get_candidate_ver(base).depends_list +for dep in depends["Depends"]: # FIXME: do we need to consider PreDepends? + pkg = dep[0].target_pkg srcpkg_name = get_source_pkg(pkg, records, depcache) if not srcpkg_name: - print "Can't find source package for '%s'" % pkg.Name + print "Can't find source package for '%s'" % pkg.name continue - srcrec = srcrecords.Lookup(srcpkg_name) + srcrec = srcrecords.lookup(srcpkg_name) if srcrec: - #print srcrecords.Package - #print srcrecords.Binaries - bd = srcrecords.BuildDepends + #print srcrecords.package + #print srcrecords.binaries + bd = srcrecords.build_depends #print "%s: %s " % (srcpkg_name, bd) for b in bd: all_build_depends.add(b[0]) diff --git a/doc/examples/build-deps.py b/doc/examples/build-deps.py index 5d243943..e618e414 100755 --- a/doc/examples/build-deps.py +++ b/doc/examples/build-deps.py @@ -24,12 +24,12 @@ all_build_depends = set() srcpkg_name = base.candidate.source_name print "srcpkg_name: %s " % srcpkg_name if not srcpkg_name: - print "Can't find source package for '%s'" % pkg.Name -srcrec = srcrecords.Lookup(srcpkg_name) + print "Can't find source package for '%s'" % pkg.name +srcrec = srcrecords.lookup(srcpkg_name) if srcrec: print "Files:" - print srcrecords.Files - bd = srcrecords.BuildDepends + print srcrecords.files + bd = srcrecords.build_depends print "build-depends of the package: %s " % bd for b in bd: all_build_depends.add(b[0]) @@ -41,13 +41,13 @@ for or_dep in depends: pkg = cache[dep.name] srcpkg_name = pkg.candidate.source_name if not srcpkg_name: - print "Can't find source package for '%s'" % pkg.Name + print "Can't find source package for '%s'" % pkg.name continue - srcrec = srcrecords.Lookup(srcpkg_name) + srcrec = srcrecords.lookup(srcpkg_name) if srcrec: - #print srcrecords.Package - #print srcrecords.Binaries - bd = srcrecords.BuildDepends + #print srcrecords.package + #print srcrecords.binaries + bd = srcrecords.build_depends #print "%s: %s " % (srcpkg_name, bd) for b in bd: all_build_depends.add(b[0]) diff --git a/doc/examples/cdrom.py b/doc/examples/cdrom.py index 78f2a8af..2fbc8f34 100644 --- a/doc/examples/cdrom.py +++ b/doc/examples/cdrom.py @@ -15,11 +15,11 @@ print cdrom progress = TextCdromProgress() -(res, ident) = cdrom.Ident(progress) +(res, ident) = cdrom.ident(progress) print "ident result is: %s (%s) " % (res, ident) -apt_pkg.Config.Set("APT::CDROM::Rename", "True") -cdrom.Add(progress) +apt_pkg.config["APT::CDROM::Rename"] = "True" +cdrom.add(progress) print "Exiting" sys.exit(0) diff --git a/doc/examples/checkstate.py b/doc/examples/checkstate.py index 41040b6c..084fdb87 100755 --- a/doc/examples/checkstate.py +++ b/doc/examples/checkstate.py @@ -9,27 +9,27 @@ import apt_pkg apt_pkg.init() cache = apt_pkg.Cache() -packages = cache.Packages +packages = cache.packages uninstalled, updated, upgradable = {}, {}, {} for package in packages: - versions = package.VersionList + versions = package.version_list if not versions: continue version = versions[0] for other_version in versions: - if apt_pkg.VersionCompare(version.VerStr, other_version.VerStr)<0: + if apt_pkg.version_compare(version.ver_str, other_version.ver_str) < 0: version = other_version - if package.CurrentVer: - current = package.CurrentVer - if apt_pkg.VersionCompare(current.VerStr, version.VerStr)<0: - upgradable[package.Name] = version + if package.current_ver: + current = package.current_ver + if apt_pkg.version_compare(current.ver_str, version.ver_str) < 0: + upgradable[package.name] = version break else: - updated[package.Name] = current + updated[package.name] = current else: - uninstalled[package.Name] = version + uninstalled[package.name] = version for l in (uninstalled, updated, upgradable): 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) diff --git a/doc/examples/configisc.py b/doc/examples/configisc.py index fe3d161b..d9355d49 100755 --- a/doc/examples/configisc.py +++ b/doc/examples/configisc.py @@ -11,14 +11,14 @@ import apt_pkg import sys -ConfigFile = apt_pkg.ParseCommandLine(apt_pkg.Config, [], sys.argv) +ConfigFile = apt_pkg.parse_commandline(apt_pkg.config, [], sys.argv) if len(ConfigFile) != 1: print "Must have exactly 1 file name" sys.exit(0) Cnf = apt_pkg.Configuration() -apt_pkg.ReadConfigFileISC(Cnf, ConfigFile[0]) +apt_pkg.read_config_file_isc(Cnf, ConfigFile[0]) # Print the configuration space #print "The Configuration space looks like:" @@ -26,18 +26,18 @@ apt_pkg.ReadConfigFileISC(Cnf, ConfigFile[0]) # print "%s \"%s\";" % (I, Cnf[I]) # bind8 config file.. -if Cnf.Exists("Zone"): - print "Zones: ", Cnf.SubTree("zone").List() - for I in Cnf.List("zone"): - SubCnf = Cnf.SubTree(I) - if SubCnf.Find("type") == "slave": +if "Zone" in Cnf: + print "Zones: ", Cnf.sub_tree("zone").list() + for I in Cnf.list("zone"): + SubCnf = Cnf.sub_tree(I) + if SubCnf.find("type") == "slave": print "Masters for %s: %s" % ( - SubCnf.MyTag(), SubCnf.ValueList("masters")) + SubCnf.my_tag(), SubCnf.value_list("masters")) else: print "Tree definitions:" - for I in Cnf.List("tree"): - SubCnf = Cnf.SubTree(I) + for I in Cnf.list("tree"): + SubCnf = Cnf.sub_tree(I) # This could use Find which would eliminate the possibility of # exceptions. print "Subtree %s with sections '%s' and architectures '%s'" % ( - SubCnf.MyTag(), SubCnf["Sections"], SubCnf["Architectures"]) + SubCnf.my_tag(), SubCnf["Sections"], SubCnf["Architectures"]) diff --git a/doc/examples/deb_inspect.py b/doc/examples/deb_inspect.py index 54c52b7b..f6e090a1 100755 --- a/doc/examples/deb_inspect.py +++ b/doc/examples/deb_inspect.py @@ -7,10 +7,11 @@ import sys import os.path -def Callback(What, Name, Link, Mode, UID, GID, Size, MTime, Major, Minor): +def Callback(member, data): """ callback for debExtract """ - print "%s '%s','%s',%u,%u,%u,%u,%u,%u,%u" \ - % (What, Name, Link, Mode, UID, GID, Size, MTime, Major, Minor) + print "'%s','%s',%u,%u,%u,%u,%u,%u,%u" \ + % (member.name, member.linkname, member.mode, member.uid, + member.gid, member.size, member.mtime, member.major, member.minor) if __name__ == "__main__": @@ -21,10 +22,10 @@ if __name__ == "__main__": print "Working on: %s" % file print "Displaying data.tar.gz:" - apt_inst.debExtract(open(file), Callback, "data.tar.gz") + apt_inst.DebFile(open(file)).data.go(Callback) print "Now extracting the control file:" - control = apt_inst.debExtractControl(open(file)) + control = apt_inst.DebFile(open(file)).control.extractdata("control") sections = apt_pkg.TagSection(control) print "Maintainer is: " @@ -33,13 +34,12 @@ if __name__ == "__main__": print print "DependsOn: " depends = sections["Depends"] - print apt_pkg.ParseDepends(depends) - + print apt_pkg.parse_depends(depends) print "extracting archive" dir = "/tmp/deb" os.mkdir(dir) - apt_inst.debExtractArchive(open(file), dir) + apt_inst.DebFile(open(file)).data.extractall(dir) def visit(arg, dirname, names): print "%s/" % dirname diff --git a/doc/examples/depcache.py b/doc/examples/depcache.py index 858e45a4..8e33e98b 100644 --- a/doc/examples/depcache.py +++ b/doc/examples/depcache.py @@ -10,7 +10,7 @@ apt_pkg.init() progress = TextProgress() cache = apt_pkg.Cache(progress) -print "Available packages: %s " % cache.PackageCount +print "Available packages: %s " % cache.package_count iter = cache["base-config"] print "example package iter: %s" % iter @@ -18,90 +18,90 @@ print "example package iter: %s" % iter # get depcache print "\n\n depcache" depcache = apt_pkg.DepCache(cache) -depcache.ReadPinFile() +depcache.read_pinfile() # init is needed after the creation/pin file reading -depcache.Init(progress) +depcache.init(progress) print "got a depcache: %s " % depcache -print "Marked for install: %s " % depcache.InstCount +print "Marked for install: %s " % depcache.inst_count print "\n\n Reinit" -depcache.Init(progress) +depcache.init(progress) #sys.exit() # get a canidate version -ver= depcache.GetCandidateVer(iter) +ver = depcache.get_candidate_ver(iter) print "Candidate version: %s " % ver print "\n\nQuerry interface" -print "%s.IsUpgradable(): %s" % (iter.Name, depcache.IsUpgradable(iter)) +print "%s.is_upgradable(): %s" % (iter.name, depcache.is_upgradable(iter)) print "\nMarking interface" -print "Marking '%s' for install" % iter.Name -depcache.MarkInstall(iter) -print "Install count: %s " % depcache.InstCount -print "%s.MarkedInstall(): %s" % (iter.Name, depcache.MarkedInstall(iter)) -print "%s.MarkedUpgrade(): %s" % (iter.Name, depcache.MarkedUpgrade(iter)) -print "%s.MarkedDelete(): %s" % (iter.Name, depcache.MarkedDelete(iter)) +print "Marking '%s' for install" % iter.name +depcache.mark_install(iter) +print "Install count: %s " % depcache.inst_count +print "%s.marked_install(): %s" % (iter.name, depcache.marked_install(iter)) +print "%s.marked_upgrade(): %s" % (iter.name, depcache.marked_upgrade(iter)) +print "%s.marked_delete(): %s" % (iter.name, depcache.marked_delete(iter)) -print "Marking %s for delete" % iter.Name -depcache.MarkDelete(iter) -print "DelCount: %s " % depcache.DelCount -print "%s.MarkedDelete(): %s" % (iter.Name, depcache.MarkedDelete(iter)) +print "Marking %s for delete" % iter.name +depcache.mark_delete(iter) +print "del_count: %s " % depcache.del_count +print "%s.marked_delete(): %s" % (iter.name, depcache.marked_delete(iter)) iter = cache["3dchess"] -print "\nMarking '%s' for install" % iter.Name -depcache.MarkInstall(iter) -print "Install count: %s " % depcache.InstCount -print "%s.MarkedInstall(): %s" % (iter.Name, depcache.MarkedInstall(iter)) -print "%s.MarkedUpgrade(): %s" % (iter.Name, depcache.MarkedUpgrade(iter)) -print "%s.MarkedDelete(): %s" % (iter.Name, depcache.MarkedDelete(iter)) +print "\nMarking '%s' for install" % iter.name +depcache.mark_install(iter) +print "Install count: %s " % depcache.inst_count +print "%s.marked_install(): %s" % (iter.name, depcache.marked_install(iter)) +print "%s.marked_upgrade(): %s" % (iter.name, depcache.marked_upgrade(iter)) +print "%s.marked_delete(): %s" % (iter.name, depcache.marked_delete(iter)) -print "Marking %s for keep" % iter.Name -depcache.MarkKeep(iter) -print "Install: %s " % depcache.InstCount +print "Marking %s for keep" % iter.name +depcache.mark_keep(iter) +print "Install: %s " % depcache.inst_count iter = cache["synaptic"] -print "\nMarking '%s' for install" % iter.Name -depcache.MarkInstall(iter) -print "Install: %s " % depcache.InstCount -print "Broken count: %s" % depcache.BrokenCount -print "FixBroken() " -depcache.FixBroken() -print "Broken count: %s" % depcache.BrokenCount - -print "\nPerforming Upgrade" -depcache.Upgrade() -print "Keep: %s " % depcache.KeepCount -print "Install: %s " % depcache.InstCount -print "Delete: %s " % depcache.DelCount -print "UsrSize: %s " % apt_pkg.SizeToStr(depcache.UsrSize) -print "DebSize: %s " % apt_pkg.SizeToStr(depcache.DebSize) - -for pkg in cache.Packages: - if pkg.CurrentVer is not None and not depcache.MarkedInstall(pkg) \ - and depcache.IsUpgradable(pkg): - print "Upgrade didn't upgrade (kept): %s" % pkg.Name +print "\nMarking '%s' for install" % iter.name +depcache.mark_install(iter) +print "Install: %s " % depcache.inst_count +print "Broken count: %s" % depcache.broken_count +print "fix_broken() " +depcache.fix_broken() +print "Broken count: %s" % depcache.broken_count + +print "\nPerforming upgrade" +depcache.upgrade() +print "Keep: %s " % depcache.keep_count +print "Install: %s " % depcache.inst_count +print "Delete: %s " % depcache.del_count +print "usr_size: %s " % apt_pkg.size_to_str(depcache.usr_size) +print "deb_size: %s " % apt_pkg.size_to_str(depcache.deb_size) + +for pkg in cache.packages: + if pkg.current_ver is not None and not depcache.marked_install(pkg) \ + and depcache.is_upgradable(pkg): + print "upgrade didn't upgrade (kept): %s" % pkg.name print "\nPerforming DistUpgrade" -depcache.Upgrade(True) -print "Keep: %s " % depcache.KeepCount -print "Install: %s " % depcache.InstCount -print "Delete: %s " % depcache.DelCount -print "UsrSize: %s " % apt_pkg.SizeToStr(depcache.UsrSize) -print "DebSize: %s " % apt_pkg.SizeToStr(depcache.DebSize) +depcache.upgrade(True) +print "Keep: %s " % depcache.keep_count +print "Install: %s " % depcache.inst_count +print "Delete: %s " % depcache.del_count +print "usr_size: %s " % apt_pkg.size_to_str(depcache.usr_size) +print "deb_size: %s " % apt_pkg.size_to_str(depcache.deb_size) # overview about what would happen -for pkg in cache.Packages: - if depcache.MarkedInstall(pkg): - if pkg.CurrentVer is not None: - print "Marked upgrade: %s " % pkg.Name +for pkg in cache.packages: + if depcache.marked_install(pkg): + if pkg.current_ver is not None: + print "Marked upgrade: %s " % pkg.name else: - print "Marked install: %s" % pkg.Name - elif depcache.MarkedDelete(pkg): - print "Marked delete: %s" % pkg.Name - elif depcache.MarkedKeep(pkg): - print "Marked keep: %s" % pkg.Name + print "Marked install: %s" % pkg.name + elif depcache.marked_delete(pkg): + print "Marked delete: %s" % pkg.name + elif depcache.marked_keep(pkg): + print "Marked keep: %s" % pkg.name diff --git a/doc/examples/dependant-pkgs.py b/doc/examples/dependant-pkgs.py index 5fbbc76d..a02547ac 100755 --- a/doc/examples/dependant-pkgs.py +++ b/doc/examples/dependant-pkgs.py @@ -6,27 +6,27 @@ import sys pkgs = set() cache = apt.Cache() for pkg in cache: - candver = cache._depcache.GetCandidateVer(pkg._pkg) + candver = cache._depcache.get_candidate_ver(pkg._pkg) if candver is None: continue - dependslist = candver.DependsList + dependslist = candver.depends_list for dep in dependslist.keys(): # get the list of each dependency object for depVerList in dependslist[dep]: for z in depVerList: # get all TargetVersions of # the dependency object - for tpkg in z.AllTargets(): - if sys.argv[1] == tpkg.ParentPkg.Name: + for tpkg in z.all_targets(): + if sys.argv[1] == tpkg.parent_pkg.name: pkgs.add(pkg.name) main = set() universe = set() for pkg in pkgs: if "universe" in cache[pkg].section: - universe.add(cache[pkg].sourcePackageName) + universe.add(cache[pkg].source_name) else: - main.add(cache[pkg].sourcePackageName) + main.add(cache[pkg].source_name) print "main:" print "\n".join(main) diff --git a/doc/examples/desc.py b/doc/examples/desc.py index d50aa0ce..797459aa 100644 --- a/doc/examples/desc.py +++ b/doc/examples/desc.py @@ -4,22 +4,22 @@ import apt_pkg apt_pkg.init() -apt_pkg.Config.Set("APT::Acquire::Translation", "de") +apt_pkg.config.set("APT::Acquire::Translation", "de") cache = apt_pkg.Cache() depcache = apt_pkg.DepCache(cache) pkg = cache["gcc"] -cand = depcache.GetCandidateVer(pkg) +cand = depcache.get_candidate_ver(pkg) print cand desc = cand.TranslatedDescription print desc -print desc.FileList -(f, index) = desc.FileList.pop(0) +print desc.file_list +(f, index) = desc.file_list.pop(0) records = apt_pkg.PackageRecords(cache) -records.Lookup((f, index)) -desc = records.LongDesc +records.lookup((f, index)) +desc = records.long_desc print len(desc) print desc diff --git a/doc/examples/gui-inst.py b/doc/examples/gui-inst.py deleted file mode 100755 index 68f06fc0..00000000 --- a/doc/examples/gui-inst.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/python -# example how to install in a custom terminal widget -# see also gnome bug: #169201 -import pygtk -pygtk.require('2.0') -import gtk - -import apt.progress.gtk2 - - -if __name__ == "__main__": - - win = gtk.Window() - progress = apt.progress.gtk2.GtkAptProgress() - win.set_title("GtkAptProgress Demo") - win.add(progress) - progress.show() - win.show() - - cache = apt.cache.Cache(progress.open) - if cache["2vcard"].isInstalled: - cache["2vcard"].markDelete() - else: - cache["2vcard"].markInstall() - progress.show_terminal(expanded=True) - cache.commit(progress.fetch, progress.install) - gtk.main() diff --git a/doc/examples/indexfile.py b/doc/examples/indexfile.py index cc5070aa..a9282bf5 100644 --- a/doc/examples/indexfile.py +++ b/doc/examples/indexfile.py @@ -5,18 +5,18 @@ import apt_pkg apt_pkg.init() sources = apt_pkg.SourceList() -sources.ReadMainList() +sources.read_main_list() cache = apt_pkg.Cache() depcache = apt_pkg.DepCache(cache) pkg = cache["libimlib2"] -cand = depcache.GetCandidateVer(pkg) -for (f, i) in cand.FileList: - index = sources.FindIndex(f) +cand = depcache.get_candidate_ver(pkg) +for (f, i) in cand.file_list: + index = sources.find_index(f) print index if index: - print index.Size - print index.IsTrusted - print index.Exists - print index.HasPackages - print index.ArchiveURI("some/path") + print index.size + print index.is_trusted + print index.exists + print index.Haspackages + print index.archive_uri("some/path") diff --git a/doc/examples/inst.py b/doc/examples/inst.py index 5a7fc993..25658435 100644 --- a/doc/examples/inst.py +++ b/doc/examples/inst.py @@ -17,7 +17,7 @@ class TextInstallProgress(InstallProgress): InstallProgress.updateInterface(self) if self.last >= self.percent: return - sys.stdout.write("\r[%s] %s\n" %(self.percent, self.status)) + sys.stdout.write("\r[%s] %s\n" % (self.percent, self.status)) sys.stdout.flush() self.last = self.percent @@ -36,12 +36,12 @@ iprogress = TextInstallProgress() pkg = cache["3dchess"] # install or remove, the importend thing is to keep us busy :) -if pkg.isInstalled: +if pkg.is_installed: print "Going to delete %s" % pkg.name - pkg.markDelete() + pkg.mark_delete() else: print "Going to install %s" % pkg.name - pkg.markInstall() + pkg.mark_install() res = cache.commit(fprogress, iprogress) print res diff --git a/doc/examples/metaindex.py b/doc/examples/metaindex.py index bbb4ac47..a04a83dd 100644 --- a/doc/examples/metaindex.py +++ b/doc/examples/metaindex.py @@ -5,12 +5,12 @@ import apt_pkg apt_pkg.init() sources = apt_pkg.SourceList() -sources.ReadMainList() +sources.read_main_list() -for metaindex in sources.List: +for metaindex in sources.list: print metaindex - print "URI: ", metaindex.URI - print "Dist: ", metaindex.Dist - print "IndexFiles: ", "\n".join([str(i) for i in metaindex.IndexFiles]) + print "uri: ", metaindex.uri + print "dist: ", metaindex.dist + print "index_files: ", "\n".join([str(i) for i in metaindex.index_files]) print diff --git a/doc/examples/print_uris.py b/doc/examples/print_uris.py index c64a4b54..e5f69ff3 100755 --- a/doc/examples/print_uris.py +++ b/doc/examples/print_uris.py @@ -4,19 +4,7 @@ # import apt -import apt_pkg - -cache = apt.Cache() -upgradable = filter(lambda p: p.isUpgradable, cache) - - -for pkg in upgradable: - pkg._lookupRecord(True) - 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) - if indexfile: - uri = indexfile.ArchiveURI(path) - print uri +for pkg in apt.Cache(): + if pkg.is_upgradable: + print pkg.candidate.uri diff --git a/doc/examples/progress.py b/doc/examples/progress.py index c007681f..a273eb24 100644 --- a/doc/examples/progress.py +++ b/doc/examples/progress.py @@ -3,13 +3,15 @@ import sys import time +import apt_pkg import apt +import apt.progress.base -class TextProgress(apt.OpProgress): +class TextProgress(apt.progress.base.OpProgress): def __init__(self): - self.last=0.0 + self.last = 0.0 def update(self, percent): if (self.last + 1.0) <= percent: @@ -20,10 +22,10 @@ class TextProgress(apt.OpProgress): def done(self): self.last = 0.0 - print "\rDone " + print("\rDone ") -class TextFetchProgress(apt.FetchProgress): +class TextFetchProgress(apt.progress.base.AcquireProgress): def __init__(self): pass @@ -34,60 +36,52 @@ class TextFetchProgress(apt.FetchProgress): def stop(self): pass - def updateStatus(self, uri, descr, shortDescr, status): - print "UpdateStatus: '%s' '%s' '%s' '%i' " % ( - uri, descr, shortDescr, status) + def fail(self, item): + print('fail', item) - def update_status_full(self, uri, descr, shortDescr, status, fileSize, - partialSize): - print "update_status_full: '%s' '%s' '%s' '%i' '%d/%d'" % ( - uri, descr, shortDescr, status, partialSize, fileSize) + def fetch(self, item): + print('fetch', item) - def pulse(self): - print "Pulse: CPS: %s/s; Bytes: %s/%s; Item: %s/%s" % ( - apt.SizeToStr(self.currentCPS), apt.SizeToStr(self.currentBytes), - apt.SizeToStr(self.totalBytes), self.currentItems, self.totalItems) - return True + def ims_hit(self, item): + print('ims_hit', item) - def pulse_items(self, items): - print "Pulse: CPS: %s/s; Bytes: %s/%s; Item: %s/%s" % ( - apt.SizeToStr(self.currentCPS), apt.SizeToStr(self.currentBytes), - apt.SizeToStr(self.totalBytes), self.currentItems, self.totalItems) - print "Pulse-Items: " - for itm in items: - uri, descr, shortDescr, fileSize, partialSize = itm - print " - '%s' '%s' '%s' '%d/%d'" % ( - uri, descr, shortDescr, partialSize, fileSize) + def pulse(self, owner): + print("pulse: CPS: %s/s; Bytes: %s/%s; Item: %s/%s" % ( + apt_pkg.size_to_str(self.current_cps), + apt_pkg.size_to_str(self.current_bytes), + apt_pkg.size_to_str(self.total_bytes), + self.current_items, + self.total_items)) return True - def mediaChange(self, medium, drive): - print "Please insert medium %s in drive %s" % (medium, drive) + def media_change(self, medium, drive): + print("Please insert medium %s in drive %s" % (medium, drive)) sys.stdin.readline() #return False -class TextInstallProgress(apt.InstallProgress): +class TextInstallProgress(apt.progress.base.InstallProgress): def __init__(self): - apt.InstallProgress.__init__(self) + apt.progress.base.InstallProgress.__init__(self) pass - def startUpdate(self): - print "StartUpdate" + def start_update(self): + print("start_update") - def finishUpdate(self): - print "FinishUpdate" + def finish_update(self): + print("finish_update") - def statusChange(self, pkg, percent, status): - print "[%s] %s: %s" % (percent, pkg, status) + def status_change(self, pkg, percent, status): + print("[%s] %s: %s" % (percent, pkg, status)) - def updateInterface(self): - apt.InstallProgress.updateInterface(self) + def update_interface(self): + apt.progress.base.InstallProgress.update_interface(self) # usefull to e.g. redraw a GUI time.sleep(0.1) -class TextCdromProgress(apt.CdromProgress): +class TextCdromProgress(apt.progress.base.CdromProgress): def __init__(self): pass @@ -97,27 +91,28 @@ class TextCdromProgress(apt.CdromProgress): def update(self, text, step): # check if we actually have some text to display if text != "": - print "Update: %s %s" % (text.strip(), step) + print("Update: %s %s" % (text.strip(), step)) - def askCdromName(self): - print "Please enter cd-name: ", + def ask_cdrom_name(self): + sys.stdout.write("Please enter cd-name: ") cd_name = sys.stdin.readline() return (True, cd_name.strip()) - def changeCdrom(self): - print "Please insert cdrom and press <ENTER>" + def change_cdrom(self): + print("Please insert cdrom and press <ENTER>") answer = sys.stdin.readline() + print(answer) return True if __name__ == "__main__": c = apt.Cache() pkg = c["3dchess"] - if pkg.isInstalled: - pkg.markDelete() + if pkg.is_installed: + pkg.mark_delete() else: - pkg.markInstall() + pkg.mark_install() res = c.commit(TextFetchProgress(), TextInstallProgress()) - print res + print(res) diff --git a/doc/examples/recommends.py b/doc/examples/recommends.py index 0ecd5882..01727820 100755 --- a/doc/examples/recommends.py +++ b/doc/examples/recommends.py @@ -16,21 +16,21 @@ class Wanted: wanted = {} -for package in cache.Packages: - current = package.CurrentVer +for package in cache.packages: + current = package.current_ver if not current: continue - depends = current.DependsList + depends = current.depends_list for (key, attr) in (('Suggests', 'suggested'), ('Recommends', 'recommended')): list = depends.get(key, []) for dependency in list: - name = dependency[0].TargetPkg.Name + name = dependency[0].target_pkg.name dep = cache[name] - if dep.CurrentVer: + if dep.current_ver: continue getattr(wanted.setdefault(name, Wanted(name)), - attr).append(package.Name) + attr).append(package.name) ks = wanted.keys() ks.sort() diff --git a/doc/examples/sources.py b/doc/examples/sources.py index bc08ad69..aa783758 100644 --- a/doc/examples/sources.py +++ b/doc/examples/sources.py @@ -8,9 +8,9 @@ apt_pkg.init() #sources = apt_pkg.SourceRecords(cache) sources = apt_pkg.SourceRecords() -sources.Restart() -while sources.Lookup('hello'): - print sources.Package, sources.Version, sources.Maintainer, \ - sources.Section, `sources.Binaries` - print sources.Files - print sources.Index.ArchiveURI(sources.Files[0][2]) +sources.restart() +while sources.lookup('hello'): + print sources.package, sources.version, sources.maintainer, \ + sources.section, repr(sources.binaries) + print sources.files + print sources.index.archive_uri(sources.files[0][2]) diff --git a/doc/examples/tagfile.py b/doc/examples/tagfile.py index 770e40de..d8984cad 100755 --- a/doc/examples/tagfile.py +++ b/doc/examples/tagfile.py @@ -3,6 +3,6 @@ import apt_pkg Parse = apt_pkg.TagFile(open("/var/lib/dpkg/status", "r")) -while Parse.Step() == 1: - print Parse.Section.get("Package") - print apt_pkg.ParseDepends(Parse.Section.get("Depends", "")) +while Parse.step() == 1: + print Parse.section.get("Package") + print apt_pkg.parse_depends(Parse.section.get("Depends", "")) diff --git a/doc/examples/update.py b/doc/examples/update.py index 5929c9f8..3ff80fde 100755 --- a/doc/examples/update.py +++ b/doc/examples/update.py @@ -4,9 +4,9 @@ import apt_pkg import os.path if __name__ == "__main__": - apt_pkg.Config.Set("APT::Update::Pre-Invoke::", + apt_pkg.config.set("APT::Update::Pre-Invoke::", "touch /tmp/update-about-to-run") - apt_pkg.Config.Set("APT::Update::Post-Invoke::", + apt_pkg.config.set("APT::Update::Post-Invoke::", "touch /tmp/update-was-run") c = apt.Cache() res = c.update(apt.progress.TextFetchProgress()) diff --git a/doc/examples/versiontest.py b/doc/examples/versiontest.py index fa13cc1c..2f736161 100755 --- a/doc/examples/versiontest.py +++ b/doc/examples/versiontest.py @@ -5,19 +5,19 @@ import apt_pkg import sys import re -apt_pkg.InitConfig() -apt_pkg.InitSystem() +apt_pkg.init_config() +apt_pkg.init_system() -TestFile = apt_pkg.ParseCommandLine(apt_pkg.Config, [], sys.argv) +TestFile = apt_pkg.parse_commandline(apt_pkg.config, [], sys.argv) if len(TestFile) != 1: print "Must have exactly 1 file name" sys.exit(0) # Go over the file.. -List = open(TestFile[0], "r") +list = open(TestFile[0], "r") CurLine = 0 while(1): - Line = List.readline() + Line = list.readline() CurLine = CurLine + 1 if Line == "": break @@ -28,12 +28,12 @@ while(1): Split = re.split("[ \n]", Line) # Check forward - if apt_pkg.VersionCompare(Split[0], Split[1]) != int(Split[2]): + if apt_pkg.version_compare(Split[0], Split[1]) != int(Split[2]): print "Comparision failed on line %u. '%s' ? '%s' %i != %i" % (CurLine, - Split[0], Split[1], apt_pkg.VersionCompare(Split[0], Split[1]), + Split[0], Split[1], apt_pkg.version_compare(Split[0], Split[1]), int(Split[2])) # Check reverse - if apt_pkg.VersionCompare(Split[1], Split[0]) != -1 * int(Split[2]): + if apt_pkg.version_compare(Split[1], Split[0]) != -1 * int(Split[2]): print "Comparision failed on line %u. '%s' ? '%s' %i != %i" % (CurLine, - Split[1], Split[0], apt_pkg.VersionCompare(Split[1], Split[0]), + Split[1], Split[0], apt_pkg.version_compare(Split[1], Split[0]), -1 * int(Split[2])) diff --git a/doc/source/c++/api.rst b/doc/source/c++/api.rst index 63ed1599..632966bb 100644 --- a/doc/source/c++/api.rst +++ b/doc/source/c++/api.rst @@ -14,379 +14,379 @@ a _CheckExact() function, a _FromCpp() and a _ToCpp() function. Acquire (pkgAcquire) -------------------- -.. cvar:: PyTypeObject PyAcquire_Type +.. c:var:: PyTypeObject PyAcquire_Type The type object for :class:`apt_pkg.Acquire` objects. -.. cfunction:: int PyAcquire_Check(PyObject *object) +.. c:function:: int PyAcquire_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Acquire` object, or a subclass thereof. -.. cfunction:: int PyAcquire_CheckExact(PyObject *object) +.. c:function:: int PyAcquire_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Acquire` object and no subclass thereof. -.. cfunction:: PyObject* PyAcquire_FromCpp(pkgAcquire *acquire, bool delete, PyObject *owner) +.. c:function:: PyObject* PyAcquire_FromCpp(pkgAcquire *acquire, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.Acquire` object from the :ctype:`pkgAcquire` + Create a new :class:`apt_pkg.Acquire` object from the :c:type:`pkgAcquire` pointer given by the parameter *acquire*. If the parameter *delete* is true, the object pointed to by *acquire* will be deleted when the refcount of the return value reaches 0. -.. cfunction:: pkgAcquire* PyAcquire_ToCpp(PyObject *acquire) +.. c:function:: pkgAcquire* PyAcquire_ToCpp(PyObject *acquire) - Return the :ctype:`pkgAcquire` pointer contained in the Python object + Return the :c:type:`pkgAcquire` pointer contained in the Python object *acquire*. AcquireFile (pkgAcqFile) ------------------------ -.. cvar:: PyTypeObject PyAcquireFile_Type +.. c:var:: PyTypeObject PyAcquireFile_Type The type object for :class:`apt_pkg.AcquireFile` objects. -.. cfunction:: int PyAcquireFile_Check(PyObject *object) +.. c:function:: int PyAcquireFile_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.AcquireFile` object, or a subclass thereof. -.. cfunction:: int PyAcquireFile_CheckExact(PyObject *object) +.. c:function:: int PyAcquireFile_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.AcquireFile` object and no subclass thereof. -.. cfunction:: PyObject* PyAcquireFile_FromCpp(pkgAcqFile *file, bool delete, PyObject *owner) +.. c:function:: PyObject* PyAcquireFile_FromCpp(pkgAcqFile *file, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.AcquireFile` object from the :ctype:`pkgAcqFile` + Create a new :class:`apt_pkg.AcquireFile` object from the :c:type:`pkgAcqFile` pointer given by the parameter *file*. If the parameter *delete* is true, the object pointed to by *file* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* should point to a :class:`apt_pkg.Acquire` object. -.. cfunction:: pkgAcqFile* PyAcquireFile_ToCpp(PyObject *acquire) +.. c:function:: pkgAcqFile* PyAcquireFile_ToCpp(PyObject *acquire) - Return the :ctype:`pkgAcqFile` pointer contained in the Python object + Return the :c:type:`pkgAcqFile` pointer contained in the Python object *acquire*. AcquireItem (pkgAcquire::Item) ------------------------------ -.. cvar:: PyTypeObject PyAcquireItem_Type +.. c:var:: PyTypeObject PyAcquireItem_Type The type object for :class:`apt_pkg.AcquireItem` objects. -.. cfunction:: int PyAcquireItem_Check(PyObject *object) +.. c:function:: int PyAcquireItem_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.AcquireItem` object, or a subclass thereof. -.. cfunction:: int PyAcquireItem_CheckExact(PyObject *object) +.. c:function:: int PyAcquireItem_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.AcquireItem` object and no subclass thereof. -.. cfunction:: PyObject* PyAcquireItem_FromCpp(pkgAcquire::Item *item, bool delete, PyObject *owner) +.. c:function:: PyObject* PyAcquireItem_FromCpp(pkgAcquire::Item *item, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.AcquireItem` object from the :ctype:`pkgAcquire::Item` + Create a new :class:`apt_pkg.AcquireItem` object from the :c:type:`pkgAcquire::Item` pointer given by the parameter *item*. If the parameter *delete* is true, the object pointed to by *item* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* should point to a :class:`apt_pkg.Acquire` object. -.. cfunction:: pkgAcquire::Item* PyAcquireItem_ToCpp(PyObject *object) +.. c:function:: pkgAcquire::Item* PyAcquireItem_ToCpp(PyObject *object) - Return the :ctype:`pkgAcquire::Item` pointer contained in the Python object + Return the :c:type:`pkgAcquire::Item` pointer contained in the Python object *object*. AcquireItemDesc (pkgAcquire::ItemDesc) -------------------------------------- -.. cvar:: PyTypeObject PyAcquireItemDesc_Type +.. c:var:: PyTypeObject PyAcquireItemDesc_Type The type object for :class:`apt_pkg.AcquireItemDesc` objects. -.. cfunction:: int PyAcquireItemDesc_Check(PyObject *object) +.. c:function:: int PyAcquireItemDesc_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.AcquireItemDesc` object, or a subclass thereof. -.. cfunction:: int PyAcquireItemDesc_CheckExact(PyObject *object) +.. c:function:: int PyAcquireItemDesc_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.AcquireItemDesc` object and no subclass thereof. -.. cfunction:: PyObject* PyAcquireItemDesc_FromCpp(pkgAcquire::ItemDesc *desc, bool delete, PyObject *owner) +.. c:function:: PyObject* PyAcquireItemDesc_FromCpp(pkgAcquire::ItemDesc *desc, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.AcquireItemDesc` object from the :ctype:`pkgAcquire::ItemDesc` + Create a new :class:`apt_pkg.AcquireItemDesc` object from the :c:type:`pkgAcquire::ItemDesc` pointer given by the parameter *desc*. If the parameter *delete* is true, the object pointed to by *desc* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* should point to a :class:`apt_pkg.AcquireItem` object. -.. cfunction:: pkgAcquire::ItemDesc* PyAcquireItemDesc_ToCpp(PyObject *object) +.. c:function:: pkgAcquire::ItemDesc* PyAcquireItemDesc_ToCpp(PyObject *object) - Return the :ctype:`pkgAcquire::ItemDesc` pointer contained in the Python object + Return the :c:type:`pkgAcquire::ItemDesc` pointer contained in the Python object *object*. AcquireWorker (pkgAcquire::Worker) ---------------------------------- -.. cvar:: PyTypeObject PyAcquireWorker_Type +.. c:var:: PyTypeObject PyAcquireWorker_Type The type object for :class:`apt_pkg.AcquireWorker` objects. -.. cfunction:: int PyAcquireWorker_Check(PyObject *object) +.. c:function:: int PyAcquireWorker_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.AcquireWorker` object, or a subclass thereof. -.. cfunction:: int PyAcquireWorker_CheckExact(PyObject *object) +.. c:function:: int PyAcquireWorker_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.AcquireWorker` object and no subclass thereof. -.. cfunction:: PyObject* PyAcquireWorker_FromCpp(pkgAcquire::Worker *worker, bool delete, PyObject *owner) +.. c:function:: PyObject* PyAcquireWorker_FromCpp(pkgAcquire::Worker *worker, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.AcquireWorker` object from the :ctype:`pkgAcquire::Worker` + Create a new :class:`apt_pkg.AcquireWorker` object from the :c:type:`pkgAcquire::Worker` pointer given by the parameter *worker*. If the parameter *delete* is true, the object pointed to by *worker* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* should point to a :class:`apt_pkg.Acquire` object. -.. cfunction:: pkgAcquire::Worker* PyAcquireWorker_ToCpp(PyObject *object) +.. c:function:: pkgAcquire::Worker* PyAcquireWorker_ToCpp(PyObject *object) - Return the :ctype:`pkgAcquire::Worker` pointer contained in the Python object + Return the :c:type:`pkgAcquire::Worker` pointer contained in the Python object *object*. ActionGroup (pkgDepCache::ActionGroup) -------------------------------------- -.. cvar:: PyTypeObject PyActionGroup_Type +.. c:var:: PyTypeObject PyActionGroup_Type The type object for :class:`apt_pkg.ActionGroup` objects. -.. cfunction:: int PyActionGroup_Check(PyObject *object) +.. c:function:: int PyActionGroup_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.ActionGroup` object, or a subclass thereof. -.. cfunction:: int PyActionGroup_CheckExact(PyObject *object) +.. c:function:: int PyActionGroup_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.ActionGroup` object and no subclass thereof. -.. cfunction:: PyObject* PyActionGroup_FromCpp(pkgDepCache::ActionGroup *agroup, bool delete, PyObject *owner) +.. c:function:: PyObject* PyActionGroup_FromCpp(pkgDepCache::ActionGroup *agroup, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.ActionGroup` object from the :ctype:`pkgDepCache::ActionGroup` + Create a new :class:`apt_pkg.ActionGroup` object from the :c:type:`pkgDepCache::ActionGroup` pointer given by the parameter *agroup*. If the parameter *delete* is true, the object pointed to by *agroup* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* should point to a :class:`apt_pkg.DepCache` object. -.. cfunction:: pkgDepCache::ActionGroup* PyActionGroup_ToCpp(PyObject *object) +.. c:function:: pkgDepCache::ActionGroup* PyActionGroup_ToCpp(PyObject *object) - Return the :ctype:`pkgDepCache::ActionGroup` pointer contained in the + Return the :c:type:`pkgDepCache::ActionGroup` pointer contained in the Python object *object*. Cache (pkgCache) ------------------------ -.. cvar:: PyTypeObject PyCache_Type +.. c:var:: PyTypeObject PyCache_Type The type object for :class:`apt_pkg.Cache` objects. -.. cfunction:: int PyCache_Check(PyObject *object) +.. c:function:: int PyCache_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Cache` object, or a subclass thereof. -.. cfunction:: int PyCache_CheckExact(PyObject *object) +.. c:function:: int PyCache_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Cache` object and no subclass thereof. -.. cfunction:: PyObject* PyCache_FromCpp(pkgCache *cache, bool delete, PyObject *owner) +.. c:function:: PyObject* PyCache_FromCpp(pkgCache *cache, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.Cache` object from the :ctype:`pkgCache` + Create a new :class:`apt_pkg.Cache` object from the :c:type:`pkgCache` pointer given by the parameter *cache*. If the parameter *delete* is true, the object pointed to by *cache* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* shall point - to a object of the type :cdata:`PyCacheFile_Type`. + to a object of the type :c:data:`PyCacheFile_Type`. -.. cfunction:: pkgCache* PyCache_ToCpp(PyObject *object) +.. c:function:: pkgCache* PyCache_ToCpp(PyObject *object) - Return the :ctype:`pkgCache` pointer contained in the Python object + Return the :c:type:`pkgCache` pointer contained in the Python object *object*. CacheFile (pkgCacheFile) ------------------------ -.. cvar:: PyTypeObject PyCacheFile_Type +.. c:var:: PyTypeObject PyCacheFile_Type The type object for CacheFile. This type is internal and not exported to Python anywhere. -.. cfunction:: int PyCacheFile_Check(PyObject *object) +.. c:function:: int PyCacheFile_Check(PyObject *object) - Check that the object *object* is of the type :cdata:`PyCacheFile_Type` or + Check that the object *object* is of the type :c:data:`PyCacheFile_Type` or a subclass thereof. -.. cfunction:: int PyCacheFile_CheckExact(PyObject *object) +.. c:function:: int PyCacheFile_CheckExact(PyObject *object) - Check that the object *object* is of the type :cdata:`PyCacheFile_Type` and + Check that the object *object* is of the type :c:data:`PyCacheFile_Type` and no subclass thereof. -.. cfunction:: PyObject* PyCacheFile_FromCpp(pkgCacheFile *file, bool delete, PyObject *owner) +.. c:function:: PyObject* PyCacheFile_FromCpp(pkgCacheFile *file, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.CacheFile` object from the :ctype:`pkgCacheFile` + Create a new :class:`apt_pkg.CacheFile` object from the :c:type:`pkgCacheFile` pointer given by the parameter *file* If the parameter *delete* is true, the object pointed to by *file* will be deleted when the reference count of the returned object reaches 0. -.. cfunction:: pkgCacheFile* PyCacheFile_ToCpp(PyObject *object) +.. c:function:: pkgCacheFile* PyCacheFile_ToCpp(PyObject *object) - Return the :ctype:`pkgCacheFile` pointer contained in the Python object + Return the :c:type:`pkgCacheFile` pointer contained in the Python object *object*. Cdrom (pkgCdrom) ------------------------ -.. cvar:: PyTypeObject PyCdrom_Type +.. c:var:: PyTypeObject PyCdrom_Type The type object for :class:`apt_pkg.Cdrom` objects. -.. cfunction:: int PyCdrom_Check(PyObject *object) +.. c:function:: int PyCdrom_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Cdrom` object, or a subclass thereof. -.. cfunction:: int PyCdrom_CheckExact(PyObject *object) +.. c:function:: int PyCdrom_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Cdrom` object and no subclass thereof. -.. cfunction:: PyObject* PyCdrom_FromCpp(pkgCdrom &cdrom, bool delete, PyObject *owner) +.. c:function:: PyObject* PyCdrom_FromCpp(pkgCdrom &cdrom, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.Cdrom` object from the :ctype:`pkgCdrom` + Create a new :class:`apt_pkg.Cdrom` object from the :c:type:`pkgCdrom` reference given by the parameter *cdrom*. If the parameter *delete* is true, *cdrom* will be deleted when the reference count of the returned object reaches 0. -.. cfunction:: pkgCdrom& PyCdrom_ToCpp(PyObject *object) +.. c:function:: pkgCdrom& PyCdrom_ToCpp(PyObject *object) - Return the :ctype:`pkgCdrom` reference contained in the Python object + Return the :c:type:`pkgCdrom` reference contained in the Python object *object*. Configuration (Configuration) ------------------------------- -.. cvar:: PyTypeObject PyConfiguration_Type +.. c:var:: PyTypeObject PyConfiguration_Type The type object for :class:`apt_pkg.Configuration` objects. -.. cfunction:: int PyConfiguration_Check(PyObject *object) +.. c:function:: int PyConfiguration_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Configuration` object, or a subclass thereof. -.. cfunction:: int PyConfiguration_CheckExact(PyObject *object) +.. c:function:: int PyConfiguration_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Configuration` object and no subclass thereof. -.. cfunction:: PyObject* PyConfiguration_FromCpp(Configuration *cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyConfiguration_FromCpp(Configuration *cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.Configuration` object from the :ctype:`Configuration` + Create a new :class:`apt_pkg.Configuration` object from the :c:type:`Configuration` pointer given by the parameter *cpp*. If the parameter *delete* is true, the object pointed to by *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* may refer to a parent object (e.g. when exposing a sub tree of a configuration object). -.. cfunction:: Configuration* PyConfiguration_ToCpp(PyObject *object) +.. c:function:: Configuration* PyConfiguration_ToCpp(PyObject *object) - Return the :ctype:`Configuration` pointer contained in the Python object + Return the :c:type:`Configuration` pointer contained in the Python object *object*. DepCache (pkgDepCache) ------------------------ -.. cvar:: PyTypeObject PyDepCache_Type +.. c:var:: PyTypeObject PyDepCache_Type The type object for :class:`apt_pkg.DepCache` objects. -.. cfunction:: int PyDepCache_Check(PyObject *object) +.. c:function:: int PyDepCache_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.DepCache` object, or a subclass thereof. -.. cfunction:: int PyDepCache_CheckExact(PyObject *object) +.. c:function:: int PyDepCache_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.DepCache` object and no subclass thereof. -.. cfunction:: PyObject* PyDepCache_FromCpp(pkgDepCache *cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyDepCache_FromCpp(pkgDepCache *cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.DepCache` object from the :ctype:`pkgDepCache` + Create a new :class:`apt_pkg.DepCache` object from the :c:type:`pkgDepCache` pointer given by the parameter *cpp*. If the parameter *delete* is true, the object pointed to by *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* must be - a PyObject of the type :cdata:`PyCache_Type`. + a PyObject of the type :c:data:`PyCache_Type`. -.. cfunction:: pkgDepCache* PyDepCache_ToCpp(PyObject *object) +.. c:function:: pkgDepCache* PyDepCache_ToCpp(PyObject *object) - Return the :ctype:`pkgDepCache` pointer contained in the Python object + Return the :c:type:`pkgDepCache` pointer contained in the Python object *object*. Dependency (pkgCache::DepIterator) ---------------------------------- -.. cvar:: PyTypeObject PyDependency_Type +.. c:var:: PyTypeObject PyDependency_Type The type object for :class:`apt_pkg.Dependency` objects. -.. cfunction:: int PyDependency_Check(PyObject *object) +.. c:function:: int PyDependency_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Dependency` object, or a subclass thereof. -.. cfunction:: int PyDependency_CheckExact(PyObject *object) +.. c:function:: int PyDependency_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Dependency` object and no subclass thereof. -.. cfunction:: PyObject* PyDependency_FromCpp(pkgCache::DepIterator &cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyDependency_FromCpp(pkgCache::DepIterator &cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.Dependency` object from the :ctype:`pkgCache::DepIterator` + Create a new :class:`apt_pkg.Dependency` object from the :c:type:`pkgCache::DepIterator` reference given by the parameter *cpp*. If the parameter *delete* is true, *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* must be - a PyObject of the type :cdata:`PyPackage_Type`. + a PyObject of the type :c:data:`PyPackage_Type`. -.. cfunction:: pkgCache::DepIterator& PyDependency_ToCpp(PyObject *object) +.. c:function:: pkgCache::DepIterator& PyDependency_ToCpp(PyObject *object) - Return the :ctype:`pkgCache::DepIterator` reference contained in the + Return the :c:type:`pkgCache::DepIterator` reference contained in the Python object *object*. Description (pkgCache::DescIterator) ------------------------------------ -.. cvar:: PyTypeObject PyDescription_Type +.. c:var:: PyTypeObject PyDescription_Type The type object for :class:`apt_pkg.Description` objects. -.. cfunction:: int PyDescription_Check(PyObject *object) +.. c:function:: int PyDescription_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Description` object, or a subclass thereof. -.. cfunction:: int PyDescription_CheckExact(PyObject *object) +.. c:function:: int PyDescription_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Description` object and no subclass thereof. -.. cfunction:: PyObject* PyDescription_FromCpp(pkgCache::DescIterator &cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyDescription_FromCpp(pkgCache::DescIterator &cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.Description` object from the :ctype:`pkgCache::DescIterator` + Create a new :class:`apt_pkg.Description` object from the :c:type:`pkgCache::DescIterator` reference given by the parameter *cpp*. If the parameter *delete* is true, *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* must be - a PyObject of the type :cdata:`PyPackage_Type`. + a PyObject of the type :c:data:`PyPackage_Type`. -.. cfunction:: pkgCache::DescIterator& PyDescription_ToCpp(PyObject *object) +.. c:function:: pkgCache::DescIterator& PyDescription_ToCpp(PyObject *object) - Return the :ctype:`pkgCache::DescIterator` reference contained in the + Return the :c:type:`pkgCache::DescIterator` reference contained in the Python object *object*. @@ -394,465 +394,465 @@ Group (pkgCache::GrpIterator) ---------------------------------- .. versionadded:: 0.8.0 -.. cvar:: PyTypeObject PyGroup_Type +.. c:var:: PyTypeObject PyGroup_Type The type object for :class:`apt_pkg.Group` objects. -.. cfunction:: int PyGroup_Check(PyObject *object) +.. c:function:: int PyGroup_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Group` object, or a subclass thereof. -.. cfunction:: int PyGroup_CheckExact(PyObject *object) +.. c:function:: int PyGroup_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Group` object and no subclass thereof. -.. cfunction:: PyObject* PyGroup_FromCpp(pkgCache::GrpIterator &cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyGroup_FromCpp(pkgCache::GrpIterator &cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.Group` object from the :ctype:`pkgCache::GrpIterator` + Create a new :class:`apt_pkg.Group` object from the :c:type:`pkgCache::GrpIterator` reference given by the parameter *cpp*. If the parameter *delete* is true, *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* should be - a PyObject of the type :cdata:`PyCache_Type`. + a PyObject of the type :c:data:`PyCache_Type`. -.. cfunction:: pkgCache::GrpIterator& PyGroup_ToCpp(PyObject *object) +.. c:function:: pkgCache::GrpIterator& PyGroup_ToCpp(PyObject *object) - Return the :ctype:`pkgCache::GrpIterator` reference contained in the + Return the :c:type:`pkgCache::GrpIterator` reference contained in the Python object *object*. Hashes (Hashes) ---------------------------------- -.. cvar:: PyTypeObject PyHashes_Type +.. c:var:: PyTypeObject PyHashes_Type The type object for :class:`apt_pkg.Hashes` objects. -.. cfunction:: int PyHashes_Check(PyObject *object) +.. c:function:: int PyHashes_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Hashes` object, or a subclass thereof. -.. cfunction:: int PyHashes_CheckExact(PyObject *object) +.. c:function:: int PyHashes_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Hashes` object and no subclass thereof. -.. cfunction:: PyObject* PyHashes_FromCpp(Hashes &cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyHashes_FromCpp(Hashes &cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.Hashes` object from the :ctype:`Hashes` + Create a new :class:`apt_pkg.Hashes` object from the :c:type:`Hashes` reference given by the parameter *cpp*. If the parameter *delete* is true, *cpp* will be deleted when the reference count of the returned object reaches 0. -.. cfunction:: Hashes& PyHashes_ToCpp(PyObject *object) +.. c:function:: Hashes& PyHashes_ToCpp(PyObject *object) - Return the :ctype:`Hashes` reference contained in the + Return the :c:type:`Hashes` reference contained in the Python object *object*. HashString (HashString) ------------------------ -.. cvar:: PyTypeObject PyHashString_Type +.. c:var:: PyTypeObject PyHashString_Type The type object for :class:`apt_pkg.HashString` objects. -.. cfunction:: int PyHashString_Check(PyObject *object) +.. c:function:: int PyHashString_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.HashString` object, or a subclass thereof. -.. cfunction:: int PyHashString_CheckExact(PyObject *object) +.. c:function:: int PyHashString_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.HashString` object and no subclass thereof. -.. cfunction:: PyObject* PyHashString_FromCpp(HashString *cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyHashString_FromCpp(HashString *cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.HashString` object from the :ctype:`HashString` + Create a new :class:`apt_pkg.HashString` object from the :c:type:`HashString` pointer given by the parameter *cpp*. If the parameter *delete* is true, the object pointed to by *cpp* will be deleted when the reference count of the returned object reaches 0. -.. cfunction:: HashString* PyHashString_ToCpp(PyObject *object) +.. c:function:: HashString* PyHashString_ToCpp(PyObject *object) - Return the :ctype:`HashString` pointer contained in the Python object + Return the :c:type:`HashString` pointer contained in the Python object *object*. IndexRecords (indexRecords) ---------------------------- -.. cvar:: PyTypeObject PyIndexRecords_Type +.. c:var:: PyTypeObject PyIndexRecords_Type The type object for :class:`apt_pkg.IndexRecords` objects. -.. cfunction:: int PyIndexRecords_Check(PyObject *object) +.. c:function:: int PyIndexRecords_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.IndexRecords` object, or a subclass thereof. -.. cfunction:: int PyIndexRecords_CheckExact(PyObject *object) +.. c:function:: int PyIndexRecords_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.IndexRecords` object and no subclass thereof. -.. cfunction:: PyObject* PyIndexRecords_FromCpp(indexRecords *cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyIndexRecords_FromCpp(indexRecords *cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.IndexRecords` object from the :ctype:`indexRecords` + Create a new :class:`apt_pkg.IndexRecords` object from the :c:type:`indexRecords` pointer given by the parameter *cpp*. If the parameter *delete* is true, the object pointed to by *cpp* will be deleted when the reference count of the returned object reaches 0. -.. cfunction:: indexRecords* PyIndexRecords_ToCpp(PyObject *object) +.. c:function:: indexRecords* PyIndexRecords_ToCpp(PyObject *object) - Return the :ctype:`indexRecords` pointer contained in the Python object + Return the :c:type:`indexRecords` pointer contained in the Python object *object*. MetaIndex (metaIndex) ------------------------ -.. cvar:: PyTypeObject PyMetaIndex_Type +.. c:var:: PyTypeObject PyMetaIndex_Type The type object for :class:`apt_pkg.MetaIndex` objects. -.. cfunction:: int PyMetaIndex_Check(PyObject *object) +.. c:function:: int PyMetaIndex_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.MetaIndex` object, or a subclass thereof. -.. cfunction:: int PyMetaIndex_CheckExact(PyObject *object) +.. c:function:: int PyMetaIndex_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.MetaIndex` object and no subclass thereof. -.. cfunction:: PyObject* PyMetaIndex_FromCpp(metaIndex *cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyMetaIndex_FromCpp(metaIndex *cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.MetaIndex` object from the :ctype:`metaIndex` + Create a new :class:`apt_pkg.MetaIndex` object from the :c:type:`metaIndex` pointer given by the parameter *cpp*. If the parameter *delete* is true, the object pointed to by *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* should be - a PyObject of the type :cdata:`PySourceList_Type`. + a PyObject of the type :c:data:`PySourceList_Type`. -.. cfunction:: metaIndex* PyMetaIndex_ToCpp(PyObject *object) +.. c:function:: metaIndex* PyMetaIndex_ToCpp(PyObject *object) - Return the :ctype:`metaIndex` pointer contained in the Python object + Return the :c:type:`metaIndex` pointer contained in the Python object *object*. Package (pkgCache::PkgIterator) ---------------------------------- -.. cvar:: PyTypeObject PyPackage_Type +.. c:var:: PyTypeObject PyPackage_Type The type object for :class:`apt_pkg.Package` objects. -.. cfunction:: int PyPackage_Check(PyObject *object) +.. c:function:: int PyPackage_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Package` object, or a subclass thereof. -.. cfunction:: int PyPackage_CheckExact(PyObject *object) +.. c:function:: int PyPackage_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Package` object and no subclass thereof. -.. cfunction:: PyObject* PyPackage_FromCpp(pkgCache::PkgIterator &cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyPackage_FromCpp(pkgCache::PkgIterator &cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.Package` object from the :ctype:`pkgCache::PkgIterator` + Create a new :class:`apt_pkg.Package` object from the :c:type:`pkgCache::PkgIterator` reference given by the parameter *cpp*. If the parameter *delete* is true, *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* should be - a PyObject of the type :cdata:`PyCache_Type`. + a PyObject of the type :c:data:`PyCache_Type`. -.. cfunction:: pkgCache::PkgIterator& PyPackage_ToCpp(PyObject *object) +.. c:function:: pkgCache::PkgIterator& PyPackage_ToCpp(PyObject *object) - Return the :ctype:`pkgCache::PkgIterator` reference contained in the + Return the :c:type:`pkgCache::PkgIterator` reference contained in the Python object *object*. PackageFile (pkgCache::PkgFileIterator) ---------------------------------------- -.. cvar:: PyTypeObject PyPackageFile_Type +.. c:var:: PyTypeObject PyPackageFile_Type The type object for :class:`apt_pkg.PackageFile` objects. -.. cfunction:: int PyPackageFile_Check(PyObject *object) +.. c:function:: int PyPackageFile_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.PackageFile` object, or a subclass thereof. -.. cfunction:: int PyPackageFile_CheckExact(PyObject *object) +.. c:function:: int PyPackageFile_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.PackageFile` object and no subclass thereof. -.. cfunction:: PyObject* PyPackageFile_FromCpp(pkgCache::PkgFileIterator &cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyPackageFile_FromCpp(pkgCache::PkgFileIterator &cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.PackageFile` object from the :ctype:`pkgCache::PkgFileIterator` + Create a new :class:`apt_pkg.PackageFile` object from the :c:type:`pkgCache::PkgFileIterator` reference given by the parameter *cpp*. If the parameter *delete* is true, *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* should be - a PyObject of the type :cdata:`PyCache_Type`. + a PyObject of the type :c:data:`PyCache_Type`. -.. cfunction:: pkgCache::PkgFileIterator& PyPackageFile_ToCpp(PyObject *object) +.. c:function:: pkgCache::PkgFileIterator& PyPackageFile_ToCpp(PyObject *object) - Return the :ctype:`pkgCache::PkgFileIterator` reference contained in the + Return the :c:type:`pkgCache::PkgFileIterator` reference contained in the Python object *object*. IndexFile (pkgIndexFile) -------------------------------------- -.. cvar:: PyTypeObject PyIndexFile_Type +.. c:var:: PyTypeObject PyIndexFile_Type The type object for :class:`apt_pkg.IndexFile` objects. -.. cfunction:: int PyIndexFile_Check(PyObject *object) +.. c:function:: int PyIndexFile_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.IndexFile` object, or a subclass thereof. -.. cfunction:: int PyIndexFile_CheckExact(PyObject *object) +.. c:function:: int PyIndexFile_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.IndexFile` object and no subclass thereof. -.. cfunction:: PyObject* PyIndexFile_FromCpp(pkgIndexFile *cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyIndexFile_FromCpp(pkgIndexFile *cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.IndexFile` object from the :ctype:`pkgIndexFile` + Create a new :class:`apt_pkg.IndexFile` object from the :c:type:`pkgIndexFile` pointer given by the parameter *cpp*. If the parameter *delete* is true, the object pointed to by *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* should be - a PyObject of the type :cdata:`PyMetaIndex_Type`. + a PyObject of the type :c:data:`PyMetaIndex_Type`. -.. cfunction:: pkgIndexFile* PyIndexFile_ToCpp(PyObject *object) +.. c:function:: pkgIndexFile* PyIndexFile_ToCpp(PyObject *object) - Return the :ctype:`pkgIndexFile` pointer contained in the Python object + Return the :c:type:`pkgIndexFile` pointer contained in the Python object *object*. OrderList (pkgOrderList) --------------------------- -.. cvar:: PyTypeObject PyOrderList_Type +.. c:var:: PyTypeObject PyOrderList_Type The type object for :class:`apt_pkg.OrderList` objects. -.. cfunction:: int PyOrderList_Check(PyObject *object) +.. c:function:: int PyOrderList_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.OrderList` object, or a subclass thereof. -.. cfunction:: int PyOrderList_CheckExact(PyObject *object) +.. c:function:: int PyOrderList_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.OrderList` object and no subclass thereof. -.. cfunction:: PyObject* PyOrderList_FromCpp(pkgOrderList *cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyOrderList_FromCpp(pkgOrderList *cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.OrderList` object from the :ctype:`pkgOrderList` + Create a new :class:`apt_pkg.OrderList` object from the :c:type:`pkgOrderList` pointer given by the parameter *cpp*. If the parameter *delete* is true, the object pointed to by *cpp* will be deleted when the reference count of the returned object reaches 0. The owner must be a :class:`apt_pkg.DepCache` object. -.. cfunction:: pkgOrderList* PyOrderList_ToCpp(PyObject *object) +.. c:function:: pkgOrderList* PyOrderList_ToCpp(PyObject *object) - Return the :ctype:`pkgOrderList` pointer contained in the Python object + Return the :c:type:`pkgOrderList` pointer contained in the Python object *object*. PackageManager (pkgPackageManager) ---------------------------------- -.. cvar:: PyTypeObject PyPackageManager_Type +.. c:var:: PyTypeObject PyPackageManager_Type The type object for :class:`apt_pkg.PackageManager` objects. -.. cfunction:: int PyPackageManager_Check(PyObject *object) +.. c:function:: int PyPackageManager_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.PackageManager` object, or a subclass thereof. -.. cfunction:: int PyPackageManager_CheckExact(PyObject *object) +.. c:function:: int PyPackageManager_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.PackageManager` object and no subclass thereof. -.. cfunction:: PyObject* PyPackageManager_FromCpp(pkgPackageManager *cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyPackageManager_FromCpp(pkgPackageManager *cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.PackageManager` object from the :ctype:`pkgPackageManager` + Create a new :class:`apt_pkg.PackageManager` object from the :c:type:`pkgPackageManager` pointer given by the parameter *cpp*. If the parameter *delete* is true, the object pointed to by *cpp* will be deleted when the reference count of the returned object reaches 0. -.. cfunction:: pkgPackageManager* PyPackageManager_ToCpp(PyObject *object) +.. c:function:: pkgPackageManager* PyPackageManager_ToCpp(PyObject *object) - Return the :ctype:`pkgPackageManager` pointer contained in the Python object + Return the :c:type:`pkgPackageManager` pointer contained in the Python object *object*. Policy (pkgPolicy) ------------------ -.. cvar:: PyTypeObject PyPolicy_Type +.. c:var:: PyTypeObject PyPolicy_Type The type object for :class:`apt_pkg.Policy` objects. -.. cfunction:: int PyPolicy_Check(PyObject *object) +.. c:function:: int PyPolicy_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Policy` object, or a subclass thereof. -.. cfunction:: int PyPolicy_CheckExact(PyObject *object) +.. c:function:: int PyPolicy_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Policy` object and no subclass thereof. -.. cfunction:: PyObject* PyPolicy_FromCpp(pkgPolicy *cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyPolicy_FromCpp(pkgPolicy *cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.Policy` object from the :ctype:`pkgPolicy` + Create a new :class:`apt_pkg.Policy` object from the :c:type:`pkgPolicy` pointer given by the parameter *cpp*. If the parameter *delete* is true, the object pointed to by *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* must be - a PyObject of the type :cdata:`PyCache_Type`. + a PyObject of the type :c:data:`PyCache_Type`. -.. cfunction:: pkgPolicy* PyPolicy_ToCpp(PyObject *object) +.. c:function:: pkgPolicy* PyPolicy_ToCpp(PyObject *object) - Return the :ctype:`pkgPolicy` pointer contained in the Python object + Return the :c:type:`pkgPolicy` pointer contained in the Python object *object*. ProblemResolver (pkgProblemResolver) -------------------------------------- -.. cvar:: PyTypeObject PyProblemResolver_Type +.. c:var:: PyTypeObject PyProblemResolver_Type The type object for :class:`apt_pkg.ProblemResolver` objects. -.. cfunction:: int PyProblemResolver_Check(PyObject *object) +.. c:function:: int PyProblemResolver_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.ProblemResolver` object, or a subclass thereof. -.. cfunction:: int PyProblemResolver_CheckExact(PyObject *object) +.. c:function:: int PyProblemResolver_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.ProblemResolver` object and no subclass thereof. -.. cfunction:: PyObject* PyProblemResolver_FromCpp(pkgProblemResolver *cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyProblemResolver_FromCpp(pkgProblemResolver *cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.ProblemResolver` object from the :ctype:`pkgProblemResolver` + Create a new :class:`apt_pkg.ProblemResolver` object from the :c:type:`pkgProblemResolver` pointer given by the parameter *cpp*. If the parameter *delete* is true, the object pointed to by *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* must be - a PyObject of the type :cdata:`PyDepCache_Type`. + a PyObject of the type :c:data:`PyDepCache_Type`. -.. cfunction:: pkgProblemResolver* PyProblemResolver_ToCpp(PyObject *object) +.. c:function:: pkgProblemResolver* PyProblemResolver_ToCpp(PyObject *object) - Return the :ctype:`pkgProblemResolver` pointer contained in the Python object + Return the :c:type:`pkgProblemResolver` pointer contained in the Python object *object*. SourceList (pkgSourceList) --------------------------- -.. cvar:: PyTypeObject PySourceList_Type +.. c:var:: PyTypeObject PySourceList_Type The type object for :class:`apt_pkg.SourceList` objects. -.. cfunction:: int PySourceList_Check(PyObject *object) +.. c:function:: int PySourceList_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.SourceList` object, or a subclass thereof. -.. cfunction:: int PySourceList_CheckExact(PyObject *object) +.. c:function:: int PySourceList_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.SourceList` object and no subclass thereof. -.. cfunction:: PyObject* PySourceList_FromCpp(pkgSourceList *cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PySourceList_FromCpp(pkgSourceList *cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.SourceList` object from the :ctype:`pkgSourceList` + Create a new :class:`apt_pkg.SourceList` object from the :c:type:`pkgSourceList` pointer given by the parameter *cpp*. If the parameter *delete* is true, the object pointed to by *cpp* will be deleted when the reference count of the returned object reaches 0. -.. cfunction:: pkgSourceList* PySourceList_ToCpp(PyObject *object) +.. c:function:: pkgSourceList* PySourceList_ToCpp(PyObject *object) - Return the :ctype:`pkgSourceList` pointer contained in the Python object + Return the :c:type:`pkgSourceList` pointer contained in the Python object *object*. TagFile (pkgTagFile) ---------------------------------- -.. cvar:: PyTypeObject PyTagFile_Type +.. c:var:: PyTypeObject PyTagFile_Type The type object for :class:`apt_pkg.TagFile` objects. -.. cfunction:: int PyTagFile_Check(PyObject *object) +.. c:function:: int PyTagFile_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.TagFile` object, or a subclass thereof. -.. cfunction:: int PyTagFile_CheckExact(PyObject *object) +.. c:function:: int PyTagFile_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.TagFile` object and no subclass thereof. -.. cfunction:: PyObject* PyTagFile_FromCpp(pkgTagFile &cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyTagFile_FromCpp(pkgTagFile &cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.TagFile` object from the :ctype:`pkgTagFile` + Create a new :class:`apt_pkg.TagFile` object from the :c:type:`pkgTagFile` reference given by the parameter *cpp*. If the parameter *delete* is true, *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* may be any Python object. -.. cfunction:: pkgTagFile& PyTagFile_ToCpp(PyObject *object) +.. c:function:: pkgTagFile& PyTagFile_ToCpp(PyObject *object) - Return the :ctype:`pkgTagFile` reference contained in the + Return the :c:type:`pkgTagFile` reference contained in the Python object *object*. TagSection (pkgTagSection) ---------------------------------- -.. cvar:: PyTypeObject PyTagSection_Type +.. c:var:: PyTypeObject PyTagSection_Type The type object for :class:`apt_pkg.TagSection` objects. -.. cfunction:: int PyTagSection_Check(PyObject *object) +.. c:function:: int PyTagSection_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.TagSection` object, or a subclass thereof. -.. cfunction:: int PyTagSection_CheckExact(PyObject *object) +.. c:function:: int PyTagSection_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.TagSection` object and no subclass thereof. -.. cfunction:: PyObject* PyTagSection_FromCpp(pkgTagSection &cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyTagSection_FromCpp(pkgTagSection &cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.TagSection` object from the :ctype:`pkgTagSection` + Create a new :class:`apt_pkg.TagSection` object from the :c:type:`pkgTagSection` reference given by the parameter *cpp*. If the parameter *delete* is true, *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* may be - a PyObject of the type :cdata:`PyTagFile_Type`. + a PyObject of the type :c:data:`PyTagFile_Type`. -.. cfunction:: pkgTagSection& PyTagSection_ToCpp(PyObject *object) +.. c:function:: pkgTagSection& PyTagSection_ToCpp(PyObject *object) - Return the :ctype:`pkgTagSection` reference contained in the + Return the :c:type:`pkgTagSection` reference contained in the Python object *object*. Version (pkgCache::VerIterator) ---------------------------------- -.. cvar:: PyTypeObject PyVersion_Type +.. c:var:: PyTypeObject PyVersion_Type The type object for :class:`apt_pkg.Version` objects. -.. cfunction:: int PyVersion_Check(PyObject *object) +.. c:function:: int PyVersion_Check(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Version` object, or a subclass thereof. -.. cfunction:: int PyVersion_CheckExact(PyObject *object) +.. c:function:: int PyVersion_CheckExact(PyObject *object) Check that the object *object* is an :class:`apt_pkg.Version` object and no subclass thereof. -.. cfunction:: PyObject* PyVersion_FromCpp(pkgCache::VerIterator &cpp, bool delete, PyObject *owner) +.. c:function:: PyObject* PyVersion_FromCpp(pkgCache::VerIterator &cpp, bool delete, PyObject *owner) - Create a new :class:`apt_pkg.Version` object from the :ctype:`pkgCache::VerIterator` + Create a new :class:`apt_pkg.Version` object from the :c:type:`pkgCache::VerIterator` reference given by the parameter *cpp*. If the parameter *delete* is true, *cpp* will be deleted when the reference count of the returned object reaches 0. The parameter *owner* must be - a PyObject of the type :cdata:`PyPackage_Type`. + a PyObject of the type :c:data:`PyPackage_Type`. -.. cfunction:: pkgCache::VerIterator& PyVersion_ToCpp(PyObject *object) +.. c:function:: pkgCache::VerIterator& PyVersion_ToCpp(PyObject *object) - Return the :ctype:`pkgCache::VerIterator` reference contained in the + Return the :c:type:`pkgCache::VerIterator` reference contained in the Python object *object*. diff --git a/doc/source/c++/embedding.rst b/doc/source/c++/embedding.rst index 754ad398..445e9c6f 100644 --- a/doc/source/c++/embedding.rst +++ b/doc/source/c++/embedding.rst @@ -12,7 +12,7 @@ To use the python-apt C++ bindings, first include the #include <python-apt/python-apt.h> Now, the module needs to be initialized. This is done by calling the function -:cfunc:`import_apt_pkg`. This function returns 0 on success and a negative +:c:func:`import_apt_pkg`. This function returns 0 on success and a negative value in case of failure:: if (import_apt_pkg() < 0) diff --git a/doc/source/conf.py b/doc/source/conf.py index 8fbf2c11..c4dde305 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -26,18 +26,16 @@ if os.path.exists("../../build"): sys.path.insert(0, os.path.abspath(os.path.dirname(apt_pkg_path))) try: import apt_pkg + apt_pkg # pyflakes except ImportError as exc: # Not the correct version sys.stderr.write('W: Ignoring error %s\n' % exc) sys.path.pop(0) else: sys.stdout.write('I: Found apt_pkg.so in %s\n' % sys.path[0]) - # Hack: Disable compatibility mode - apt_pkg._COMPAT_0_7 = 0 break - # General configuration # --------------------- @@ -69,7 +67,7 @@ copyright = u'2009-2010, Julian Andres Klode <jak@debian.org>' # try: - release=os.environ['DEBVER'] + release = os.environ['DEBVER'] except KeyError: from subprocess import Popen, PIPE p1 = Popen(["dpkg-parsechangelog", "-l../../debian/changelog"], @@ -77,13 +75,15 @@ except KeyError: p2 = Popen(["sed", "-n", 's/^Version: //p'], stdin=p1.stdout, stdout=PIPE) release = p2.communicate()[0] +if sys.version_info.major >= 3: + release = release.decode("utf-8") # Handle the alpha release scheme release_raw = "0" for c in release.split("~")[0].split(".")[2]: if not c.isdigit(): break release_raw += c - + if int(release_raw) >= 90: version_s = release.split("~")[0].split(".")[:3] # Set the version to 0.X.100 if the release is 0.X.9Y (0.7.90 => 0.7.100) @@ -95,7 +95,7 @@ if int(release_raw) >= 90: version = '.'.join(version_s) del version_s else: - version = '.'.join(release.split("~")[0].split('.')[:3]) + version = '.'.join(release.split("~")[0].split('.')[:2]) del release_raw # The language for content autogenerated by Sphinx. Refer to documentation @@ -164,7 +164,7 @@ html_static_path = ['.static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -html_last_updated_fmt = '%b %d, %Y' +html_last_updated_fmt = None # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. @@ -213,8 +213,8 @@ htmlhelp_basename = 'python-aptdoc' # Grouping the document tree into LaTeX files. List of tuples # (source index, target name, title, author, document class [howto/manual]). latex_documents = [ - ('contents', 'python-apt.tex', ur'python-apt Documentation', - ur'Julian Andres Klode <jak@debian.org>', 'manual'), + ('contents', 'python-apt.tex', u'python-apt Documentation', + u'Julian Andres Klode <jak@debian.org>', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of diff --git a/doc/source/contents.rst b/doc/source/contents.rst index 3c9fb511..6c4e161d 100644 --- a/doc/source/contents.rst +++ b/doc/source/contents.rst @@ -16,5 +16,4 @@ Indices and tables ================== * :ref:`genindex` -* :ref:`modindex` * :ref:`search` diff --git a/doc/source/examples/apt-gtk.py b/doc/source/examples/apt-gtk.py deleted file mode 100644 index ad46454e..00000000 --- a/doc/source/examples/apt-gtk.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/python -"""Example for gtk widgets""" -import pygtk -pygtk.require("2.0") -import gtk - -import apt.progress.gtk2 - - -def main(): - """Main function.""" - win = gtk.Window() - win.connect("destroy", gtk.main_quit) - progress = apt.progress.gtk2.GtkAptProgress() - win.set_title("GtkAptProgress Demo") - win.add(progress) - progress.show() - win.show() - cache = apt.cache.Cache(progress.open) - if cache["xterm"].is_installed: - cache["xterm"].mark_delete() - else: - cache["xterm"].mark_install() - progress.show_terminal(expanded=True) - cache.commit(progress.fetch, progress.install) - gtk.main() - -if __name__ == "__main__": - main() diff --git a/doc/source/examples/cache-pkgfile.py b/doc/source/examples/cache-pkgfile.py index f4cc2e66..10216c19 100644 --- a/doc/source/examples/cache-pkgfile.py +++ b/doc/source/examples/cache-pkgfile.py @@ -8,7 +8,7 @@ def main(): cache = apt_pkg.Cache() for pkgfile in cache.file_list: print 'Package-File:', pkgfile.filename - print 'Index-Type:', pkgfile.index_type # 'Debian Package Index' + print 'Index-Type:', pkgfile.index_type # 'Debian Package Index' if pkgfile.not_source: print 'Source: None' else: diff --git a/doc/source/examples/dpkg-info.py b/doc/source/examples/dpkg-info.py index 6be8595c..af220590 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 deb_extract_control +from apt_inst import DebFile def main(): @@ -12,7 +12,7 @@ def main(): sys.exit(0) fobj = open(sys.argv[1]) try: - print deb_extract_control(fobj, sys.argv[2]) + print DebFile(fobj).control.extractdata(sys.argv[2]) finally: fobj.close() diff --git a/doc/source/examples/missing-deps.py b/doc/source/examples/missing-deps.py index 7af18128..b9ccdc19 100644 --- a/doc/source/examples/missing-deps.py +++ b/doc/source/examples/missing-deps.py @@ -43,7 +43,7 @@ def main(): # Check every version for pfile, _ in version.file_list: if (pfile.origin == "Debian" and pfile.component == "main" and - pfile.archive == "unstable"): + pfile.archive == "unstable"): # We only want packages from Debian unstable main. check_version(version) break diff --git a/doc/source/library/apt.package.rst b/doc/source/library/apt.package.rst index 01a26973..1a69c1e2 100644 --- a/doc/source/library/apt.package.rst +++ b/doc/source/library/apt.package.rst @@ -23,26 +23,8 @@ The Version class Dependency Information ---------------------- -.. class:: BaseDependency - - The :class:`BaseDependency` class defines various attributes for accessing - the parts of a dependency. The attributes are as follows: - - .. attribute:: name - - The name of the dependency - - .. attribute:: relation - - The relation (>,>=,==,<,<=,) - - .. attribute:: version - - The version or None. - - .. attribute:: pre_depend - - Boolean value whether this is a pre-dependency. +.. autoclass:: BaseDependency + :members: .. class:: Dependency diff --git a/doc/source/library/apt.progress.gtk2.rst b/doc/source/library/apt.progress.gtk2.rst deleted file mode 100644 index 0d53ad41..00000000 --- a/doc/source/library/apt.progress.gtk2.rst +++ /dev/null @@ -1,131 +0,0 @@ -:mod:`apt.progress.gtk2` --- Progress reporting for GTK+ interfaces -=================================================================== -.. module:: apt.progress.gtk2 - -The :mod:`apt.progress.gtk2` module provides classes with GObject signals and -a class with a GTK+ widget for progress handling. - - -GObject progress classes -------------------------- -.. class:: GInstallProgress - - An implementation of :class:`apt.progress.base.InstallProgress` supporting - GObject signals. The class emits the following signals: - - .. describe:: status-changed(status: str, percent: int) - - Emitted when the status of an operation changed. - - .. describe:: status-started() - - Emitted when the installation started. - - .. describe:: status-finished() - - Emitted when the installation finished. - - .. describe:: status-timeout() - - Emitted when a timeout happens - - .. describe:: status-error() - - Emitted in case of an error. - - .. describe:: status-conffile() - - Emitted when a conffile update is happening. - - -.. class:: GAcquireProgress - - An implementation of :class:`apt.progress.base.AcquireProgress` supporting - GObject signals. The class emits the following signals: - - .. describe:: status-changed(description: str, percent: int) - - Emitted when the status of the fetcher changed, e.g. when the - percentage increased. - - .. describe:: status-started() - - Emitted when the fetcher starts to fetch. - - .. describe:: status-finished() - - Emitted when the fetcher finished. - - -.. class:: GDpkgInstallProgress - - An implementation of :class:`apt.progress.base.InstallProgress` supporting - GObject signals. This is the same as :class:`GInstallProgress` and is thus - completely deprecated. - -.. class:: GOpProgress - - An implementation of :class:`apt.progress.old.FetchProgress` supporting - GObject signals. The class emits the following signals: - - .. describe:: status-changed(operation: str, percent: int) - - Emitted when the status of an operation changed. - - .. describe:: status-started() - - Emitted when it starts - Not implemented yet. - - .. describe:: status-finished() - - Emitted when all operations have finished. - -GTK+ Widget ------------ -.. class:: GtkAptProgress - - Graphical progress for installation/fetch/operations, providing - a progress bar, a terminal and a status bar for showing the progress - of package manipulation tasks. - - .. method:: cancel_download() - - Cancel a currently running download. - - .. method:: clear() - - Reset all status information. - - .. attribute:: dpkg_install - - Return the install progress handler for dpkg. - - .. attribute:: fetch - - Return the fetch progress handler. - - .. method:: hide_terminal() - - Hide the expander with the terminal widget. - - .. attribute:: install - - Return the install progress handler. - - .. attribute:: open - - Return the cache opening progress handler. - - .. method:: show() - - Show the Box - - .. method:: show_terminal(expanded=False) - - Show an expander with a terminal widget which provides a way to - interact with dpkg. - - -Example -------- -.. literalinclude:: ../examples/apt-gtk.py diff --git a/doc/source/library/apt_pkg.rst b/doc/source/library/apt_pkg.rst index 7a359652..c704db3b 100644 --- a/doc/source/library/apt_pkg.rst +++ b/doc/source/library/apt_pkg.rst @@ -487,7 +487,7 @@ Installation ordering with :class:`OrderList` .. class:: OrderList(depcache: DepCache) - Represent a :ctype:`pkgOrderList`, used for installation + Represent a :c:type:`pkgOrderList`, used for installation ordering. This class provides several methods and attributes, is complicated and should not be used by normal programs. @@ -715,7 +715,7 @@ Resolving Dependencies with :class:`ProblemResolver` The version currently installed as a :class:`Version` object, or None if the package is not installed. - .. method:: get_fullname([pretty: bool = False]) -> str + .. method:: get_fullname([pretty: bool = False]) -> str Get the full name of the package, including the architecture. If *pretty* is ``True``, the architecture is omitted for native packages, @@ -723,7 +723,7 @@ Resolving Dependencies with :class:`ProblemResolver` .. versionadded:: 0.7.100.3 - .. attribute:: has_provides + .. attribute:: has_provides A boolean value determining whether the list available via the attribute :attr:`provides_list` has at least one element. This @@ -733,7 +733,7 @@ Resolving Dependencies with :class:`ProblemResolver` pkg.has_provides and not pkg.has_versions - .. attribute:: has_versions + .. attribute:: has_versions A boolean value determining whether the list available via the attribute :attr:`version_list` has at least one element. This @@ -787,6 +787,11 @@ Resolving Dependencies with :class:`ProblemResolver` The section of the package, as specified in the record. The list of possible sections is defined in the Policy. This is a string. + .. deprecated:: 1.0 + + A package can have multiple versions with different sections, so + the section information should be accessed from the version class. + .. attribute:: version_list A list of :class:`Version` objects for all versions of this package @@ -815,13 +820,6 @@ Resolving Dependencies with :class:`ProblemResolver` **Flags**: - .. attribute:: auto - - This flag is here for compatibility purposes and does not appear to - be used anymore in APT. To find out whether a package is marked as - automatically installed, use :meth:`DepCache.is_auto_installed` - instead. - .. attribute:: essential Whether the package has the 'Essential' flag set; that is, @@ -916,7 +914,7 @@ Example: The multi-arch state of the package. Can be one of the following attributes. - .. attribute:: MULTI_ARCH_NONE + .. attribute:: MULTI_ARCH_NO No multi-arch @@ -1022,7 +1020,8 @@ Example: .. attribute:: comp_type - The type of comparison (>=, ==, >>, <=), as string. + The type of comparison (<,<=,=,!=,>=,>,), as string. Note that the + empty string is a valid string as well, if no version is specified. .. attribute:: dep_type @@ -1353,10 +1352,10 @@ Records (Release files, Packages, Sources) Example (shortened):: - cand = depcache.GetCandidateVer(cache['python-apt']) - records.Lookup(cand.FileList[0]) + cand = depcache.get_candidate_ver(cache['python-apt']) + records.lookup(cand.file_list[0]) # Now you can access the record - print records.SourcePkg # == python-apt + print records.source_pkg # == python-apt .. attribute:: filename @@ -1480,6 +1479,8 @@ Records (Release files, Packages, Sources) ``(str: md5, int: size, str: path, str:type)``, where 'type' can be 'diff' (includes .debian.tar.gz), 'dsc', 'tar'. + .. deprecated: 1.0 + .. attribute:: index A list of :class:`IndexFile` objects associated with this @@ -1533,8 +1534,7 @@ installation. The constructor takes an optional parameter *progress* which takes an :class:`apt.progress.base.AcquireProgress` object. This object may then report progress information (see :mod:`apt.progress.text` for reporting - progress to a I/O stream and :mod:`apt.progress.gtk2` for GTK+ progress - reporting). + progress to a I/O stream). Acquire items have two methods to start and stop the fetching: @@ -1599,8 +1599,12 @@ installation. .. attribute:: RESULT_CONTINUE - All items have been fetched successfully and the process has not been - canceled. + All items have been fetched successfully or failed transiently + and the process has not been canceled. + + You need to look at the status of each item and check if it has not + failed transiently to discover errors like a Not Found when acquiring + packages. .. attribute:: RESULT_FAILED @@ -1703,7 +1707,7 @@ installation. There was a network error. -.. class:: AcquireFile(owner, uri[, md5, size, descr, short_descr, destdir, destfile]) +.. class:: AcquireFile(owner, uri[, hash, size, descr, short_descr, destdir, destfile]) Create a new :class:`AcquireFile()` object and register it with *acquire*, so it will be fetched. You must always keep around a reference to the @@ -1716,8 +1720,9 @@ installation. The parameter *uri* refers to the location of the file, any protocol of apt is supported. - The parameter *md5* refers to the md5sum of the file. This can be used - for checking the file. + The parameter *hash* refers to the hash of the file. If this is set + libapt will check the file after downloading. See :class:`HashString` + for the combined form string format description. The parameter *size* can be used to specify the size of the package, which can then be used to calculate the progress and validate the download. @@ -1849,8 +1854,8 @@ generic hash support: .. attribute:: hashtype - The type of the hash, as a string. This may be "MD5Sum", "SHA1" - or "SHA256". + The type of the hash, as a string. This may be "MD5Sum", "SHA1", + "SHA256" or "SHA512". .. method:: verify_file(filename: str) -> bool @@ -1907,16 +1912,38 @@ section as a string. .. class:: TagFile(file, bytes: bool = False) An object which represents a typical debian control file. Can be used for - Packages, Sources, control, Release, etc. Such an object provides two - kinds of API which should not be used together: + Packages, Sources, control, Release, etc. + + The *file* argument shall be a path name or an open file object. The + argument *bytes* specifies whether the file shall be represented using + bytes (``True``) or unicode (``False``) strings. + + It is a context manager that can be used with a with statement or the + :meth:`close` method. + + .. describe:: with TagFile(...) as ...: + + Use the :class:`TagFile` as a context manager. This will automatically + close the file after the body finished execution. + + .. versionadded:: 1.0 + + .. method:: close() + + Close the file. It's recommended to use the context manager + instead (that is, the `with` statement). + + .. versionadded:: 1.0 + + It provides two kinds of API which should not be used together: The first API implements the iterator protocol and should be used whenever possible because it has less side effects than the other one. It may be used e.g. with a for loop:: - tagf = apt_pkg.TagFile(open('/var/lib/dpkg/status')) - for section in tagfile: - print section['Package'] + with apt_pkg.TagFile('/var/lib/dpkg/status') as tagfile: + for section in tagfile: + print section['Package'] .. versionchanged:: 0.7.100 Added support for using gzip files, via :class:`gzip.GzipFile` or any @@ -1942,9 +1969,9 @@ section as a string. use less memory, but is not recommended because it works by modifying one object. It can be used like this:: - tagf = apt_pkg.TagFile(open('/var/lib/dpkg/status')) - tagf.step() - print tagf.section['Package'] + with apt_pkg.TagFile('/var/lib/dpkg/status') as tagf: + tagf.step() + print tagf.section['Package'] .. method:: step() -> bool diff --git a/doc/source/library/index.rst b/doc/source/library/index.rst index 70e91f84..0b048c80 100644 --- a/doc/source/library/index.rst +++ b/doc/source/library/index.rst @@ -10,9 +10,9 @@ When going through the library, the first two modules are :mod:`apt_pkg` and apt-pkg and apt-inst libraries and the base for the rest of python-apt. Going forward, the :mod:`apt` package appears. This package is using -:mod:`apt_pkg` and :mod`apt_inst` to provide easy to use ways to manipulate +:mod:`apt_pkg` and :mod:`apt_inst` to provide easy to use ways to manipulate the cache, fetch packages, or install new packages. It also provides useful -progress classes, for text and GTK+ interfaces. The last package is +progress classes, currently only for text interfaces. The last package is :mod:`aptsources`. The aptsources package provides classes and functions to read files like :file:`/etc/apt/sources.list` and to modify them. @@ -28,7 +28,6 @@ read files like :file:`/etc/apt/sources.list` and to modify them. apt.package apt.progress.base apt.progress.text - apt.progress.gtk2 aptsources.distinfo aptsources.distro diff --git a/doc/source/templates/indexcontent.html b/doc/source/templates/indexcontent.html index 394b46d5..b1395816 100644 --- a/doc/source/templates/indexcontent.html +++ b/doc/source/templates/indexcontent.html @@ -35,7 +35,7 @@ <p><strong>Indices and tables:</strong></p> <table class="contentstable" align="center"><tr> <td width="50%"> - <p class="biglink"><a class="biglink" href="{{ pathto("modindex") }}">Global Module Index</a><br/> + <p class="biglink"><a class="biglink" href="{{ pathto("py-modindex") }}">Global Module Index</a><br/> <span class="linkdescr">quick access to all modules</span></p> <p class="biglink"><a class="biglink" href="{{ pathto("genindex") }}">General Index</a><br/> <span class="linkdescr">all functions, classes, terms</span></p> diff --git a/doc/source/templates/layout.html b/doc/source/templates/layout.html index 60298719..04a3e0d4 100644 --- a/doc/source/templates/layout.html +++ b/doc/source/templates/layout.html @@ -1,10 +1,4 @@ {% extends "!layout.html" %} {% block rootrellink %} - <li><img src="{{ pathto('_static/py.png', 1) }}" alt="" - style="vertical-align: middle; margin-top: -1px"/></li> <li><a href="{{ pathto('index') }}">{{ shorttitle }}</a>{{ reldelim1 }}</li> {% endblock %} -{% block extrahead %} - <link rel="shortcut icon" type="image/png" href="{{ pathto('_static/py.png', 1) }}" /> -{{ super() }} -{% endblock %} diff --git a/doc/source/tutorials/apt-get.rst b/doc/source/tutorials/apt-get.rst index 3bac473b..f8dd0895 100644 --- a/doc/source/tutorials/apt-get.rst +++ b/doc/source/tutorials/apt-get.rst @@ -11,7 +11,7 @@ by the :command:`apt-get` command. Printing the URIs of all index files ------------------------------------ We all now that we can print the URIs of all our index files by running a -simple ``apt-get -s --print-uris update``. We can do the same. Responsible for +simple ``apt-get --print-uris update``. We can do the same. Responsible for the source entries is the class :class:`apt_pkg.SourceList`, which can be combined with an :class:`apt_pkg.Acquire` object using :meth:`get_indexes`. diff --git a/doc/source/whatsnew/0.9.4.rst b/doc/source/whatsnew/0.9.4.rst new file mode 100644 index 00000000..617ef08f --- /dev/null +++ b/doc/source/whatsnew/0.9.4.rst @@ -0,0 +1,17 @@ +What's New In python-apt 0.9.4 +============================== +Python-apt 0.9.4 is a maintenance update. + +New features +------------ + + * Support for apt_pkg.sha512sum() + * Support for apt_pkg.maybe_open_clear_signed_file() + * Use apt_pkg.open_maybe_clear_signed_file() when opening a .dsc file + * add MULTI_ARCH_NO constant (MULTI_ARCH_NONE is deprecated) + +Maintenance +----------- + + * Add Ubuntu Wily + * Update examples diff --git a/doc/source/whatsnew/1.0.rst b/doc/source/whatsnew/1.0.rst new file mode 100644 index 00000000..ab59f1a7 --- /dev/null +++ b/doc/source/whatsnew/1.0.rst @@ -0,0 +1,53 @@ +What's New In python-apt 1.0 +============================== +Python-Apt 1.0 fixes several issues and use of deprecated methods. Most +importantly, it introduces large file support + +New features +------------ +* :class:`apt_pkg.AcquireFile` can now take a hash string that is not an + md5 value, using the new `hash` argument. +* A new a :meth:`apt_pkg.TagFile.close` method was added +* :class:`apt_pkg.TagFile` is now a context manager + +* The high-level cache class, :class:`apt.cache.Cache` and it's companion + :class:`apt.cache.FilteredCache` now support package + names with special architecture qualifiers such as :all and :native. + +* The method :meth:`apt.cache.Cache.connect2` allows connecting callbacks on + cache changes that take the cache as their first argument, reducing the + potential for reference cycles. + +Deprecated +---------- +The following features are deprecated, starting with this release: + +* The `section` member of :class:`apt_pkg.Package` +* The `files` member of of :class:`apt_pkg.SourceRecords` +* The `md5` argument to :class:`apt_pkg.AcquireFile`, it is replaced by + the `hash` argument. +* The method :meth:`apt.cache.Cache.connect` has been deprecated. It is + replaced by :meth:`apt.cache.Cache.connect2` which is more flexible and + less prone to reference cycles. + +Removed +------- +* The module :mod:`apt.progress.gtk2` has been removed. There were no + users in the Debian archive, its last update was in 2013, and it was buggy + already. Apart from that, it suggested that it is OK to run a graphical + application as root, and used the unmaintained GTK+ 2 version. + + Therefore, there is no replacement, please use PackageKit or aptdaemon + for installation in graphical environments. +* The attribute :attr:`apt_pkg.Package.auto` was not set anymore, and thus + removed. + +Maintenance +----------- +* The classes :class:`apt.cache.Cache` and :class:`apt.cache.FilteredCache` no + longer store cyclic references to/between them. This fixes a huge issue, + because a cache can have tens of open file descriptors, causing the maximum + of file descriptors to be reached easily. + +* :mod:`apt_inst` now supports ar and tar archives that are larger than 4 GiB +* Various smaller bug fixes |
