Mercurial > cpython-lru_cache-weakref
annotate Lib/distutils/command/bdist.py @ 80661:94de77bd0b4b 2.7
Issue #16194: document imp.load_dynamic problems
when read several extension modules from the same binary object file.
| author | Andrew Svetlov <andrew.svetlov@gmail.com> |
|---|---|
| date | Thu, 29 Nov 2012 19:51:28 +0200 |
| parents | f9fd1795fcf7 |
| children |
| rev | line source |
|---|---|
|
12155
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
1 """distutils.command.bdist |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
2 |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
3 Implements the Distutils 'bdist' command (create a built [binary] |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
4 distribution).""" |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
5 |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
6 __revision__ = "$Id$" |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
7 |
|
45468
1d84bf5f9478
Patch #2167 from calvin: Remove unused imports
Christian Heimes <christian@cheimes.de>
parents:
33965
diff
changeset
|
8 import os |
|
57847
3e2b7965ada9
massive import cleaning in Distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
56335
diff
changeset
|
9 |
|
58503
f9fd1795fcf7
added local get_platform/set_platform APIs in distutils.sysconfig
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
58450
diff
changeset
|
10 from distutils.util import get_platform |
|
12155
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
11 from distutils.core import Command |
|
57847
3e2b7965ada9
massive import cleaning in Distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
56335
diff
changeset
|
12 from distutils.errors import DistutilsPlatformError, DistutilsOptionError |
|
12155
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
13 |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
14 |
|
52917
433de3d59607
Fixed #5095: msi missing from Distutils bdist formats
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
15 def show_formats(): |
|
12999
7160b52ca74a
Changed so all the help-generating functions are defined, at module-level,
Greg Ward <gward@python.net>
parents:
12997
diff
changeset
|
16 """Print list of available formats (arguments to "--format" option). |
|
7160b52ca74a
Changed so all the help-generating functions are defined, at module-level,
Greg Ward <gward@python.net>
parents:
12997
diff
changeset
|
17 """ |
| 21268 | 18 from distutils.fancy_getopt import FancyGetopt |
|
57847
3e2b7965ada9
massive import cleaning in Distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
56335
diff
changeset
|
19 formats = [] |
|
12999
7160b52ca74a
Changed so all the help-generating functions are defined, at module-level,
Greg Ward <gward@python.net>
parents:
12997
diff
changeset
|
20 for format in bdist.format_commands: |
|
7160b52ca74a
Changed so all the help-generating functions are defined, at module-level,
Greg Ward <gward@python.net>
parents:
12997
diff
changeset
|
21 formats.append(("formats=" + format, None, |
|
7160b52ca74a
Changed so all the help-generating functions are defined, at module-level,
Greg Ward <gward@python.net>
parents:
12997
diff
changeset
|
22 bdist.format_command[format][1])) |
|
7160b52ca74a
Changed so all the help-generating functions are defined, at module-level,
Greg Ward <gward@python.net>
parents:
12997
diff
changeset
|
23 pretty_printer = FancyGetopt(formats) |
|
7160b52ca74a
Changed so all the help-generating functions are defined, at module-level,
Greg Ward <gward@python.net>
parents:
12997
diff
changeset
|
24 pretty_printer.print_help("List of available distribution formats:") |
|
7160b52ca74a
Changed so all the help-generating functions are defined, at module-level,
Greg Ward <gward@python.net>
parents:
12997
diff
changeset
|
25 |
|
7160b52ca74a
Changed so all the help-generating functions are defined, at module-level,
Greg Ward <gward@python.net>
parents:
12997
diff
changeset
|
26 |
|
52917
433de3d59607
Fixed #5095: msi missing from Distutils bdist formats
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
27 class bdist(Command): |
|
12155
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
28 |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
29 description = "create a built (binary) distribution" |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
30 |
|
12703
f555fd805085
Added the 'bdist_base' option, the base temp directory for all bdist commands.
Gregory P. Smith <greg@mad-scientist.com>
parents:
12691
diff
changeset
|
31 user_options = [('bdist-base=', 'b', |
|
f555fd805085
Added the 'bdist_base' option, the base temp directory for all bdist commands.
Gregory P. Smith <greg@mad-scientist.com>
parents:
12691
diff
changeset
|
32 "temporary directory for creating built distributions"), |
|
14507
c8727aca1404
Added --plat-name option to override sysconfig.get_platform() in
Greg Ward <gward@python.net>
parents:
13810
diff
changeset
|
33 ('plat-name=', 'p', |
|
c8727aca1404
Added --plat-name option to override sysconfig.get_platform() in
Greg Ward <gward@python.net>
parents:
13810
diff
changeset
|
34 "platform name to embed in generated filenames " |
|
c8727aca1404
Added --plat-name option to override sysconfig.get_platform() in
Greg Ward <gward@python.net>
parents:
13810
diff
changeset
|
35 "(default: %s)" % get_platform()), |
|
12862
af0def063658
Support for multiple distribution formats in one run.
Greg Ward <gward@python.net>
parents:
12783
diff
changeset
|
36 ('formats=', None, |
|
12997
27f3a18fd296
Stylistic/formatting changes to Rene Liebscher's '--help-xxx' patch.
Greg Ward <gward@python.net>
parents:
12869
diff
changeset
|
37 "formats for distribution (comma-separated list)"), |
|
13348
7628882dcccd
Added the --dist-dir option that the "bdist_*" will use to control where
Greg Ward <gward@python.net>
parents:
13030
diff
changeset
|
38 ('dist-dir=', 'd', |
|
7628882dcccd
Added the --dist-dir option that the "bdist_*" will use to control where
Greg Ward <gward@python.net>
parents:
13030
diff
changeset
|
39 "directory to put final built distributions in " |
|
7628882dcccd
Added the --dist-dir option that the "bdist_*" will use to control where
Greg Ward <gward@python.net>
parents:
13030
diff
changeset
|
40 "[default: dist]"), |
|
21714
630293be1035
Patch #414775: Add --skip-build option to bdist command.
Martin v. Löwis <martin@v.loewis.de>
parents:
21268
diff
changeset
|
41 ('skip-build', None, |
|
630293be1035
Patch #414775: Add --skip-build option to bdist command.
Martin v. Löwis <martin@v.loewis.de>
parents:
21268
diff
changeset
|
42 "skip rebuilding everything (for testing/debugging)"), |
|
56335
c2c90d1f3c33
#6516 added owner/group support for tarfiles in Distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
52921
diff
changeset
|
43 ('owner=', 'u', |
|
c2c90d1f3c33
#6516 added owner/group support for tarfiles in Distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
52921
diff
changeset
|
44 "Owner name used when creating a tar file" |
|
c2c90d1f3c33
#6516 added owner/group support for tarfiles in Distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
52921
diff
changeset
|
45 " [default: current user]"), |
|
c2c90d1f3c33
#6516 added owner/group support for tarfiles in Distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
52921
diff
changeset
|
46 ('group=', 'g', |
|
c2c90d1f3c33
#6516 added owner/group support for tarfiles in Distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
52921
diff
changeset
|
47 "Group name used when creating a tar file" |
|
c2c90d1f3c33
#6516 added owner/group support for tarfiles in Distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
52921
diff
changeset
|
48 " [default: current group]"), |
|
12155
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
49 ] |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
50 |
|
21714
630293be1035
Patch #414775: Add --skip-build option to bdist command.
Martin v. Löwis <martin@v.loewis.de>
parents:
21268
diff
changeset
|
51 boolean_options = ['skip-build'] |
|
630293be1035
Patch #414775: Add --skip-build option to bdist command.
Martin v. Löwis <martin@v.loewis.de>
parents:
21268
diff
changeset
|
52 |
|
12999
7160b52ca74a
Changed so all the help-generating functions are defined, at module-level,
Greg Ward <gward@python.net>
parents:
12997
diff
changeset
|
53 help_options = [ |
|
7160b52ca74a
Changed so all the help-generating functions are defined, at module-level,
Greg Ward <gward@python.net>
parents:
12997
diff
changeset
|
54 ('help-formats', None, |
|
7160b52ca74a
Changed so all the help-generating functions are defined, at module-level,
Greg Ward <gward@python.net>
parents:
12997
diff
changeset
|
55 "lists available distribution formats", show_formats), |
| 15216 | 56 ] |
|
12999
7160b52ca74a
Changed so all the help-generating functions are defined, at module-level,
Greg Ward <gward@python.net>
parents:
12997
diff
changeset
|
57 |
|
12691
7b466a73c961
Harry Henry Gebel: add support for the 'bdist_rpm' command, specifically
Gregory P. Smith <greg@mad-scientist.com>
parents:
12603
diff
changeset
|
58 # The following commands do not take a format option from bdist |
|
52917
433de3d59607
Fixed #5095: msi missing from Distutils bdist formats
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
59 no_format_option = ('bdist_rpm',) |
|
12691
7b466a73c961
Harry Henry Gebel: add support for the 'bdist_rpm' command, specifically
Gregory P. Smith <greg@mad-scientist.com>
parents:
12603
diff
changeset
|
60 |
|
12155
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
61 # This won't do in reality: will need to distinguish RPM-ish Linux, |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
62 # Debian-ish Linux, Solaris, FreeBSD, ..., Windows, Mac OS. |
|
52917
433de3d59607
Fixed #5095: msi missing from Distutils bdist formats
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
63 default_format = {'posix': 'gztar', |
|
433de3d59607
Fixed #5095: msi missing from Distutils bdist formats
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
64 'nt': 'zip', |
|
433de3d59607
Fixed #5095: msi missing from Distutils bdist formats
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
65 'os2': 'zip'} |
|
12155
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
66 |
|
13810
76237c0cbf13
Added 'wininst' to the 'format_commands' list, so it's included in
Greg Ward <gward@python.net>
parents:
13348
diff
changeset
|
67 # Establish the preferred order (for the --help-formats option). |
|
76237c0cbf13
Added 'wininst' to the 'format_commands' list, so it's included in
Greg Ward <gward@python.net>
parents:
13348
diff
changeset
|
68 format_commands = ['rpm', 'gztar', 'bztar', 'ztar', 'tar', |
|
52917
433de3d59607
Fixed #5095: msi missing from Distutils bdist formats
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
69 'wininst', 'zip', 'msi'] |
|
13810
76237c0cbf13
Added 'wininst' to the 'format_commands' list, so it's included in
Greg Ward <gward@python.net>
parents:
13348
diff
changeset
|
70 |
|
76237c0cbf13
Added 'wininst' to the 'format_commands' list, so it's included in
Greg Ward <gward@python.net>
parents:
13348
diff
changeset
|
71 # And the real information. |
|
52917
433de3d59607
Fixed #5095: msi missing from Distutils bdist formats
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
72 format_command = {'rpm': ('bdist_rpm', "RPM distribution"), |
|
433de3d59607
Fixed #5095: msi missing from Distutils bdist formats
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
73 'gztar': ('bdist_dumb', "gzip'ed tar file"), |
|
433de3d59607
Fixed #5095: msi missing from Distutils bdist formats
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
74 'bztar': ('bdist_dumb', "bzip2'ed tar file"), |
|
433de3d59607
Fixed #5095: msi missing from Distutils bdist formats
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
75 'ztar': ('bdist_dumb', "compressed tar file"), |
|
433de3d59607
Fixed #5095: msi missing from Distutils bdist formats
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
76 'tar': ('bdist_dumb', "tar file"), |
|
433de3d59607
Fixed #5095: msi missing from Distutils bdist formats
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
77 'wininst': ('bdist_wininst', |
|
433de3d59607
Fixed #5095: msi missing from Distutils bdist formats
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
78 "Windows executable installer"), |
|
433de3d59607
Fixed #5095: msi missing from Distutils bdist formats
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
79 'zip': ('bdist_dumb', "ZIP file"), |
|
433de3d59607
Fixed #5095: msi missing from Distutils bdist formats
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
51047
diff
changeset
|
80 'msi': ('bdist_msi', "Microsoft Installer") |
|
23113
e7513e142c70
Patch #531901 by Mark W. Alexander: adds a new distutils packager
Marc-André Lemburg <mal@egenix.com>
parents:
22912
diff
changeset
|
81 } |
|
12155
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
82 |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
83 |
|
52921
4b881b4a90e9
pep8-fied method names
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
52917
diff
changeset
|
84 def initialize_options(self): |
|
12703
f555fd805085
Added the 'bdist_base' option, the base temp directory for all bdist commands.
Gregory P. Smith <greg@mad-scientist.com>
parents:
12691
diff
changeset
|
85 self.bdist_base = None |
|
14507
c8727aca1404
Added --plat-name option to override sysconfig.get_platform() in
Greg Ward <gward@python.net>
parents:
13810
diff
changeset
|
86 self.plat_name = None |
|
12862
af0def063658
Support for multiple distribution formats in one run.
Greg Ward <gward@python.net>
parents:
12783
diff
changeset
|
87 self.formats = None |
|
13348
7628882dcccd
Added the --dist-dir option that the "bdist_*" will use to control where
Greg Ward <gward@python.net>
parents:
13030
diff
changeset
|
88 self.dist_dir = None |
|
21714
630293be1035
Patch #414775: Add --skip-build option to bdist command.
Martin v. Löwis <martin@v.loewis.de>
parents:
21268
diff
changeset
|
89 self.skip_build = 0 |
|
56335
c2c90d1f3c33
#6516 added owner/group support for tarfiles in Distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
52921
diff
changeset
|
90 self.group = None |
|
c2c90d1f3c33
#6516 added owner/group support for tarfiles in Distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
52921
diff
changeset
|
91 self.owner = None |
|
12155
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
92 |
|
52921
4b881b4a90e9
pep8-fied method names
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
52917
diff
changeset
|
93 def finalize_options(self): |
|
14507
c8727aca1404
Added --plat-name option to override sysconfig.get_platform() in
Greg Ward <gward@python.net>
parents:
13810
diff
changeset
|
94 # have to finalize 'plat_name' before 'bdist_base' |
|
c8727aca1404
Added --plat-name option to override sysconfig.get_platform() in
Greg Ward <gward@python.net>
parents:
13810
diff
changeset
|
95 if self.plat_name is None: |
|
46331
a93d2919ea59
Issue #2513: enable 64bit cross compilation on windows.
Mark Hammond <mhammond@skippinet.com.au>
parents:
45468
diff
changeset
|
96 if self.skip_build: |
|
a93d2919ea59
Issue #2513: enable 64bit cross compilation on windows.
Mark Hammond <mhammond@skippinet.com.au>
parents:
45468
diff
changeset
|
97 self.plat_name = get_platform() |
|
a93d2919ea59
Issue #2513: enable 64bit cross compilation on windows.
Mark Hammond <mhammond@skippinet.com.au>
parents:
45468
diff
changeset
|
98 else: |
|
a93d2919ea59
Issue #2513: enable 64bit cross compilation on windows.
Mark Hammond <mhammond@skippinet.com.au>
parents:
45468
diff
changeset
|
99 self.plat_name = self.get_finalized_command('build').plat_name |
|
14507
c8727aca1404
Added --plat-name option to override sysconfig.get_platform() in
Greg Ward <gward@python.net>
parents:
13810
diff
changeset
|
100 |
|
12703
f555fd805085
Added the 'bdist_base' option, the base temp directory for all bdist commands.
Gregory P. Smith <greg@mad-scientist.com>
parents:
12691
diff
changeset
|
101 # 'bdist_base' -- parent of per-built-distribution-format |
|
f555fd805085
Added the 'bdist_base' option, the base temp directory for all bdist commands.
Gregory P. Smith <greg@mad-scientist.com>
parents:
12691
diff
changeset
|
102 # temporary directories (eg. we'll probably have |
|
f555fd805085
Added the 'bdist_base' option, the base temp directory for all bdist commands.
Gregory P. Smith <greg@mad-scientist.com>
parents:
12691
diff
changeset
|
103 # "build/bdist.<plat>/dumb", "build/bdist.<plat>/rpm", etc.) |
|
f555fd805085
Added the 'bdist_base' option, the base temp directory for all bdist commands.
Gregory P. Smith <greg@mad-scientist.com>
parents:
12691
diff
changeset
|
104 if self.bdist_base is None: |
|
12783
b91b35c1d4c0
Some far-reaching naming changes:
Greg Ward <gward@python.net>
parents:
12703
diff
changeset
|
105 build_base = self.get_finalized_command('build').build_base |
|
14634
8bd5349e7aa8
Rene Liebscher: if we have to run the same sub-command multiple times
Greg Ward <gward@python.net>
parents:
14507
diff
changeset
|
106 self.bdist_base = os.path.join(build_base, |
|
8bd5349e7aa8
Rene Liebscher: if we have to run the same sub-command multiple times
Greg Ward <gward@python.net>
parents:
14507
diff
changeset
|
107 'bdist.' + self.plat_name) |
|
12703
f555fd805085
Added the 'bdist_base' option, the base temp directory for all bdist commands.
Gregory P. Smith <greg@mad-scientist.com>
parents:
12691
diff
changeset
|
108 |
|
12862
af0def063658
Support for multiple distribution formats in one run.
Greg Ward <gward@python.net>
parents:
12783
diff
changeset
|
109 self.ensure_string_list('formats') |
|
af0def063658
Support for multiple distribution formats in one run.
Greg Ward <gward@python.net>
parents:
12783
diff
changeset
|
110 if self.formats is None: |
|
12155
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
111 try: |
|
12862
af0def063658
Support for multiple distribution formats in one run.
Greg Ward <gward@python.net>
parents:
12783
diff
changeset
|
112 self.formats = [self.default_format[os.name]] |
|
12155
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
113 except KeyError: |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
114 raise DistutilsPlatformError, \ |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
115 "don't know how to create built distributions " + \ |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
116 "on platform %s" % os.name |
|
13348
7628882dcccd
Added the --dist-dir option that the "bdist_*" will use to control where
Greg Ward <gward@python.net>
parents:
13030
diff
changeset
|
117 |
|
7628882dcccd
Added the --dist-dir option that the "bdist_*" will use to control where
Greg Ward <gward@python.net>
parents:
13030
diff
changeset
|
118 if self.dist_dir is None: |
|
7628882dcccd
Added the --dist-dir option that the "bdist_*" will use to control where
Greg Ward <gward@python.net>
parents:
13030
diff
changeset
|
119 self.dist_dir = "dist" |
| 21268 | 120 |
|
52921
4b881b4a90e9
pep8-fied method names
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
52917
diff
changeset
|
121 def run(self): |
|
14634
8bd5349e7aa8
Rene Liebscher: if we have to run the same sub-command multiple times
Greg Ward <gward@python.net>
parents:
14507
diff
changeset
|
122 # Figure out which sub-commands we need to run. |
|
8bd5349e7aa8
Rene Liebscher: if we have to run the same sub-command multiple times
Greg Ward <gward@python.net>
parents:
14507
diff
changeset
|
123 commands = [] |
|
12862
af0def063658
Support for multiple distribution formats in one run.
Greg Ward <gward@python.net>
parents:
12783
diff
changeset
|
124 for format in self.formats: |
|
af0def063658
Support for multiple distribution formats in one run.
Greg Ward <gward@python.net>
parents:
12783
diff
changeset
|
125 try: |
|
14634
8bd5349e7aa8
Rene Liebscher: if we have to run the same sub-command multiple times
Greg Ward <gward@python.net>
parents:
14507
diff
changeset
|
126 commands.append(self.format_command[format][0]) |
|
12862
af0def063658
Support for multiple distribution formats in one run.
Greg Ward <gward@python.net>
parents:
12783
diff
changeset
|
127 except KeyError: |
|
14634
8bd5349e7aa8
Rene Liebscher: if we have to run the same sub-command multiple times
Greg Ward <gward@python.net>
parents:
14507
diff
changeset
|
128 raise DistutilsOptionError, "invalid format '%s'" % format |
|
12862
af0def063658
Support for multiple distribution formats in one run.
Greg Ward <gward@python.net>
parents:
12783
diff
changeset
|
129 |
|
14634
8bd5349e7aa8
Rene Liebscher: if we have to run the same sub-command multiple times
Greg Ward <gward@python.net>
parents:
14507
diff
changeset
|
130 # Reinitialize and run each command. |
|
8bd5349e7aa8
Rene Liebscher: if we have to run the same sub-command multiple times
Greg Ward <gward@python.net>
parents:
14507
diff
changeset
|
131 for i in range(len(self.formats)): |
|
8bd5349e7aa8
Rene Liebscher: if we have to run the same sub-command multiple times
Greg Ward <gward@python.net>
parents:
14507
diff
changeset
|
132 cmd_name = commands[i] |
|
12862
af0def063658
Support for multiple distribution formats in one run.
Greg Ward <gward@python.net>
parents:
12783
diff
changeset
|
133 sub_cmd = self.reinitialize_command(cmd_name) |
|
af0def063658
Support for multiple distribution formats in one run.
Greg Ward <gward@python.net>
parents:
12783
diff
changeset
|
134 if cmd_name not in self.no_format_option: |
|
14634
8bd5349e7aa8
Rene Liebscher: if we have to run the same sub-command multiple times
Greg Ward <gward@python.net>
parents:
14507
diff
changeset
|
135 sub_cmd.format = self.formats[i] |
|
8bd5349e7aa8
Rene Liebscher: if we have to run the same sub-command multiple times
Greg Ward <gward@python.net>
parents:
14507
diff
changeset
|
136 |
|
56335
c2c90d1f3c33
#6516 added owner/group support for tarfiles in Distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
52921
diff
changeset
|
137 # passing the owner and group names for tar archiving |
|
c2c90d1f3c33
#6516 added owner/group support for tarfiles in Distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
52921
diff
changeset
|
138 if cmd_name == 'bdist_dumb': |
|
c2c90d1f3c33
#6516 added owner/group support for tarfiles in Distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
52921
diff
changeset
|
139 sub_cmd.owner = self.owner |
|
c2c90d1f3c33
#6516 added owner/group support for tarfiles in Distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
52921
diff
changeset
|
140 sub_cmd.group = self.group |
|
c2c90d1f3c33
#6516 added owner/group support for tarfiles in Distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents:
52921
diff
changeset
|
141 |
|
14634
8bd5349e7aa8
Rene Liebscher: if we have to run the same sub-command multiple times
Greg Ward <gward@python.net>
parents:
14507
diff
changeset
|
142 # If we're going to need to run this command again, tell it to |
|
8bd5349e7aa8
Rene Liebscher: if we have to run the same sub-command multiple times
Greg Ward <gward@python.net>
parents:
14507
diff
changeset
|
143 # keep its temporary files around so subsequent runs go faster. |
|
8bd5349e7aa8
Rene Liebscher: if we have to run the same sub-command multiple times
Greg Ward <gward@python.net>
parents:
14507
diff
changeset
|
144 if cmd_name in commands[i+1:]: |
|
8bd5349e7aa8
Rene Liebscher: if we have to run the same sub-command multiple times
Greg Ward <gward@python.net>
parents:
14507
diff
changeset
|
145 sub_cmd.keep_temp = 1 |
|
14948
7acb8bbc215b
Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents:
14634
diff
changeset
|
146 self.run_command(cmd_name) |
