From f8a84b4ea12d78ef8259cc856a827452e8ca2ea5 Mon Sep 17 00:00:00 2001 From: David Cantrell Date: Fri, 24 Apr 2015 15:31:24 -0400 Subject: [PATCH] Add Python 3 subpackage (#1196402) --- pyparted-3.9.5-rhbz1196402.patch | 267 +++++++++++++++++++++++++++---- 1 file changed, 236 insertions(+), 31 deletions(-) diff --git a/pyparted-3.9.5-rhbz1196402.patch b/pyparted-3.9.5-rhbz1196402.patch index 61d84d6..99d44b5 100644 --- a/pyparted-3.9.5-rhbz1196402.patch +++ b/pyparted-3.9.5-rhbz1196402.patch @@ -396,8 +396,8 @@ diff -up pyparted-3.9.5/setup.py.orig pyparted-3.9.5/setup.py sys.exit(1) diff -up pyparted-3.9.5/src/pyconstraint.c.orig pyparted-3.9.5/src/pyconstraint.c --- pyparted-3.9.5/src/pyconstraint.c.orig 2014-06-24 13:06:32.000000000 -0400 -+++ pyparted-3.9.5/src/pyconstraint.c 2015-04-24 15:01:20.001767442 -0400 -@@ -50,32 +50,6 @@ void _ped_Constraint_dealloc(_ped_Constr ++++ pyparted-3.9.5/src/pyconstraint.c 2015-04-24 15:23:08.200767442 -0400 +@@ -50,45 +50,12 @@ void _ped_Constraint_dealloc(_ped_Constr PyObject_GC_Del(self); } @@ -428,12 +428,30 @@ diff -up pyparted-3.9.5/src/pyconstraint.c.orig pyparted-3.9.5/src/pyconstraint. -} - PyObject *_ped_Constraint_richcompare(_ped_Constraint *a, PyObject *b, int op) { - if (op == Py_EQ) { - if (!(_ped_Constraint_Type_obj.tp_compare((PyObject *) a, b))) { +- if (op == Py_EQ) { +- if (!(_ped_Constraint_Type_obj.tp_compare((PyObject *) a, b))) { +- Py_RETURN_TRUE; +- } else { +- Py_RETURN_FALSE; +- } +- } else if (op == Py_NE) { +- if (_ped_Constraint_Type_obj.tp_compare((PyObject *) a, b)) { +- Py_RETURN_TRUE; +- } else { +- Py_RETURN_FALSE; +- } ++ if (op == Py_EQ || op == Py_NE) { ++ int rv = _ped_Constraint_compare(a, b); ++ if (PyErr_Occurred()) ++ return NULL; ++ return PyBool_FromLong(op == Py_EQ ? rv == 0 : rv != 0); + } else if ((op == Py_LT) || (op == Py_LE) || + (op == Py_GT) || (op == Py_GE)) { + PyErr_SetString(PyExc_TypeError, "comparison operator not supported for _ped.Constraint"); diff -up pyparted-3.9.5/src/pydevice.c.orig pyparted-3.9.5/src/pydevice.c --- pyparted-3.9.5/src/pydevice.c.orig 2014-06-24 13:06:32.000000000 -0400 -+++ pyparted-3.9.5/src/pydevice.c 2015-04-24 15:02:02.152767442 -0400 -@@ -36,29 +36,6 @@ void _ped_CHSGeometry_dealloc(_ped_CHSGe ++++ pyparted-3.9.5/src/pydevice.c 2015-04-24 15:24:38.791767442 -0400 +@@ -36,43 +36,13 @@ void _ped_CHSGeometry_dealloc(_ped_CHSGe PyObject_GC_Del(self); } @@ -462,8 +480,27 @@ diff -up pyparted-3.9.5/src/pydevice.c.orig pyparted-3.9.5/src/pydevice.c - PyObject *_ped_CHSGeometry_richcompare(_ped_CHSGeometry *a, PyObject *b, int op) { - if (op == Py_EQ) { -@@ -139,41 +116,6 @@ void _ped_Device_dealloc(_ped_Device *se +- if (op == Py_EQ) { +- if (!(_ped_CHSGeometry_Type_obj.tp_compare((PyObject *) a, b))) { +- Py_RETURN_TRUE; +- } else { +- Py_RETURN_FALSE; +- } +- } else if (op == Py_NE) { +- if (_ped_CHSGeometry_Type_obj.tp_compare((PyObject *) a, b)) { +- Py_RETURN_TRUE; +- } else { +- Py_RETURN_FALSE; +- } ++ if (op == Py_EQ || op == Py_NE) { ++ int rv = _ped_CHSGeometry_compare(a, b); ++ if (PyErr_Occurred()) ++ return NULL; ++ return PyBool_FromLong(op == Py_EQ ? rv == 0 : rv != 0); + } else if ((op == Py_LT) || (op == Py_LE) || + (op == Py_GT) || (op == Py_GE)) { + PyErr_SetString(PyExc_TypeError, "comparison operator not supported for _ped.CHSGeometry"); +@@ -139,54 +109,12 @@ void _ped_Device_dealloc(_ped_Device *se PyObject_GC_Del(self); } @@ -503,12 +540,30 @@ diff -up pyparted-3.9.5/src/pydevice.c.orig pyparted-3.9.5/src/pydevice.c -} - PyObject *_ped_Device_richcompare(_ped_Device *a, PyObject *b, int op) { - if (op == Py_EQ) { - if (!(_ped_Device_Type_obj.tp_compare((PyObject *) a, b))) { +- if (op == Py_EQ) { +- if (!(_ped_Device_Type_obj.tp_compare((PyObject *) a, b))) { +- Py_RETURN_TRUE; +- } else { +- Py_RETURN_FALSE; +- } +- } else if (op == Py_NE) { +- if (_ped_Device_Type_obj.tp_compare((PyObject *) a, b)) { +- Py_RETURN_TRUE; +- } else { +- Py_RETURN_FALSE; +- } ++ if (op == Py_EQ || op == Py_NE) { ++ int rv = _ped_Device_compare(a, b); ++ if (PyErr_Occurred()) ++ return NULL; ++ return PyBool_FromLong(op == Py_EQ ? rv == 0 : rv != 0); + } else if ((op == Py_LT) || (op == Py_LE) || + (op == Py_GT) || (op == Py_GE)) { + PyErr_SetString(PyExc_TypeError, "comparison operator not supported for _ped.Device"); diff -up pyparted-3.9.5/src/pydisk.c.orig pyparted-3.9.5/src/pydisk.c --- pyparted-3.9.5/src/pydisk.c.orig 2015-04-24 14:46:46.312767442 -0400 -+++ pyparted-3.9.5/src/pydisk.c 2015-04-24 15:02:16.280767442 -0400 -@@ -47,31 +47,6 @@ void _ped_Partition_dealloc(_ped_Partiti ++++ pyparted-3.9.5/src/pydisk.c 2015-04-24 15:28:45.030767442 -0400 +@@ -47,40 +47,15 @@ void _ped_Partition_dealloc(_ped_Partiti PyObject_GC_Del(self); } @@ -539,11 +594,70 @@ diff -up pyparted-3.9.5/src/pydisk.c.orig pyparted-3.9.5/src/pydisk.c - PyObject *_ped_Partition_richcompare(_ped_Partition *a, PyObject *b, int op) { if (op == Py_EQ) { - if (!(_ped_Partition_Type_obj.tp_compare((PyObject *) a, b))) { +- if (!(_ped_Partition_Type_obj.tp_compare((PyObject *) a, b))) { ++ if ((_ped_Partition_Type_obj.tp_richcompare((PyObject *) a, b, Py_EQ))) { + Py_RETURN_TRUE; + } else { + Py_RETURN_FALSE; + } + } else if (op == Py_NE) { +- if (_ped_Partition_Type_obj.tp_compare((PyObject *) a, b)) { ++ if (!(_ped_Partition_Type_obj.tp_richcompare((PyObject *) a, b, Py_EQ))) { + Py_RETURN_TRUE; + } else { + Py_RETURN_FALSE; +@@ -324,18 +299,11 @@ int _ped_Disk_compare(_ped_Disk *self, P + } + + PyObject *_ped_Disk_richcompare(_ped_Disk *a, PyObject *b, int op) { +- if (op == Py_EQ) { +- if (!(_ped_Disk_Type_obj.tp_compare((PyObject *) a, b))) { +- Py_RETURN_TRUE; +- } else { +- Py_RETURN_FALSE; +- } +- } else if (op == Py_NE) { +- if (_ped_Disk_Type_obj.tp_compare((PyObject *) a, b)) { +- Py_RETURN_TRUE; +- } else { +- Py_RETURN_FALSE; +- } ++ if (op == Py_EQ || op == Py_NE) { ++ int rv = _ped_Disk_compare(a, b); ++ if (PyErr_Occurred()) ++ return NULL; ++ return PyBool_FromLong(op == Py_EQ ? rv == 0 : rv != 0); + } else if ((op == Py_LT) || (op == Py_LE) || + (op == Py_GT) || (op == Py_GE)) { + PyErr_SetString(PyExc_TypeError, "comparison operator not supported for _ped.Disk"); +@@ -476,18 +444,11 @@ int _ped_DiskType_compare(_ped_DiskType + } + + PyObject *_ped_DiskType_richcompare(_ped_DiskType *a, PyObject *b, int op) { +- if (op == Py_EQ) { +- if (!(_ped_DiskType_Type_obj.tp_compare((PyObject *) a, b))) { +- Py_RETURN_TRUE; +- } else { +- Py_RETURN_FALSE; +- } +- } else if (op == Py_NE) { +- if (_ped_DiskType_Type_obj.tp_compare((PyObject *) a, b)) { +- Py_RETURN_TRUE; +- } else { +- Py_RETURN_FALSE; +- } ++ if (op == Py_EQ || op == Py_NE) { ++ int rv = _ped_DiskType_compare(a, b); ++ if (PyErr_Occurred()) ++ return NULL; ++ return PyBool_FromLong(op == Py_EQ ? rv == 0 : rv != 0); + } else if ((op == Py_LT) || (op == Py_LE) || + (op == Py_GT) || (op == Py_GE)) { + PyErr_SetString(PyExc_TypeError, "comparison operator not supported for _ped.DiskType"); diff -up pyparted-3.9.5/src/pyfilesys.c.orig pyparted-3.9.5/src/pyfilesys.c --- pyparted-3.9.5/src/pyfilesys.c.orig 2014-06-24 13:06:32.000000000 -0400 -+++ pyparted-3.9.5/src/pyfilesys.c 2015-04-24 15:02:40.112767442 -0400 -@@ -38,27 +38,6 @@ void _ped_FileSystemType_dealloc(_ped_Fi ++++ pyparted-3.9.5/src/pyfilesys.c 2015-04-24 15:29:53.925767442 -0400 +@@ -38,41 +38,13 @@ void _ped_FileSystemType_dealloc(_ped_Fi PyObject_GC_Del(self); } @@ -570,8 +684,27 @@ diff -up pyparted-3.9.5/src/pyfilesys.c.orig pyparted-3.9.5/src/pyfilesys.c - PyObject *_ped_FileSystemType_richcompare(_ped_FileSystemType *a, PyObject *b, int op) { - if (op == Py_EQ) { -@@ -137,30 +116,6 @@ void _ped_FileSystem_dealloc(_ped_FileSy +- if (op == Py_EQ) { +- if (!(_ped_FileSystemType_Type_obj.tp_compare((PyObject *) a, b))) { +- Py_RETURN_TRUE; +- } else { +- Py_RETURN_FALSE; +- } +- } else if (op == Py_NE) { +- if (_ped_FileSystemType_Type_obj.tp_compare((PyObject *) a, b)) { +- Py_RETURN_TRUE; +- } else { +- Py_RETURN_FALSE; +- } ++ if (op == Py_EQ || op == Py_NE) { ++ int rv = _ped_FileSystemType_compare(a, b); ++ if (PyErr_Occurred()) ++ return NULL; ++ return PyBool_FromLong(op == Py_EQ ? rv == 0 : rv != 0); + } else if ((op == Py_LT) || (op == Py_LE) || + (op == Py_GT) || (op == Py_GE)) { + PyErr_SetString(PyExc_TypeError, "comparison operator not supported for _ped.FileSystemType"); +@@ -137,43 +109,12 @@ void _ped_FileSystem_dealloc(_ped_FileSy PyObject_GC_Del(self); } @@ -600,12 +733,30 @@ diff -up pyparted-3.9.5/src/pyfilesys.c.orig pyparted-3.9.5/src/pyfilesys.c -} - PyObject *_ped_FileSystem_richcompare(_ped_FileSystem *a, PyObject *b, int op) { - if (op == Py_EQ) { - if (!(_ped_FileSystem_Type_obj.tp_compare((PyObject *) a, b))) { +- if (op == Py_EQ) { +- if (!(_ped_FileSystem_Type_obj.tp_compare((PyObject *) a, b))) { +- Py_RETURN_TRUE; +- } else { +- Py_RETURN_FALSE; +- } +- } else if (op == Py_NE) { +- if (_ped_FileSystem_Type_obj.tp_compare((PyObject *) a, b)) { +- Py_RETURN_TRUE; +- } else { +- Py_RETURN_FALSE; +- } ++ if (op == Py_EQ || op == Py_NE) { ++ int rv = _ped_FileSystem_compare(a, b); ++ if (PyErr_Occurred()) ++ return NULL; ++ return PyBool_FromLong(op == Py_EQ ? rv == 0 : rv != 0); + } else if ((op == Py_LT) || (op == Py_LE) || + (op == Py_GT) || (op == Py_GE)) { + PyErr_SetString(PyExc_TypeError, "comparison operator not supported for _ped.FileSystem"); diff -up pyparted-3.9.5/src/pygeom.c.orig pyparted-3.9.5/src/pygeom.c --- pyparted-3.9.5/src/pygeom.c.orig 2014-06-24 13:06:32.000000000 -0400 -+++ pyparted-3.9.5/src/pygeom.c 2015-04-24 15:02:53.984767442 -0400 -@@ -43,30 +43,6 @@ void _ped_Geometry_dealloc(_ped_Geometry ++++ pyparted-3.9.5/src/pygeom.c 2015-04-24 15:30:20.477767442 -0400 +@@ -43,43 +43,12 @@ void _ped_Geometry_dealloc(_ped_Geometry PyObject_GC_Del(self); } @@ -634,12 +785,30 @@ diff -up pyparted-3.9.5/src/pygeom.c.orig pyparted-3.9.5/src/pygeom.c -} - PyObject *_ped_Geometry_richcompare(_ped_Geometry *a, PyObject *b, int op) { - if (op == Py_EQ) { - if (!(_ped_Geometry_Type_obj.tp_compare((PyObject *) a, b))) { +- if (op == Py_EQ) { +- if (!(_ped_Geometry_Type_obj.tp_compare((PyObject *) a, b))) { +- Py_RETURN_TRUE; +- } else { +- Py_RETURN_FALSE; +- } +- } else if (op == Py_NE) { +- if (_ped_Geometry_Type_obj.tp_compare((PyObject *) a, b)) { +- Py_RETURN_TRUE; +- } else { +- Py_RETURN_FALSE; +- } ++ if (op == Py_EQ || op == Py_NE) { ++ int rv = _ped_Geometry_compare(a, b); ++ if (PyErr_Occurred()) ++ return NULL; ++ return PyBool_FromLong(op == Py_EQ ? rv == 0 : rv != 0); + } else if ((op == Py_LT) || (op == Py_LE) || + (op == Py_GT) || (op == Py_GE)) { + PyErr_SetString(PyExc_TypeError, "comparison operator not supported for _ped.Geometry"); diff -up pyparted-3.9.5/src/pynatmath.c.orig pyparted-3.9.5/src/pynatmath.c --- pyparted-3.9.5/src/pynatmath.c.orig 2014-06-24 13:06:32.000000000 -0400 -+++ pyparted-3.9.5/src/pynatmath.c 2015-04-24 15:03:07.816767442 -0400 -@@ -36,28 +36,6 @@ void _ped_Alignment_dealloc(_ped_Alignme ++++ pyparted-3.9.5/src/pynatmath.c 2015-04-24 15:30:48.821767442 -0400 +@@ -36,41 +36,12 @@ void _ped_Alignment_dealloc(_ped_Alignme PyObject_GC_Del(self); } @@ -666,12 +835,30 @@ diff -up pyparted-3.9.5/src/pynatmath.c.orig pyparted-3.9.5/src/pynatmath.c -} - PyObject *_ped_Alignment_richcompare(_ped_Alignment *a, PyObject *b, int op) { - if (op == Py_EQ) { - if (!(_ped_Alignment_Type_obj.tp_compare((PyObject *) a, b))) { +- if (op == Py_EQ) { +- if (!(_ped_Alignment_Type_obj.tp_compare((PyObject *) a, b))) { +- Py_RETURN_TRUE; +- } else { +- Py_RETURN_FALSE; +- } +- } else if (op == Py_NE) { +- if (_ped_Alignment_Type_obj.tp_compare((PyObject *) a, b)) { +- Py_RETURN_TRUE; +- } else { +- Py_RETURN_FALSE; +- } ++ if (op == Py_EQ || op == Py_NE) { ++ int rv = _ped_Alignment_compare(a, b); ++ if (PyErr_Occurred()) ++ return NULL; ++ return PyBool_FromLong(op == Py_EQ ? rv == 0 : rv != 0); + } else if ((op == Py_LT) || (op == Py_LE) || + (op == Py_GT) || (op == Py_GE)) { + PyErr_SetString(PyExc_TypeError, "comparison operator not supported for _ped.Alignment"); diff -up pyparted-3.9.5/src/pytimer.c.orig pyparted-3.9.5/src/pytimer.c --- pyparted-3.9.5/src/pytimer.c.orig 2014-06-24 13:06:32.000000000 -0400 -+++ pyparted-3.9.5/src/pytimer.c 2015-04-24 14:46:46.316767442 -0400 -@@ -35,33 +35,6 @@ void _ped_Timer_dealloc(_ped_Timer *self ++++ pyparted-3.9.5/src/pytimer.c 2015-04-24 15:31:12.269767442 -0400 +@@ -35,46 +35,12 @@ void _ped_Timer_dealloc(_ped_Timer *self PyObject_GC_Del(self); } @@ -703,6 +890,24 @@ diff -up pyparted-3.9.5/src/pytimer.c.orig pyparted-3.9.5/src/pytimer.c -} - PyObject *_ped_Timer_richcompare(_ped_Timer *a, PyObject *b, int op) { - if (op == Py_EQ) { - if (!(_ped_Timer_Type_obj.tp_compare((PyObject *) a, b))) { +- if (op == Py_EQ) { +- if (!(_ped_Timer_Type_obj.tp_compare((PyObject *) a, b))) { +- Py_RETURN_TRUE; +- } else { +- Py_RETURN_FALSE; +- } +- } else if (op == Py_NE) { +- if (_ped_Timer_Type_obj.tp_compare((PyObject *) a, b)) { +- Py_RETURN_TRUE; +- } else { +- Py_RETURN_FALSE; +- } ++ if (op == Py_EQ || op == Py_NE) { ++ int rv = _ped_Timer_compare(a, b); ++ if (PyErr_Occurred()) ++ return NULL; ++ return PyBool_FromLong(op == Py_EQ ? rv == 0 : rv != 0); + } else if ((op == Py_LT) || (op == Py_LE) || + (op == Py_GT) || (op == Py_GE)) { + PyErr_SetString(PyExc_TypeError, "comparison operator not supported for _ped.Timer"); diff -up pyparted-3.9.5/src/pyunit.c.orig pyparted-3.9.5/src/pyunit.c