mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Support for multiple distribution formats in one run.
This commit is contained in:
parent
ec21cc60db
commit
e18dd8dd8f
1 changed files with 18 additions and 17 deletions
|
@ -20,9 +20,9 @@ class bdist (Command):
|
||||||
|
|
||||||
user_options = [('bdist-base=', 'b',
|
user_options = [('bdist-base=', 'b',
|
||||||
"temporary directory for creating built distributions"),
|
"temporary directory for creating built distributions"),
|
||||||
('format=', 'f',
|
('formats=', None,
|
||||||
"format for distribution " +
|
"formats for distribution " +
|
||||||
"(tar, ztar, gztar, bztar, zip, ... )"),
|
"(gztar, bztar, zip, rpm, ... )"),
|
||||||
]
|
]
|
||||||
|
|
||||||
# The following commands do not take a format option from bdist
|
# The following commands do not take a format option from bdist
|
||||||
|
@ -43,7 +43,7 @@ class bdist (Command):
|
||||||
|
|
||||||
def initialize_options (self):
|
def initialize_options (self):
|
||||||
self.bdist_base = None
|
self.bdist_base = None
|
||||||
self.format = None
|
self.formats = None
|
||||||
|
|
||||||
# initialize_options()
|
# initialize_options()
|
||||||
|
|
||||||
|
@ -57,29 +57,30 @@ class bdist (Command):
|
||||||
plat = get_platform()
|
plat = get_platform()
|
||||||
self.bdist_base = os.path.join (build_base, 'bdist.' + plat)
|
self.bdist_base = os.path.join (build_base, 'bdist.' + plat)
|
||||||
|
|
||||||
if self.format is None:
|
self.ensure_string_list('formats')
|
||||||
|
if self.formats is None:
|
||||||
try:
|
try:
|
||||||
self.format = self.default_format[os.name]
|
self.formats = [self.default_format[os.name]]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise DistutilsPlatformError, \
|
raise DistutilsPlatformError, \
|
||||||
"don't know how to create built distributions " + \
|
"don't know how to create built distributions " + \
|
||||||
"on platform %s" % os.name
|
"on platform %s" % os.name
|
||||||
#elif type (self.format) is StringType:
|
|
||||||
# self.format = string.split (self.format, ',')
|
|
||||||
|
|
||||||
# finalize_options()
|
# finalize_options()
|
||||||
|
|
||||||
|
|
||||||
def run (self):
|
def run (self):
|
||||||
|
|
||||||
|
for format in self.formats:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cmd_name = self.format_command[self.format]
|
cmd_name = self.format_command[self.format]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise DistutilsOptionError, \
|
raise DistutilsOptionError, \
|
||||||
"invalid archive format '%s'" % self.format
|
"invalid format '%s'" % self.format
|
||||||
|
|
||||||
|
sub_cmd = self.reinitialize_command(cmd_name)
|
||||||
if cmd_name not in self.no_format_option:
|
if cmd_name not in self.no_format_option:
|
||||||
sub_cmd = self.get_finalized_command (cmd_name)
|
|
||||||
sub_cmd.format = self.format
|
sub_cmd.format = self.format
|
||||||
self.run_command (cmd_name)
|
self.run_command (cmd_name)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue