Skip to content

Commit

Permalink
Merge pull request #2780 from hugovk/deprecate-bdist_rpm
Browse files Browse the repository at this point in the history
Deprecate bdist_rpm
  • Loading branch information
jaraco authored Sep 12, 2021
2 parents 9d85f0b + d7f9226 commit c9e9904
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ jobs:
strategy:
matrix:
python:
- pypy3
- 3.6
- 3.9
- 3.10.0-alpha - 3.10.99
- pypy3
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ docs/build
include
lib
distribute.egg-info
foo.egg-info
setuptools.egg-info
.coverage
.eggs
Expand Down
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_rpm`` 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 c9e9904

Please sign in to comment.