Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge with distutils fac564f #3521

Merged
merged 17 commits into from
Aug 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/3521.breaking.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove bdist_msi and bdist_wininst commands, which have been deprecated since Python 3.9. Use older Setuptools for these behaviors if needed.
37 changes: 0 additions & 37 deletions docs/deprecated/distutils/apiref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1845,30 +1845,6 @@ Subclasses of :class:`Command` must define the following methods.
:synopsis: Build a "dumb" installer - a simple archive of files


.. % todo


:mod:`distutils.command.bdist_msi` --- Build a Microsoft Installer binary package
=================================================================================

.. module:: distutils.command.bdist_msi
:synopsis: Build a binary distribution as a Windows MSI file

.. class:: bdist_msi

.. deprecated:: 3.9
Use bdist_wheel (wheel packages) instead.

Builds a `Windows Installer`_ (.msi) binary package.

.. _Windows Installer: https://msdn.microsoft.com/en-us/library/cc185688(VS.85).aspx

In most cases, the ``bdist_msi`` installer is a better choice than the
``bdist_wininst`` installer, because it provides better support for
Win64 platforms, allows administrators to perform non-interactive
installations, and allows installation through group policies.


:mod:`distutils.command.bdist_rpm` --- Build a binary distribution as a Redhat RPM and SRPM
===========================================================================================

Expand All @@ -1879,19 +1855,6 @@ Subclasses of :class:`Command` must define the following methods.
.. % todo


:mod:`distutils.command.bdist_wininst` --- Build a Windows installer
====================================================================

.. module:: distutils.command.bdist_wininst
:synopsis: Build a Windows installer

.. deprecated:: 3.8
Use bdist_wheel (wheel packages) instead.


.. % todo


:mod:`distutils.command.sdist` --- Build a source distribution
==============================================================

Expand Down
95 changes: 2 additions & 93 deletions docs/deprecated/distutils/builtdist.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,6 @@ The available formats for built distributions are:
+-------------+------------------------------+---------+
| ``sdux`` | HP-UX :program:`swinstall` | |
+-------------+------------------------------+---------+
| ``wininst`` | self-extracting ZIP file for | \(4) |
| | Windows | |
+-------------+------------------------------+---------+
| ``msi`` | Microsoft Installer. | |
+-------------+------------------------------+---------+

.. versionchanged:: 3.5
Added support for the ``xztar`` format.
Expand Down Expand Up @@ -141,16 +136,6 @@ generated by each, are:
+--------------------------+-------------------------------------+
| :command:`bdist_rpm` | rpm, srpm |
+--------------------------+-------------------------------------+
| :command:`bdist_wininst` | wininst |
+--------------------------+-------------------------------------+
| :command:`bdist_msi` | msi |
+--------------------------+-------------------------------------+

.. note::
bdist_wininst is deprecated since Python 3.8.

.. note::
bdist_msi is deprecated since Python 3.9.

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

python setup.py bdist_rpm --packager="John Doe <jdoe@example.org>" \
bdist_wininst --target-version="2.0"
bdist_dumb --dumb-option=foo

Creating RPM packages is driven by a :file:`.spec` file, much as using the
Distutils is driven by the setup script. To make your life easier, the
Expand Down Expand Up @@ -298,62 +283,6 @@ file winds up deep in the "build tree," in a temporary directory created by
.. % \command{bdist\_rpm} command with one that writes whatever else you want
.. % to the \file{.spec} file.)


.. _creating-wininst:

Creating Windows Installers
===========================

.. warning::
bdist_wininst is deprecated since Python 3.8.

.. warning::
bdist_msi is deprecated since Python 3.9.

Executable installers are the natural format for binary distributions on
Windows. They display a nice graphical user interface, display some information
about the module distribution to be installed taken from the metadata in the
setup script, let the user select a few options, and start or cancel the
installation.

Since the metadata is taken from the setup script, creating Windows installers
is usually as easy as running::

python setup.py bdist_wininst

or the :command:`bdist` command with the :option:`!--formats` option::

python setup.py bdist --formats=wininst

If you have a pure module distribution (only containing pure Python modules and
packages), the resulting installer will be version independent and have a name
like :file:`foo-1.0.win32.exe`. Note that creating ``wininst`` binary
distributions in only supported on Windows systems.

If you have a non-pure distribution, the extensions can only be created on a
Windows platform, and will be Python version dependent. The installer filename
will reflect this and now has the form :file:`foo-1.0.win32-py2.0.exe`. You
have to create a separate installer for every Python version you want to
support.

The installer will try to compile pure modules into :term:`bytecode` after installation
on the target system in normal and optimizing mode. If you don't want this to
happen for some reason, you can run the :command:`bdist_wininst` command with
the :option:`!--no-target-compile` and/or the :option:`!--no-target-optimize`
option.

By default the installer will display the cool "Python Powered" logo when it is
run, but you can also supply your own 152x261 bitmap which must be a Windows
:file:`.bmp` file with the :option:`!--bitmap` option.

