From 45cdd4f2c6b04bfdfd37ef0e1a6358b29680afb8 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 19 Apr 2009 15:17:32 +0200 Subject: * python/*.cc: Export all types and add a __new__() method to them. Some names may be changed before the release, but this is a good draft. --- python/configuration.cc | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'python/configuration.cc') diff --git a/python/configuration.cc b/python/configuration.cc index eaac48ec..abbed6d9 100644 --- a/python/configuration.cc +++ b/python/configuration.cc @@ -475,6 +475,13 @@ static PyMethodDef CnfMethods[] = {} }; +static PyObject *CnfNew(PyTypeObject *type, PyObject *args, PyObject *kwds) { + static char *kwlist[] = {}; + if (PyArg_ParseTupleAndKeywords(args,kwds,"",kwlist) == 0) + return 0; + return CppPyObject_NEW(type); +} + // Type for a Normal Configuration object static PySequenceMethods ConfigurationSeq = {0,0,0,0,0,0,0,CnfContains,0,0}; static PyMappingMethods ConfigurationMap = {0,CnfMap,CnfMapSet}; @@ -484,7 +491,7 @@ PyTypeObject ConfigurationType = #if PY_MAJOR_VERSION < 3 0, // ob_size #endif - "Configuration", // tp_name + "apt_pkg.Configuration", // tp_name sizeof(CppPyObject), // tp_basicsize 0, // tp_itemsize // Methods @@ -512,6 +519,16 @@ PyTypeObject ConfigurationType = 0, // tp_iter 0, // tp_iternext CnfMethods, // tp_methods + 0, // tp_members + 0, // tp_getset + 0, // tp_base + 0, // tp_dict + 0, // tp_descr_get + 0, // tp_descr_set + 0, // tp_dictoffset + 0, // tp_init + 0, // tp_alloc + CnfNew, // tp_new }; PyTypeObject ConfigurationPtrType = @@ -520,7 +537,7 @@ PyTypeObject ConfigurationPtrType = #if PY_MAJOR_VERSION < 3 0, // ob_size #endif - "ConfigurationPtr", // tp_name + "apt_pkg.ConfigurationPtr", // tp_name sizeof(CppPyObject), // tp_basicsize 0, // tp_itemsize // Methods @@ -556,7 +573,7 @@ PyTypeObject ConfigurationSubType = #if PY_MAJOR_VERSION < 3 0, // ob_size #endif - "ConfigurationSub", // tp_name + "apt_pkg.ConfigurationSub", // tp_name sizeof(SubConfiguration), // tp_basicsize 0, // tp_itemsize // Methods -- cgit v1.2.3