Mercurial > cpython-lru_cache-weakref
annotate Lib/distutils/command/bdist.py @ 58925:eecf1bef052d 2.6
Merged revisions 78207 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r78207 | ezio.melotti | 2010-02-17 01:26:09 +0200 (Wed, 17 Feb 2010) | 1 line
#7930: fix stripid
........
| author | Ezio Melotti <ezio.melotti@gmail.com> |
|---|---|
| date | Tue, 16 Feb 2010 23:29:44 +0000 |
| parents | a93d2919ea59 |
| children | a5229237eb50 |
| 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 |
|
33965
893d46576737
Update compatibility comments to 2.1, corresponding to PEP 291 1.13.
Martin v. Löwis <martin@v.loewis.de>
parents:
32736
diff
changeset
|
6 # This module should be kept compatible with Python 2.1. |
|
26285
42bfc98d295b
Add comment to Distutil files about requiring 1.5.2 compatibility, as
Andrew M. Kuchling <amk@amk.ca>
parents:
26210
diff
changeset
|
7 |
|
12155
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
8 __revision__ = "$Id$" |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
9 |
|
45468
1d84bf5f9478
Patch #2167 from calvin: Remove unused imports
Christian Heimes <christian@cheimes.de>
parents:
33965
diff
changeset
|
10 import os |
| 12168 | 11 from types import * |
|
12155
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
12 from distutils.core import Command |
|
12169
ff6c1a82c322
Rename 'formats' option to 'format', and remove the ability to generate
Greg Ward <gward@python.net>
parents:
12168
diff
changeset
|
13 from distutils.errors import * |
|
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
|
14 from distutils.util import get_platform |
|
12155
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
15 |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
16 |
|
12999
7160b52ca74a
Changed so all the help-generating functions are defined, at module-level,
Greg Ward <gward@python.net>
parents:
12997
diff
changeset
|
17 def show_formats (): |
|
7160b52ca74a
Changed so all the help-generating functions are defined, at module-level,
Greg Ward <gward@python.net>
parents:
12997
diff
changeset
|
18 """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
|
19 """ |
| 21268 | 20 from distutils.fancy_getopt import FancyGetopt |
|
12999
7160b52ca74a
Changed so all the help-generating functions are defined, at module-level,
Greg Ward <gward@python.net>
parents:
12997
diff
changeset
|
21 formats=[] |
|
7160b52ca74a
Changed so all the help-generating functions are defined, at module-level,
Greg Ward <gward@python.net>
parents:
12997
diff
changeset
|
22 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
|
23 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
|
24 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
|
25 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
|
26 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
|
27 |
|
7160b52ca74a
Changed so all the help-generating functions are defined, at module-level,
Greg Ward <gward@python.net>
parents:
12997
diff
changeset
|
28 |
|
12155
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
29 class bdist (Command): |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
30 |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
31 description = "create a built (binary) distribution" |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
32 |
|
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
|
33 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
|
34 "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
|
35 ('plat-name=', 'p', |
|
c8727aca1404
Added --plat-name option to override sysconfig.get_platform() in
Greg Ward <gward@python.net>
parents:
13810
diff
changeset
|
36 "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
|
37 "(default: %s)" % get_platform()), |
|
12862
af0def063658
Support for multiple distribution formats in one run.
Greg Ward <gward@python.net>
parents:
12783
diff
changeset
|
38 ('formats=', None, |
|
12997
27f3a18fd296
Stylistic/formatting changes to Rene Liebscher's '--help-xxx' patch.
Greg Ward <gward@python.net>
parents:
12869
diff
changeset
|
39 "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
|
40 ('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
|
41 "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
|
42 "[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
|
43 ('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
|
44 "skip rebuilding everything (for testing/debugging)"), |
|
12155
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
45 ] |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
46 |
|
21714
630293be1035
Patch #414775: Add --skip-build option to bdist command.
Martin v. Löwis <martin@v.loewis.de>
parents:
21268
diff
changeset
|
47 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
|
48 |
|
12999
7160b52ca74a
Changed so all the help-generating functions are defined, at module-level,
Greg Ward <gward@python.net>
parents:
12997
diff
changeset
|
49 help_options = [ |
|
7160b52ca74a
Changed so all the help-generating functions are defined, at module-level,
Greg Ward <gward@python.net>
parents:
12997
diff
changeset
|
50 ('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
|
51 "lists available distribution formats", show_formats), |
| 15216 | 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 |
|
12691
7b466a73c961
Harry Henry Gebel: add support for the 'bdist_rpm' command, specifically
Gregory P. Smith <greg@mad-scientist.com>
parents:
12603
diff
changeset
|
54 # The following commands do not take a format option from bdist |
|
25546
c7b9da859b55
Pulling Mark Alexander's contribution from CVS.
Marc-André Lemburg <mal@egenix.com>
parents:
23113
diff
changeset
|
55 no_format_option = ('bdist_rpm', |
|
c7b9da859b55
Pulling Mark Alexander's contribution from CVS.
Marc-André Lemburg <mal@egenix.com>
parents:
23113
diff
changeset
|
56 #'bdist_sdux', 'bdist_pkgtool' |
|
c7b9da859b55
Pulling Mark Alexander's contribution from CVS.
Marc-André Lemburg <mal@egenix.com>
parents:
23113
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 |
|
12155
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
59 # 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
|
60 # Debian-ish Linux, Solaris, FreeBSD, ..., Windows, Mac OS. |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
61 default_format = { 'posix': 'gztar', |
|
21851
e0fc286d57a4
OS/2 patches by Andrew I MacIntyre for distutils.
Marc-André Lemburg <mal@egenix.com>
parents:
21714
diff
changeset
|
62 'nt': 'zip', |
|
e0fc286d57a4
OS/2 patches by Andrew I MacIntyre for distutils.
Marc-André Lemburg <mal@egenix.com>
parents:
21714
diff
changeset
|
63 'os2': 'zip', } |
|
12155
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
64 |
|
13810
76237c0cbf13
Added 'wininst' to the 'format_commands' list, so it's included in
Greg Ward <gward@python.net>
parents:
13348
diff
changeset
|
65 # 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
|
66 format_commands = ['rpm', 'gztar', 'bztar', 'ztar', 'tar', |
|
25546
c7b9da859b55
Pulling Mark Alexander's contribution from CVS.
Marc-André Lemburg <mal@egenix.com>
parents:
23113
diff
changeset
|
67 'wininst', 'zip', |
|
c7b9da859b55
Pulling Mark Alexander's contribution from CVS.
Marc-André Lemburg <mal@egenix.com>
parents:
23113
diff
changeset
|
68 #'pkgtool', 'sdux' |
|
c7b9da859b55
Pulling Mark Alexander's contribution from CVS.
Marc-André Lemburg <mal@egenix.com>
parents:
23113
diff
changeset
|
69 ] |
|
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. |
|
12997
27f3a18fd296
Stylistic/formatting changes to Rene Liebscher's '--help-xxx' patch.
Greg Ward <gward@python.net>
parents:
12869
diff
changeset
|
72 format_command = { 'rpm': ('bdist_rpm', "RPM distribution"), |
|
25546
c7b9da859b55
Pulling Mark Alexander's contribution from CVS.
Marc-André Lemburg <mal@egenix.com>
parents:
23113
diff
changeset
|
73 'zip': ('bdist_dumb', "ZIP file"), |
|
c7b9da859b55
Pulling Mark Alexander's contribution from CVS.
Marc-André Lemburg <mal@egenix.com>
parents:
23113
diff
changeset
|
74 'gztar': ('bdist_dumb', "gzip'ed tar file"), |
|
12997
27f3a18fd296
Stylistic/formatting changes to Rene Liebscher's '--help-xxx' patch.
Greg Ward <gward@python.net>
parents:
12869
diff
changeset
|
75 'bztar': ('bdist_dumb', "bzip2'ed tar file"), |
|
27f3a18fd296
Stylistic/formatting changes to Rene Liebscher's '--help-xxx' patch.
Greg Ward <gward@python.net>
parents:
12869
diff
changeset
|
76 'ztar': ('bdist_dumb', "compressed tar file"), |
|
27f3a18fd296
Stylistic/formatting changes to Rene Liebscher's '--help-xxx' patch.
Greg Ward <gward@python.net>
parents:
12869
diff
changeset
|
77 'tar': ('bdist_dumb', "tar file"), |
|
13030
5df034826735
Infrastructure support for the "bdist_wininst" command.
Greg Ward <gward@python.net>
parents:
12999
diff
changeset
|
78 'wininst': ('bdist_wininst', |
|
5df034826735
Infrastructure support for the "bdist_wininst" command.
Greg Ward <gward@python.net>
parents:
12999
diff
changeset
|
79 "Windows executable installer"), |
|
13810
76237c0cbf13
Added 'wininst' to the 'format_commands' list, so it's included in
Greg Ward <gward@python.net>
parents:
13348
diff
changeset
|
80 'zip': ('bdist_dumb', "ZIP file"), |
|
32736
c3a096bfbd6b
Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents:
26285
diff
changeset
|
81 #'pkgtool': ('bdist_pkgtool', |
|
25546
c7b9da859b55
Pulling Mark Alexander's contribution from CVS.
Marc-André Lemburg <mal@egenix.com>
parents:
23113
diff
changeset
|
82 # "Solaris pkgtool distribution"), |
|
c7b9da859b55
Pulling Mark Alexander's contribution from CVS.
Marc-André Lemburg <mal@egenix.com>
parents:
23113
diff
changeset
|
83 #'sdux': ('bdist_sdux', "HP-UX swinstall depot"), |
|
23113
e7513e142c70
Patch #531901 by Mark W. Alexander: adds a new distutils packager
Marc-André Lemburg <mal@egenix.com>
parents:
22912
diff
changeset
|
84 } |
|
12155
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
85 |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
86 |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
87 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
|
88 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
|
89 self.plat_name = None |
|
12862
af0def063658
Support for multiple distribution formats in one run.
Greg Ward <gward@python.net>
parents:
12783
diff
changeset
|
90 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
|
91 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
|
92 self.skip_build = 0 |
|
12155
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
93 |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
94 # initialize_options() |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
95 |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
96 |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
97 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
|
98 # 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
|
99 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
|
100 if self.skip_build: |
|
a93d2919ea59
Issue #2513: enable 64bit cross compilation on windows.
Mark Hammond <mhammond@skippinet.com.au>
parents:
45468
diff
changeset
|
101 self.plat_name = get_platform() |
|
a93d2919ea59
Issue #2513: enable 64bit cross compilation on windows.
Mark Hammond <mhammond@skippinet.com.au>
parents:
45468
diff
changeset
|
102 else: |
|
a93d2919ea59
Issue #2513: enable 64bit cross compilation on windows.
Mark Hammond <mhammond@skippinet.com.au>
parents:
45468
diff
changeset
|
103 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
|
104 |
|
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
|
105 # '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
|
106 # 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
|
107 # "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
|
108 if self.bdist_base is None: |
|
12783
b91b35c1d4c0
Some far-reaching naming changes:
Greg Ward <gward@python.net>
parents:
12703
diff
changeset
|
109 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
|
110 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
|
111 '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
|
112 |
|
12862
af0def063658
Support for multiple distribution formats in one run.
Greg Ward <gward@python.net>
parents:
12783
diff
changeset
|
113 self.ensure_string_list('formats') |
|
af0def063658
Support for multiple distribution formats in one run.
Greg Ward <gward@python.net>
parents:
12783
diff
changeset
|
114 if self.formats is None: |
|
12155
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
115 try: |
|
12862
af0def063658
Support for multiple distribution formats in one run.
Greg Ward <gward@python.net>
parents:
12783
diff
changeset
|
116 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
|
117 except KeyError: |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
118 raise DistutilsPlatformError, \ |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
119 "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
|
120 "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
|
121 |
|
7628882dcccd
Added the --dist-dir option that the "bdist_*" will use to control where
Greg Ward <gward@python.net>
parents:
13030
diff
changeset
|
122 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
|
123 self.dist_dir = "dist" |
| 21268 | 124 |
|
12155
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
125 # finalize_options() |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
126 |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
127 def run (self): |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
128 |
|
14634
8bd5349e7aa8
Rene Liebscher: if we have to run the same sub-command multiple times
Greg Ward <gward@python.net>
parents:
14507
diff
changeset
|
129 # 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
|
130 commands = [] |
|
12862
af0def063658
Support for multiple distribution formats in one run.
Greg Ward <gward@python.net>
parents:
12783
diff
changeset
|
131 for format in self.formats: |
|
af0def063658
Support for multiple distribution formats in one run.
Greg Ward <gward@python.net>
parents:
12783
diff
changeset
|
132 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
|
133 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
|
134 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
|
135 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
|
136 |
|
14634
8bd5349e7aa8
Rene Liebscher: if we have to run the same sub-command multiple times
Greg Ward <gward@python.net>
parents:
14507
diff
changeset
|
137 # 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
|
138 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
|
139 cmd_name = commands[i] |
|
12862
af0def063658
Support for multiple distribution formats in one run.
Greg Ward <gward@python.net>
parents:
12783
diff
changeset
|
140 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
|
141 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
|
142 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
|
143 |
|
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 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
|
145 # 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
|
146 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
|
147 sub_cmd.keep_temp = 1 |
|
14948
7acb8bbc215b
Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents:
14634
diff
changeset
|
148 self.run_command(cmd_name) |
|
12155
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
149 |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
150 # run() |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
151 |
|
fed89b57637a
The 'bdist' command, for creating "built" (binary) distributions.
Greg Ward <gward@python.net>
parents:
diff
changeset
|
152 # class bdist |
