rpms/python-pysctp/devel __init__.py, NONE, 1.1 pysctp-buildfix.patch, NONE, 1.1 python-pysctp.spec, NONE, 1.1 setup.py, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Neil Horman nhorman at fedoraproject.org
Thu Sep 11 17:14:10 UTC 2008


Author: nhorman

Update of /cvs/extras/rpms/python-pysctp/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv13352

Modified Files:
	.cvsignore sources 
Added Files:
	__init__.py pysctp-buildfix.patch python-pysctp.spec setup.py 
Log Message:
Initial import


--- NEW FILE __init__.py ---
__version__ = "0.3.1"

pysctp-buildfix.patch:

--- NEW FILE pysctp-buildfix.patch ---
diff -up pysctp-0.3.1/sctp.py.orig pysctp-0.3.1/sctp.py
--- pysctp-0.3.1/sctp.py.orig	2008-04-10 21:30:33.000000000 -0400
+++ pysctp-0.3.1/sctp.py	2008-04-10 21:30:20.000000000 -0400
@@ -32,7 +32,7 @@ send_failed(): 
 remote_error(): 
 shutdown_event(): 
 pdapi_event(): 
-adaption_event(): 
+adaptation_event(): 
 
 Every SCTP socket has a number of properties. Two "complex" properties,
 that contain a number of sub-properties, are: 
@@ -246,7 +246,7 @@ class notification(object):
 	type_REMOTE_ERROR = _sctp.getconstant("SCTP_REMOTE_ERROR")
 	type_SHUTDOWN_EVENT = _sctp.getconstant("SCTP_SHUTDOWN_EVENT")
 	type_PARTIAL_DELIVERY_EVENT = _sctp.getconstant("SCTP_PARTIAL_DELIVERY_EVENT")
-	type_ADAPTION_INDICATION = _sctp.getconstant("SCTP_ADAPTION_INDICATION")
+	type_ADAPTATION_INDICATION = _sctp.getconstant("SCTP_ADAPTATION_INDICATION")
 
 class assoc_change(notification):
 	"""
@@ -396,14 +396,14 @@ class shutdown_event(notification):
 		self.assoc_id = 0
 		notification.__init__(self, values)
 	
-class adaption_event(notification):
+class adaptation_event(notification):
 	"""
 	Adaption indication event. It signals that the remote peer requests
-	an specific adaption layer.
+	an specific adaptation layer.
 
 	In SCTP, you can pass an optional 32-bit metadata identifier 
 	along each message, called "ppid". For protocols that actively use
-	this feature, it is like a subprotocol identifier, or "adaption
+	this feature, it is like a subprotocol identifier, or "adaptation
 	layer". The message interpreter is chosen by this value. This is
 	mostly for telephony signaling-related protocols.
 
@@ -419,7 +419,7 @@ class adaption_event(notification):
 	that (see event_subscribe class for details).
 	"""
 	def __init__(self, values=None):
-		self.adaption_ind = 0
+		self.adaptation_ind = 0
 		self.assoc_id = 0
 		notification.__init__(self, values)
 
@@ -451,7 +451,7 @@ notification_table = {
 	notification.type_REMOTE_ERROR: remote_error,
 	notification.type_SHUTDOWN_EVENT: shutdown_event,
 	notification.type_PARTIAL_DELIVERY_EVENT: pdapi_event,
-	notification.type_ADAPTION_INDICATION: adaption_event,
+	notification.type_ADAPTATION_INDICATION: adaptation_event,
 }
 
 
@@ -519,7 +519,7 @@ class event_subscribe(object):
 	peer_error: refers to remote_error() event
 	shutdown: refers to shutdon_event() 
 	partial_delivery: refers to pdapi_event()
-	adaption_layer: refers to adaption_event()
+	adaptation_layer: refers to adaptation_event()
 
 	(*) sndrcvinfo is ALWAYS returned by sctp_recv() along with message data. The
 	    data_io property just controls whether sndrcvinfo() contains useful data.
@@ -531,7 +531,7 @@ class event_subscribe(object):
 	sendfailure = send_failure
 	peererror = peer_error
 	partialdelivery = partial_delivery
-	adaptionlayer = adaption_layer
+	adaptationlayer = adaptation_layer
 	"""
 
 	def flush(self):
