Skip to content

Commit 8d90b83

Browse files
authored
Merge pull request #3521 from pypa/distutils-fac564f
Merge with distutils fac564f
2 parents 12f9d54 + bfeb6cb commit 8d90b83

File tree

14 files changed

+28
-1782
lines changed

14 files changed

+28
-1782
lines changed

changelog.d/3521.breaking.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove bdist_msi and bdist_wininst commands, which have been deprecated since Python 3.9. Use older Setuptools for these behaviors if needed.

docs/deprecated/distutils/apiref.rst

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,30 +1845,6 @@ Subclasses of :class:`Command` must define the following methods.
18451845
:synopsis: Build a "dumb" installer - a simple archive of files
18461846

18471847

1848-
.. % todo
1849-
1850-
1851-
:mod:`distutils.command.bdist_msi` --- Build a Microsoft Installer binary package
1852-
=================================================================================
1853-
1854-
.. module:: distutils.command.bdist_msi
1855-
:synopsis: Build a binary distribution as a Windows MSI file
1856-
1857-
.. class:: bdist_msi
1858-
1859-
.. deprecated:: 3.9
1860-
Use bdist_wheel (wheel packages) instead.
1861-
1862-
Builds a `Windows Installer`_ (.msi) binary package.
1863-
1864-
.. _Windows Installer: https://msdn.microsoft.com/en-us/library/cc185688(VS.85).aspx
1865-
1866-
In most cases, the ``bdist_msi`` installer is a better choice than the
1867-
``bdist_wininst`` installer, because it provides better support for
1868-
Win64 platforms, allows administrators to perform non-interactive
1869-
installations, and allows installation through group policies.
1870-
1871-
18721848
:mod:`distutils.command.bdist_rpm` --- Build a binary distribution as a Redhat RPM and SRPM
18731849
===========================================================================================
18741850

@@ -1879,19 +1855,6 @@ Subclasses of :class:`Command` must define the following methods.
18791855
.. % todo
18801856
18811857
1882-
:mod:`distutils.command.bdist_wininst` --- Build a Windows installer
1883-
====================================================================
1884-
1885-
.. module:: distutils.command.bdist_wininst
1886-
:synopsis: Build a Windows installer
1887-
1888-
.. deprecated:: 3.8
1889-
Use bdist_wheel (wheel packages) instead.
1890-
1891-
1892-
.. % todo
1893-
1894-
18951858
:mod:`distutils.command.sdist` --- Build a source distribution
18961859
==============================================================
18971860

docs/deprecated/distutils/builtdist.rst

Lines changed: 2 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,6 @@ The available formats for built distributions are:
9696
+-------------+------------------------------+---------+
9797
| ``sdux`` | HP-UX :program:`swinstall` | |
9898
+-------------+------------------------------+---------+
99-
| ``wininst`` | self-extracting ZIP file for | \(4) |
100-
| | Windows | |
101-
+-------------+------------------------------+---------+
102-
| ``msi`` | Microsoft Installer. | |
103-
+-------------+------------------------------+---------+
10499

105100
.. versionchanged:: 3.5
106101
Added support for the ``xztar`` format.
@@ -141,16 +136,6 @@ generated by each, are:
141136
+--------------------------+-------------------------------------+
142137
| :command:`bdist_rpm` | rpm, srpm |
143138
+--------------------------+-------------------------------------+
144-
| :command:`bdist_wininst` | wininst |
145-
+--------------------------+-------------------------------------+
146-
| :command:`bdist_msi` | msi |
147-
+--------------------------+-------------------------------------+
148-
149-
.. note::
150-
bdist_wininst is deprecated since Python 3.8.
151-
152-
.. note::
153-
bdist_msi is deprecated since Python 3.9.
154139

155140
The following sections give details on the individual :command:`bdist_\*`
156141
commands.
@@ -191,7 +176,7 @@ easily specify multiple formats in one run. If you need to do both, you can
191176
explicitly specify multiple :command:`bdist_\*` commands and their options::
192177

