Repository: Kinto/kinto

Issue:
kinto start fails: no module named functools32
```
kinto start
Starting subprocess with file monitor
2015-11-29 10:12:24,821 INFO  [venusian][MainThread] kinto 1.9.0 starting. 
Traceback (most recent call last):
  File "/var/www/kinto.leplat.re/venv/bin/kinto", line 9, in <module>
    load_entry_point('kinto==1.9.0', 'console_scripts', 'kinto')()
  File "/var/www/kinto.leplat.re/venv/local/lib/python2.7/site-packages/kinto/__main__.py", line 55, in main
    pserve.main(pserve_argv)
  File "/var/www/kinto.leplat.re/venv/local/lib/python2.7/site-packages/pyramid/scripts/pserve.py", line 60, in main
    return command.run()
  File "/var/www/kinto.leplat.re/venv/local/lib/python2.7/site-packages/pyramid/scripts/pserve.py", line 366, in run
    global_conf=vars)
  File "/var/www/kinto.leplat.re/venv/local/lib/python2.7/site-packages/pyramid/scripts/pserve.py", line 401, in loadapp
    return loadapp(app_spec, name=name, relative_to=relative_to, **kw)
  File "/var/www/kinto.leplat.re/venv/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
    return loadobj(APP, uri, name=name, **kw)
  File "/var/www/kinto.leplat.re/venv/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
    return context.create()
  File "/var/www/kinto.leplat.re/venv/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 710, in create
    return self.object_type.invoke(self)
  File "/var/www/kinto.leplat.re/venv/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke
    return fix_call(context.object, context.global_conf, **context.local_conf)
  File "/var/www/kinto.leplat.re/venv/local/lib/python2.7/site-packages/paste/deploy/util.py", line 55, in fix_call
    val = callable(*args, **kw)
  File "/var/www/kinto.leplat.re/venv/local/lib/python2.7/site-packages/kinto/__init__.py", line 77, in main
    config.scan("kinto.views", **kwargs)
  File "/var/www/kinto.leplat.re/venv/local/lib/python2.7/site-packages/pyramid/config/__init__.py", line 974, in scan
    ignore=ignore)
  File "/var/www/kinto.leplat.re/venv/local/lib/python2.7/site-packages/venusian/__init__.py", line 205, in scan
    __import__(modname)
  File "/var/www/kinto.leplat.re/venv/local/lib/python2.7/site-packages/kinto/views/buckets.py", line 12, in <module>
    from kinto.views.collections import Collection
  File "/var/www/kinto.leplat.re/venv/local/lib/python2.7/site-packages/kinto/views/collections.py", line 2, in <module>
    import jsonschema
  File "/var/www/kinto.leplat.re/venv/local/lib/python2.7/site-packages/jsonschema/__init__.py", line 12, in <module>
    from jsonschema.exceptions import (
  File "/var/www/kinto.leplat.re/venv/local/lib/python2.7/site-packages/jsonschema/exceptions.py", line 6, in <module>
    from jsonschema import _utils
  File "/var/www/kinto.leplat.re/venv/local/lib/python2.7/site-packages/jsonschema/_utils.py", line 6, in <module>
    from jsonschema.compat import str_types, MutableMapping, urlsplit
  File "/var/www/kinto.leplat.re/venv/local/lib/python2.7/site-packages/jsonschema/compat.py", line 39, in <module>
    from functools32 import lru_cache
ImportError: No module named functools32
```



Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1,5 +1,6 @@
-import os
 import codecs
+import os
+import sys
 from setuptools import setup, find_packages
 
 here = os.path.abspath(os.path.dirname(__file__))
@@ -21,6 +22,11 @@ def read_file(filename):
     'jsonschema',
 ]
 
+if sys.version_info < (3,):
+    REQUIREMENTS.extend([
+        'functools32',  # not installed by jsonschema with old pip versions.
+    ])
+
 POSTGRESQL_REQUIREMENTS = REQUIREMENTS + [
     'cliquet[postgresql]>=2.13,<3'
 ]


Test patch: