8000 bpo-37481: Deprecate distutils bdist_wininst command (GH-14553) · python/cpython@b4cd6ba · GitHub
[go: up one dir, main page]

Skip to content

Commit b4cd6ba

Browse files
bpo-37481: Deprecate distutils bdist_wininst command (GH-14553)
The distutils bdist_wininst command is now deprecated, use bdist_wheel (wheel packages) instead. (cherry picked from commit 1da4462) Co-authored-by: Victor Stinner <vstinner@redhat.com>
1 parent c3ef1a5 commit b4cd6ba

File tree

6 files changed

+30
-3
lines changed

6 files changed

+30
-3
lines changed

Doc/distutils/apiref.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,6 +1863,9 @@ Subclasses of :class:`Command` must define the following methods.
18631863
.. module:: distutils.command.bdist_wininst
18641864
:synopsis: Build a Windows installer
18651865

1866+
.. deprecated:: 3.8
1867+
Use bdist_wheel (wheel packages) instead.
1868+
18661869

18671870
.. % todo
18681871

Doc/distutils/builtdist.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ generated by each, are:
146146
| :command:`bdist_msi` | msi |
147147
+--------------------------+-------------------------------------+
148148

149+
.. note::
150+
bdist_wininst is deprecated since Python 3.8.
151+
149152
The following sections give details on the individual :command:`bdist_\*`
150153
commands.
151154

@@ -298,6 +301,9 @@ file winds up deep in the "build tree," in a temporary directory created by
298301
Creating Windows Installers
299302
===========================
300303

304+
.. warning::
305+
bdist_wininst is deprecated since Python 3.8.
306+
301307
Executable installers are the natural format for binary distributions on
302308
Windows. They display a nice graphical user interface, display some information
303309
about the module distribution to be installed taken from the metadata in the
@@ -459,3 +465,6 @@ Starting with Python 2.6, bdist_wininst supports a :option:`!--user-access-contr
459465
option. The default is 'none' (meaning no UAC handling is done), and other
460466
valid values are 'auto' (meaning prompt for UAC elevation if Python was
461467
installed for all users) and 'force' (meaning always prompt for elevation).
468+
469+
.. note::
470+
bdist_wininst is deprecated since Python 3.8.

Doc/whatsnew/3.8.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,10 @@ Build and C API Changes
10651065
Deprecated
10661066
==========
10671067

1068+
* The distutils ``bdist_wininst`` command is now deprecated, use
1069+
``bdist_wheel`` (wheel packages) instead.
1070+
(Contributed by Victor Stinner in :issue:`37481`.)
1071+
10681072
* Deprecated methods ``getchildren()`` and ``getiterator()`` in
10691073
the :mod:`~xml.etree.ElementTree` module emit now a
10701074
:exc:`DeprecationWarning` instead of :exc:`PendingDeprecationWarning`.

Lib/distutils/command/bdist_wininst.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
Implements the Distutils 'bdist_wininst' command: create a windows installer
44
exe-program."""
55

6-
import sys, os
6+
import os
7+
import sys
8+
import warnings
79
from distutils.core import Command
810
from distutils.util import get_platform
911
from distutils.dir_util import create_tree, remove_tree
@@ -58,6 +60,12 @@ class bdist_wininst(Command):
5860
# bpo-10945: bdist_wininst requires mbcs encoding only available on Windows
5961
_unsupported = (sys.platform != "win32")
6062

63+
def __init__(self, *args, **kw):
64+
super().__init__(*args, **kw)
65+
warnings.warn("bdist_wininst command is deprecated since Python 3.8, "
66+
"use bdist_wheel (wheel packages) instead",
67+
DeprecationWarning, 2)
68+
6169
def initialize_options(self):
6270
self.bdist_dir = None
6371
self.plat_name = None

Lib/distutils/tests/test_bdist_wininst.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import sys
33
import platform
44
import unittest
5-
from test.support import run_unittest
5+
from test.support import run_unittest, check_warnings
66

77
from distutils.command.bdist_wininst import bdist_wininst
88
from distutils.tests import support
@@ -21,7 +21,8 @@ def test_get_exe_bytes(self):
2121
# this test makes sure it works now for every platform
2222
# let's create a command
2323
pkg_pth, dist = self.create_dist()
24-
cmd = bdist_wininst(dist)
24+
with check_warnings(("", DeprecationWarning)):
25+
cmd = bdist_wininst(dist)
2526
cmd.ensure_finalized()
2627

2728
# let's run the code that finds the right wininst*.exe file
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The distutils ``bdist_wininst`` command is deprecated in Python 3.8, use
2+
``bdist_wheel`` (wheel packages) instead.

0 commit comments

Comments
 (0)
0