diff options
author | Miro Hrončok <miro@hroncok.cz> | 2021-02-12 09:55:57 +0100 |
---|---|---|
committer | Miro Hrončok <miro@hroncok.cz> | 2021-03-08 12:15:11 +0100 |
commit | e6fdc967a538c7c08768a4898317572a76de2f84 (patch) | |
tree | 5ac88cd2d847f96f6846c8dafbdb8c0abbb5e98a | |
parent | b2f7b8f92725c63b164d5776f85e67cc560def4e (diff) | |
download | python-setuptools-git-e6fdc967a538c7c08768a4898317572a76de2f84.tar.gz |
Remove bdist_wininst
Fixes https://github.com/pypa/setuptools/issues/2558
-rw-r--r-- | changelog.d/2566.breaking.rst | 1 | ||||
-rw-r--r-- | setuptools/command/__init__.py | 2 | ||||
-rw-r--r-- | setuptools/command/bdist_wininst.py | 30 | ||||
-rw-r--r-- | setuptools/command/install_scripts.py | 3 | ||||
-rw-r--r-- | setuptools/tests/test_bdist_deprecations.py | 23 |
5 files changed, 4 insertions, 55 deletions
diff --git a/changelog.d/2566.breaking.rst b/changelog.d/2566.breaking.rst new file mode 100644 index 00000000..e5694575 --- /dev/null +++ b/changelog.d/2566.breaking.rst @@ -0,0 +1 @@ +Remove the deprecated ``bdist_wininst`` command. Binary packages should be built as wheels instead. -- by :user:`hroncok` diff --git a/setuptools/command/__init__.py b/setuptools/command/__init__.py index 743f5588..570e6957 100644 --- a/setuptools/command/__init__.py +++ b/setuptools/command/__init__.py @@ -2,7 +2,7 @@ __all__ = [ 'alias', 'bdist_egg', 'bdist_rpm', 'build_ext', 'build_py', 'develop', 'easy_install', 'egg_info', 'install', 'install_lib', 'rotate', 'saveopts', 'sdist', 'setopt', 'test', 'install_egg_info', 'install_scripts', - 'bdist_wininst', 'upload_docs', 'build_clib', 'dist_info', + 'upload_docs', 'build_clib', 'dist_info', ] from distutils.command.bdist import bdist diff --git a/setuptools/command/bdist_wininst.py b/setuptools/command/bdist_wininst.py deleted file mode 100644 index ff4b6345..00000000 --- a/setuptools/command/bdist_wininst.py +++ /dev/null @@ -1,30 +0,0 @@ -import distutils.command.bdist_wininst as orig -import warnings - -from setuptools import SetuptoolsDeprecationWarning - - -class bdist_wininst(orig.bdist_wininst): - def reinitialize_command(self, command, reinit_subcommands=0): - """ - Supplement reinitialize_command to work around - http://bugs.python.org/issue20819 - """ - cmd = self.distribution.reinitialize_command( - command, reinit_subcommands) - if command in ('install', 'install_lib'): - cmd.install_lib = None - 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) - finally: - self._is_running = False diff --git a/setuptools/command/install_scripts.py b/setuptools/command/install_scripts.py index 8c9a15e2..9cd8eb06 100644 --- a/setuptools/command/install_scripts.py +++ b/setuptools/command/install_scripts.py @@ -1,5 +1,6 @@ from distutils import log import distutils.command.install_scripts as orig +from distutils.errors import DistutilsModuleError import os import sys @@ -35,7 +36,7 @@ class install_scripts(orig.install_scripts): try: bw_cmd = self.get_finalized_command("bdist_wininst") is_wininst = getattr(bw_cmd, '_is_running', False) - except ImportError: + except (ImportError, DistutilsModuleError): is_wininst = False writer = ei.ScriptWriter if is_wininst: diff --git a/setuptools/tests/test_bdist_deprecations.py b/setuptools/tests/test_bdist_deprecations.py deleted file mode 100644 index 704164aa..00000000 --- a/setuptools/tests/test_bdist_deprecations.py +++ /dev/null @@ -1,23 +0,0 @@ -"""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() |