diff options
| author | Michael Vogt <mvo@debian.org> | 2011-02-18 22:37:34 +0100 |
|---|---|---|
| committer | Michael Vogt <mvo@debian.org> | 2011-02-18 22:37:34 +0100 |
| commit | be46a92a5621d2c199792ead5371afb979f32f9c (patch) | |
| tree | 3d4397fc802685b433b1f72cf7067907c4a6540f /python | |
| parent | 45100d466f6c392758ff2e490cdfee9aae7e55a7 (diff) | |
| parent | 2885341cf3d7a1050be1bf2a45237395a3149feb (diff) | |
| download | python-apt-be46a92a5621d2c199792ead5371afb979f32f9c.tar.gz | |
merged from lp:~mvo/python-apt/mvo
Diffstat (limited to 'python')
| -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, |
