Skip to content

Commit

Permalink
Remove bdist_rpm and bdist_dumb comment
Browse files Browse the repository at this point in the history
This comment is not used anywhere and `platform.dist()` is deprecated.

See CPython PR #10414: python/cpython#10414
and bpo-35186: https://bugs.python.org/issue35186
  • Loading branch information
pganssle committed Nov 12, 2018
1 parent fe2c9e4 commit 2b5b913
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 28 deletions.
10 changes: 2 additions & 8 deletions setuptools/command/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,8 @@ def upload_file(self, command, pyversion, filename):
'requires': meta.get_requires(),
'obsoletes': meta.get_obsoletes(),
}
comment = ''
if command == 'bdist_rpm':
dist, version, id = platform.dist()
if dist:
comment = 'built for %s %s' % (dist, version)
elif command == 'bdist_dumb':
comment = 'built for %s' % platform.platform(terse=1)
data['comment'] = comment

data['comment'] = ''

if self.sign:
data['gpg_signature'] = (os.path.basename(filename) + ".asc",
Expand Down
20 changes: 0 additions & 20 deletions setuptools/tests/test_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,26 +203,6 @@ def test_upload_file_gpg(self, spawn, patched_upload):
entries = patched_upload.get_uploaded_metadata()
assert entries['gpg_signature'] == 'signed-data'

@pytest.mark.parametrize('bdist', ['bdist_rpm', 'bdist_dumb'])
@mock.patch('setuptools.command.upload.platform')
def test_bdist_rpm_upload(self, platform, bdist, patched_upload):
# Set the upload command to include bdist_rpm
cmd = patched_upload.cmd
dist_files = cmd.distribution.dist_files
dist_files = [(bdist,) + dist_files[0][1:]]
cmd.distribution.dist_files = dist_files

# Mock out the platform commands to make this platform-independent
platform.dist.return_value = ('redhat', '', '')

cmd.ensure_finalized()
cmd.run()

entries = patched_upload.get_uploaded_metadata()

assert entries['comment'].startswith(u'built for')
assert len(entries['comment']) > len(u'built for')

def test_show_response_no_error(self, patched_upload):
# This test is just that show_response doesn't throw an error
# It is not really important what the printed response looks like
Expand Down

0 comments on commit 2b5b913

Please sign in to comment.