diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2011-02-18 17:14:31 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2011-02-18 17:14:31 +0100 |
| commit | 2885341cf3d7a1050be1bf2a45237395a3149feb (patch) | |
| tree | 692e41a3b65b3b50846d747ceebdc7796dae13b7 /python/depcache.cc | |
| parent | f88aa9d422cb796644de8d7f3a003ab7027041fc (diff) | |
| download | python-apt-2885341cf3d7a1050be1bf2a45237395a3149feb.tar.gz | |
* python/depcache.cc:
- provide bindings for new libapt SetCandidateRelease()
* debian/control:
- require new libapt-pkg-dev SetCandidateRelease()
Diffstat (limited to 'python/depcache.cc')
| -rw-r--r-- | python/depcache.cc | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/python/depcache.cc b/python/depcache.cc index cfa4f5d6..12c13a73 100644 --- a/python/depcache.cc +++ b/python/depcache.cc @@ -184,6 +184,30 @@ static PyObject *PkgDepCacheCommit(PyObject *Self,PyObject *Args) return HandleErrors(Py_None); } +static PyObject *PkgDepCacheSetCandidateRelease(PyObject *Self,PyObject *Args) +{ + bool Success; + PyObject *PackageObj; + PyObject *VersionObj; + const char *target_rel; + std::list<std::pair<pkgCache::VerIterator, pkgCache::VerIterator> > Changed; + if (PyArg_ParseTuple(Args,"O!O!s", + &PyPackage_Type, &PackageObj, + &PyVersion_Type, &VersionObj, + &target_rel) == 0) + return 0; + + pkgDepCache *depcache = GetCpp<pkgDepCache *>(Self); + pkgCache::VerIterator &I = GetCpp<pkgCache::VerIterator>(VersionObj); + if(I.end()) { + return HandleErrors(PyBool_FromLong(false)); + } + + Success = depcache->SetCandidateRelease(I, target_rel, Changed); + + return HandleErrors(PyBool_FromLong(Success)); +} + static PyObject *PkgDepCacheSetCandidateVer(PyObject *Self,PyObject *Args) { pkgDepCache *depcache = GetCpp<pkgDepCache *>(Self); @@ -552,6 +576,12 @@ static PyMethodDef PkgDepCacheMethods[] = {"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'."}, + {"set_candidate_release",PkgDepCacheSetCandidateRelease,METH_VARARGS, + "set_candidate_release(pkg: apt_pkg.Package, ver: apt_pkg.Version, rel: string) -> bool\n\n" + "Sets not only the candidate version 'ver' for package 'pkg', " + "but walks also down the dependency tree and checks if it is required " + "to set the candidate of the dependency to a version from the given " + "release string 'rel', too."}, // global cache operations {"upgrade",PkgDepCacheUpgrade,METH_VARARGS, |
