Skip to content
This repository has been archived by the owner on Jan 5, 2021. It is now read-only.

Commit

Permalink
Refs #33: Break server out into an optional feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
iancmcc committed Aug 23, 2015
1 parent 906018a commit 94b0930
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
5 changes: 5 additions & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ Or, if you have virtualenvwrapper installed::
$ mkvirtualenv ouimeaux
$ pip install ouimeaux

If you want to enable ``wemo server`` functionality, specify the ``server``
feature to install the necessary dependencies::

$ pip install ouimeaux[server]

Linux
-----
ouimeaux requires Python header files to build some dependencies, and is
Expand Down
5 changes: 5 additions & 0 deletions docs/server.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ Server
``wemo server`` starts a process serving up both a Web app providing basic
device control and a REST API allowing integration with any number of services.

The necessary dependencies to run the server are not installed unless the
``server`` feature is specified at installation::

$ pip install ouimeaux[server]

Configuration
-------------
The IP and port to which the server will bind are specified by the ``listen``
Expand Down
8 changes: 6 additions & 2 deletions ouimeaux/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,12 @@ def on_bridge(bridge):


def server(args):
from socketio.server import SocketIOServer
from ouimeaux.server import app, initialize
try:
from socketio.server import SocketIOServer
from ouimeaux.server import app, initialize
except ImportError:
print "ouimeaux server dependencies are not installed. Please run, e.g., 'pip install ouimeaux[server]'"
sys.exit(1)
initialize(bind=getattr(args, 'bind', None))
level = logging.INFO
if getattr(args, 'debug', False):
Expand Down
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@ gevent >= 1.0
requests >= 2.3.0
pyyaml
pysignals
flask-restful
gevent-socketio
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,8 @@
'wemo = ouimeaux.cli:wemo'
]
},
extras_require = {
'server': ["flask-restful", "gevent-socketio"],
},
test_suite='tests',
)

0 comments on commit 94b0930

Please sign in to comment.