Commit 21ead63d authored by Stefan H. Holek's avatar Stefan H. Holek

Revert 86d7748 drive-by commit because of unclear BBB consequences.

--HG--
branch : distribute
extra : rebase_source : 2fb9a6ec09184e238551be4d0ea908e719badd27
parent db678072
...@@ -292,19 +292,6 @@ class FileList(FileList): ...@@ -292,19 +292,6 @@ 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): class manifest_maker(sdist):
template = "MANIFEST.in" template = "MANIFEST.in"
...@@ -329,7 +316,6 @@ class manifest_maker(sdist): ...@@ -329,7 +316,6 @@ class manifest_maker(sdist):
self.prune_file_list() self.prune_file_list()
self.filelist.sort() self.filelist.sort()
self.filelist.remove_duplicates() self.filelist.remove_duplicates()
self.filelist.files = [compose(path) for path in self.filelist.files]
self.write_manifest() self.write_manifest()
def write_manifest (self): def write_manifest (self):
......
...@@ -29,6 +29,17 @@ setup(**%r) ...@@ -29,6 +29,17 @@ setup(**%r)
""" % SETUP_ATTRS """ % SETUP_ATTRS
def compose(path):
# HFS Plus returns decomposed UTF-8
if sys.platform == 'darwin':
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 TestSdistTest(unittest.TestCase): class TestSdistTest(unittest.TestCase):
def setUp(self): def setUp(self):
self.temp_dir = tempfile.mkdtemp() self.temp_dir = tempfile.mkdtemp()
...@@ -79,31 +90,6 @@ class TestSdistTest(unittest.TestCase): ...@@ -79,31 +90,6 @@ class TestSdistTest(unittest.TestCase):
self.assertTrue(os.path.join('sdist_test', 'b.txt') in manifest) self.assertTrue(os.path.join('sdist_test', 'b.txt') in manifest)
self.assertTrue(os.path.join('sdist_test', 'c.rst') not in manifest) self.assertTrue(os.path.join('sdist_test', 'c.rst') not in manifest)
def test_filelist_is_fully_composed(self):
# Test for #303. Requires HFS Plus to fail.
# Add file with non-ASCII filename
filename = os.path.join('sdist_test', 'smörbröd.py')
open(filename, 'w').close()
dist = Distribution(SETUP_ATTRS)
dist.script_name = 'setup.py'
cmd = sdist(dist)
cmd.ensure_finalized()
# squelch output
old_stdout = sys.stdout
old_stderr = sys.stderr
sys.stdout = StringIO()
sys.stderr = StringIO()
try:
cmd.run()
finally:
sys.stdout = old_stdout
sys.stderr = old_stderr
self.assertTrue(filename in cmd.filelist.files)
def test_manifest_is_written_in_utf8(self): def test_manifest_is_written_in_utf8(self):
# Test for #303. # Test for #303.
...@@ -162,7 +148,7 @@ class TestSdistTest(unittest.TestCase): ...@@ -162,7 +148,7 @@ class TestSdistTest(unittest.TestCase):
cmd.manifest = os.path.join('sdist_test.egg-info', 'SOURCES.txt') cmd.manifest = os.path.join('sdist_test.egg-info', 'SOURCES.txt')
cmd.read_manifest() cmd.read_manifest()
self.assertTrue(filename in cmd.filelist.files) self.assertTrue(filename in [compose(x) for x in cmd.filelist.files])
def test_suite(): def test_suite():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment