BDist.py :  » XML » 4Suite » 4Suite-XML-1.0.2 » Ft » Lib » DistExt » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » XML » 4Suite 
4Suite » 4Suite XML 1.0.2 » Ft » Lib » DistExt » BDist.py
import os
import sys
from distutils.command import bdist

from Ft.Lib.DistExt import Util

class BDist(bdist.bdist):
    """
    Extended 'bdist' command that adds support for InnoSetup Windows installers
    and Python Egg files.
    """

    command_name = 'bdist'

    default_format = bdist.bdist.default_format.copy()
    default_format['nt'] = 'inno'

    format_commands = bdist.bdist.format_commands + ['inno', 'egg']

    format_command = bdist.bdist.format_command.copy()
    format_command['inno'] = ('bdist_inno', 'Windows InnoSetup installer')
    format_command['egg'] = ('bdist_egg', 'Python Egg file')

    # Try to keep the option help the same between Python versions.
    if sys.version < '2.3':
        user_options = bdist.bdist.user_options + [
            ('skip-build', None,
             "skip rebuilding everything (for testing/debugging)")
            ]
        boolean_options = ['skip-build']
    else:
        user_options = bdist.bdist.user_options
        boolean_options = bdist.bdist.boolean_options

    # Inplace addition must not be used as it could modify the super class'
    # attributes.
    user_options = user_options + [
        ('keep-temp', 'k',
         "keep the pseudo-installation tree around after " +
         "creating the distribution archive"),
        ]
    boolean_options = boolean_options + ['keep-temp']

    def initialize_options(self):
        bdist.bdist.initialize_options(self)
        self.skip_build = False         # only necessary for Python 2.2
        self.keep_temp = False
        return

    def finalize_options(self):
        self.set_undefined_options('config', ('plat_name', 'plat_name'))

        if self.bdist_base is None:
            build_base = self.get_finalized_command('build').build_base
            bdist_base = 'bdist.' + self.plat_name + '-' + sys.version[:3]
            self.bdist_base = os.path.join(build_base, bdist_base)

        bdist.bdist.finalize_options(self)

        for format in self.formats:
            if format not in self.format_command:
                raise DistutilsOptionError("invalid format '%s'" % format)
        return

    sub_commands = []
    for format in format_commands:
        command, description = format_command[format]
        if command not in dict(sub_commands):
            sub_commands.append((command, lambda self: False))
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.