The installer will also display a large title on the desktop background window
when it is run, which is constructed from the name of your distribution and the
version number. This can be changed to another text by using the
:option:`!--title` option.

The installer file will be written to the "distribution directory" --- normally
:file:`dist/`, but customizable with the :option:`!--dist-dir` option.

.. _cross-compile-windows:

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

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

to build a 64bit version of your extension. The Windows Installers also
support this option, so the command::

python setup.py build --plat-name=win-amd64 bdist_wininst

would create a 64bit installation executable on your 32bit version of Windows.
to build a 64bit version of your extension.

To cross-compile, you must download the Python source code and cross-compile
Python itself for the platform you are targeting - it is not possible from a
Expand Down Expand Up @@ -462,18 +386,3 @@ built-in functions in the installation script.
and *iconindex* is the index of the icon in the file *iconpath*. Again, for
details consult the Microsoft documentation for the :class:`IShellLink`
interface.


Vista User Access Control (UAC)
===============================

Starting with Python 2.6, bdist_wininst supports a :option:`!--user-access-control`
option. The default is 'none' (meaning no UAC handling is done), and other
valid values are 'auto' (meaning prompt for UAC elevation if Python was
installed for all users) and 'force' (meaning always prompt for elevation).

.. note::
bdist_wininst is deprecated since Python 3.8.

.. note::
bdist_msi is deprecated since Python 3.9.
1 change: 0 additions & 1 deletion docs/deprecated/distutils/commandref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,5 @@ anything except backslash or colon.
.. % \subsection{\protect\command{bdist}}
.. % \subsection{\protect\command{bdist\_dumb}}
.. % \subsection{\protect\command{bdist\_rpm}}
.. % \subsection{\protect\command{bdist\_wininst}}


11 changes: 0 additions & 11 deletions docs/deprecated/distutils/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,6 @@ the setup script. The difference is which Distutils *commands* they use: the
:command:`install` is more often for installers (although most developers will
want to install their own code occasionally).

If you want to make things really easy for your users, you can create one or
more built distributions for them. For instance, if you are running on a
Windows machine, and want to make things easy for other Windows users, you can
create an executable installer (the most appropriate type of built distribution
for this platform) with the :command:`bdist_wininst` command. For example::

python setup.py bdist_wininst

will create an executable installer, :file:`foo-1.0.win32.exe`, in the current
directory.

Other useful built distribution formats are RPM, implemented by the
:command:`bdist_rpm` command, Solaris :program:`pkgtool`
(:command:`bdist_pkgtool`), and HP-UX :program:`swinstall`
Expand Down
24 changes: 22 additions & 2 deletions setuptools/_distutils/ccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import sys
import os
import re
import warnings

from distutils.errors import (
CompileError,
LinkError,
Expand Down Expand Up @@ -925,8 +927,7 @@ def object_filenames(self, source_filenames, strip_dir=0, output_dir=''):
obj_names = []
for src_name in source_filenames:
base, ext = os.path.splitext(src_name)
base = os.path.splitdrive(base)[1] # Chop off the drive
base = base[os.path.isabs(base) :] # If abs, chop off leading /
base = self._mangle_base(base)
if ext not in self.src_extensions:
raise UnknownFileError(
"unknown file type '{}' (from '{}')".format(ext, src_name)
Expand All @@ -936,6 +937,25 @@ def object_filenames(self, source_filenames, strip_dir=0, output_dir=''):
obj_names.append(os.path.join(output_dir, base + self.obj_extension))
return obj_names

@staticmethod
def _mangle_base(base):
"""
For unknown reasons, absolute paths are mangled.
"""
# Chop off the drive
no_drive = os.path.splitdrive(base)[1]
# If abs, chop off leading /
rel = no_drive[os.path.isabs(no_drive) :]
if rel != base:
msg = (
f"Absolute path {base!r} is being replaced with a "
f"relative path {rel!r} for outputs. This behavior is "
"deprecated. If this behavior is desired, please "
"comment in pypa/distutils#169."
)
warnings.warn(msg, DeprecationWarning)
return rel

def shared_object_filename(self, basename, strip_dir=0, output_dir=''):
assert output_dir is not None
if strip_dir:
Expand Down
1 change: 0 additions & 1 deletion setuptools/_distutils/command/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
'bdist',
'bdist_dumb',
'bdist_rpm',
'bdist_wininst',
'check',
'upload',
]
2 changes: 0 additions & 2 deletions setuptools/_distutils/command/bdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ class bdist(Command):
'xztar': ('bdist_dumb', "xz'ed tar file"),
'ztar': ('bdist_dumb', "compressed tar file"),
'tar': ('bdist_dumb', "tar file"),
'wininst': ('bdist_wininst', "Windows executable installer"),
'zip': ('bdist_dumb', "ZIP file"),
'msi': ('bdist_msi', "Microsoft Installer"),
}
)

Expand Down