bpo-34738: Add directory entries in ZIP files created by distutils. (… · python/cpython@53bed18 (original) (raw)

`@@ -122,12 +122,13 @@ def _tarinfo(self, path):

`

122

122

`try:

`

123

123

`names = tar.getnames()

`

124

124

`names.sort()

`

125

``

`-

return tuple(names)

`

``

125

`+

return names

`

126

126

`finally:

`

127

127

`tar.close()

`

128

128

``

129

``

`-

_created_files = ('dist', 'dist/file1', 'dist/file2',

`

130

``

`-

'dist/sub', 'dist/sub/file3', 'dist/sub2')

`

``

129

`+

_zip_created_files = ['dist/', 'dist/file1', 'dist/file2',

`

``

130

`+

'dist/sub/', 'dist/sub/file3', 'dist/sub2/']

`

``

131

`+

_created_files = [p.rstrip('/') for p in _zip_created_files]

`

131

132

``

132

133

`def _create_files(self):

`

133

134

`# creating something to tar

`

`@@ -244,8 +245,7 @@ def test_make_zipfile(self):

`

244

245

`tarball = base_name + '.zip'

`

245

246

`self.assertTrue(os.path.exists(tarball))

`

246

247

`with zipfile.ZipFile(tarball) as zf:

`

247

``

`-

self.assertEqual(sorted(zf.namelist()),

`

248

``

`-

['dist/file1', 'dist/file2', 'dist/sub/file3'])

`

``

248

`+

self.assertEqual(sorted(zf.namelist()), self._zip_created_files)

`

249

249

``

250

250

`@unittest.skipUnless(ZIP_SUPPORT, 'Need zip support to run')

`

251

251

`def test_make_zipfile_no_zlib(self):

`

`@@ -271,8 +271,7 @@ def fake_zipfile(*a, **kw):

`

271

271

` [((tarball, "w"), {'compression': zipfile.ZIP_STORED})])

`

272

272

`self.assertTrue(os.path.exists(tarball))

`

273

273

`with zipfile.ZipFile(tarball) as zf:

`

274

``

`-

self.assertEqual(sorted(zf.namelist()),

`

275

``

`-

['dist/file1', 'dist/file2', 'dist/sub/file3'])

`

``

274

`+

self.assertEqual(sorted(zf.namelist()), self._zip_created_files)

`

276

275

``

277

276

`def test_check_archive_formats(self):

`

278

277

`self.assertEqual(check_archive_formats(['gztar', 'xxx', 'zip']),

`