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

Skip to content

Commit caa745e

Browse files
committed
Branch merge
2 parents 55549ec + fbe37df commit caa745e

5 files changed

Lines changed: 43 additions & 25 deletions

File tree

Lib/distutils/command/bdist_dumb.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def initialize_options(self):
4747
self.format = None
4848
self.keep_temp = 0
4949
self.dist_dir = None
50-
self.skip_build = 0
50+
self.skip_build = None
5151
self.relative = 0
5252

5353
def finalize_options(self):
@@ -65,7 +65,8 @@ def finalize_options(self):
6565

6666
self.set_undefined_options('bdist',
6767
('dist_dir', 'dist_dir'),
68-
('plat_name', 'plat_name'))
68+
('plat_name', 'plat_name'),
69+
('skip_build', 'skip_build'))
6970

7071
def run(self):
7172
if not self.skip_build:

Lib/distutils/command/bdist_msi.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,18 +130,22 @@ def initialize_options(self):
130130
self.no_target_optimize = 0
131131
self.target_version = None
132132
self.dist_dir = None
133-
self.skip_build = 0
133+
self.skip_build = None
134134
self.install_script = None
135135
self.pre_install_script = None
136136
self.versions = None
137137

138138
def finalize_options(self):
139+
self.set_undefined_options('bdist', ('skip_build', 'skip_build'))
140+
139141
if self.bdist_dir is None:
140142
bdist_base = self.get_finalized_command('bdist').bdist_base
141143
self.bdist_dir = os.path.join(bdist_base, 'msi')
144+
142145
short_version = get_python_version()
143146
if (not self.target_version) and self.distribution.has_ext_modules():
144147
self.target_version = short_version
148+
145149
if self.target_version:
146150
self.versions = [self.target_version]
147151
if not self.skip_build and self.distribution.has_ext_modules()\

Lib/distutils/command/bdist_wininst.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,15 @@ def initialize_options(self):
6565
self.dist_dir = None
6666
self.bitmap = None
6767
self.title = None
68-
self.skip_build = 0
68+
self.skip_build = None
6969
self.install_script = None
7070
self.pre_install_script = None
7171
self.user_access_control = None
7272

7373

7474
def finalize_options(self):
75+
self.set_undefined_options('bdist', ('skip_build', 'skip_build'))
76+
7577
if self.bdist_dir is None:
7678
if self.skip_build and self.plat_name:
7779
# If build is skipped and plat_name is overridden, bdist will
@@ -81,8 +83,10 @@ def finalize_options(self):
8183
# next the command will be initialized using that name
8284
bdist_base = self.get_finalized_command('bdist').bdist_base
8385
self.bdist_dir = os.path.join(bdist_base, 'wininst')
86+
8487
if not self.target_version:
8588
self.target_version = ""
89+
8690
if not self.skip_build and self.distribution.has_ext_modules():
8791
short_version = get_python_version()
8892
if self.target_version and self.target_version != short_version:

Lib/distutils/tests/test_bdist.py

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,47 @@
11
"""Tests for distutils.command.bdist."""
2-
import unittest
3-
import sys
42
import os
5-
import tempfile
6-
import shutil
3+
import unittest
74
from test.support import run_unittest
85

9-
from distutils.core import Distribution
106
from distutils.command.bdist import bdist
117
from distutils.tests import support
12-
from distutils.spawn import find_executable
13-
from distutils import spawn
14-
from distutils.errors import DistutilsExecError
8+
159

1610
class BuildTestCase(support.TempdirManager,
1711
unittest.TestCase):
1812

1913
def test_formats(self):
20-
2114
# let's create a command and make sure
22-
# we can fix the format
23-
pkg_pth, dist = self.create_dist()
15+
# we can set the format
16+
dist = self.create_dist()[1]
2417
cmd = bdist(dist)
2518
cmd.formats = ['msi']
2619
cmd.ensure_finalized()
2720
self.assertEqual(cmd.formats, ['msi'])
2821

29-
# what format bdist offers ?
30-
# XXX an explicit list in bdist is
31-
# not the best way to bdist_* commands
32-
# we should add a registry
33-
formats = ['rpm', 'zip', 'gztar', 'bztar', 'ztar',
34-
'tar', 'wininst', 'msi']
35-
formats.sort()
36-
founded = list(cmd.format_command.keys())
37-
founded.sort()
38-
self.assertEqual(founded, formats)
22+
# what formats does bdist offer?
23+
formats = ['bztar', 'gztar', 'msi', 'rpm', 'tar',
24+
'wininst', 'zip', 'ztar']
25+
found = sorted(cmd.format_command)
26+
self.assertEqual(found, formats)
27+
28+
def test_skip_build(self):
29+
# bug #10946: bdist --skip-build should trickle down to subcommands
30+
dist = self.create_dist()[1]
31+
cmd = bdist(dist)
32+
cmd.skip_build = 1
33+
cmd.ensure_finalized()
34+
dist.command_obj['bdist'] = cmd
35+
36+
names = ['bdist_dumb', 'bdist_wininst'] # bdist_rpm does not support --skip-build
37+
if os.name == 'nt':
38+
names.append('bdist_msi')
39+
40+
for name in names:
41+
subcmd = cmd.get_finalized_command(name)
42+
self.assertTrue(subcmd.skip_build,
43+
'%s should take --skip-build from bdist' % name)
44+
3945

4046
def test_suite():
4147
return unittest.makeSuite(BuildTestCase)

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ Core and Builtins
2222
Library
2323
-------
2424

25+
- Issue #10946: The distutils commands bdist_dumb, bdist_wininst and bdist_msi
26+
now respect a --skip-build option given to bdist.
27+
2528
- Issue #12847: Fix a crash with negative PUT and LONG_BINPUT arguments in
2629
the C pickle implementation.
2730

0 commit comments

Comments
 (0)