Description: Bundle levenshtein_distance from jellyfish
 Debian already has a Python library called jellyfish. While we resolve that
 problem, let's avoid the need for re-packaging jellyfish.
Bug-Debian: https://bugs.debian.org/806716
Author: Stefano Rivera <stefanor@debian.org>

--- a/beets/autotag/hooks.py
+++ b/beets/autotag/hooks.py
@@ -25,7 +25,7 @@
 from beets import config
 from beets.util import as_string
 from beets.autotag import mb
-from jellyfish import levenshtein_distance
+from beets.util._jellyfish import levenshtein_distance
 from unidecode import unidecode
 
 log = logging.getLogger('beets')
--- /dev/null
+++ b/beets/util/_jellyfish.py
@@ -0,0 +1,56 @@
+# Borrowed from Jellyfish (https://github.com/jamesturk/jellyfish)
+# Copyright (c) 2015, James Turk
+# Copyright (c) 2015, Sunlight Foundation
+#
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+#     * Redistributions of source code must retain the above copyright notice,
+#       this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above copyright
+#       notice, this list of conditions and the following disclaimer in the
+#       documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+_range = xrange
+_no_bytes_err = 'expected unicode, got str'
+
+
+def levenshtein_distance(s1, s2):
+    if isinstance(s1, bytes) or isinstance(s2, bytes):
+        raise TypeError(_no_bytes_err)
+
+    if s1 == s2:
+        return 0
+    rows = len(s1)+1
+    cols = len(s2)+1
+
+    if not s1:
+        return cols-1
+    if not s2:
+        return rows-1
+
+    prev = None
+    cur = range(cols)
+    for r in _range(1, rows):
+        prev, cur = cur, [r] + [0]*(cols-1)
+        for c in _range(1, cols):
+            deletion = prev[c] + 1
+            insertion = cur[c-1] + 1
+            edit = prev[c-1] + (0 if s1[r-1] == s2[c-1] else 1)
+            cur[c] = min(edit, deletion, insertion)
+
+    return cur[-1]
--- a/setup.py
+++ b/setup.py
@@ -92,7 +92,6 @@
         'unidecode',
         'musicbrainzngs>=0.4',
         'pyyaml',
-        'jellyfish',
     ] + (['colorama'] if (sys.platform == 'win32') else []),
 
     tests_require=[
