mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	 02296cea39
			
		
	
	
		02296cea39
		
	
	
	
	
		
			
			multiple built distributions in one run -- it seemed a bit dodgy and I'd rather remove it than try to beat it into submission right now.
		
			
				
	
	
		
			69 lines
		
	
	
	
		
			1.8 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			69 lines
		
	
	
	
		
			1.8 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| """distutils.command.bdist
 | |
| 
 | |
| Implements the Distutils 'bdist' command (create a built [binary]
 | |
| distribution)."""
 | |
| 
 | |
| # created 2000/03/29, Greg Ward
 | |
| 
 | |
| __revision__ = "$Id$"
 | |
| 
 | |
| import os, string
 | |
| from types import *
 | |
| from distutils.core import Command
 | |
| from distutils.errors import *
 | |
| 
 | |
| 
 | |
| class bdist (Command):
 | |
| 
 | |
|     description = "create a built (binary) distribution"
 | |
| 
 | |
|     user_options = [('format=', 'f',
 | |
|                      "format for distribution (tar, ztar, gztar, zip, ... )"),
 | |
|                    ]
 | |
| 
 | |
|     # This won't do in reality: will need to distinguish RPM-ish Linux,
 | |
|     # Debian-ish Linux, Solaris, FreeBSD, ..., Windows, Mac OS.
 | |
|     default_format = { 'posix': 'gztar',
 | |
|                        'nt': 'zip', }
 | |
| 
 | |
|     format_command = { 'gztar': 'bdist_dumb',
 | |
|                        'ztar':  'bdist_dumb',
 | |
|                        'tar':   'bdist_dumb',
 | |
|                        'zip':   'bdist_dumb', }
 | |
| 
 | |
| 
 | |
|     def initialize_options (self):
 | |
|         self.format = None
 | |
| 
 | |
|     # initialize_options()
 | |
| 
 | |
| 
 | |
|     def finalize_options (self):
 | |
|         if self.format is None:
 | |
|             try:
 | |
|                 self.format = self.default_format[os.name]
 | |
|             except KeyError:
 | |
|                 raise DistutilsPlatformError, \
 | |
|                       "don't know how to create built distributions " + \
 | |
|                       "on platform %s" % os.name
 | |
|         #elif type (self.format) is StringType:
 | |
|         #    self.format = string.split (self.format, ',')
 | |
|             
 | |
| 
 | |
|     # finalize_options()
 | |
| 
 | |
| 
 | |
|     def run (self):
 | |
| 
 | |
|         try:
 | |
|             cmd_name = self.format_command[self.format]
 | |
|         except KeyError:
 | |
|             raise DistutilsOptionError, \
 | |
|                   "invalid archive format '%s'" % self.format
 | |
| 
 | |
|         sub_cmd = self.find_peer (cmd_name)
 | |
|         sub_cmd.set_option ('format', self.format)
 | |
| 
 | |
|     # run()
 | |
| 
 | |
| # class bdist
 |