From 6851d4e38e1e4e5a2bbbf2556523fd19675cdbf7 Mon Sep 17 00:00:00 2001 From: "Stefan H. Holek" Date: Mon, 8 Oct 2012 19:48:19 +0200 Subject: Make sure the manifest never contains decomposed UTF-8. --HG-- branch : distribute extra : rebase_source : 0e0fb3beac56f66f12670ec69ebfd3996d12d912 --- setuptools/command/egg_info.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'setuptools/command') diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 46cdf4e0..e932d46a 100755 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -287,6 +287,19 @@ class FileList(FileList): +def compose(path): + # Apple's HFS Plus returns decomposed UTF-8. Since just about + # everyone else chokes on it, we must make sure to return fully + # composed UTF-8 only. + if sys.getfilesystemencoding().lower() == 'utf-8': + from unicodedata import normalize + if sys.version_info >= (3,): + path = normalize('NFC', path) + else: + path = normalize('NFC', path.decode('utf-8')).encode('utf-8') + return path + + class manifest_maker(sdist): template = "MANIFEST.in" @@ -311,6 +324,7 @@ class manifest_maker(sdist): self.prune_file_list() self.filelist.sort() self.filelist.remove_duplicates() + self.filelist.files = [compose(path) for path in self.filelist.files] self.write_manifest() def write_manifest (self): -- cgit v1.2.3