193178
python setup.py bdist_rpm --packager="John Doe <[email protected]>" \
194-
bdist_wininst --target-version="2.0"
179+
bdist_dumb --dumb-option=foo
195180

196181
Creating RPM packages is driven by a :file:`.spec` file, much as using the
197182
Distutils is driven by the setup script. To make your life easier, the
@@ -298,62 +283,6 @@ file winds up deep in the "build tree," in a temporary directory created by
298283
.. % \command{bdist\_rpm} command with one that writes whatever else you want
299284
.. % to the \file{.spec} file.)
300285
301-
302-
.. _creating-wininst:
303-
304-
Creating Windows Installers
305-
===========================
306-
307-
.. warning::
308-
bdist_wininst is deprecated since Python 3.8.
309-
310-
.. warning::
311-
bdist_msi is deprecated since Python 3.9.
312-
313-
Executable installers are the natural format for binary distributions on
314-
Windows. They display a nice graphical user interface, display some information
315-
about the module distribution to be installed taken from the metadata in the
316-
setup script, let the user select a few options, and start or cancel the
317-
installation.
318-
319-
Since the metadata is taken from the setup script, creating Windows installers
320-
is usually as easy as running::
321-
322-
python setup.py bdist_wininst
323-
324-
or the :command:`bdist` command with the :option:`!--formats` option::
325-
326-
python setup.py bdist --formats=wininst
327-
328-
If you have a pure module distribution (only containing pure Python modules and
329-
packages), the resulting installer will be version independent and have a name
330-
like :file:`foo-1.0.win32.exe`. Note that creating ``wininst`` binary
331-
distributions in only supported on Windows systems.
332-
333-
If you have a non-pure distribution, the extensions can only be created on a
334-
Windows platform, and will be Python version dependent. The installer filename
335-
will reflect this and now has the form :file:`foo-1.0.win32-py2.0.exe`. You
336-
have to create a separate installer for every Python version you want to
337-
support.
338-
339-
The installer will try to compile pure modules into :term:`bytecode` after installation
340-
on the target system in normal and optimizing mode. If you don't want this to
341-
happen for some reason, you can run the :command:`bdist_wininst` command with
342-
the :option:`!--no-target-compile` and/or the :option:`!--no-target-optimize`
343-
option.
344-
345-
By default the installer will display the cool "Python Powered" logo when it is
346-
run, but you can also supply your own 152x261 bitmap which must be a Windows
347-
:file:`.bmp` file with the :option:`!--bitmap` option.
348-
349-
The installer will also display a large title on the desktop background window
350-
when it is run, which is constructed from the name of your distribution and the
351-
version number. This can be changed to another text by using the
352-
:option:`!--title` option.
353-
354-
The installer file will be written to the "distribution directory" --- normally
355-
:file:`dist/`, but customizable with the :option:`!--dist-dir` option.
356-
357286
.. _cross-compile-windows:
358287

359288
Cross-compiling on Windows
@@ -370,12 +299,7 @@ For example, on a 32bit version of Windows, you could execute::
370299

371300
python setup.py build --plat-name=win-amd64
372301

373-
to build a 64bit version of your extension. The Windows Installers also
374-
support this option, so the command::
375-
376-
python setup.py build --plat-name=win-amd64 bdist_wininst
377-
378-
would create a 64bit installation executable on your 32bit version of Windows.
302+
to build a 64bit version of your extension.
379303

380304
To cross-compile, you must download the Python source code and cross-compile
381305
Python itself for the platform you are targeting - it is not possible from a
@@ -462,18 +386,3 @@ built-in functions in the installation script.
462386
and *iconindex* is the index of the icon in the file *iconpath*. Again, for
463387
details consult the Microsoft documentation for the :class:`IShellLink`
464388
interface.
465-
466-
467-
Vista User Access Control (UAC)
468-
===============================
469-
470-
Starting with Python 2.6, bdist_wininst supports a :option:`!--user-access-control`
471-
option. The default is 'none' (meaning no UAC handling is done), and other
472-
valid values are 'auto' (meaning prompt for UAC elevation if Python was
473-
installed for all users) and 'force' (meaning always prompt for elevation).
474-
475-
.. note::
476-
bdist_wininst is deprecated since Python 3.8.
477-
478-
.. note::
479-
bdist_msi is deprecated since Python 3.9.

docs/deprecated/distutils/commandref.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,5 @@ anything except backslash or colon.
101101
.. % \subsection{\protect\command{bdist}}
102102
.. % \subsection{\protect\command{bdist\_dumb}}
103103
.. % \subsection{\protect\command{bdist\_rpm}}
104-
.. % \subsection{\protect\command{bdist\_wininst}}
105104
106105

docs/deprecated/distutils/introduction.rst

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,6 @@ the setup script. The difference is which Distutils *commands* they use: the
112112
:command:`install` is more often for installers (although most developers will
113113
want to install their own code occasionally).
114114

115-
If you want to make things really easy for your users, you can create one or
116-
more built distributions for them. For instance, if you are running on a
117-
Windows machine, and want to make things easy for other Windows users, you can
118-
create an executable installer (the most appropriate type of built distribution
119-
for this platform) with the :command:`bdist_wininst` command. For example::
120-
121-
python setup.py bdist_wininst
122-
123-
will create an executable installer, :file:`foo-1.0.win32.exe`, in the current
124-
directory.
125-
126115
Other useful built distribution formats are RPM, implemented by the
127116
:command:`bdist_rpm` command, Solaris :program:`pkgtool`
128117
(:command:`bdist_pkgtool`), and HP-UX :program:`swinstall`

setuptools/_distutils/ccompiler.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import sys
77
import os
88
import re
9+
import warnings
10+
911
from distutils.errors import (
1012
CompileError,
1113
LinkError,
@@ -925,8 +927,7 @@ def object_filenames(self, source_filenames, strip_dir=0, output_dir=''):
925927
obj_names = []
926928
for src_name in source_filenames:
927929
base, ext = os.path.splitext(src_name)
928-
base = os.path.splitdrive(base)[1] # Chop off the drive
929-
base = base[os.path.isabs(base) :] # If abs, chop off leading /
930+
base = self._mangle_base(base)
930931
if ext not in self.src_extensions:
931932
raise UnknownFileError(
932933
"unknown file type '{}' (from '{}')".format(ext, src_name)
@@ -936,6 +937,25 @@ def object_filenames(self, source_filenames, strip_dir=0, output_dir=''):
936937
obj_names.append(os.path.join(output_dir, base + self.obj_extension))
937938
return obj_names
938939

940+
@staticmethod
941+
def _mangle_base(base):
942+
"""
943+
For unknown reasons, absolute paths are mangled.
944+
"""
945+
# Chop off the drive
946+
no_drive = os.path.splitdrive(base)[1]
947+
# If abs, chop off leading /
948+
rel = no_drive[os.path.isabs(no_drive) :]
949+
if rel != base:
950+
msg = (
951+
f"Absolute path {base!r} is being replaced with a "
952+
f"relative path {rel!r} for outputs. This behavior is "
953+
"deprecated. If this behavior is desired, please "
954+
"comment in pypa/distutils#169."
955+
)
956+
warnings.warn(msg, DeprecationWarning)
957+
return rel
958+
939959
def shared_object_filename(self, basename, strip_dir=0, output_dir=''):
940960
assert output_dir is not None
941961
if strip_dir:

setuptools/_distutils/command/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
'bdist',
2121
'bdist_dumb',
2222
'bdist_rpm',
23-
'bdist_wininst',
2423
'check',
2524
'upload',
2625
]

setuptools/_distutils/command/bdist.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ class bdist(Command):
8585
'xztar': ('bdist_dumb', "xz'ed tar file"),
8686
'ztar': ('bdist_dumb', "compressed tar file"),
8787
'tar': ('bdist_dumb', "tar file"),
88-
'wininst': ('bdist_wininst', "Windows executable installer"),
8988
'zip': ('bdist_dumb', "ZIP file"),
90-
'msi': ('bdist_msi', "Microsoft Installer"),
9189
}
9290
)
9391

0 commit comments

Comments
 (0)