Browse Source

Made SSL support optional.

pyserial_fix
Scott Petersen 9 years ago
parent
commit
3e8ebe1266
3 changed files with 13 additions and 11 deletions
  1. +13
    -1
      alarmdecoder/devices.py
  2. +0
    -9
      requirements.txt
  3. +0
    -1
      setup.py

+ 13
- 1
alarmdecoder/devices.py View File

@@ -21,7 +21,6 @@ import serial
import serial.tools.list_ports
import socket

from OpenSSL import SSL, crypto
from .util import CommError, TimeoutError, NoDeviceError, InvalidMessageError
from .event import event

@@ -35,6 +34,16 @@ try:
except ImportError:
have_pyftdi = False

try:
from OpenSSL import SSL, crypto

have_openssl = True

except ImportError:
from collections import namedtuple
SSL = namedtuple('SSL', ['Error', 'WantReadError', 'SysCallError'])
have_openssl = False


class Device(object):
"""
@@ -1142,6 +1151,9 @@ class SocketDevice(Device):
:raises: :py:class:`~alarmdecoder.util.CommError`
"""

if not have_openssl:
raise ImportError('SSL sockets have been disabled due to missing requirement: pyopenssl.')

try:
ctx = SSL.Context(SSL.TLSv1_METHOD)



+ 0
- 9
requirements.txt View File

@@ -1,10 +1 @@
argparse==1.2.1
cffi==0.9.2
cryptography==0.8.1
enum34==1.0.4
pyOpenSSL==0.14
pyasn1==0.1.7
pycparser==2.10
pyserial==2.7
six==1.9.0
wsgiref==0.1.2

+ 0
- 1
setup.py View File

@@ -30,7 +30,6 @@ setup(name='alarmdecoder',
license='MIT',
packages=['alarmdecoder', 'alarmdecoder.event'],
install_requires=[
'pyopenssl',
'pyserial>=2.7',
],
test_suite='nose.collector',


Loading…
Cancel
Save