Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Lib/distutils/command/bdist.py

    r2 r391  
    44distribution)."""
    55
    6 # This module should be kept compatible with Python 2.1.
    7 
    8 __revision__ = "$Id: bdist.py 62197 2008-04-07 01:53:39Z mark.hammond $"
     6__revision__ = "$Id$"
    97
    108import os
    11 from types import *
     9
     10from distutils.util import get_platform
    1211from distutils.core import Command
    13 from distutils.errors import *
    14 from distutils.util import get_platform
     12from distutils.errors import DistutilsPlatformError, DistutilsOptionError
    1513
    1614
    17 def show_formats ():
     15def show_formats():
    1816    """Print list of available formats (arguments to "--format" option).
    1917    """
    2018    from distutils.fancy_getopt import FancyGetopt
    21     formats=[]
     19    formats = []
    2220    for format in bdist.format_commands:
    2321        formats.append(("formats=" + format, None,
     
    2725
    2826
    29 class bdist (Command):
     27class bdist(Command):
    3028
    3129    description = "create a built (binary) distribution"
     
    4341                    ('skip-build', None,
    4442                     "skip rebuilding everything (for testing/debugging)"),
     43                    ('owner=', 'u',
     44                     "Owner name used when creating a tar file"
     45                     " [default: current user]"),
     46                    ('group=', 'g',
     47                     "Group name used when creating a tar file"
     48                     " [default: current group]"),
    4549                   ]
    4650
     
    5357
    5458    # The following commands do not take a format option from bdist
    55     no_format_option = ('bdist_rpm',
    56                         #'bdist_sdux', 'bdist_pkgtool'
    57                         )
     59    no_format_option = ('bdist_rpm',)
    5860
    5961    # This won't do in reality: will need to distinguish RPM-ish Linux,
    6062    # Debian-ish Linux, Solaris, FreeBSD, ..., Windows, Mac OS.
    61     default_format = { 'posix': 'gztar',
    62                        'nt': 'zip',
    63                        'os2': 'zip', }
     63    default_format = {'posix': 'gztar',
     64                      'nt': 'zip',
     65                      'os2': 'zip'}
    6466
    6567    # Establish the preferred order (for the --help-formats option).
    6668    format_commands = ['rpm', 'gztar', 'bztar', 'ztar', 'tar',
    67                        'wininst', 'zip',
    68                        #'pkgtool', 'sdux'
    69                        ]
     69                       'wininst', 'zip', 'msi']
    7070
    7171    # And the real information.
    72     format_command = { 'rpm':   ('bdist_rpm',  "RPM distribution"),
    73                        'zip':   ('bdist_dumb', "ZIP file"),
    74                        'gztar': ('bdist_dumb', "gzip'ed tar file"),
    75                        'bztar': ('bdist_dumb', "bzip2'ed tar file"),
    76                        'ztar':  ('bdist_dumb', "compressed tar file"),
    77                        'tar':   ('bdist_dumb', "tar file"),
    78                        'wininst': ('bdist_wininst',
    79                                    "Windows executable installer"),
    80                        'zip':   ('bdist_dumb', "ZIP file"),
    81                        #'pkgtool': ('bdist_pkgtool',
    82                        #            "Solaris pkgtool distribution"),
    83                        #'sdux':  ('bdist_sdux', "HP-UX swinstall depot"),
     72    format_command = {'rpm':   ('bdist_rpm',  "RPM distribution"),
     73                      'gztar': ('bdist_dumb', "gzip'ed tar file"),
     74                      'bztar': ('bdist_dumb', "bzip2'ed tar file"),
     75                      'ztar':  ('bdist_dumb', "compressed tar file"),
     76                      'tar':   ('bdist_dumb', "tar file"),
     77                      'wininst': ('bdist_wininst',
     78                                  "Windows executable installer"),
     79                      'zip':   ('bdist_dumb', "ZIP file"),
     80                      'msi':   ('bdist_msi',  "Microsoft Installer")
    8481                      }
    8582
    8683
    87     def initialize_options (self):
     84    def initialize_options(self):
    8885        self.bdist_base = None
    8986        self.plat_name = None
     
    9188        self.dist_dir = None
    9289        self.skip_build = 0
     90        self.group = None
     91        self.owner = None
    9392
    94     # initialize_options()
    95 
    96 
    97     def finalize_options (self):
     93    def finalize_options(self):
    9894        # have to finalize 'plat_name' before 'bdist_base'
    9995        if self.plat_name is None:
     
    123119            self.dist_dir = "dist"
    124120
    125     # finalize_options()
    126 
    127     def run (self):
    128 
     121    def run(self):
    129122        # Figure out which sub-commands we need to run.
    130123        commands = []
     
    142135                sub_cmd.format = self.formats[i]
    143136
     137            # passing the owner and group names for tar archiving
     138            if cmd_name == 'bdist_dumb':
     139                sub_cmd.owner = self.owner
     140                sub_cmd.group = self.group
     141
    144142            # If we're going to need to run this command again, tell it to
    145143            # keep its temporary files around so subsequent runs go faster.
     
    147145                sub_cmd.keep_temp = 1
    148146            self.run_command(cmd_name)
    149 
    150     # run()
    151 
    152 # class bdist
Note: See TracChangeset for help on using the changeset viewer.