summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorMichael Vogt <egon@bottom>2007-05-02 18:51:48 +0200
committerMichael Vogt <egon@bottom>2007-05-02 18:51:48 +0200
commit7e7e01e96d57515f323e19127dc05f4b2b2d31cc (patch)
treedcfb35abf5a80ceaf541c5df80bb6580efaaac0c /python
parente537ea9f6a1905c6ec4af01367851b053dfca40e (diff)
parent4a741085e3895d83aa3b0a522123a923b0a64aa4 (diff)
downloadpython-apt-7e7e01e96d57515f323e19127dc05f4b2b2d31cc.tar.gz
* merged from http://people.ubuntu.com/~mvo/bzr/python-apt/auto-mark/
Diffstat (limited to 'python')
-rw-r--r--python/apt_pkgmodule.cc1
-rw-r--r--python/apt_pkgmodule.h1
-rw-r--r--python/depcache.cc76
3 files changed, 76 insertions, 2 deletions
diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc
index 627eaced..a0352d4e 100644
--- a/python/apt_pkgmodule.cc
+++ b/python/apt_pkgmodule.cc
@@ -431,6 +431,7 @@ static PyMethodDef methods[] =
// misc
{"GetPkgProblemResolver",GetPkgProblemResolver,METH_VARARGS,"GetDepProblemResolver(DepCache) -> PkgProblemResolver"},
+ {"GetPkgActionGroup",GetPkgActionGroup,METH_VARARGS,"GetPkgActionGroup(DepCache) -> PkgActionGroup"},
// Cdrom
{"GetCdrom",GetCdrom,METH_VARARGS,"GetCdrom() -> Cdrom"},
diff --git a/python/apt_pkgmodule.h b/python/apt_pkgmodule.h
index fe7dfe88..d58f4589 100644
--- a/python/apt_pkgmodule.h
+++ b/python/apt_pkgmodule.h
@@ -67,6 +67,7 @@ PyObject *GetDepCache(PyObject *Self,PyObject *Args);
// pkgProblemResolver
extern PyTypeObject PkgProblemResolverType;
PyObject *GetPkgProblemResolver(PyObject *Self, PyObject *Args);
+PyObject *GetPkgActionGroup(PyObject *Self, PyObject *Args);
// cdrom
extern PyTypeObject PkgCdromType;
diff --git a/python/depcache.cc b/python/depcache.cc
index 60bbc1a4..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<pkgCache::PkgIterator>(PackageObj);
- depcache->MarkInstall(Pkg, autoInst);
+ depcache->MarkInstall(Pkg, autoInst, 0, fromUser);
Py_INCREF(Py_None);
return HandleErrors(Py_None);
@@ -745,3 +747,73 @@ PyTypeObject PkgProblemResolverType =
};
/*}}}*/
+
+// pkgActionGroup Class /*{{{*/
+// ---------------------------------------------------------------------
+
+
+static PyObject *PkgActionGroupRelease(PyObject *Self,PyObject *Args)
+{
+ pkgDepCache::ActionGroup *ag = GetCpp<pkgDepCache::ActionGroup*>(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<pkgDepCache::ActionGroup*>(Self);
+
+ return Py_FindMethod(PkgActionGroupMethods,Self,Name);
+}
+
+
+PyTypeObject PkgActionGroupType =
+{
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0, // ob_size
+ "pkgActionGroup", // tp_name
+ sizeof(CppOwnedPyObject<pkgDepCache::ActionGroup*>), // tp_basicsize
+ 0, // tp_itemsize
+ // Methods
+ CppOwnedDealloc<pkgDepCache::ActionGroup*>, // 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<pkgDepCache*>(Owner);
+ pkgDepCache::ActionGroup *group = new pkgDepCache::ActionGroup(*depcache);
+ CppOwnedPyObject<pkgDepCache::ActionGroup*> *PkgActionGroupPyObj;
+ PkgActionGroupPyObj = CppOwnedPyObject_NEW<pkgDepCache::ActionGroup*>(Owner,
+ &PkgActionGroupType,
+ group);
+ HandleErrors(PkgActionGroupPyObj);
+
+ return PkgActionGroupPyObj;
+
+}
+
+
+ /*}}}*/