1 #include "rpmsystem-py.h"
3 #include <rpm/rpmlib.h> /* rpmReadPackageFile, headerCheck */
4 #include <rpm/rpmtag.h>
5 #include <rpm/rpmpgp.h>
7 #include <rpm/rpmbuild.h>
10 #include "rpmds-py.h" /* XXX for rpmdsNew */
12 #include "rpmfi-py.h" /* XXX for rpmfiNew */
24 * \brief A python rpm.ts object represents an RPM transaction set.
26 * The transaction set is the workhorse of RPM. It performs the
27 * installation and upgrade of packages. The rpm.ts object is
28 * instantiated by the TransactionSet function in the rpm module.
30 * The TransactionSet function takes two optional arguments. The first
31 * argument is the root path. The second is the verify signature disable flags,
32 * a set of the following bits:
34 * - rpm.RPMVSF_NOHDRCHK if set, don't check rpmdb headers
35 * - rpm.RPMVSF_NEEDPAYLOAD if not set, check header+payload (if possible)
36 * - rpm.RPMVSF_NOSHA1HEADER if set, don't check header SHA1 digest
37 * - rpm.RPMVSF_NODSAHEADER if set, don't check header DSA signature
38 * - rpm.RPMVSF_NOMD5 if set, don't check header+payload MD5 digest
39 * - rpm.RPMVSF_NODSA if set, don't check header+payload DSA signature
40 * - rpm.RPMVSF_NORSA if set, don't check header+payload RSA signature
42 * For convenience, there are the following masks:
43 * - rpm._RPMVSF_NODIGESTS if set, don't check digest(s).
44 * - rpm._RPMVSF_NOSIGNATURES if set, don't check signature(s).
46 * A rpm.ts object has the following methods:
48 * - addInstall(hdr,data,mode) Add an install element to a transaction set.
49 * @param hdr the header to be added
50 * @param data user data that will be passed to the transaction callback
51 * during transaction execution
52 * @param mode optional argument that specifies if this package should
53 * be installed ('i'), upgraded ('u').
55 * - addErase(name) Add an erase element to a transaction set.
56 * @param name the package name to be erased
58 * - check() Perform a dependency check on the transaction set. After
59 * headers have been added to a transaction set, a dependency
60 * check can be performed to make sure that all package
61 * dependencies are satisfied.
62 * @return None If there are no unresolved dependencies
63 * Otherwise a list of complex tuples is returned, one tuple per
64 * unresolved dependency, with
65 * The format of the dependency tuple is:
66 * ((packageName, packageVersion, packageRelease),
67 * (reqName, reqVersion),
71 * packageName, packageVersion, packageRelease are the name,
72 * version, and release of the package that has the unresolved
73 * dependency or conflict.
74 * The reqName and reqVersion are the name and version of the
75 * requirement or conflict.
76 * The needsFlags is a bitfield that describes the versioned
77 * nature of a requirement or conflict. The constants
78 * rpm.RPMSENSE_LESS, rpm.RPMSENSE_GREATER, and
79 * rpm.RPMSENSE_EQUAL can be logical ANDed with the needsFlags
80 * to get versioned dependency information.
81 * suggestedPackage is a tuple if the dependency check was aware
82 * of a package that solves this dependency problem when the
83 * dependency check was run. Packages that are added to the
84 * transaction set as "available" are examined during the
85 * dependency check as possible dependency solvers. The tuple
86 * contains two values, (header, suggestedName). These are set to
87 * the header of the suggested package and its name, respectively.
88 * If there is no known package to solve the dependency problem,
89 * suggestedPackage is None.
90 * The constants rpm.RPMDEP_SENSE_CONFLICTS and
91 * rpm.RPMDEP_SENSE_REQUIRES are set to show a dependency as a
92 * requirement or a conflict.
94 * - ts.order() Do a topological sort of added element relations.
97 * - ts.setFlags(transFlags) Set transaction set flags.
98 * @param transFlags - bit(s) to controll transaction operations. The
99 * following values can be logically OR'ed together:
100 * - rpm.RPMTRANS_FLAG_TEST - test mode, do not modify the RPM
101 * database, change any files, or run any package scripts
102 * - rpm.RPMTRANS_FLAG_BUILD_PROBS - only build a list of
103 * problems encountered when attempting to run this transaction
105 * - rpm.RPMTRANS_FLAG_NOSCRIPTS - do not execute package scripts
106 * - rpm.RPMTRANS_FLAG_JUSTDB - only make changes to the rpm
107 * database, do not modify files.
108 * - rpm.RPMTRANS_FLAG_NOTRIGGERS - do not run trigger scripts
109 * - rpm.RPMTRANS_FLAG_NODOCS - do not install files marked as %doc
110 * - rpm.RPMTRANS_FLAG_ALLFILES - create all files, even if a
111 * file is marked %config(missingok) and an upgrade is
113 * - rpm.RPMTRANS_FLAG_KEEPOBSOLETE - do not remove obsoleted
115 * @return previous transFlags
117 * - ts.setProbFilter(ignoreSet) Set transaction set problem filter.
118 * @param problemSetFilter - control bit(s) to ignore classes of problems,
119 * a logical or of one or more of the following bit(s):
120 * - rpm.RPMPROB_FILTER_IGNOREOS -
121 * - rpm.RPMPROB_FILTER_IGNOREARCH -
122 * - rpm.RPMPROB_FILTER_REPLACEPKG -
123 * - rpm.RPMPROB_FILTER_FORCERELOCATE -
124 * - rpm.RPMPROB_FILTER_REPLACENEWFILES -
125 * - rpm.RPMPROB_FILTER_REPLACEOLDFILES -
126 * - rpm.RPMPROB_FILTER_OLDPACKAGE -
127 * - rpm.RPMPROB_FILTER_DISKSPACE -
128 * @return previous ignoreSet
130 * - ts.run(callback,data) Attempt to execute a transaction set.
131 * After the transaction set has been populated with install/upgrade or
132 * erase actions, the transaction set can be executed by invoking
133 * the ts.run() method.
136 struct rpmtsObject_s {
138 PyObject *md_dict; /*!< to look like PyModuleObject */
144 struct rpmtsCallbackType_s {
148 PyThreadState *_save;
152 static void die(PyObject *cb)
157 if (PyErr_Occurred()) {
160 if ((r = PyObject_Repr(cb)) != NULL) {
161 pyfn = PyString_AsString(r);
163 fprintf(stderr, _("error: python callback %s failed, aborting!\n"),
164 pyfn ? pyfn : "???");
165 rpmdbCheckTerminate(1);
170 rpmts_AddInstall(rpmtsObject * s, PyObject * args)
177 if (!PyArg_ParseTuple(args, "O&Oi:AddInstall",
178 hdrFromPyObject, &h, &key, &how))
181 rc = rpmtsAddInstallElement(s->ts, h, key, how, NULL);
182 return PyBool_FromLong((rc == 0));
186 rpmts_AddErase(rpmtsObject * s, PyObject * args)
190 if (!PyArg_ParseTuple(args, "O&:AddErase", hdrFromPyObject, &h))
193 return PyBool_FromLong(rpmtsAddEraseElement(s->ts, h, -1) == 0);
197 rpmts_SolveCallback(rpmts ts, rpmds ds, const void * data)
199 struct rpmtsCallbackType_s * cbInfo = (struct rpmtsCallbackType_s *) data;
200 PyObject * args, * result;
203 if (cbInfo->tso == NULL) return res;
204 if (cbInfo->cb == Py_None) return res;
206 PyEval_RestoreThread(cbInfo->_save);
208 args = Py_BuildValue("(Oissi)", cbInfo->tso,
209 rpmdsTagN(ds), rpmdsN(ds), rpmdsEVR(ds), rpmdsFlags(ds));
210 result = PyEval_CallObject(cbInfo->cb, args);
216 if (PyInt_Check(result))
217 res = PyInt_AsLong(result);
221 cbInfo->_save = PyEval_SaveThread();
227 rpmts_Check(rpmtsObject * s, PyObject * args, PyObject * kwds)
229 struct rpmtsCallbackType_s cbInfo;
231 char * kwlist[] = {"callback", NULL};
233 memset(&cbInfo, 0, sizeof(cbInfo));
234 if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:Check", kwlist,
238 if (cbInfo.cb != NULL) {
239 if (!PyCallable_Check(cbInfo.cb)) {
240 PyErr_SetString(PyExc_TypeError, "expected a callable");
243 rc = rpmtsSetSolveCallback(s->ts, rpmts_SolveCallback, (void *)&cbInfo);
247 cbInfo._save = PyEval_SaveThread();
249 rc = rpmtsCheck(s->ts);
251 PyEval_RestoreThread(cbInfo._save);
253 return PyBool_FromLong((rc == 0));
257 rpmts_Order(rpmtsObject * s)
261 Py_BEGIN_ALLOW_THREADS
262 rc = rpmtsOrder(s->ts);
265 return Py_BuildValue("i", rc);
269 rpmts_Clean(rpmtsObject * s)
277 rpmts_OpenDB(rpmtsObject * s)
281 dbmode = rpmtsGetDBMode(s->ts);
285 return Py_BuildValue("i", rpmtsOpenDB(s->ts, dbmode));
289 rpmts_CloseDB(rpmtsObject * s)
293 rc = rpmtsCloseDB(s->ts);
294 rpmtsSetDBMode(s->ts, -1); /* XXX disable lazy opens */
296 return Py_BuildValue("i", rc);
300 rpmts_InitDB(rpmtsObject * s)
304 rc = rpmtsInitDB(s->ts, O_RDONLY);
306 rc = rpmtsCloseDB(s->ts);
308 return Py_BuildValue("i", rc);
312 rpmts_RebuildDB(rpmtsObject * s)
316 Py_BEGIN_ALLOW_THREADS
317 rc = rpmtsRebuildDB(s->ts);
320 return Py_BuildValue("i", rc);
324 rpmts_VerifyDB(rpmtsObject * s)
328 Py_BEGIN_ALLOW_THREADS
329 rc = rpmtsVerifyDB(s->ts);
332 return Py_BuildValue("i", rc);
336 rpmts_HdrFromFdno(rpmtsObject * s, PyObject * args, PyObject * kwds)
338 PyObject * result = NULL;
342 char * kwlist[] = {"fd", NULL};
344 if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&:HdrFromFdno", kwlist,
345 rpmFdFromPyObject, &fd))
348 rpmrc = rpmReadPackageFile(s->ts, fd, "rpmts_HdrFromFdno", &h);
354 result = Py_BuildValue("N", hdr_Wrap(&hdr_Type, h));
355 h = headerFree(h); /* XXX ref held by result */
359 PyErr_SetString(pyrpmError, "public key not available");
362 case RPMRC_NOTTRUSTED:
363 PyErr_SetString(pyrpmError, "public key not trusted");
369 PyErr_SetString(pyrpmError, "error reading package header");
377 rpmts_HdrCheck(rpmtsObject * s, PyObject *obj)
385 if (!PyArg_Parse(obj, "S:HdrCheck", &blob))
388 uh = PyString_AsString(blob);
389 uc = PyString_Size(blob);
391 Py_BEGIN_ALLOW_THREADS;
392 rpmrc = headerCheck(s->ts, uh, uc, &msg);
393 Py_END_ALLOW_THREADS;
395 return Py_BuildValue("(is)", rpmrc, msg);
399 rpmts_PgpPrtPkts(rpmtsObject * s, PyObject * args, PyObject * kwds)
405 char * kwlist[] = {"octets", NULL};
407 if (!PyArg_ParseTupleAndKeywords(args, kwds, "S:PgpPrtPkts", kwlist, &blob))
410 pkt = (unsigned char *)PyString_AsString(blob);
411 pktlen = PyString_Size(blob);
413 rc = pgpPrtPkts(pkt, pktlen, NULL, 1);
415 return Py_BuildValue("i", rc);
419 rpmts_PgpImportPubkey(rpmtsObject * s, PyObject * args, PyObject * kwds)
425 char * kwlist[] = {"pubkey", NULL};
427 if (!PyArg_ParseTupleAndKeywords(args, kwds, "S:PgpImportPubkey",
431 pkt = (unsigned char *)PyString_AsString(blob);
432 pktlen = PyString_Size(blob);
434 rc = rpmtsImportPubkey(s->ts, pkt, pktlen);
436 return Py_BuildValue("i", rc);
440 rpmtsCallback(const void * hd, const rpmCallbackType what,
441 const rpm_loff_t amount, const rpm_loff_t total,
442 const void * pkgKey, rpmCallbackData data)
444 Header h = (Header) hd;
445 struct rpmtsCallbackType_s * cbInfo = data;
446 PyObject * pkgObj = (PyObject *) pkgKey;
447 PyObject * args, * result;
450 if (cbInfo->cb == Py_None) return NULL;
452 /* Synthesize a python object for callback (if necessary). */
453 if (pkgObj == NULL) {
455 pkgObj = Py_BuildValue("s", headerGetString(h, RPMTAG_NAME));
463 PyEval_RestoreThread(cbInfo->_save);
465 args = Py_BuildValue("(iLLOO)", what, amount, total, pkgObj, cbInfo->data);
466 result = PyEval_CallObject(cbInfo->cb, args);
474 if (what == RPMCALLBACK_INST_OPEN_FILE) {
477 if (!PyArg_Parse(result, "i", &fdno)) {
481 cbInfo->_save = PyEval_SaveThread();
484 fcntl(Fileno(fd), F_SETFD, FD_CLOEXEC);
488 if (what == RPMCALLBACK_INST_CLOSE_FILE) {
493 cbInfo->_save = PyEval_SaveThread();
499 rpmts_Problems(rpmtsObject * s)
501 return rpmps_Wrap(&rpmps_Type, rpmtsProblems(s->ts));
505 rpmts_Run(rpmtsObject * s, PyObject * args, PyObject * kwds)
508 struct rpmtsCallbackType_s cbInfo;
509 rpmprobFilterFlags ignoreSet;
510 char * kwlist[] = {"callback", "data", "ignoreSet", NULL};
512 if (!PyArg_ParseTupleAndKeywords(args, kwds, "OOi:Run", kwlist,
513 &cbInfo.cb, &cbInfo.data, &ignoreSet))
517 cbInfo._save = PyEval_SaveThread();
519 if (cbInfo.cb != NULL) {
520 if (!PyCallable_Check(cbInfo.cb)) {
521 PyErr_SetString(PyExc_TypeError, "expected a callable");
524 (void) rpmtsSetNotifyCallback(s->ts, rpmtsCallback, (void *) &cbInfo);
527 rc = rpmtsRun(s->ts, NULL, ignoreSet);
530 (void) rpmtsSetNotifyCallback(s->ts, NULL, NULL);
532 PyEval_RestoreThread(cbInfo._save);
534 return Py_BuildValue("i", rc);
538 rpmts_iternext(rpmtsObject * s)
540 PyObject * result = NULL;
543 /* Reset iterator on 1st entry. */
544 if (s->tsi == NULL) {
545 s->tsi = rpmtsiInit(s->ts);
550 te = rpmtsiNext(s->tsi, 0);
552 result = rpmte_Wrap(&rpmte_Type, te);
554 s->tsi = rpmtsiFree(s->tsi);
561 rpmts_Match(rpmtsObject * s, PyObject * args, PyObject * kwds)
563 PyObject *Key = NULL;
565 /* XXX lkey *must* be a 32 bit integer, int "works" on all known platforms. */
568 rpmTag tag = RPMDBI_PACKAGES;
569 char * kwlist[] = {"tagNumber", "key", NULL};
571 if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O&O:Match", kwlist,
572 tagNumFromPyObject, &tag, &Key))
576 if (PyString_Check(Key)) {
577 key = PyString_AsString(Key);
578 len = PyString_Size(Key);
579 } else if (PyInt_Check(Key)) {
580 lkey = PyInt_AsLong(Key);
584 PyErr_SetString(PyExc_TypeError, "unknown key type");
587 /* One of the conversions above failed, exception is set already */
588 if (PyErr_Occurred()) {
593 /* XXX If not already opened, open the database O_RDONLY now. */
594 /* XXX FIXME: lazy default rdonly open also done by rpmtsInitIterator(). */
595 if (rpmtsGetRdb(s->ts) == NULL) {
596 int rc = rpmtsOpenDB(s->ts, O_RDONLY);
597 if (rc || rpmtsGetRdb(s->ts) == NULL) {
598 PyErr_SetString(PyExc_TypeError, "rpmdb open failed");
603 return rpmmi_Wrap(&rpmmi_Type, rpmtsInitIterator(s->ts, tag, key, len), (PyObject*)s);
606 static struct PyMethodDef rpmts_methods[] = {
607 {"addInstall", (PyCFunction) rpmts_AddInstall, METH_VARARGS,
609 {"addErase", (PyCFunction) rpmts_AddErase, METH_VARARGS|METH_KEYWORDS,
611 {"check", (PyCFunction) rpmts_Check, METH_VARARGS|METH_KEYWORDS,
613 {"order", (PyCFunction) rpmts_Order, METH_NOARGS,
615 {"problems", (PyCFunction) rpmts_Problems, METH_NOARGS,
616 "ts.problems() -> ps\n\
617 - Return current problem set.\n" },
618 {"run", (PyCFunction) rpmts_Run, METH_VARARGS|METH_KEYWORDS,
619 "ts.run(callback, data) -> (problems)\n\
620 - Run a transaction set, returning list of problems found.\n\
621 Note: The callback may not be None.\n" },
622 {"clean", (PyCFunction) rpmts_Clean, METH_NOARGS,
624 {"openDB", (PyCFunction) rpmts_OpenDB, METH_NOARGS,
625 "ts.openDB() -> None\n\
626 - Open the default transaction rpmdb.\n\
627 Note: The transaction rpmdb is lazily opened, so ts.openDB() is seldom needed.\n" },
628 {"closeDB", (PyCFunction) rpmts_CloseDB, METH_NOARGS,
629 "ts.closeDB() -> None\n\
630 - Close the default transaction rpmdb.\n\
631 Note: ts.closeDB() disables lazy opens, and should hardly ever be used.\n" },
632 {"initDB", (PyCFunction) rpmts_InitDB, METH_NOARGS,
633 "ts.initDB() -> None\n\
634 - Initialize the default transaction rpmdb.\n\
635 Note: ts.initDB() is seldom needed anymore.\n" },
636 {"rebuildDB", (PyCFunction) rpmts_RebuildDB, METH_NOARGS,
637 "ts.rebuildDB() -> None\n\
638 - Rebuild the default transaction rpmdb.\n" },
639 {"verifyDB", (PyCFunction) rpmts_VerifyDB, METH_NOARGS,
640 "ts.verifyDB() -> None\n\
641 - Verify the default transaction rpmdb.\n" },
642 {"hdrFromFdno",(PyCFunction) rpmts_HdrFromFdno,METH_VARARGS|METH_KEYWORDS,
643 "ts.hdrFromFdno(fdno) -> hdr\n\
644 - Read a package header from a file descriptor.\n" },
645 {"hdrCheck", (PyCFunction) rpmts_HdrCheck, METH_O,
647 {"pgpPrtPkts", (PyCFunction) rpmts_PgpPrtPkts, METH_VARARGS|METH_KEYWORDS,
649 {"pgpImportPubkey", (PyCFunction) rpmts_PgpImportPubkey, METH_VARARGS|METH_KEYWORDS,
651 {"dbMatch", (PyCFunction) rpmts_Match, METH_VARARGS|METH_KEYWORDS,
652 "ts.dbMatch([TagN, [key, [len]]]) -> mi\n\
653 - Create a match iterator for the default transaction rpmdb.\n" },
654 {NULL, NULL} /* sentinel */
657 static void rpmts_dealloc(rpmtsObject * s)
660 s->ts = rpmtsFree(s->ts);
662 if (s->scriptFd) Fclose(s->scriptFd);
663 s->ob_type->tp_free((PyObject *)s);
666 static PyObject * rpmts_new(PyTypeObject * subtype, PyObject *args, PyObject *kwds)
668 char * rootDir = "/";
669 rpmVSFlags vsflags = rpmExpandNumeric("%{?__vsflags}");
670 char * kwlist[] = {"rootdir", "vsflags", 0};
673 if (!PyArg_ParseTupleAndKeywords(args, kwds, "|si:rpmts_new", kwlist,
678 (void) rpmtsSetRootDir(ts, rootDir);
679 /* XXX: make this use common code with rpmts_SetVSFlags() to check the
681 (void) rpmtsSetVSFlags(ts, vsflags);
683 return rpmts_Wrap(subtype, ts);
686 static PyObject *rpmts_get_tid(rpmtsObject *s, void *closure)
688 return Py_BuildValue("i", rpmtsGetTid(s->ts));
691 static PyObject *rpmts_get_rootDir(rpmtsObject *s, void *closure)
693 return Py_BuildValue("s", rpmtsRootDir(s->ts));
696 static int rpmts_set_scriptFd(rpmtsObject *s, PyObject *value, void *closure)
699 if (PyArg_Parse(value, "O&", rpmFdFromPyObject, &s->scriptFd)) {
700 rpmtsSetScriptFd(s->ts, s->scriptFd);
701 } else if (value == Py_None) {
704 rpmtsSetScriptFd(s->ts, NULL);
711 static PyObject *rpmts_get_color(rpmtsObject *s, void *closure)
713 return Py_BuildValue("i", rpmtsColor(s->ts));
716 static PyObject *rpmts_get_prefcolor(rpmtsObject *s, void *closure)
718 return Py_BuildValue("i", rpmtsPrefColor(s->ts));
721 static int rpmts_set_color(rpmtsObject *s, PyObject *value, void *closure)
724 if (!PyArg_Parse(value, "i", &color)) return -1;
726 /* TODO: validate the bits */
727 rpmtsSetColor(s->ts, color);
731 static int rpmts_set_prefcolor(rpmtsObject *s, PyObject *value, void *closure)
734 if (!PyArg_Parse(value, "i", &color)) return -1;
736 /* TODO: validate the bits */
737 rpmtsSetPrefColor(s->ts, color);
741 static int rpmts_set_flags(rpmtsObject *s, PyObject *value, void *closure)
744 if (!PyArg_Parse(value, "i", &flags)) return -1;
746 /* TODO: validate the bits */
747 rpmtsSetFlags(s->ts, flags);
751 static int rpmts_set_vsflags(rpmtsObject *s, PyObject *value, void *closure)
754 if (!PyArg_Parse(value, "i", &flags)) return -1;
756 /* TODO: validate the bits */
757 rpmtsSetVSFlags(s->ts, flags);
761 static PyObject *rpmts_get_flags(rpmtsObject *s, void *closure)
763 return Py_BuildValue("i", rpmtsFlags(s->ts));
766 static PyObject *rpmts_get_vsflags(rpmtsObject *s, void *closure)
768 return Py_BuildValue("i", rpmtsVSFlags(s->ts));
771 static char rpmts_doc[] =
774 static PyGetSetDef rpmts_getseters[] = {
775 /* only provide a setter until we have rpmfd wrappings */
776 {"scriptFd", NULL, (setter)rpmts_set_scriptFd, NULL },
777 {"tid", (getter)rpmts_get_tid, NULL, NULL },
778 {"rootDir", (getter)rpmts_get_rootDir, NULL, NULL },
779 {"_color", (getter)rpmts_get_color, (setter)rpmts_set_color, NULL},
780 {"_prefcolor", (getter)rpmts_get_prefcolor, (setter)rpmts_set_prefcolor, NULL},
781 {"_flags", (getter)rpmts_get_flags, (setter)rpmts_set_flags, NULL},
782 {"_vsflags", (getter)rpmts_get_vsflags, (setter)rpmts_set_vsflags, NULL},
786 PyTypeObject rpmts_Type = {
787 PyObject_HEAD_INIT(&PyType_Type)
789 "rpm.ts", /* tp_name */
790 sizeof(rpmtsObject), /* tp_size */
792 (destructor) rpmts_dealloc, /* tp_dealloc */
794 (getattrfunc)0, /* tp_getattr */
795 (setattrfunc)0, /* tp_setattr */
798 0, /* tp_as_number */
799 0, /* tp_as_sequence */
800 0, /* tp_as_mapping */
804 PyObject_GenericGetAttr, /* tp_getattro */
805 PyObject_GenericSetAttr, /* tp_setattro */
806 0, /* tp_as_buffer */
807 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */
808 rpmts_doc, /* tp_doc */
811 0, /* tp_richcompare */
812 0, /* tp_weaklistoffset */
813 PyObject_SelfIter, /* tp_iter */
814 (iternextfunc) rpmts_iternext, /* tp_iternext */
815 rpmts_methods, /* tp_methods */
817 rpmts_getseters, /* tp_getset */
820 0, /* tp_descr_get */
821 0, /* tp_descr_set */
822 0, /* tp_dictoffset */
825 (newfunc) rpmts_new, /* tp_new */
830 PyObject * rpmts_Wrap(PyTypeObject *subtype, rpmts ts)
832 rpmtsObject * s = (rpmtsObject *)subtype->tp_alloc(subtype, 0);
833 if (s == NULL) return PyErr_NoMemory();
838 return (PyObject *) s;