@@ -548,8 +548,8 @@ class event_subscribe(object):
 	def __get_property(self, key):
 		return self.__dict__[key]
 
-	def get_adaption_layer(self):
-		return self.__get_property("_adaption_layer")
+	def get_adaptation_layer(self):
+		return self.__get_property("_adaptation_layer")
 
 	def get_partial_delivery(self):
 		return self.__get_property("_partial_delivery")
@@ -572,8 +572,8 @@ class event_subscribe(object):
 	def get_data_io(self, value):
 		return self.__get_property("_data_io")
 
-	def set_adaption_layer(self, value):
-		self.__set_property("_adaption_layer", value)
+	def set_adaptation_layer(self, value):
+		self.__set_property("_adaptation_layer", value)
 
 	def set_partial_delivery(self, value):
 		self.__set_property("_partial_delivery", value)
@@ -608,7 +608,7 @@ class event_subscribe(object):
 		self._peer_error = 0
 		self._shutdown = 0
 		self._partial_delivery = 0
-		self._adaption_layer = 0
+		self._adaptation_layer = 0
 
 		if self.autoflush:
 			self.flush()
@@ -642,8 +642,8 @@ class event_subscribe(object):
 	partial_delivery = property(get_partial_delivery, set_partial_delivery)
 	partialdelivery = partial_delivery
 
-	adaption_layer = property(get_adaption_layer, set_adaption_layer)
-	adaptionlayer = adaption_layer
+	adaptation_layer = property(get_adaptation_layer, set_adaptation_layer)
+	adaptationlayer = adaptation_layer
 
 
 ########## STRUCTURES EXCHANGED VIA set/getsockopt() 
@@ -964,7 +964,7 @@ class sctpsocket(object):
 		 nature of SCTP, some implementations have it turned on by default, while TCP 
 		 is mandated to have it off by default.
 
-	adaption: 32-bit value related to the "ppid" metadata field sent along each data
+	adaptation: 32-bit value related to the "ppid" metadata field sent along each data
 		  message. If this property is different than zero, the configured value
 		  is sent via ADAPTION INDICATION event to the remote peer when a new 
 		  association is opened. This is intended to be used by telephony-related
@@ -1097,7 +1097,7 @@ class sctpsocket(object):
 
 		    WARNING: identifying destination by Association ID not implemented yet!
 
-		ppid: adaption layer value, a 32-bit metadata that is sent along the message.
+		ppid: adaptation layer value, a 32-bit metadata that is sent along the message.
 		      Defaults to 0.
 
 		flags: a bitmap of MSG_* flags. For example, MSG_UNORDERED indicates that 
@@ -1313,21 +1313,21 @@ class sctpsocket(object):
 		"""
 		_sctp.set_nodelay(self._sk.fileno(), rvalue)
 
-	def get_adaption(self):
+	def get_adaptation(self):
 		"""
-		Gets the adaption layer indication from kernel.
+		Gets the adaptation layer indication from kernel.
 		
-		See class documentation for more details. (adaption property)
+		See class documentation for more details. (adaptation property)
 		"""
-		return _sctp.get_adaption(self._sk.fileno())
+		return _sctp.get_adaptation(self._sk.fileno())
 
-	def set_adaption(self, rvalue):
+	def set_adaptation(self, rvalue):
 		"""
-		Sets the adaption layer indication for this socket.
+		Sets the adaptation layer indication for this socket.
 
-		See class documentation for more details. (adaption property)
+		See class documentation for more details. (adaptation property)
 		"""
-		_sctp.set_adaption(self._sk.fileno(), rvalue)
+		_sctp.set_adaptation(self._sk.fileno(), rvalue)
 
 	def get_disable_fragments(self):
 		"""
