Skip to content

Commit 2161891

Browse files
committed
Merge https://github.com/pypa/distutils into bugfix/format-commands-regr
2 parents d90cf84 + 274758f commit 2161891

1 file changed

Lines changed: 27 additions & 10 deletions

File tree

setuptools/_distutils/command/bdist.py

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
distribution)."""
55

66
import os
7+
import warnings
8+
79
from distutils.core import Command
810
from distutils.errors import DistutilsPlatformError, DistutilsOptionError
911
from distutils.util import get_platform
@@ -20,6 +22,16 @@ def show_formats():
2022
pretty_printer.print_help("List of available distribution formats:")
2123

2224

25+
class ListCompat(dict):
26+
# adapter to allow for Setuptools compatibility in format_commands
27+
def append(self, item):
28+
warnings.warn(
29+
"""format_commands is now a dict. append is deprecated.""",
30+
DeprecationWarning,
31+
stacklevel=2,
32+
)
33+
34+
2335
class bdist(Command):
2436

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

6779
# Define commands in preferred order for the --help-formats option
68-
format_commands = dict(
69-
rpm=('bdist_rpm', "RPM distribution"),
70-
gztar=('bdist_dumb', "gzip'ed tar file"),
71-
bztar=('bdist_dumb', "bzip2'ed tar file"),
72-
xztar=('bdist_dumb', "xz'ed tar file"),
73-
ztar=('bdist_dumb', "compressed tar file"),
74-
tar=('bdist_dumb', "tar file"),
75-
wininst=('bdist_wininst', "Windows executable installer"),
76-
zip=('bdist_dumb', "ZIP file"),
77-
msi=('bdist_msi', "Microsoft Installer"),
80+
format_commands = ListCompat(
81+
{
82+
'rpm': ('bdist_rpm', "RPM distribution"),
83+
'gztar': ('bdist_dumb', "gzip'ed tar file"),
84+
'bztar': ('bdist_dumb', "bzip2'ed tar file"),
85+
'xztar': ('bdist_dumb', "xz'ed tar file"),
86+
'ztar': ('bdist_dumb', "compressed tar file"),
87+
'tar': ('bdist_dumb', "tar file"),
88+
'wininst': ('bdist_wininst', "Windows executable installer"),
89+
'zip': ('bdist_dumb', "ZIP file"),
90+
'msi': ('bdist_msi', "Microsoft Installer"),
91+
}
7892
)
7993

94+
# for compatibility until consumers only reference format_commands
95+
format_command = format_commands
96+
8097
def initialize_options(self):
8198
self.bdist_base = None
8299
self.plat_name = None

0 commit comments

Comments
 (0)