Skip to content

Commit

Permalink
Merge pull request #2040 from hugovk/deprecate-bdist_wininst
Browse files Browse the repository at this point in the history
Deprecate bdist_wininst
  • Loading branch information
mergify[bot] authored Apr 21, 2020
2 parents 53c284b + 8487f1a commit 92ca9ea
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/2040.change.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Deprecated the ``bdist_wininst`` command. Binary packages should be built as wheels instead.
9 changes: 9 additions & 0 deletions setuptools/command/bdist_wininst.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import distutils.command.bdist_wininst as orig
import warnings

from setuptools import SetuptoolsDeprecationWarning


class bdist_wininst(orig.bdist_wininst):
Expand All @@ -14,6 +17,12 @@ def reinitialize_command(self, command, reinit_subcommands=0):
return cmd

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

self._is_running = True
try:
orig.bdist_wininst.run(self)
Expand Down
23 changes: 23 additions & 0 deletions setuptools/tests/test_bdist_deprecations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""develop tests
"""
import mock

import pytest

from setuptools.dist import Distribution
from setuptools import SetuptoolsDeprecationWarning


@mock.patch("distutils.command.bdist_wininst.bdist_wininst")
def test_bdist_wininst_warning(distutils_cmd):
dist = Distribution(dict(
script_name='setup.py',
script_args=['bdist_wininst'],
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 92ca9ea

Please sign in to comment.