diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/packaging/command/bdist.py | 13 | ||||
-rw-r--r-- | Lib/packaging/command/bdist_dumb.py | 15 | ||||
-rw-r--r-- | Lib/packaging/tests/test_command_bdist.py | 19 |
3 files changed, 22 insertions, 25 deletions
diff --git a/Lib/packaging/command/bdist.py b/Lib/packaging/command/bdist.py index e8c023d..b9d550b 100644 --- a/Lib/packaging/command/bdist.py +++ b/Lib/packaging/command/bdist.py @@ -64,20 +64,18 @@ class bdist(Command): 'os2': 'zip'} # Establish the preferred order (for the --help-formats option). - format_commands = ['gztar', 'bztar', 'ztar', 'tar', + format_commands = ['gztar', 'bztar', 'tar', 'wininst', 'zip', 'msi'] # And the real information. format_command = {'gztar': ('bdist_dumb', "gzip'ed tar file"), 'bztar': ('bdist_dumb', "bzip2'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") - } - + 'msi': ('bdist_msi', "Microsoft Installer"), + } def initialize_options(self): self.bdist_base = None @@ -109,8 +107,9 @@ class bdist(Command): try: self.formats = [self.default_format[os.name]] except KeyError: - raise PackagingPlatformError("don't know how to create built distributions " + \ - "on platform %s" % os.name) + raise PackagingPlatformError( + "don't know how to create built distributions " + "on platform %s" % os.name) if self.dist_dir is None: self.dist_dir = "dist" diff --git a/Lib/packaging/command/bdist_dumb.py b/Lib/packaging/command/bdist_dumb.py index f74b720..ed83c8e 100644 --- a/Lib/packaging/command/bdist_dumb.py +++ b/Lib/packaging/command/bdist_dumb.py @@ -13,6 +13,7 @@ from packaging.command.cmd import Command from packaging.errors import PackagingPlatformError from packaging import logger + class bdist_dumb(Command): description = 'create a "dumb" built distribution' @@ -23,7 +24,7 @@ class bdist_dumb(Command): "platform name to embed in generated filenames " "(default: %s)" % get_platform()), ('format=', 'f', - "archive format to create (tar, ztar, gztar, zip)"), + "archive format to create (tar, gztar, zip)"), ('keep-temp', 'k', "keep the pseudo-installation tree around after " + "creating the distribution archive"), @@ -44,10 +45,9 @@ class bdist_dumb(Command): boolean_options = ['keep-temp', 'skip-build', 'relative'] - default_format = { 'posix': 'gztar', - 'nt': 'zip', - 'os2': 'zip' } - + default_format = {'posix': 'gztar', + 'nt': 'zip', + 'os2': 'zip'} def initialize_options(self): self.bdist_dir = None @@ -69,8 +69,9 @@ class bdist_dumb(Command): try: self.format = self.default_format[os.name] except KeyError: - raise PackagingPlatformError(("don't know how to create dumb built distributions " + - "on platform %s") % os.name) + raise PackagingPlatformError( + "don't know how to create dumb built distributions " + "on platform %s" % os.name) self.set_undefined_options('bdist', 'dist_dir', 'plat_name') diff --git a/Lib/packaging/tests/test_command_bdist.py b/Lib/packaging/tests/test_command_bdist.py index 1522b7e..fa4093c 100644 --- a/Lib/packaging/tests/test_command_bdist.py +++ b/Lib/packaging/tests/test_command_bdist.py @@ -27,33 +27,30 @@ class BuildTestCase(support.TempdirManager, util.get_platform = self._get_platform def test_formats(self): - # let's create a command and make sure - # we can fix the format - pkg_pth, dist = self.create_dist() + # we can set the format + dist = self.create_dist()[1] cmd = bdist(dist) cmd.formats = ['msi'] cmd.ensure_finalized() self.assertEqual(cmd.formats, ['msi']) - # what format bdist offers ? - # XXX an explicit list in bdist is - # not the best way to bdist_* commands - # we should add a registry - formats = sorted(('zip', 'gztar', 'bztar', 'ztar', - 'tar', 'wininst', 'msi')) + # what format does bdist offer? + # XXX hard-coded lists are not the best way to find available bdist_* + # commands; we should add a registry + formats = ['bztar', 'gztar', 'msi', 'tar', 'wininst', 'zip'] found = sorted(cmd.format_command) self.assertEqual(found, formats) def test_skip_build(self): - pkg_pth, dist = self.create_dist() + dist = self.create_dist()[1] cmd = bdist(dist) cmd.skip_build = False cmd.formats = ['ztar'] cmd.ensure_finalized() self.assertFalse(self._get_platform_called) - pkg_pth, dist = self.create_dist() + dist = self.create_dist()[1] cmd = bdist(dist) cmd.skip_build = True cmd.formats = ['ztar'] |