diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..887918f --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +*.pyc +lib +include +bin +*.un~ +*.egg-info +.Python +.tox +build diff --git a/Makefile b/Makefile index 9a0a76e..19088cb 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,20 @@ -.PHONY: docs +.PHONY: docs test + +BIN = `pwd`/bin ifndef VTENV_OPTS VTENV_OPTS = "--no-site-packages" endif +test: + $(BIN)/pip install tox + $(BIN)/tox + bin/python: virtualenv $(VTENV_OPTS) . - bin/python setup.py develop + $(BIN)/python setup.py develop docs: bin/python - bin/pip install sphinx - SPHINXBUILD=../bin/sphinx-build $(MAKE) -C docs html $^ + $(BIN)/pip install sphinx + $(BIN)/sphinx-build -b html -d docs/build/doctrees docs/source build/html diff --git a/chaussette/server.py b/chaussette/server.py index b415408..9666181 100644 --- a/chaussette/server.py +++ b/chaussette/server.py @@ -9,8 +9,8 @@ from chaussette.backend import get, backends -def make_server(app, host=None, port=None, backend='wsgiref', backlog=2048, spawn=None, - logger=None, address_family=socket.AF_INET, +def make_server(app, host=None, port=None, backend='wsgiref', backlog=2048, + spawn=None, logger=None, address_family=socket.AF_INET, socket_type=socket.SOCK_STREAM): logger = logger or chaussette_logger logger.info('Application is %r' % app) @@ -34,7 +34,9 @@ def make_server(app, host=None, port=None, backend='wsgiref', backlog=2048, spaw try: server = server_class((host, port), app, **server_class_kwargs) except TypeError: - logger.exception("Failed to create backend %s, you might be trying to use --spawn on a backend that does not support it" % backend) + logger.exception("Failed to create backend %s, you might be trying " + "to use --spawn on a backend that does " + "not support it" % backend) raise return server @@ -119,7 +121,9 @@ def main(): choices=backends()) parser.add_argument('--use-reloader', action='store_true', help="Restart server when source files change") - parser.add_argument('--spawn', type=int, default=None, help="Spawn type, only makes sense if the backend supports it (gevent)") + parser.add_argument('--spawn', type=int, default=None, + help="Spawn type, only makes sense if the backend " + "supports it (gevent)") parser.add_argument('application', default='chaussette.util.hello_app', nargs='?') parser.add_argument('--pre-hook', type=str, default=None) diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..113fe3f --- /dev/null +++ b/tox.ini @@ -0,0 +1,15 @@ +[tox] +envlist = flake8,py26,py27,py33,docs + +[testenv] +commands = + python setup.py develop + python setup.py test + +[testenv:docs] +deps = Sphinx +commands = /usr/bin/make docs + +[testenv:flake8] +deps = flake8 +commands = flake8 chaussette