Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f637050

Browse files
author
Tarek Ziadé
committed
Merged revisions 71291 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r71291 | tarek.ziade | 2009-04-06 00:51:09 +0200 (Mon, 06 Apr 2009) | 1 line Fixed #5095: msi missing from Distutils bdist formats ........
1 parent 0d8f073 commit f637050

4 files changed

Lines changed: 67 additions & 25 deletions

File tree

Doc/distutils/builtdist.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ The available formats for built distributions are:
8080
+-------------+------------------------------+---------+
8181
| ``tar`` | tar file (:file:`.tar`) | \(3) |
8282
+-------------+------------------------------+---------+
83-
| ``zip`` | zip file (:file:`.zip`) | \(4) |
83+
| ``zip`` | zip file (:file:`.zip`) | (2),(4) |
8484
+-------------+------------------------------+---------+
8585
| ``rpm`` | RPM | \(5) |
8686
+-------------+------------------------------+---------+
@@ -90,9 +90,12 @@ The available formats for built distributions are:
9090
+-------------+------------------------------+---------+
9191
| ``rpm`` | RPM | \(5) |
9292
+-------------+------------------------------+---------+
93-
| ``wininst`` | self-extracting ZIP file for | (2),(4) |
93+
| ``wininst`` | self-extracting ZIP file for | \(4) |
9494
| | Windows | |
9595
+-------------+------------------------------+---------+
96+
| ``msi`` | Microsoft Installer. | |
97+
+-------------+------------------------------+---------+
98+
9699

97100
Notes:
98101

@@ -102,8 +105,6 @@ Notes:
102105
(2)
103106
default on Windows
104107

105-
**\*\*** to-do! **\*\***
106-
107108
(3)
108109
requires external utilities: :program:`tar` and possibly one of :program:`gzip`,
109110
:program:`bzip2`, or :program:`compress`
@@ -133,6 +134,8 @@ generates all the "dumb" archive formats (``tar``, ``ztar``, ``gztar``, and
133134
+--------------------------+-----------------------+
134135
| :command:`bdist_wininst` | wininst |
135136
+--------------------------+-----------------------+
137+
| :command:`bdist_msi` | msi |
138+
+--------------------------+-----------------------+
136139

137140
The following sections give details on the individual :command:`bdist_\*`
138141
commands.

Lib/distutils/command/bdist.py

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,35 +49,28 @@ class bdist(Command):
4949
]
5050

5151
# The following commands do not take a format option from bdist
52-
no_format_option = ('bdist_rpm',
53-
#'bdist_sdux', 'bdist_pkgtool'
54-
)
52+
no_format_option = ('bdist_rpm',)
5553

5654
# This won't do in reality: will need to distinguish RPM-ish Linux,
5755
# Debian-ish Linux, Solaris, FreeBSD, ..., Windows, Mac OS.
58-
default_format = { 'posix': 'gztar',
59-
'nt': 'zip',
60-
'os2': 'zip', }
56+
default_format = {'posix': 'gztar',
57+
'nt': 'zip',
58+
'os2': 'zip'}
6159

6260
# Establish the preferred order (for the --help-formats option).
6361
format_commands = ['rpm', 'gztar', 'bztar', 'ztar', 'tar',
64-
'wininst', 'zip',
65-
#'pkgtool', 'sdux'
66-
]
62+
'wininst', 'zip', 'msi']
6763

6864
# And the real information.
69-
format_command = { 'rpm': ('bdist_rpm', "RPM distribution"),
70-
'zip': ('bdist_dumb', "ZIP file"),
71-
'gztar': ('bdist_dumb', "gzip'ed tar file"),
72-
'bztar': ('bdist_dumb', "bzip2'ed tar file"),
73-
'ztar': ('bdist_dumb', "compressed tar file"),
74-
'tar': ('bdist_dumb', "tar file"),
75-
'wininst': ('bdist_wininst',
76-
"Windows executable installer"),
77-
'zip': ('bdist_dumb', "ZIP file"),
78-
#'pkgtool': ('bdist_pkgtool',
79-
# "Solaris pkgtool distribution"),
80-
#'sdux': ('bdist_sdux', "HP-UX swinstall depot"),
65+
format_command = {'rpm': ('bdist_rpm', "RPM distribution"),
66+
'gztar': ('bdist_dumb', "gzip'ed tar file"),
67+
'bztar': ('bdist_dumb', "bzip2'ed tar file"),
68+
'ztar': ('bdist_dumb', "compressed tar file"),
69+
'tar': ('bdist_dumb', "tar file"),
70+
'wininst': ('bdist_wininst',
71+
"Windows executable installer"),
72+
'zip': ('bdist_dumb', "ZIP file"),
73+
'msi': ('bdist_msi', "Microsoft Installer")
8174
}
8275

8376

Lib/distutils/tests/test_bdist.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
"""Tests for distutils.command.bdist."""
2+
import unittest
3+
import sys
4+
import os
5+
import tempfile
6+
import shutil
7+
8+
from distutils.core import Distribution
9+
from distutils.command.bdist import bdist
10+
from distutils.tests import support
11+
from distutils.spawn import find_executable
12+
from distutils import spawn
13+
from distutils.errors import DistutilsExecError
14+
15+
class BuildTestCase(support.TempdirManager,
16+
unittest.TestCase):
17+
18+
def test_formats(self):
19+
20+
# let's create a command and make sure
21+
# we can fix the format
22+
pkg_pth, dist = self.create_dist()
23+
cmd = bdist(dist)
24+
cmd.formats = ['msi']
25+
cmd.ensure_finalized()
26+
self.assertEquals(cmd.formats, ['msi'])
27+
28+
# what format bdist offers ?
29+
# XXX an explicit list in bdist is
30+
# not the best way to bdist_* commands
31+
# we should add a registry
32+
formats = ['rpm', 'zip', 'gztar', 'bztar', 'ztar',
33+
'tar', 'wininst', 'msi']
34+
formats.sort()
35+
founded = list(cmd.format_command.keys())
36+
founded.sort()
37+
self.assertEquals(founded, formats)
38+
39+
def test_suite():
40+
return unittest.makeSuite(BuildTestCase)
41+
42+
if __name__ == '__main__':
43+
test_support.run_unittest(test_suite())

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,9 @@ Core and Builtins
327327
Library
328328
-------
329329

330+
- Issue #5095: Added bdist_msi to the list of bdist supported formats.
331+
Initial fix by Steven Bethard.
332+
330333
- Issue #1491431: Fixed distutils.filelist.glob_to_re for edge cases.
331334
Initial fix by Wayne Davison.
332335

0 commit comments

Comments
 (0)