From: Tomas Mlcoch Date: Tue, 10 Sep 2013 14:25:35 +0000 (+0200) Subject: doc: Update X-Git-Tag: upstream/0.2.1~33 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3f192b70ec38c9643eca314ebf6340e6edff1ccf;p=services%2Fcreaterepo_c.git doc: Update --- diff --git a/src/python/__init__.py b/src/python/__init__.py index a3a341a..d74f1c7 100644 --- a/src/python/__init__.py +++ b/src/python/__init__.py @@ -128,16 +128,13 @@ MetadataLocation = _createrepo_c.MetadataLocation # Package class -class Package(_createrepo_c.Package): - def __copy__(self): - return self.copy() - def __deepcopy__(self, _): - return self.copy() +Package = _createrepo_c.Package # Repomd class class Repomd(_createrepo_c.Repomd): def __init__(self, path=None): + """:arg path: Path to existing repomd.xml or None""" _createrepo_c.Repomd.__init__(self) if path: xml_parse_repomd(path, self) @@ -145,6 +142,12 @@ class Repomd(_createrepo_c.Repomd): # RepomdRecord class class RepomdRecord(_createrepo_c.RepomdRecord): + def __init__(self, type=None, path=None): + """:arg type: String with type of the file (e.g. other, other_db etc.) + :arg path: Path to the file + """ + _createrepo_c.RepomdRecord.__init__(self, type, path) + def compress_and_fill(self, hashtype, compresstype): rec = RepomdRecord(self.type + "_gz", None) _createrepo_c.RepomdRecord.compress_and_fill(self, @@ -178,21 +181,30 @@ class OtherSqlite(Sqlite): XmlFile = _createrepo_c.XmlFile class PrimaryXmlFile(XmlFile): - def __init__(self, filename, compressiontype=GZ_COMPRESSION, + def __init__(self, path, compressiontype=GZ_COMPRESSION, contentstat=None): - XmlFile.__init__(self, filename, XMLFILE_PRIMARY, + """:arg path: Path to the primary xml file + :arg compressiontype: Compression type + :arg contentstat: ContentStat object""" + XmlFile.__init__(self, path, XMLFILE_PRIMARY, compressiontype, contentstat) class FilelistsXmlFile(XmlFile): - def __init__(self, filename, compressiontype=GZ_COMPRESSION, + def __init__(self, path, compressiontype=GZ_COMPRESSION, contentstat=None): - XmlFile.__init__(self, filename, XMLFILE_FILELISTS, + """:arg path: Path to the filelists xml file + :arg compressiontype: Compression type + :arg contentstat: ContentStat object""" + XmlFile.__init__(self, path, XMLFILE_FILELISTS, compressiontype, contentstat) class OtherXmlFile(XmlFile): - def __init__(self, filename, compressiontype=GZ_COMPRESSION, + def __init__(self, path, compressiontype=GZ_COMPRESSION, contentstat=None): - XmlFile.__init__(self, filename, XMLFILE_OTHER, + """:arg path: Path to the other xml file + :arg compressiontype: Compression type + :arg contentstat: ContentStat object""" + XmlFile.__init__(self, path, XMLFILE_OTHER, compressiontype, contentstat) # Functions diff --git a/src/python/contentstat-py.c b/src/python/contentstat-py.c index 738bf13..1d741b7 100644 --- a/src/python/contentstat-py.c +++ b/src/python/contentstat-py.c @@ -65,6 +65,11 @@ contentstat_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return (PyObject *)self; } +PyDoc_STRVAR(contentstat_init__doc__, +"ContentStat object representing statistical information about content\n\n" +".. method:: __init__(checksum_type)\n\n" +" :arg checksum_type: Type of checksum that should be used\n"); + static int contentstat_init(_ContentStatObject *self, PyObject *args, PyObject *kwds) { @@ -228,7 +233,7 @@ PyTypeObject ContentStat_Type = { 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE, /* tp_flags */ - "ContentStat object", /* tp_doc */ + contentstat_init__doc__, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ diff --git a/src/python/package-py.c b/src/python/package-py.c index e573095..fa1983f 100644 --- a/src/python/package-py.c +++ b/src/python/package-py.c @@ -222,10 +222,24 @@ copy_pkg(_PackageObject *self, void *nothing) return Object_FromPackage(cr_package_copy(self->package), 1); } +static PyObject * +deepcopy_pkg(_PackageObject *self, PyObject *args) +{ + PyObject *obj; + + if (!PyArg_ParseTuple(args, "O:deepcopy_pkg", &obj)) + return NULL; + if (check_PackageStatus(self)) + return NULL; + return Object_FromPackage(cr_package_copy(self->package), 1); +} + static struct PyMethodDef package_methods[] = { {"nvra", (PyCFunction)nvra, METH_NOARGS, nvra__doc__}, {"nevra", (PyCFunction)nevra, METH_NOARGS, nevra__doc__}, {"copy", (PyCFunction)copy_pkg, METH_NOARGS, copy__doc__}, + {"__copy__", (PyCFunction)copy_pkg, METH_NOARGS, copy__doc__}, + {"__deepcopy__", (PyCFunction)deepcopy_pkg, METH_VARARGS, copy__doc__}, {NULL} /* sentinel */ }; diff --git a/src/python/xml_file-py.c b/src/python/xml_file-py.c index b5ff8fa..522d496 100644 --- a/src/python/xml_file-py.c +++ b/src/python/xml_file-py.c @@ -66,7 +66,7 @@ xmlfile_new(PyTypeObject *type, PyObject *args, PyObject *kwds) PyDoc_STRVAR(xmlfile_init__doc__, "XmlFile object represents a single XML file (primary, filelists or other).\n\n" ".. method:: __init__(path, type, compression_type, contentstat)\n\n" -" :arg path: Path to the database\n" +" :arg path: Path to the xml file\n" " :arg type: Type of the XML file. One from XMLFILE_PRIMARY,\n" " XMLFILE_FILELISTS, XMLFILE_OTHER constants\n" " :arg compression_type: Compression type specified by constant\n"