@@ -1599,7 +1599,7 @@ class sctpsocket(object):
 	# properties
 
 	nodelay = property(get_nodelay, set_nodelay)
-	adaption = property(get_adaption, set_adaption)
+	adaptation = property(get_adaptation, set_adaptation)
 	disable_fragments = property(get_disable_fragments, set_disable_fragments)
 	mappedv4 = property(get_mappedv4, set_mappedv4)
 	maxseg = property(get_maxseg, set_maxseg)
diff -up pysctp-0.3.1/Makefile.orig pysctp-0.3.1/Makefile
--- pysctp-0.3.1/Makefile.orig	2008-04-10 21:30:33.000000000 -0400
+++ pysctp-0.3.1/Makefile	2008-04-10 21:29:46.000000000 -0400
@@ -1,4 +1,4 @@
-PYTHON_VERSION = 2.4
+PYTHON_VERSION = 2.5
 CFLAGS = -Wall -I/usr/include/python$(PYTHON_VERSION) -fPIC
 LDFLAGS = -fPIC -shared -lsctp
 
diff -up pysctp-0.3.1/_sctp.c.orig pysctp-0.3.1/_sctp.c
--- pysctp-0.3.1/_sctp.c.orig	2008-04-10 21:30:33.000000000 -0400
+++ pysctp-0.3.1/_sctp.c	2008-04-10 21:30:20.000000000 -0400
@@ -5,8 +5,7 @@
  * Elvis Pfützenreuter (elvis.pfutzenreuter@{gmail.com,indt.org.br})
  * Copyright (c) 2005 Instituto Nokia de Tecnologia
  */
-
-#include "Python.h"
+#include <Python.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <netinet/sctp.h>
@@ -36,8 +35,8 @@ static PyObject* get_disable_fragments(P
 static PyObject* set_disable_fragments(PyObject* dummy, PyObject* args);
 static PyObject* get_autoclose(PyObject* dummy, PyObject* args);
 static PyObject* set_autoclose(PyObject* dummy, PyObject* args);
-static PyObject* get_adaption(PyObject* dummy, PyObject* args);
-static PyObject* set_adaption(PyObject* dummy, PyObject* args);
+static PyObject* get_adaptation(PyObject* dummy, PyObject* args);
+static PyObject* set_adaptation(PyObject* dummy, PyObject* args);
 static PyObject* set_peer_primary(PyObject* dummy, PyObject* args);
 static PyObject* set_primary(PyObject* dummy, PyObject* args);
 static PyObject* bindx(PyObject* dummy, PyObject* args);
@@ -84,8 +83,8 @@ static PyMethodDef _sctpMethods[] = 
 	{"set_initparams", set_initparams, METH_VARARGS, ""},
 	{"get_nodelay", get_nodelay, METH_VARARGS, ""},
 	{"set_nodelay", set_nodelay, METH_VARARGS, ""},
-	{"get_adaption", get_adaption, METH_VARARGS, ""},
-	{"set_adaption", set_adaption, METH_VARARGS, ""},
+	{"get_adaptation", get_adaptation, METH_VARARGS, ""},
+	{"set_adaptation", set_adaptation, METH_VARARGS, ""},
 	{"get_disable_fragments", get_disable_fragments, METH_VARARGS, ""},
 	{"set_disable_fragments", set_disable_fragments, METH_VARARGS, ""},
 	{"get_events", get_events, METH_VARARGS, ""},
@@ -206,7 +205,7 @@ static ktuple _constants[] = 
 	{"SCTP_REMOTE_ERROR", SCTP_REMOTE_ERROR},
 	{"SCTP_SHUTDOWN_EVENT", SCTP_SHUTDOWN_EVENT},
 	{"SCTP_PARTIAL_DELIVERY_EVENT", SCTP_PARTIAL_DELIVERY_EVENT}, 
-	{"SCTP_ADAPTION_INDICATION", SCTP_ADAPTION_INDICATION},
+	{"SCTP_ADAPTATION_INDICATION", SCTP_ADAPTATION_INDICATION},
 	{0, -1}
 };
 
