Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 38883e0

Browse files
committed
fix(cygwin): lru_cach did not exist for py < 3.2
1 parent a1ce01c commit 38883e0

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

git/util.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66
import contextlib
7-
from functools import wraps, lru_cache
7+
from functools import wraps
88
import getpass
99
import logging
1010
import os
@@ -18,6 +18,10 @@
1818
from unittest import SkipTest
1919
except ImportError:
2020
from unittest2 import SkipTest
21+
try:
22+
from functools import lru_cache
23+
except ImportError:
24+
from repoze.lru import lru_cache
2125

2226
from gitdb.util import (# NOQA @IgnorePep8
2327
make_sha,
@@ -286,7 +290,7 @@ def _cyg_regex_path(drive, path):
286290
)
287291

288292

289-
@lru_cache()
293+
@lru_cache(500) # Sice arg required only for py3.2 backport `repoze.lru` lib.
290294
def cygpath(path):
291295
"""Use :meth:`git.cmd.Git.polish_url()` instead, that works on any environment."""
292296
for regex, parser, recurse in _cygpath_parsers:

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
gitdb>=0.6.4
22
ddt>=1.1.1
3+
ordereddict; python_version < '2.7'
4+
repoze.lru; python_version < '3.2'
35
unittest2; python_version < '2.7'

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def _stamp_version(filename):
6868
install_requires = ['gitdb2 >= 2.0.0']
6969
extras_require = {
7070
':python_version == "2.6"': ['ordereddict'],
71+
':python_version < "3.2"': ['repoze.lru'],
7172
}
7273
test_requires = ['ddt>=1.1.1']
7374
if sys.version_info[:2] < (2, 7):

0 commit comments

Comments
 (0)