diff options
Diffstat (limited to 'python/depcache.cc')
| -rw-r--r-- | python/depcache.cc | 240 |
1 files changed, 171 insertions, 69 deletions
diff --git a/python/depcache.cc b/python/depcache.cc index 8b4e02b5..cd098f2f 100644 --- a/python/depcache.cc +++ b/python/depcache.cc @@ -157,18 +157,18 @@ static PyObject *PkgDepCacheCommit(PyObject *Self,PyObject *Args) // fail if something else went wrong //FIXME: make this more flexible, e.g. with a failedDl handler if(Failed) - return Py_BuildValue("b", false); + Py_RETURN_FALSE; _system->UnLock(true); pkgPackageManager::OrderResult Res = iprogress.Run(PM); //std::cout << "iprogress.Run() returned: " << (int)Res << std::endl; if (Res == pkgPackageManager::Failed || _error->PendingError() == true) { - return HandleErrors(Py_BuildValue("b", false)); + return HandleErrors(PyBool_FromLong(false)); } if (Res == pkgPackageManager::Completed) { //std::cout << "iprogress.Run() returned Completed " << std::endl; - return Py_BuildValue("b", true); + Py_RETURN_TRUE; } //std::cout << "looping again, install unfinished" << std::endl; @@ -176,7 +176,7 @@ static PyObject *PkgDepCacheCommit(PyObject *Self,PyObject *Args) // Reload the fetcher object and loop again for media swapping Fetcher.Shutdown(); if (PM->GetArchives(&Fetcher,&List,&Recs) == false) { - return Py_BuildValue("b", false); + Py_RETURN_FALSE; } _system->Lock(); } @@ -196,11 +196,11 @@ static PyObject *PkgDepCacheSetCandidateVer(PyObject *Self,PyObject *Args) pkgCache::VerIterator &I = GetCpp<pkgCache::VerIterator>(VersionObj); if(I.end()) { - return HandleErrors(Py_BuildValue("b",false)); + return HandleErrors(PyBool_FromLong(false)); } depcache->SetCandidateVersion(I); - return HandleErrors(Py_BuildValue("b",true)); + return HandleErrors(PyBool_FromLong(true)); } static PyObject *PkgDepCacheGetCandidateVer(PyObject *Self,PyObject *Args) @@ -241,7 +241,7 @@ static PyObject *PkgDepCacheUpgrade(PyObject *Self,PyObject *Args) Py_END_ALLOW_THREADS Py_INCREF(Py_None); - return HandleErrors(Py_BuildValue("b",res)); + return HandleErrors(PyBool_FromLong(res)); } static PyObject *PkgDepCacheMinimizeUpgrade(PyObject *Self,PyObject *Args) @@ -257,7 +257,7 @@ static PyObject *PkgDepCacheMinimizeUpgrade(PyObject *Self,PyObject *Args) Py_END_ALLOW_THREADS Py_INCREF(Py_None); - return HandleErrors(Py_BuildValue("b",res)); + return HandleErrors(PyBool_FromLong(res)); } @@ -291,7 +291,7 @@ static PyObject *PkgDepCacheFixBroken(PyObject *Self,PyObject *Args) res &=pkgFixBroken(*depcache); res &=pkgMinimizeUpgrade(*depcache); - return HandleErrors(Py_BuildValue("b",res)); + return HandleErrors(PyBool_FromLong(res)); } @@ -380,7 +380,6 @@ static PyObject *PkgDepCacheMarkAuto(PyObject *Self,PyObject *Args) return HandleErrors(Py_None); } - static PyObject *PkgDepCacheIsUpgradable(PyObject *Self,PyObject *Args) { pkgDepCache *depcache = GetCpp<pkgDepCache *>(Self); @@ -392,7 +391,7 @@ static PyObject *PkgDepCacheIsUpgradable(PyObject *Self,PyObject *Args) pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(PackageObj); pkgDepCache::StateCache &state = (*depcache)[Pkg]; - return HandleErrors(Py_BuildValue("b",state.Upgradable())); + return HandleErrors(PyBool_FromLong(state.Upgradable())); } static PyObject *PkgDepCacheIsGarbage(PyObject *Self,PyObject *Args) @@ -406,7 +405,7 @@ static PyObject *PkgDepCacheIsGarbage(PyObject *Self,PyObject *Args) pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(PackageObj); pkgDepCache::StateCache &state = (*depcache)[Pkg]; - return HandleErrors(Py_BuildValue("b",state.Garbage)); + return HandleErrors(PyBool_FromLong(state.Garbage)); } static PyObject *PkgDepCacheIsAutoInstalled(PyObject *Self,PyObject *Args) @@ -420,7 +419,7 @@ static PyObject *PkgDepCacheIsAutoInstalled(PyObject *Self,PyObject *Args) pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(PackageObj); pkgDepCache::StateCache &state = (*depcache)[Pkg]; - return HandleErrors(Py_BuildValue("b",state.Flags & pkgCache::Flag::Auto)); + return HandleErrors(PyBool_FromLong(state.Flags & pkgCache::Flag::Auto)); } static PyObject *PkgDepCacheIsNowBroken(PyObject *Self,PyObject *Args) @@ -434,7 +433,7 @@ static PyObject *PkgDepCacheIsNowBroken(PyObject *Self,PyObject *Args) pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(PackageObj); pkgDepCache::StateCache &state = (*depcache)[Pkg]; - return HandleErrors(Py_BuildValue("b",state.NowBroken())); + return HandleErrors(PyBool_FromLong(state.NowBroken())); } static PyObject *PkgDepCacheIsInstBroken(PyObject *Self,PyObject *Args) @@ -448,7 +447,7 @@ static PyObject *PkgDepCacheIsInstBroken(PyObject *Self,PyObject *Args) pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(PackageObj); pkgDepCache::StateCache &state = (*depcache)[Pkg]; - return HandleErrors(Py_BuildValue("b",state.InstBroken())); + return HandleErrors(PyBool_FromLong(state.InstBroken())); } @@ -463,7 +462,7 @@ static PyObject *PkgDepCacheMarkedInstall(PyObject *Self,PyObject *Args) pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(PackageObj); pkgDepCache::StateCache &state = (*depcache)[Pkg]; - return HandleErrors(Py_BuildValue("b",state.NewInstall())); + return HandleErrors(PyBool_FromLong(state.NewInstall())); } @@ -478,7 +477,7 @@ static PyObject *PkgDepCacheMarkedUpgrade(PyObject *Self,PyObject *Args) pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(PackageObj); pkgDepCache::StateCache &state = (*depcache)[Pkg]; - return HandleErrors(Py_BuildValue("b",state.Upgrade())); + return HandleErrors(PyBool_FromLong(state.Upgrade())); } static PyObject *PkgDepCacheMarkedDelete(PyObject *Self,PyObject *Args) @@ -492,7 +491,7 @@ static PyObject *PkgDepCacheMarkedDelete(PyObject *Self,PyObject *Args) pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(PackageObj); pkgDepCache::StateCache &state = (*depcache)[Pkg]; - return HandleErrors(Py_BuildValue("b",state.Delete())); + return HandleErrors(PyBool_FromLong(state.Delete())); } static PyObject *PkgDepCacheMarkedKeep(PyObject *Self,PyObject *Args) @@ -506,7 +505,7 @@ static PyObject *PkgDepCacheMarkedKeep(PyObject *Self,PyObject *Args) pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(PackageObj); pkgDepCache::StateCache &state = (*depcache)[Pkg]; - return HandleErrors(Py_BuildValue("b",state.Keep())); + return HandleErrors(PyBool_FromLong(state.Keep())); } static PyObject *PkgDepCacheMarkedDowngrade(PyObject *Self,PyObject *Args) @@ -520,7 +519,7 @@ static PyObject *PkgDepCacheMarkedDowngrade(PyObject *Self,PyObject *Args) pkgCache::PkgIterator &Pkg = GetCpp<pkgCache::PkgIterator>(PackageObj); pkgDepCache::StateCache &state = (*depcache)[Pkg]; - return HandleErrors(Py_BuildValue("b",state.Downgrade())); + return HandleErrors(PyBool_FromLong(state.Downgrade())); } static PyObject *PkgDepCacheMarkedReinstall(PyObject *Self,PyObject *Args) @@ -536,41 +535,104 @@ static PyObject *PkgDepCacheMarkedReinstall(PyObject *Self,PyObject *Args) bool res = state.Install() && (state.iFlags & pkgDepCache::ReInstall); - return HandleErrors(Py_BuildValue("b",res)); + return HandleErrors(PyBool_FromLong(res)); } static PyMethodDef PkgDepCacheMethods[] = { - {"init",PkgDepCacheInit,METH_VARARGS,"Init the depcache (done on construct automatically)"}, - {"get_candidate_ver",PkgDepCacheGetCandidateVer,METH_VARARGS,"Get candidate version"}, - {"set_candidate_ver",PkgDepCacheSetCandidateVer,METH_VARARGS,"Set candidate version"}, + {"init",PkgDepCacheInit,METH_VARARGS, + "init(progress: apt.progress.base.OpProgress)\n\n" + "Initialize the depcache (done automatically when constructing\n" + "the object)."}, + {"get_candidate_ver",PkgDepCacheGetCandidateVer,METH_VARARGS, + "get_candidate_ver(pkg: apt_pkg.Package) -> apt_pkg.Version\n\n" + "Return the candidate version for the package, normally the version\n" + "with the highest pin (changeable using set_candidate_ver)."}, + {"set_candidate_ver",PkgDepCacheSetCandidateVer,METH_VARARGS, + "set_candidate_ver(pkg: apt_pkg.Package, ver: apt_pkg.Version) -> bool\n\n" + "Set the candidate version of 'pkg' to 'ver'."}, // global cache operations - {"upgrade",PkgDepCacheUpgrade,METH_VARARGS,"Perform Upgrade (optional boolean argument if dist-upgrade should be performed)"}, - {"fix_broken",PkgDepCacheFixBroken,METH_VARARGS,"Fix broken packages"}, - {"read_pinfile",PkgDepCacheReadPinFile,METH_VARARGS,"Read the pin policy"}, - {"minimize_upgrade",PkgDepCacheMinimizeUpgrade, METH_VARARGS,"Go over the entire set of packages and try to keep each package marked for upgrade. If a conflict is generated then the package is restored."}, + {"upgrade",PkgDepCacheUpgrade,METH_VARARGS, + "upgrade([dist_upgrade: bool = True]) -> bool\n\n" + "Mark the packages for upgrade under the same conditions apt-get\n" + "upgrade does. If 'dist_upgrade' is True, also allow packages to\n" + "be upgraded if they require installation/removal of other packages;\n" + "just like apt-get dist-upgrade."}, + {"fix_broken",PkgDepCacheFixBroken,METH_VARARGS, + "fix_broken() -> bool\n\n" + "Fix broken packages."}, + {"read_pinfile",PkgDepCacheReadPinFile,METH_VARARGS, + "read_pinfile([file: str])\n\n" + "Read the pin policy"}, + {"minimize_upgrade",PkgDepCacheMinimizeUpgrade, METH_VARARGS, + "minimize_upgrade() -> bool\n\n" + "Go over the entire set of packages and try to keep each package\n" + "marked for upgrade. If a conflict is generated then the package\n" + "is restored."}, // Manipulators - {"mark_keep",PkgDepCacheMarkKeep,METH_VARARGS,"Mark package for keep"}, - {"mark_delete",PkgDepCacheMarkDelete,METH_VARARGS,"Mark package for delete (optional boolean argument if it should be purged)"}, - {"mark_install",PkgDepCacheMarkInstall,METH_VARARGS,"Mark package for Install"}, - {"mark_auto",PkgDepCacheMarkAuto,METH_VARARGS,"mark_auto(pkg: apt_pkg.Package, auto: bool)\n\nMark package as automatically installed."}, - {"set_reinstall",PkgDepCacheSetReInstall,METH_VARARGS,"Set if the package should be reinstalled"}, + {"mark_keep",PkgDepCacheMarkKeep,METH_VARARGS, + "mark_keep(pkg: apt_pkg.Package)\n\n" + "Mark package to be kept."}, + {"mark_delete",PkgDepCacheMarkDelete,METH_VARARGS, + "mark_delete(pkg: apt_pkg.Package[, purge: bool = False])\n\n" + "Mark package for deletion, and if 'purge' is True also for purging."}, + {"mark_install",PkgDepCacheMarkInstall,METH_VARARGS, + "mark_install(pkg: apt_pkg.Package[, auto_inst=True, from_user=True])\n\n" + "Mark the package for installation. The parameter 'auto_inst' controls\n" + "whether the dependencies of the package are marked for installation\n" + "as well. The parameter 'from_user' controls whether the package is\n" + "registered as NOT automatically installed."}, + {"mark_auto",PkgDepCacheMarkAuto,METH_VARARGS, + "mark_auto(pkg: apt_pkg.Package, auto: bool)\n\n" + "Mark package as automatically installed (if auto=True),\n" + "or as not automatically installed (if auto=False)."}, + {"set_reinstall",PkgDepCacheSetReInstall,METH_VARARGS, + "set_reinstall(pkg: apt_pkg.Package, reinstall: bool)\n\n" + "Set whether the package should be reinstalled (reinstall = True or False)."}, // state information - {"is_upgradable",PkgDepCacheIsUpgradable,METH_VARARGS,"Is pkg upgradable"}, - {"is_now_broken",PkgDepCacheIsNowBroken,METH_VARARGS,"Is pkg is now broken"}, - {"is_inst_broken",PkgDepCacheIsInstBroken,METH_VARARGS,"Is pkg broken on the current install"}, - {"is_garbage",PkgDepCacheIsGarbage,METH_VARARGS,"Is pkg garbage (mark-n-sweep)"}, - {"is_auto_installed",PkgDepCacheIsAutoInstalled,METH_VARARGS,"Is pkg marked as auto installed"}, - {"marked_install",PkgDepCacheMarkedInstall,METH_VARARGS,"Is pkg marked for install"}, - {"marked_upgrade",PkgDepCacheMarkedUpgrade,METH_VARARGS,"Is pkg marked for upgrade"}, - {"marked_delete",PkgDepCacheMarkedDelete,METH_VARARGS,"Is pkg marked for delete"}, - {"marked_keep",PkgDepCacheMarkedKeep,METH_VARARGS,"Is pkg marked for keep"}, - {"marked_reinstall",PkgDepCacheMarkedReinstall,METH_VARARGS,"Is pkg marked for reinstall"}, - {"marked_downgrade",PkgDepCacheMarkedDowngrade,METH_VARARGS,"Is pkg marked for downgrade"}, + {"is_upgradable",PkgDepCacheIsUpgradable,METH_VARARGS, + "is_upgradable(pkg: apt_pkg.Package) -> bool\n\n" + "Check whether the package is upgradable."}, + {"is_now_broken",PkgDepCacheIsNowBroken,METH_VARARGS, + "is_now_broken(pkg: apt_pkg.Package) -> bool\n\n" + "Check whether the package is broken, taking marked changes into account."}, + {"is_inst_broken",PkgDepCacheIsInstBroken,METH_VARARGS, + "is_inst_broken(pkg: apt_pkg.Package) -> bool\n\n" + "Check whether the package is broken, ignoring marked changes."}, + {"is_garbage",PkgDepCacheIsGarbage,METH_VARARGS, + "is_garbage(pkg: apt_pkg.Package) -> bool\n\n" + "Check whether the package is garbage, i.e. whether it is automatically\n" + "installed and the reverse dependencies are not installed anymore."}, + {"is_auto_installed",PkgDepCacheIsAutoInstalled,METH_VARARGS, + "is_auto_installed(pkg: apt_pkg.Package) -> bool\n\n" + "Check whether the package is marked as automatically installed."}, + {"marked_install",PkgDepCacheMarkedInstall,METH_VARARGS, + "marked_install(pkg: apt_pkg.Package) -> bool\n\n" + "Check whether the package is marked for installation."}, + {"marked_upgrade",PkgDepCacheMarkedUpgrade,METH_VARARGS, + "marked_upgrade(pkg: apt_pkg.Package) -> bool\n\n" + "Check whether the package is marked for upgrade."}, + {"marked_delete",PkgDepCacheMarkedDelete,METH_VARARGS, + "marked_delete(pkg: apt_pkg.Package) -> bool\n\n" + "Check whether the package is marked for removal."}, + {"marked_keep",PkgDepCacheMarkedKeep,METH_VARARGS, + "marked_keep(pkg: apt_pkg.Package) -> bool\n\n" + "Check whether the package should be kept."}, + {"marked_reinstall",PkgDepCacheMarkedReinstall,METH_VARARGS, + "marked_reinstall(pkg: apt_pkg.Package) -> bool\n\n" + "Check whether the package is marked for re-installation."}, + {"marked_downgrade",PkgDepCacheMarkedDowngrade,METH_VARARGS, + "marked_downgrade(pkg: apt_pkg.Package) -> bool\n\n" + "Check whether the package is marked for downgrade."}, // Action - {"commit", PkgDepCacheCommit, METH_VARARGS, "Commit pending changes"}, + {"commit", PkgDepCacheCommit, METH_VARARGS, + "commit(acquire_progress, install_progress)\n\n" + "Commit all the marked changes. This method takes two arguments,\n" + "'acquire_progress' takes an apt.progress.base.AcquireProgress\n" + "object and 'install_progress' an apt.progress.base.InstallProgress\n" + "object."}, {} }; @@ -608,13 +670,23 @@ static PyObject *PkgDepCacheGetPolicy(PyObject *Self,void*) { static PyGetSetDef PkgDepCacheGetSet[] = { - {"broken_count",PkgDepCacheGetBrokenCount}, - {"deb_size",PkgDepCacheGetDebSize}, - {"del_count",PkgDepCacheGetDelCount}, - {"inst_count",PkgDepCacheGetInstCount}, - {"keep_count",PkgDepCacheGetKeepCount}, - {"usr_size",PkgDepCacheGetUsrSize}, - {"policy",PkgDepCacheGetPolicy}, + {"broken_count",PkgDepCacheGetBrokenCount,0, + "The number of packages with broken dependencies in the cache."}, + {"deb_size",PkgDepCacheGetDebSize,0, + "The size of the packages which are needed for the changes to be\n" + "applied."}, + {"del_count",PkgDepCacheGetDelCount,0, + "The number of packages marked for removal."}, + {"inst_count",PkgDepCacheGetInstCount,0, + "The number of packages marked for installation."}, + {"keep_count",PkgDepCacheGetKeepCount,0, + "The number of packages marked for keep."}, + {"usr_size",PkgDepCacheGetUsrSize,0, + "The amount of space required for installing/removing the packages,\n" + "i.e. the Installed-Size of all packages marked for installation\n" + "minus the Installed-Size of all packages for removal."}, + {"policy",PkgDepCacheGetPolicy,0, + "The apt_pkg.Policy object used by this cache."}, {} }; @@ -643,9 +715,9 @@ static PyObject *PkgDepCacheNew(PyTypeObject *type,PyObject *Args,PyObject *kwds return HandleErrors(DepCachePyObj); } -static char *doc_PkgDepCache = "DepCache(cache) -> DepCache() object\n\n" +static char *doc_PkgDepCache = "DepCache(cache: apt_pkg.Cache)\n\n" "A DepCache() holds extra information on the state of the packages.\n\n" - "The parameter *cache* refers to an apt_pkg.Cache() object."; + "The parameter 'cache' refers to an apt_pkg.Cache() object."; PyTypeObject PyDepCache_Type = { PyVarObject_HEAD_INIT(&PyType_Type, 0) @@ -748,7 +820,7 @@ static PyObject *PkgProblemResolverResolve(PyObject *Self,PyObject *Args) res = fixer->Resolve(brokenFix); Py_END_ALLOW_THREADS - return HandleErrors(Py_BuildValue("b", res)); + return HandleErrors(PyBool_FromLong(res)); } static PyObject *PkgProblemResolverResolveByKeep(PyObject *Self,PyObject *Args) @@ -762,7 +834,7 @@ static PyObject *PkgProblemResolverResolveByKeep(PyObject *Self,PyObject *Args) res = fixer->ResolveByKeep(); Py_END_ALLOW_THREADS - return HandleErrors(Py_BuildValue("b", res)); + return HandleErrors(PyBool_FromLong(res)); } static PyObject *PkgProblemResolverProtect(PyObject *Self,PyObject *Args) @@ -814,17 +886,37 @@ static PyObject *PkgProblemResolverInstallProtect(PyObject *Self,PyObject *Args) static PyMethodDef PkgProblemResolverMethods[] = { // config - {"protect", PkgProblemResolverProtect, METH_VARARGS, "protect(PkgIterator)"}, - {"remove", PkgProblemResolverRemove, METH_VARARGS, "remove(PkgIterator)"}, - {"clear", PkgProblemResolverClear, METH_VARARGS, "clear(PkgIterator)"}, - {"install_protect", PkgProblemResolverInstallProtect, METH_VARARGS, "install_protect()"}, + {"protect", PkgProblemResolverProtect, METH_VARARGS, + "protect(pkg: apt_pkg.Package)\n\n" + "Mark the package as protected in the resolver, meaning that its\n" + "state will not be changed."}, + {"remove", PkgProblemResolverRemove, METH_VARARGS, + "remove(pkg: apt_pkg.Package)\n\n" + "Mark the package for removal in the resolver."}, + {"clear", PkgProblemResolverClear, METH_VARARGS, + "clear(pkg: apt_pkg.Package)\n\n" + "Revert the actions done by protect()/remove() on the package."}, + {"install_protect", PkgProblemResolverInstallProtect, METH_VARARGS, + "install_protect()\n\n" + "Install all protected packages."}, // Actions - {"resolve", PkgProblemResolverResolve, METH_VARARGS, "Try to intelligently resolve problems by installing and removing packages"}, - {"resolve_by_keep", PkgProblemResolverResolveByKeep, METH_VARARGS, "Try to resolv problems only by using keep"}, + {"resolve", PkgProblemResolverResolve, METH_VARARGS, + "resolve([fix_broken: bool = True]) -> bool\n\n" + "Try to intelligently resolve problems by installing and removing\n" + "packages. If 'fix_broken' is True, apt will try to repair broken\n" + "dependencies of installed packages."}, + {"resolve_by_keep", PkgProblemResolverResolveByKeep, METH_VARARGS, + "resolve_by_keep() -> bool\n\n" + "Try to resolve problems only by using keep."}, {} }; +static const char *problemresolver_doc = + "ProblemResolver(depcache: apt_pkg.DepCache)\n\n" + "ProblemResolver objects take care of resolving problems\n" + "with dependencies. They mark packages for installation/\n" + "removal and try to satisfy all dependencies."; PyTypeObject PyProblemResolver_Type = { PyVarObject_HEAD_INIT(&PyType_Type, 0) @@ -850,7 +942,7 @@ PyTypeObject PyProblemResolver_Type = (Py_TPFLAGS_DEFAULT | // tp_flags Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC), - "ProblemResolver Object", // tp_doc + problemresolver_doc, // tp_doc CppTraverse<pkgProblemResolver *>, // tp_traverse CppClear<pkgProblemResolver *>, // tp_clear 0, // tp_richcompare @@ -875,7 +967,11 @@ PyTypeObject PyProblemResolver_Type = // pkgActionGroup Class /*{{{*/ // --------------------------------------------------------------------- - +static const char *actiongroup_release_doc = + "release()\n\n" + "End the scope of this action group. If this is the only action\n" + "group bound to the cache, this will cause any deferred cleanup\n" + "actions to be performed."; static PyObject *PkgActionGroupRelease(PyObject *Self,PyObject *Args) { pkgDepCache::ActionGroup *ag = GetCpp<pkgDepCache::ActionGroup*>(Self); @@ -886,11 +982,19 @@ static PyObject *PkgActionGroupRelease(PyObject *Self,PyObject *Args) return HandleErrors(Py_None); } +static const char *actiongroup__enter__doc = + "__enter__() -> ActionGroup\n\n" + "A dummy action which just returns the object itself, so it can\n" + "be used as a context manager."; static PyObject *PkgActionGroupEnter(PyObject *Self,PyObject *Args) { if (PyArg_ParseTuple(Args,"") == 0) return 0; return Self; } + +static const char *actiongroup__exit__doc = + "__exit__(*excinfo) -> bool\n\n" + "Same as release(), but for use as a context manager."; static PyObject *PkgActionGroupExit(PyObject *Self,PyObject *Args) { pkgDepCache::ActionGroup *ag = GetCpp<pkgDepCache::ActionGroup*>(Self); ag->release(); @@ -899,11 +1003,9 @@ static PyObject *PkgActionGroupExit(PyObject *Self,PyObject *Args) { static PyMethodDef PkgActionGroupMethods[] = { - {"release", PkgActionGroupRelease, METH_VARARGS, "release()"}, - {"__exit__", PkgActionGroupExit, METH_VARARGS, "__exit__(...) -> " - "Release the action group, for 'with' statement."}, - {"__enter__", PkgActionGroupEnter, METH_VARARGS, "__enter__() -> " - "Enter, for the 'with' statement. Does nothing."}, + {"release", PkgActionGroupRelease, METH_VARARGS, actiongroup_release_doc}, + {"__enter__", PkgActionGroupEnter, METH_VARARGS, actiongroup__enter__doc}, + {"__exit__", PkgActionGroupExit, METH_VARARGS, actiongroup__exit__doc}, {} }; |
