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 pypa/distutils@274758f1c02048 #3482

Merged
merged 4 commits into from
Aug 3, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/3482.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Sync with pypa/distutils@274758f1c02048d295efdbc13d2f88d9923547f8, restoring compatibility shim in bdist.format_commands.
37 changes: 27 additions & 10 deletions setuptools/_distutils/command/bdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
distribution)."""

import os
import warnings

from distutils.core import Command
from distutils.errors import DistutilsPlatformError, DistutilsOptionError
from distutils.util import get_platform
Expand All @@ -20,6 +22,16 @@ def show_formats():
pretty_printer.print_help("List of available distribution formats:")


class ListCompat(dict):
# adapter to allow for Setuptools compatibility in format_commands
def append(self, item):
warnings.warn(
"""format_commands is now a dict. append is deprecated.""",
DeprecationWarning,
stacklevel=2,
)


class bdist(Command):

description = "create a built (binary) distribution"
Expand Down Expand Up @@ -65,18 +77,23 @@ class bdist(Command):
default_format = {'posix': 'gztar', 'nt': 'zip'}

# Define commands in preferred order for the --help-formats option
format_commands = dict(
rpm=('bdist_rpm', "RPM distribution"),
gztar=('bdist_dumb', "gzip'ed tar file"),
bztar=('bdist_dumb', "bzip2'ed tar file"),
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"),
format_commands = ListCompat(
{
'rpm': ('bdist_rpm', "RPM distribution"),
'gztar': ('bdist_dumb', "gzip'ed tar file"),
'bztar': ('bdist_dumb', "bzip2'ed tar file"),
'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"),
}
)

# for compatibility until consumers only reference format_commands
format_command = format_commands

def initialize_options(self):
self.bdist_base = None
self.plat_name = None
Expand Down