Skip to content

Commit

Permalink
Don't include Home-page with UNKNOWN value
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p committed Jan 28, 2022
1 parent 1a1397a commit c279400
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
1 change: 1 addition & 0 deletions changelog.d/3057.change.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Don't include optional ``Home-page`` in metadata if no ``url`` is specified. -- by :user:`cdce8p`
11 changes: 3 additions & 8 deletions setuptools/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,9 @@ def read_pkg_file(self, file):
self.author_email = _read_field_from_msg(msg, 'author-email')
self.maintainer_email = None
self.url = _read_field_from_msg(msg, 'home-page')
self.download_url = _read_field_from_msg(msg, 'download-url')
self.license = _read_field_unescaped_from_msg(msg, 'license')

if 'download-url' in msg:
self.download_url = _read_field_from_msg(msg, 'download-url')
else:
self.download_url = None

self.long_description = _read_field_unescaped_from_msg(msg, 'description')
if (
self.long_description is None and
Expand Down Expand Up @@ -171,9 +167,10 @@ def write_field(key, value):
write_field('Name', self.get_name())
write_field('Version', self.get_version())
write_field('Summary', single_line(self.get_description()))
write_field('Home-page', self.get_url())

optional_fields = (
('Home-page', 'url'),
('Download-URL', 'download_url'),
('Author', 'author'),
('Author-email', 'author_email'),
('Maintainer', 'maintainer'),
Expand All @@ -187,8 +184,6 @@ def write_field(key, value):

license = rfc822_escape(self.get_license())
write_field('License', license)
if self.download_url:
write_field('Download-URL', self.download_url)
for project_url in self.project_urls.items():
write_field('Project-URL', '%s, %s' % project_url)

Expand Down

0 comments on commit c279400

Please sign in to comment.