Skip to content

Commit

Permalink
remove MANIFEST.in, README.txt, VERSION.txt, update gitignore, split …
Browse files Browse the repository at this point in the history
…transport, move tests
  • Loading branch information
Michael Ricordeau committed Apr 26, 2011
1 parent 7658ddf commit 1611376
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 74 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.pyc
*.egg
*egg*
dist*
build*
src/dist*
src/build*
src/*egg*
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

32 changes: 0 additions & 32 deletions README.txt

This file was deleted.

1 change: 0 additions & 1 deletion VERSION.txt

This file was deleted.

3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
except:
from distutils.core import find_packages

version = open('VERSION.txt').read().strip()
author = "Plivo Team"
author_email = "contact@plivo.org"
maintainer = "Plivo Team"
Expand All @@ -13,7 +12,7 @@

setup_args = {
'name':'plivo',
'version':version,
'version':'0.4.0',
'description':'Plivo framework',
'url':'http://github.com/miglu/Plivo',
'author':author,
Expand Down
2 changes: 1 addition & 1 deletion src/plivo/core/freeswitch/eventsocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from gevent.coros import RLock
from plivo.core.freeswitch.commands import Commands
from plivo.core.freeswitch.eventtypes import Event, CommandResponse, ApiResponse, BgapiResponse
from plivo.core.errors import (LimitExceededError, ConnectError)
from plivo.core.errors import LimitExceededError, ConnectError


EOL = "\n"
Expand Down
2 changes: 1 addition & 1 deletion src/plivo/core/freeswitch/inboundsocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import gevent
from gevent.timeout import Timeout
from plivo.core.freeswitch.eventsocket import EventSocket
from plivo.core.transport import InboundTransport
from plivo.core.freeswitch.transport import InboundTransport
from plivo.core.errors import ConnectError


Expand Down
2 changes: 1 addition & 1 deletion src/plivo/core/freeswitch/outboundsocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from gevent.server import StreamServer
from gevent.timeout import Timeout
from plivo.core.freeswitch.eventsocket import EventSocket
from plivo.core.transport import OutboundTransport
from plivo.core.freeswitch.transport import OutboundTransport
from plivo.core.errors import ConnectError


Expand Down
39 changes: 39 additions & 0 deletions src/plivo/core/freeswitch/transport.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
"""
Freeswitch Transport classes
"""

import gevent.socket as socket
from plivo.core.errors import ConnectError
from plivo.core.transport import Transport


class InboundTransport(Transport):
def __init__(self, host, port, connect_timeout=5):
self.host = host
self.port = port
self.timeout = connect_timeout
self.sockfd = None

def connect(self):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.sock.settimeout(self.timeout)
self.sock.connect((self.host, self.port))
self.sock.settimeout(None)
self.sockfd = self.sock.makefile()

def write(self, data):
if not self.sockfd:
raise ConnectError('not connected')
self.sockfd.write(data)
self.sockfd.flush()



class OutboundTransport(Transport):
def __init__(self, socket, address, connect_timeout=5):
self.sock = socket
self.sockfd = socket.makefile()
self.address = address
self.timeout = connect_timeout

32 changes: 1 addition & 31 deletions src/plivo/core/transport.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""
Transport classes
Transport class
"""

import gevent.socket as socket
Expand All @@ -27,33 +27,3 @@ def close(self):
def get_connect_timeout(self):
return self.timeout


class InboundTransport(Transport):
def __init__(self, host, port, connect_timeout=5):
self.host = host
self.port = port
self.timeout = connect_timeout
self.sockfd = None

def connect(self):
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.sock.settimeout(self.timeout)
self.sock.connect((self.host, self.port))
self.sock.settimeout(None)
self.sockfd = self.sock.makefile()

def write(self, data):
if not self.sockfd:
raise ConnectError('not connected')
self.sockfd.write(data)
self.sockfd.flush()



class OutboundTransport(Transport):
def __init__(self, socket, address, connect_timeout=5):
self.sock = socket
self.sockfd = socket.makefile()
self.address = address
self.timeout = connect_timeout

5 changes: 2 additions & 3 deletions src/tests.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# -*- coding: utf-8 -*-
import unittest

__all__ = ['test_freeswitch_events', 'test_freeswitch_inboundsocket']

def make_test():
return unittest.TextTestRunner()

def make_suite():
return unittest.TestLoader().loadTestsFromNames([
'tests.test_freeswitch_events',
'tests.test_freeswitch_inboundsocket',
'tests.freeswitch.test_events',
'tests.freeswitch.test_inboundsocket',
])

def run_test():
Expand Down
Empty file.
File renamed without changes.
File renamed without changes.

0 comments on commit 1611376

Please sign in to comment.