RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  j...@rpm5.org
  Module: rpm                              Date:   03-Sep-2014 22:53:40
  Branch: rpm-5_4                          Handle: 2014090320534000

  Modified files:           (Branch: rpm-5_4)
    rpm/python              rpmte-py.c

  Log:
    - python: WIP.

  Summary:
    Revision    Changes     Path
    1.31.4.5    +12 -40     rpm/python/rpmte-py.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/python/rpmte-py.c
  ============================================================================
  $ cvs diff -u -r1.31.4.4 -r1.31.4.5 rpmte-py.c
  --- rpm/python/rpmte-py.c     31 Aug 2014 16:19:20 -0000      1.31.4.4
  +++ rpm/python/rpmte-py.c     3 Sep 2014 20:53:40 -0000       1.31.4.5
  @@ -163,7 +163,7 @@
   static PyObject *
   rpmte_PkgFileSize(rpmteObject * s)
   {
  -    return Py_BuildValue("i", rpmtePkgFileSize(s->te));
  +    return Py_BuildValue("L", rpmtePkgFileSize(s->te));
   }
   
   static PyObject *
  @@ -230,20 +230,14 @@
   static PyObject *
   rpmte_DS(rpmteObject * s, PyObject * args, PyObject * kwds)
   {
  -    PyObject * TagN = NULL;
       rpmds ds;
       rpmTag tag;
       char * kwlist[] = {"tag", NULL};
   
  -    if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:DS", kwlist, &TagN))
  +    if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&:DS", kwlist,
  +             tagNumFromPyObject, &tag))
        return NULL;
   
  -    tag = tagNumFromPyObject(TagN);
  -    if (tag == (rpmTag)-1) {
  -     PyErr_SetString(PyExc_TypeError, "unknown tag type");
  -     return NULL;
  -    }
  -
       ds = rpmteDS(s->te, tag);
       if (ds == NULL) {
        Py_RETURN_NONE;
  @@ -254,26 +248,19 @@
   static PyObject *
   rpmte_FI(rpmteObject * s, PyObject * args, PyObject * kwds)
   {
  -    PyObject * TagN = NULL;
       rpmfi fi;
       rpmTag tag;
       char * kwlist[] = {"tag", NULL};
   
  -    DEPRECATED_METHOD("use .Files() instead");
  -    if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:FI", kwlist, &TagN))
  +    if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&:FI", kwlist,
  +             tagNumFromPyObject, &tag))
        return NULL;
   
  -    tag = tagNumFromPyObject(TagN);
  -    if (tag == (rpmTag)-1) {
  -     PyErr_SetString(PyExc_TypeError, "unknown tag type");
  -     return NULL;
  -    }
  -
       fi = rpmteFI(s->te, tag);
       if (fi == NULL) {
        Py_RETURN_NONE;
       }
  -    return (PyObject *) rpmfi_Wrap(&rpmfi_Type, rpmfiLink(fi, "rpmte_FI"));
  +    return rpmfi_Wrap(&rpmfi_Type, rpmfiLink(fi, "rpmte_FI"));
   }
   
   /*@}*/
  @@ -309,10 +296,10 @@
   - Return element os.\n" },
       {"NEVR", (PyCFunction)rpmte_NEVR,        METH_NOARGS,
   "te.NEVR() -> NEVR\n\
  -- Return element name-version-release.\n" },
  +- Return element name-[epoch:]version-release.\n" },
       {"NEVRA",        (PyCFunction)rpmte_NEVRA,       METH_NOARGS,
   "te.NEVRA() -> NEVRA\n\
  -- Return element name-version-release.arch.\n" },
  +- Return element name-[epoch:]version-release.arch.\n" },
       {"Pkgid",        (PyCFunction)rpmte_Pkgid,       METH_NOARGS,
   "te.Pkgid() -> Pkgid\n\
   - Return element pkgid (header+payload md5 digest).\n" },
  @@ -353,21 +340,6 @@
   
   /* ---------- */
   
  -static int
  -rpmte_print(rpmteObject * s, FILE * fp, int flags)
  -{
  -    const char * tstr;
  -    if (!(s && s->te))
  -     return -1;
  -    switch (rpmteType(s->te)) {
  -    case TR_ADDED:   tstr = "++";    break;
  -    case TR_REMOVED: tstr = "--";    break;
  -    default:         tstr = "??";    break;
  -    }
  -    fprintf(fp, "%s %s %s", tstr, rpmteNEVR(s->te), rpmteA(s->te));
  -    return 0;
  -}
  -
   static char rpmte_doc[] =
   "";
   
  @@ -377,7 +349,7 @@
        sizeof(rpmteObject),            /* tp_size */
        0,                              /* tp_itemsize */
        (destructor)0,                  /* tp_dealloc */
  -     (printfunc) rpmte_print,        /* tp_print */
  +     0,                              /* tp_print */
        (getattrfunc)0,                 /* tp_getattr */
        (setattrfunc)0,                 /* tp_setattr */
        0,                              /* tp_compare */
  @@ -418,9 +390,9 @@
   
   PyObject * rpmte_Wrap(PyTypeObject *subtype, rpmte te)
   {
  -    rpmteObject *s = (rpmteObject *) PyObject_New(rpmteObject, &rpmte_Type);
  -    if (s == NULL)
  -     return NULL;
  +    rpmteObject *s = (rpmteObject *) subtype->tp_alloc(subtype, 0);
  +    if (s == NULL) return NULL;
  +
       s->te = te;
       return (PyObject *) s;
   }
  @@ .
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
CVS Sources Repository                                rpm-cvs@rpm5.org

Reply via email to