Takayuki Shimizukawa committed 4f314ba

Fix NFC/NFD normalizing problem of rst filename on Mac OS X. Closes #1142

Comments (0)

Files changed (2)

 * #1232: Sphinx generated broken ePub files on Windows.
 * #1259: Guard the debug output call when emitting events; to prevent the
   repr() implementation of arbitrary objects causing build failures.
+* #1142: Fix NFC/NFD normalizing problem of rst filename on Mac OS X.
 Release 1.2 beta1 (released Mar 31, 2013)


 import tempfile
 import posixpath
 import traceback
+import unicodedata
 from os import path
 from codecs import open, BOM_UTF8
 from collections import deque
         posixpath.join('/' + basedocname, '..', docname))[1:]
+def path_stabilize(filepath):
+    "normalize path separater and unicode string"
+    newpath = filepath.replace(os.path.sep, SEP)
+    newpath = unicodedata.normalize('NFC', newpath)
+    return newpath
 def get_matching_files(dirname, exclude_matchers=()):
     """Get all file names in a directory, recursively.
     for root, dirs, files in walk(dirname, followlinks=True):
         relativeroot = root[dirlen:]
-        qdirs = enumerate(path.join(relativeroot, dn).replace(os.path.sep, SEP)
+        qdirs = enumerate(path_stabilize(path.join(relativeroot, dn))
                           for dn in dirs)
-        qfiles = enumerate(path.join(relativeroot, fn).replace(os.path.sep, SEP)
+        qfiles = enumerate(path_stabilize(path.join(relativeroot, fn))
                            for fn in files)
         for matcher in exclude_matchers:
             qdirs = [entry for entry in qdirs if not matcher(entry[1])]