diff --git a/Makefile b/Makefile index b0a4d56..57d68b2 100644 --- a/Makefile +++ b/Makefile @@ -13,8 +13,8 @@ env: requirements.txt requirements_tests.txt --extra-search-dir=./vendor/ \ ./env/ ./$(env_bin)/pip --version - ./$(env_bin)/pip install -f file:///$(PWD)/vendor -r requirements.txt - ./$(env_bin)/pip install -f file:///$(PWD)/vendor -r requirements_tests.txt + ./$(env_bin)/pip install --no-index --find-links=file:///$(PWD)/vendor -r requirements.txt + ./$(env_bin)/pip install --no-index --find-links=file:///$(PWD)/vendor -r requirements_tests.txt clean: rm -rf env diff --git a/inside_gratipay/__init__.py b/inside_gratipay/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/canonizer.py b/inside_gratipay/canonizer.py similarity index 100% rename from canonizer.py rename to inside_gratipay/canonizer.py diff --git a/gfm.py b/inside_gratipay/gfm.py similarity index 100% rename from gfm.py rename to inside_gratipay/gfm.py diff --git a/configure-aspen.py b/inside_gratipay/main.py similarity index 92% rename from configure-aspen.py rename to inside_gratipay/main.py index da598cd..583033b 100644 --- a/configure-aspen.py +++ b/inside_gratipay/main.py @@ -1,12 +1,16 @@ import os import string import random -from os.path import basename, dirname, join, realpath, isdir +from os.path import basename, dirname from aspen import Response -import canonizer -import gfm -from nav import NavItem +from aspen.website import Website + +from . import canonizer, gfm +from .nav import NavItem + + +website = Website(www_root='www', project_root='.') # Manually register markdown renderer to work around Heroku deployment woes. diff --git a/nav.py b/inside_gratipay/nav.py similarity index 95% rename from nav.py rename to inside_gratipay/nav.py index f749c18..515d5e3 100644 --- a/nav.py +++ b/inside_gratipay/nav.py @@ -6,12 +6,12 @@ from os.path import join, realpath, isfile, isdir, basename from aspen import resources -from aspen.resources.static_resource import StaticResource +from aspen.http.resource import Static def get_simplate_context(website, fs): resource = resources.get(website, fs) - return {} if isinstance(resource, StaticResource) else resource.pages[0] + return {} if isinstance(resource, Static) else resource.pages[0] class NavItem(OrderedDict): diff --git a/requirements.txt b/requirements.txt index 7f19ab3..8736790 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,14 +1,13 @@ -aspen==0.37 - filesystem_tree==1.0.1 - first==2.0.1 -mimeparse==0.1.3 -dependency_injection==1.1.0 -algorithm==1.0.0 + algorithm==1.0.0 + dependency_injection==1.1.0 + filesystem_tree==1.0.1 + python-mimeparse==0.1.4 +aspen==0.42 -MarkupSafe==0.18 -Jinja2==2.7.1 -aspen-jinja2==0.3 + MarkupSafe==0.18 + Jinja2==2.7.1 +aspen-jinja2==0.4 simplejson==2.3.2 @@ -17,5 +16,7 @@ mistune_contrib==0.1 honcho==0.5.0 + six==1.10.0 libsass==0.3.0 - six==1.10.0 + +--editable . diff --git a/requirements_tests.txt b/requirements_tests.txt index 7a629d7..51e8dd5 100644 --- a/requirements_tests.txt +++ b/requirements_tests.txt @@ -1 +1,2 @@ + py==1.4.29 pytest==2.9.2 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..c324d3a --- /dev/null +++ b/setup.py @@ -0,0 +1,3 @@ +from setuptools import setup, find_packages + +setup(name='inside_gratipay', packages=find_packages()) diff --git a/startapp.py b/startapp.py index c465812..0081f39 100644 --- a/startapp.py +++ b/startapp.py @@ -8,25 +8,18 @@ PORT = 8536 # default/devserver port import sys -from aspen.website import Website - -aspen_config = [ - '--www_root=www/', - '--project_root=.' -] - + for param in sys.argv: if param.startswith('--port'): _, PORT = param.split('=') PORT = int(PORT) - - + + # by WSGI convention, we need to create webapp object # and by default most WSGI servers look for 'application' -application = Website(aspen_config) - +from inside_gratipay.main import website as application + if __name__ == '__main__': from wsgiref.simple_server import make_server - print("* Running development server on http://%s:%s" % (HOST, PORT)) + print("* Running development server on http://%s:%s" % (HOST or 'localhost', PORT)) make_server(HOST, PORT, application).serve_forever() - diff --git a/tests/py/test_security.py b/tests/py/test_security.py index e6cd9b6..5cd57c4 100644 --- a/tests/py/test_security.py +++ b/tests/py/test_security.py @@ -2,10 +2,13 @@ from pytest import yield_fixture from aspen.testing.client import Client +from inside_gratipay.main import website @yield_fixture def client(): - yield Client(www_root='www', project_root='') + client = Client(www_root='www', project_root='.') + client._website = website + yield client def test_disallowed_methods(client): for disallowed in ['TRACE', 'trAce', 'DELETE', 'PUT', 'OPTIONS', 'JUNK']: diff --git a/vendor/aspen-0.37-py27-none-any.whl b/vendor/aspen-0.37-py27-none-any.whl deleted file mode 100644 index 02ef727..0000000 Binary files a/vendor/aspen-0.37-py27-none-any.whl and /dev/null differ diff --git a/vendor/aspen-0.42-py2-none-any.whl b/vendor/aspen-0.42-py2-none-any.whl new file mode 100644 index 0000000..1494ceb Binary files /dev/null and b/vendor/aspen-0.42-py2-none-any.whl differ diff --git a/vendor/aspen-jinja2-0.3.tar.gz b/vendor/aspen-jinja2-0.3.tar.gz deleted file mode 100644 index 1abe9fc..0000000 Binary files a/vendor/aspen-jinja2-0.3.tar.gz and /dev/null differ diff --git a/vendor/aspen-jinja2-0.4.tar.gz b/vendor/aspen-jinja2-0.4.tar.gz new file mode 100644 index 0000000..cf710f7 Binary files /dev/null and b/vendor/aspen-jinja2-0.4.tar.gz differ diff --git a/vendor/mimeparse-0.1.3.tar.gz b/vendor/mimeparse-0.1.3.tar.gz deleted file mode 100644 index 181ffc7..0000000 Binary files a/vendor/mimeparse-0.1.3.tar.gz and /dev/null differ diff --git a/vendor/py-1.4.29.tar.gz b/vendor/py-1.4.29.tar.gz new file mode 100644 index 0000000..96a4bcf Binary files /dev/null and b/vendor/py-1.4.29.tar.gz differ diff --git a/vendor/pytest-2.9.2.tar.gz b/vendor/pytest-2.9.2.tar.gz new file mode 100644 index 0000000..fb67327 Binary files /dev/null and b/vendor/pytest-2.9.2.tar.gz differ diff --git a/vendor/python-mimeparse-0.1.4.tar.gz b/vendor/python-mimeparse-0.1.4.tar.gz new file mode 100644 index 0000000..f117f57 Binary files /dev/null and b/vendor/python-mimeparse-0.1.4.tar.gz differ