Skip to content

Commit

Permalink
Changes after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p committed May 9, 2021
1 parent 7815860 commit a9c72b3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
3 changes: 1 addition & 2 deletions changelog.d/2628.change.rst
@@ -1,2 +1 @@
Write long description in message payload of PKG-INFO file.
Changed in metadata version 2.1 - by :user:`cdce8p`
Write long description in message payload of PKG-INFO file. - by :user:`cdce8p`
7 changes: 1 addition & 6 deletions setuptools/dist.py
Expand Up @@ -185,10 +185,6 @@ def write_field(key, value):
for project_url in self.project_urls.items():
write_field('Project-URL', '%s, %s' % project_url)

if version < StrictVersion('2.1'):
long_desc = rfc822_escape(self.get_long_description())
write_field('Description', long_desc)

keywords = ','.join(self.get_keywords())
if keywords:
write_field('Keywords', keywords)
Expand Down Expand Up @@ -217,8 +213,7 @@ def write_field(key, value):
for extra in self.provides_extras:
write_field('Provides-Extra', extra)

if version >= StrictVersion('2.1'):
file.write("\n%s\n\n" % self.get_long_description())
file.write("\n%s\n\n" % self.get_long_description())


sequence = tuple, list
Expand Down
4 changes: 2 additions & 2 deletions setuptools/tests/test_dist.py
Expand Up @@ -251,8 +251,8 @@ def test_maintainer_author(name, attrs, tmpdir):
with io.open(str(fn.join('PKG-INFO')), 'r', encoding='utf-8') as f:
raw_pkg_lines = f.readlines()

# Drop blank lines
pkg_lines = list(filter(None, raw_pkg_lines))
# Drop blank lines and strip lines from default description
pkg_lines = list(filter(None, raw_pkg_lines[:-2]))

pkg_lines_set = set(pkg_lines)

Expand Down
4 changes: 2 additions & 2 deletions setuptools/tests/test_egg_info.py
Expand Up @@ -893,8 +893,8 @@ def test_long_description(self, tmpdir_cwd, env):
with open(os.path.join(egg_info_dir, 'PKG-INFO')) as pkginfo_file:
pkg_info_lines = pkginfo_file.read().split('\n')
assert 'Metadata-Version: 2.1' in pkg_info_lines
assert '' == pkg_info_lines[-1]
long_desc_lines = pkg_info_lines[8:]
assert '' == pkg_info_lines[-1] # last line should be empty
long_desc_lines = pkg_info_lines[pkg_info_lines.index(''):]
assert 'This is a long description' in long_desc_lines
assert 'over multiple lines' in long_desc_lines

Expand Down

0 comments on commit a9c72b3

Please sign in to comment.