@@ -299,7 +298,7 @@ static PyObject* get_mappedv4(PyObject* 
 {
 	PyObject* ret = 0;
 	int fd, v;
-	int lv = sizeof(v);
+	socklen_t lv = sizeof(v);
 	if (PyArg_ParseTuple(args, "i", &fd)) {
 		if (getsockopt(fd, SOL_SCTP, SCTP_I_WANT_MAPPED_V4_ADDR, &v, &lv)) {
 			PyErr_SetFromErrno(PyExc_IOError);
@@ -328,7 +327,7 @@ static PyObject* get_nodelay(PyObject* d
 {
 	PyObject* ret = 0;
 	int fd, v;
-	int lv = sizeof(v);
+	socklen_t lv = sizeof(v);
 	if (PyArg_ParseTuple(args, "i", &fd)) {
 		if (getsockopt(fd, SOL_SCTP, SCTP_NODELAY, &v, &lv)) {
 			PyErr_SetFromErrno(PyExc_IOError);
@@ -360,7 +359,7 @@ static PyObject* get_assocparams(PyObjec
 	PyObject* oassoc_id;
 	int fd;
 	struct sctp_assocparams v;
-	int lv = sizeof(v);
+	socklen_t lv = sizeof(v);
 	int ok;
 	
 	ok = PyArg_ParseTuple(args, "iO", &fd, &dict) && PyDict_Check(dict);
@@ -456,7 +455,7 @@ static PyObject* get_paddrparams(PyObjec
 	int slen_dummy;
 
 	struct sctp_paddrparams v;
-	int lv = sizeof(v);
+	socklen_t lv = sizeof(v);
 	int ok;
 	
 	ok = PyArg_ParseTuple(args, "iO", &fd, &dict) && PyDict_Check(dict);
@@ -580,7 +579,7 @@ static PyObject* get_status(PyObject* du
 
 	int fd;
 	struct sctp_status v;
-	int lv = sizeof(v);
+	socklen_t lv = sizeof(v);
 	int ok;
 	
 	ok = PyArg_ParseTuple(args, "iOO", &fd, &dict, &dict2) && \
@@ -641,7 +640,7 @@ static PyObject* get_paddrinfo(PyObject*
 	int fd;
 	int slen_dummy;
 	struct sctp_paddrinfo v;
-	int lv = sizeof(v);
+	socklen_t lv = sizeof(v);
 	int ok;
 	
 	ok = PyArg_ParseTuple(args, "iO", &fd, &dict) && PyDict_Check(dict);
@@ -682,7 +681,7 @@ static PyObject* get_rtoinfo(PyObject* d
 	PyObject* oassoc_id;
 	int fd;
 	struct sctp_rtoinfo v;
-	int lv = sizeof(v);
+	socklen_t lv = sizeof(v);
 	int ok;
 	
 	ok = PyArg_ParseTuple(args, "iO", &fd, &dict) && PyDict_Check(dict);
@@ -758,7 +757,7 @@ static PyObject* get_initparams(PyObject
 	PyObject* ret = 0;
 	int fd;
 	struct sctp_initmsg v;
-	int lv = sizeof(v);
+	socklen_t lv = sizeof(v);
 
 	if (! PyArg_ParseTuple(args, "i", &fd)) {
 		return ret;
@@ -834,7 +833,7 @@ static PyObject* get_events(PyObject* du
 	PyObject* ret = 0;
 	int fd;
 	struct sctp_event_subscribe v;
-	int lv = sizeof(v);
+	socklen_t lv = sizeof(v);
 
 	if (PyArg_ParseTuple(args, "i", &fd)) {
 		if (getsockopt(fd, SOL_SCTP, SCTP_EVENTS, &v, &lv)) {
@@ -848,7 +847,7 @@ static PyObject* get_events(PyObject* du
 			PyDict_SetItemString(ret, "_peer_error", PyBool_FromLong(v.sctp_peer_error_event));
 			PyDict_SetItemString(ret, "_shutdown", PyBool_FromLong(v.sctp_shutdown_event));
 			PyDict_SetItemString(ret, "_partial_delivery", PyBool_FromLong(v.sctp_partial_delivery_event));
-			PyDict_SetItemString(ret, "_adaption_layer", PyBool_FromLong(v.sctp_adaption_layer_event));
+			PyDict_SetItemString(ret, "_adaptation_layer", PyBool_FromLong(v.sctp_adaptation_layer_event));
 		}
 	}
 	return ret;
@@ -859,7 +858,7 @@ static PyObject* set_events(PyObject* du
 	PyObject* ret = 0;
 	int fd;
 	PyObject *ov, *o_data_io, *o_association, *o_address, *o_send_failure;
-	PyObject *o_peer_error, *o_shutdown, *o_partial_delivery, *o_adaption_layer;
+	PyObject *o_peer_error, *o_shutdown, *o_partial_delivery, *o_adaptation_layer;
 	struct sctp_event_subscribe v;
 	int ok = PyArg_ParseTuple(args, "iO", &fd, &ov) && PyDict_Check(ov);
 
@@ -870,7 +869,7 @@ static PyObject* set_events(PyObject* du
 	ok = ok && (o_peer_error = PyDict_GetItemString(ov, "_peer_error"));
 	ok = ok && (o_shutdown = PyDict_GetItemString(ov, "_shutdown"));
 	ok = ok && (o_partial_delivery = PyDict_GetItemString(ov, "_partial_delivery"));
-	ok = ok && (o_adaption_layer = PyDict_GetItemString(ov, "_adaption_layer"));
+	ok = ok && (o_adaptation_layer = PyDict_GetItemString(ov, "_adaptation_layer"));
 
 	ok = ok && (PyInt_Check(o_data_io) != 0);
 	ok = ok && (PyInt_Check(o_association) != 0);
@@ -879,7 +878,7 @@ static PyObject* set_events(PyObject* du
 	ok = ok && (PyInt_Check(o_peer_error) != 0);
 	ok = ok && (PyInt_Check(o_shutdown) != 0);
 	ok = ok && (PyInt_Check(o_send_failure) != 0);
-	ok = ok && (PyInt_Check(o_adaption_layer) != 0);
+	ok = ok && (PyInt_Check(o_adaptation_layer) != 0);
 
 	if (ok) {
 		memset(&v, 0, sizeof(v));
@@ -890,7 +889,7 @@ static PyObject* set_events(PyObject* du
 		v.sctp_peer_error_event = PyInt_AsLong(o_peer_error);
 		v.sctp_shutdown_event = PyInt_AsLong(o_shutdown);
 		v.sctp_partial_delivery_event = PyInt_AsLong(o_partial_delivery);
-		v.sctp_adaption_layer_event = PyInt_AsLong(o_adaption_layer);
+		v.sctp_adaptation_layer_event = PyInt_AsLong(o_adaptation_layer);
 		
 		if (setsockopt(fd, SOL_SCTP, SCTP_EVENTS, &v, sizeof(v))) {
 			PyErr_SetFromErrno(PyExc_IOError);
@@ -905,7 +904,7 @@ static PyObject* get_maxseg(PyObject* du
 {
 	PyObject* ret = 0;
 	int fd, v;
-	int lv = sizeof(v);
+	socklen_t lv = sizeof(v);
 
 	if (PyArg_ParseTuple(args, "i", &fd)) {
 		if (getsockopt(fd, SOL_SCTP, SCTP_MAXSEG, &v, &lv)) {
@@ -936,7 +935,7 @@ static PyObject* get_disable_fragments(P
 {
 	PyObject* ret = 0;
 	int fd, v;
-	int lv = sizeof(v);
+	socklen_t lv = sizeof(v);
 
 	if (PyArg_ParseTuple(args, "i", &fd)) {
 		if (getsockopt(fd, SOL_SCTP, SCTP_DISABLE_FRAGMENTS, &v, &lv)) {
@@ -967,7 +966,7 @@ static PyObject* get_autoclose(PyObject*
 {
 	PyObject* ret = 0;
 	int fd, v;
-	int lv = sizeof(v);
+	socklen_t lv = sizeof(v);
 
 	if (PyArg_ParseTuple(args, "i", &fd)) {
 		if (getsockopt(fd, SOL_SCTP, SCTP_AUTOCLOSE, &v, &lv)) {
@@ -994,14 +993,14 @@ static PyObject* set_autoclose(PyObject*
 	return ret;
 }
 
-static PyObject* get_adaption(PyObject* dummy, PyObject* args)
+static PyObject* get_adaptation(PyObject* dummy, PyObject* args)
 {
 	PyObject* ret = 0;
 	int fd, v;
-	int lv = sizeof(v);
+	socklen_t lv = sizeof(v);
 	
 	if (PyArg_ParseTuple(args, "i", &fd)) {
-		if (getsockopt(fd, SOL_SCTP, SCTP_ADAPTION_LAYER, &v, &lv)) {
+		if (getsockopt(fd, SOL_SCTP, SCTP_ADAPTATION_LAYER, &v, &lv)) {
 			PyErr_SetFromErrno(PyExc_IOError);
 		} else {
 			ret = PyInt_FromLong(v);
@@ -1010,13 +1009,13 @@ static PyObject* get_adaption(PyObject* 
 	return ret;
 }
 
-static PyObject* set_adaption(PyObject* dummy, PyObject* args)
+static PyObject* set_adaptation(PyObject* dummy, PyObject* args)
 {
 	PyObject* ret = 0;
 	int fd, v;
 
 	if (PyArg_ParseTuple(args, "ii", &fd, &v)) {
-		if (setsockopt(fd, SOL_SCTP, SCTP_ADAPTION_LAYER, &v, sizeof(v))) {
+		if (setsockopt(fd, SOL_SCTP, SCTP_ADAPTATION_LAYER, &v, sizeof(v))) {
 			PyErr_SetFromErrno(PyExc_IOError);
 		} else {
 			ret = Py_None; Py_INCREF(ret);
@@ -1522,10 +1521,10 @@ void interpret_notification(PyObject* di
 		PyDict_SetItemString(dict, "assoc_id", PyInt_FromLong(n->pdapi_assoc_id));
 		}
 		break;
-	case SCTP_ADAPTION_INDICATION:
+	case SCTP_ADAPTATION_INDICATION:
 		{
-		const struct sctp_adaption_event* n = &(notif->sn_adaption_event);
-		PyDict_SetItemString(dict, "adaption_ind", PyInt_FromLong(n->sai_adaption_ind));
+		const struct sctp_adaptation_event* n = &(notif->sn_adaptation_event);
+		PyDict_SetItemString(dict, "adaptation_ind", PyInt_FromLong(n->sai_adaptation_ind));
 		PyDict_SetItemString(dict, "assoc_id", PyInt_FromLong(n->sai_assoc_id));
 		}
 		break;
@@ -1537,7 +1536,7 @@ static PyObject* sctp_recv_msg(PyObject*
 	int fd, max_len;
 
 	struct sockaddr_storage sfrom;
-	int sfrom_len = sizeof(sfrom);
+	socklen_t sfrom_len = sizeof(sfrom);
 	int family;
 	int len;
 	int port;
diff -up pysctp-0.3.1/test.py.orig pysctp-0.3.1/test.py
--- pysctp-0.3.1/test.py.orig	2008-04-10 21:30:33.000000000 -0400
+++ pysctp-0.3.1/test.py	2008-04-10 21:30:20.000000000 -0400
@@ -15,8 +15,8 @@ import time
 
 
 
-client = "10.0.1.2"
-server = "10.0.1.1" 
+client = "127.0.0.1"
+server = "127.0.0.1" 
 test_impossible_sending = False
 
 
@@ -68,12 +68,12 @@ tcp.disable_fragments = \
 tcp.mappedv4 = 0
 
 tcp.maxseg = 10001;
-tcp.adaption = 318;
+tcp.adaptation = 318;
 
 if _sctp.get_nodelay(tcp.fileno()) or  \
    _sctp.get_disable_fragments(tcp.fileno()) or \
    _sctp.get_maxseg(tcp.fileno()) != 10001 or \
-   _sctp.get_adaption(tcp.fileno()) != 318 or \
+   _sctp.get_adaptation(tcp.fileno()) != 318 or \
    _sctp.get_mappedv4(tcp.fileno()):
 	raise "Property attribution was not effective"
 
@@ -105,7 +105,7 @@ for s in (tcp, udp, tcp2, udp2):
 	rawparams["_peer_error"] or \
 	rawparams["_shutdown"] or \
 	rawparams["_partial_delivery"] or \
-	rawparams["_adaption_layer"]:
+	rawparams["_adaptation_layer"]:
 		raise "events properties were not effective (in 0)"
 	
 	s.events.data_io = True
@@ -115,7 +115,7 @@ for s in (tcp, udp, tcp2, udp2):
 	s.events.peer_error = True
 	s.events.shutdown = True
 	s.events.partial_delivery = True
-	s.events.adaption_layer = True
+	s.events.adaptation_layer = True
 
 	rawparams = _sctp.get_events(s.fileno())
 
@@ -126,7 +126,7 @@ for s in (tcp, udp, tcp2, udp2):
 	not rawparams["_peer_error"] or \
 	not rawparams["_shutdown"] or \
 	not rawparams["_partial_delivery"] or \
-	not rawparams["_adaption_layer"]:
+	not rawparams["_adaptation_layer"]:
 		raise "events properties were not effective (in 1)"
 
 	s.events.data_io = False
@@ -136,7 +136,7 @@ for s in (tcp, udp, tcp2, udp2):
 	s.events.peer_error = False
 	s.events.shutdown = False
 	s.events.partial_delivery = False
-	s.events.adaption_layer = False
+	s.events.adaptation_layer = False
 
 	rawparams = _sctp.get_events(s.fileno())
 
@@ -147,10 +147,10 @@ for s in (tcp, udp, tcp2, udp2):
 	rawparams["_peer_error"] or \
 	rawparams["_shutdown"] or \
 	rawparams["_partial_delivery"] or \
-	rawparams["_adaption_layer"]:
+	rawparams["_adaptation_layer"]:
 		raise "events properties were not effective (in 0)"
 		
-ipv4 = _sctp._sockaddr_test(("10.00.1.01", 1234))
+ipv4 = _sctp._sockaddr_test(("10.0.1.1", 1234))
 ipv6 = _sctp._sockaddr_test(("FE80::0:0:34", 65534))
 
 if ipv4[3] != ("10.0.1.1", 1234):


--- NEW FILE python-pysctp.spec ---
%define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")

Name:		python-pysctp 
Version:	0.3.1
Release:	3%{?dist}
Summary:	Python sctp socket api extensions bindings
Group:		System Environment/Libraries
License:	LGPLv2
URL:		http://epx.com.br/pysctp/
Source0:	http://epx.com.br/pysctp/pysctp-%{version}.tar.gz
Source1:	setup.py
Source2:	__init__.py
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires:	python lksctp-tools-devel 
BuildRequires:  python-setuptools-devel lksctp-tools-devel

Patch0: pysctp-buildfix.patch

%description
Python bindings for the SCTP socket api (see draft-ietf-tsvwg-sctpsocket-10.txt)

%prep
%setup -q -n pysctp-%{version}
%patch0 -p1
mkdir ./pysctp
cp %{SOURCE1} . 
cp %{SOURCE2} ./pysctp
mv ./sctp.py ./pysctp

%build
FLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build

%install
rm -rf $RPM_BUILD_ROOT
%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%{python_sitearch}/*
%doc README Changelog doc/draft-ietf-tsvwg-sctpsocket-10.txt

%changelog
* Wed Sep 10 2008 Neil Horman <nhorman at tuxdriver.com> 0.3-1-3 
- Fixed files section, last minute pre-import fixes

* Wed Sep 10 2008 Neil Horman <nhorman at tuxdriver.com> 0.3.1-2
- Updated spec file with documentation

* Thu Apr 10 2008 Neil Horman <nhorman at tuxdriver.com> 0.3.1-1
- Initial build


--- NEW FILE setup.py ---
# distutils build script
# To install fuse-python, run 'python setup.py install'

# This setup.py based on that of shout-python (py bindings for libshout,
# part of the icecast project, http://svn.xiph.org/icecast/trunk/shout-python)

try:
    from setuptools import setup
    from setuptools.dist import Distribution
except ImportError:
    from distutils.core import setup
    from distutils.dist import Distribution
from distutils.core import Extension
import os
import sys
from pysctp import __version__

classifiers = """\
Development Status :: 4 - Beta
Intended Audience :: Developers
License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
Operating System :: POSIX
Programming Language :: C
Programming Language :: Python
Topic :: System :: Libraries 
"""

class MyDistribution(Distribution):
    """
    Obnoxious hack to enforce the packager to generate
    the to-be-generated files
    """

    def run_command(self, command):
        if command == 'sdist':
            for f in ('Changelog'):
                 if not os.path.exists(f):
                     raise RuntimeError, 'file ' + `f` + \
                           " doesn't exist, please generate it before creating a source distribution"

        return Distribution.run_command(self, command)

cflags = "-Wall -I/usr/include/python$(PYTHON_VERSION) -fPIC"
# there must be an easier way to set up these flags!
iflags = [x[2:] for x in cflags.split() if x[0:2] == '-I']
extra_cflags = [x for x in cflags.split() if x[0:2] != '-I']
libdirs = []
libsonly = ['sctp'] 

try:
    import thread
except ImportError:
    # if our Python doesn't have thread support, we enforce
    # linking against libpthread so that libfuse's pthread
    # related symbols won't be undefined
    libsonly.append("pthread")

# include_dirs=[]
# libraries=[]
# runtime_library_dirs=[]
# extra_objects, extra_compile_args, extra_link_args
pysctpmodule = Extension('pysctp/_sctp', sources = ['_sctp.c'],
                  include_dirs = iflags,
                  extra_compile_args = extra_cflags,
                  library_dirs = libdirs,
                  libraries = libsonly)

setup (name = 'pysctp',
       description = 'Pyton bindings for SCTP protocol',
       classifiers = filter(None, classifiers.split("\n")),
       version = __version__,
       license = 'LGPL',
       platforms = ['posix'],
       url = 'http//epx.com.br/pysctp/index.php',
       author = 'Elvis Pfutzenreuter',
       author_email = 'epx at altoriopreto.com.br',
       maintainer = 'Neil Horman',
       maintainer_email = 'nhorman at tuxdriver.com',
       packages = ["pysctp"],
       ext_modules = [ pysctpmodule ],
       py_modules=[],
       distclass = MyDistribution)


Index: .cvsignore
===================================================================
RCS file: /cvs/extras/rpms/python-pysctp/devel/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	11 Sep 2008 00:03:21 -0000	1.1
+++ .cvsignore	11 Sep 2008 17:13:39 -0000	1.2
@@ -0,0 +1 @@
+pysctp-0.3.1.tar.gz


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/python-pysctp/devel/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	11 Sep 2008 00:03:21 -0000	1.1
+++ sources	11 Sep 2008 17:13:39 -0000	1.2
@@ -0,0 +1 @@
+7fd43fa7a7f31cff557d0a69fa751e5f  pysctp-0.3.1.tar.gz




More information about the fedora-extras-commits mailing list