merge with version tracking

This commit is contained in:
Jacob Mason 2010-08-15 14:12:54 -05:00
commit c028b95cd0
3 changed files with 12 additions and 6 deletions

View File

@ -50,10 +50,14 @@ docutils_ and Jinja2_ libraries. Sphinx should work with docutils version 0.5
or some (not broken) SVN trunk snapshot. If you like to have source code
highlighting support, you must also install the Pygments_ library.
If you use **Python 2.4** you also need uuid_.
.. _reStructuredText: http://docutils.sf.net/rst.html
.. _docutils: http://docutils.sf.net/
.. _Jinja2: http://jinja.pocoo.org/2/
.. _Pygments: http://pygments.org/
.. The given homepage is only a directory listing so I'm using the pypi site.
.. _uuid: http://pypi.python.org/pypi/uuid/
Usage

View File

@ -44,7 +44,7 @@ A development egg can be found `here
<http://bitbucket.org/birkenfeld/sphinx/get/tip.gz#egg=Sphinx-dev>`_.
'''
requires = ['Pygments>=0.8', 'Jinja2>=2.2', 'docutils>=0.5']
requires = ['Pygments>=0.8', 'Jinja2>=2.2', 'docutils>=0.5', 'uuid>=1.30']
if sys.version_info < (2, 4):
print('ERROR: Sphinx requires at least Python 2.4 to run.')
@ -61,7 +61,10 @@ if sys.version_info < (2, 5):
except:
pass
else:
del requires[-1]
del requires[-2]
elif sys.version_info >= (2, 5):
# An uuid module has been added to the stdlib in 2.5
del requires[-1]
# Provide a "compile_catalog" command that also creates the translated

View File

@ -66,12 +66,11 @@ def get_ratio(old, new):
Returns a "similiarity ratio" representing the similarity between the two
strings where 0 is equal and anything above less than equal.
"""
if old == new:
return 0
ratio = levenshtein_distance(old, new) / (len(old) / 100.0)
return ratio
return levenshtein_distance(old, new) / (len(old) / 100.0)
def levenshtein_distance(a, b):
if a == b:
return 0
if len(a) < len(b):
a, b = b, a
if not a: