# 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)
# 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,
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
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 */
};