Skip to content

Commit

Permalink
Drop repoze.lru on Python 3
Browse files Browse the repository at this point in the history
Starting with Python 3.2, the functools module grew a lru_cache function
which can replace our usage of repoze.lru.
  • Loading branch information
Mathieu Bridon committed Aug 4, 2017
1 parent 1b8a348 commit e80491c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
6 changes: 6 additions & 0 deletions pyramid/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
except ImportError: # pragma: no cover
import pickle

try:
from functools import lru_cache

except ImportError:
from repoze.lru import lru_cache

# PY3 is left as bw-compat but PY2 should be used for most checks.
PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3
Expand Down
7 changes: 4 additions & 3 deletions pyramid/static.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
resource_isdir,
)

from repoze.lru import lru_cache

from pyramid.asset import (
abspath_from_asset_spec,
resolve_asset_spec,
)

from pyramid.compat import text_
from pyramid.compat import (
lru_cache,
text_,
)

from pyramid.httpexceptions import (
HTTPNotFound,
Expand Down
3 changes: 1 addition & 2 deletions pyramid/traversal.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from zope.interface import implementer
from zope.interface.interfaces import IInterface

from repoze.lru import lru_cache

from pyramid.interfaces import (
IResourceURL,
IRequestFactory,
Expand All @@ -20,6 +18,7 @@
is_nonstr_iter,
decode_path_info,
unquote_bytes_to_wsgi,
lru_cache,
)

from pyramid.encode import url_quote
Expand Down
3 changes: 1 addition & 2 deletions pyramid/url.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import os

from repoze.lru import lru_cache

from pyramid.interfaces import (
IResourceURL,
IRoutesMapper,
Expand All @@ -12,6 +10,7 @@

from pyramid.compat import (
bytes_,
lru_cache,
string_types,
)
from pyramid.encode import (
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#
##############################################################################

import sys

from setuptools import setup, find_packages

def readfile(name):
Expand All @@ -24,7 +26,6 @@ def readfile(name):
install_requires = [
'setuptools',
'WebOb >= 1.7.0rc2', # Response.has_body
'repoze.lru >= 0.4', # py3 compat
'zope.interface >= 3.8.0', # has zope.interface.registry
'zope.deprecation >= 3.5.0', # py3 compat
'venusian >= 1.0a3', # ``ignore``
Expand Down Expand Up @@ -87,6 +88,7 @@ def readfile(name):
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
install_requires=install_requires,
extras_require={
':python_version<"3.2"': ['repoze.lru >= 0.4'],
'testing': testing_extras,
'docs': docs_extras,
},
Expand Down

0 comments on commit e80491c

Please sign in to comment.