From 0d6bdd9d329f6527f6a5f2337828e03c2e2af508 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 6 Oct 2006 17:22:40 +0200 Subject: * python/depcache.cc: - suport for pkgActionGrup added --- python/depcache.cc | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'python/depcache.cc') diff --git a/python/depcache.cc b/python/depcache.cc index 60bbc1a4..159a7103 100644 --- a/python/depcache.cc +++ b/python/depcache.cc @@ -745,3 +745,73 @@ PyTypeObject PkgProblemResolverType = }; /*}}}*/ + +// pkgActionGroup Class /*{{{*/ +// --------------------------------------------------------------------- + + +static PyObject *PkgActionGroupRelease(PyObject *Self,PyObject *Args) +{ + pkgDepCache::ActionGroup *ag = GetCpp(Self); + if (PyArg_ParseTuple(Args,"") == 0) + return 0; + ag->release(); + Py_INCREF(Py_None); + return HandleErrors(Py_None); +} + +static PyMethodDef PkgActionGroupMethods[] = +{ + {"release", PkgActionGroupRelease, METH_VARARGS, "release()"}, + {} +}; + + +static PyObject *ActionGroupAttr(PyObject *Self,char *Name) +{ + pkgDepCache::ActionGroup *ag = GetCpp(Self); + + return Py_FindMethod(PkgActionGroupMethods,Self,Name); +} + + +PyTypeObject PkgActionGroupType = +{ + PyObject_HEAD_INIT(&PyType_Type) + 0, // ob_size + "pkgActionGroup", // tp_name + sizeof(CppOwnedPyObject), // tp_basicsize + 0, // tp_itemsize + // Methods + CppOwnedDealloc, // tp_dealloc + 0, // tp_print + ActionGroupAttr, // tp_getattr + 0, // tp_setattr + 0, // tp_compare + 0, // tp_repr + 0, // tp_as_number + 0, // tp_as_sequence + 0, // tp_as_mapping + 0, // tp_hash +}; + +PyObject *GetPkgActionGroup(PyObject *Self,PyObject *Args) +{ + PyObject *Owner; + if (PyArg_ParseTuple(Args,"O!",&PkgDepCacheType,&Owner) == 0) + return 0; + + pkgDepCache *depcache = GetCpp(Owner); + pkgDepCache::ActionGroup *group = new pkgDepCache::ActionGroup(*depcache); + CppOwnedPyObject *PkgActionGroupPyObj; + PkgActionGroupPyObj = CppOwnedPyObject_NEW(Owner, + &PkgActionGroupType, + group); + HandleErrors(PkgActionGroupPyObj); + + return PkgActionGroupPyObj; + +} + + + /*}}}*/ -- cgit v1.2.3 From 4a741085e3895d83aa3b0a522123a923b0a64aa4 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 26 Jan 2007 17:20:29 +0100 Subject: * support "fromUser()" flag in apt.Package.markInstall() to make setting the automatic install information available --- apt/package.py | 5 +++-- python/depcache.cc | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'python/depcache.cc') diff --git a/apt/package.py b/apt/package.py index 0d1145ea..f67ad6ce 100644 --- a/apt/package.py +++ b/apt/package.py @@ -290,12 +290,13 @@ class Package(object): Fix.InstallProtect() Fix.Resolve() self._pcache.cachePostChange() - def markInstall(self, autoFix=True, autoInst=True): + def markInstall(self, autoFix=True, autoInst=True, fromUser=True): """ mark a package for install. Run the resolver if autoFix is set, automatically install required dependencies if autoInst is set + record it as automatically installed when fromuser is set to false """ self._pcache.cachePreChange() - self._depcache.MarkInstall(self._pkg, autoInst) + self._depcache.MarkInstall(self._pkg, autoInst, fromUser) # try to fix broken stuff if autoFix and self._depcache.BrokenCount > 0: fixer = apt_pkg.GetPkgProblemResolver(self._depcache) diff --git a/python/depcache.cc b/python/depcache.cc index 159a7103..71e6a2e6 100644 --- a/python/depcache.cc +++ b/python/depcache.cc @@ -346,11 +346,13 @@ static PyObject *PkgDepCacheMarkInstall(PyObject *Self,PyObject *Args) PyObject *PackageObj; char autoInst=1; - if (PyArg_ParseTuple(Args,"O!|b",&PackageType,&PackageObj, &autoInst) == 0) + char fromUser=1; + if (PyArg_ParseTuple(Args,"O!|bb",&PackageType,&PackageObj, + &autoInst, &fromUser) == 0) return 0; pkgCache::PkgIterator &Pkg = GetCpp(PackageObj); - depcache->MarkInstall(Pkg, autoInst); + depcache->MarkInstall(Pkg, autoInst, 0, fromUser); Py_INCREF(Py_None); return HandleErrors(Py_None); -- cgit v1.2.3