Skip to content

Commit

Permalink
Deprecate bdist_rpm
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Sep 9, 2021
1 parent fdb818d commit 87848e1
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelog.d/1988-change.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Deprecated the ``bdist_rom`` command. Binary packages should be built as wheels instead.
-- by :user:`hugovk`
9 changes: 9 additions & 0 deletions setuptools/command/bdist_rpm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import distutils.command.bdist_rpm as orig
import warnings

from setuptools import SetuptoolsDeprecationWarning


class bdist_rpm(orig.bdist_rpm):
Expand All @@ -11,6 +14,12 @@ class bdist_rpm(orig.bdist_rpm):
"""

def run(self):
warnings.warn(
"bdist_rpm is deprecated and will be removed in a future "
"version. Use bdist_wheel (wheel packages) instead.",
SetuptoolsDeprecationWarning,
)

# ensure distro name is up-to-date
self.run_command('egg_info')

Expand Down
27 changes: 27 additions & 0 deletions setuptools/tests/test_bdist_deprecations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""develop tests
"""
import mock
import sys

import pytest

from setuptools.dist import Distribution
from setuptools import SetuptoolsDeprecationWarning


@pytest.mark.skipif(sys.platform == 'win32', reason='non-Windows only')
@mock.patch('distutils.command.bdist_rpm.bdist_rpm')
def test_bdist_rpm_warning(distutils_cmd):
dist = Distribution(
dict(
script_name='setup.py',
script_args=['bdist_rpm'],
name='foo',
py_modules=['hi'],
)
)
dist.parse_command_line()
with pytest.warns(SetuptoolsDeprecationWarning):
dist.run_commands()

distutils_cmd.run.assert_called_once()

0 comments on commit 87848e1

Please sign in to comment.