當前位置: 首頁>>代碼示例>>Python>>正文


Python fancy_getopt.FancyGetopt方法代碼示例

本文整理匯總了Python中distutils.fancy_getopt.FancyGetopt方法的典型用法代碼示例。如果您正苦於以下問題:Python fancy_getopt.FancyGetopt方法的具體用法?Python fancy_getopt.FancyGetopt怎麽用?Python fancy_getopt.FancyGetopt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在distutils.fancy_getopt的用法示例。


在下文中一共展示了fancy_getopt.FancyGetopt方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: dump_properties

# 需要導入模塊: from distutils import fancy_getopt [as 別名]
# 或者: from distutils.fancy_getopt import FancyGetopt [as 別名]
def dump_properties(self):
        """Print out the attributes of a compiler instance."""
        props = []
        for key in list(self.executables.keys()) + \
                ['version', 'libraries', 'library_dirs',
                 'object_switch', 'compile_switch']:
            if hasattr(self, key):
                v = getattr(self, key)
                props.append((key, None, '= '+repr(v)))
        props.sort()

        pretty_printer = FancyGetopt(props)
        for l in pretty_printer.generate_help("%s instance properties:" \
                                              % (self.__class__.__name__)):
            if l[:4]=='  --':
                l = '  ' + l[4:]
            print(l)

    ################### 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:21,代碼來源:__init__.py

示例2: show_compilers

# 需要導入模塊: from distutils import fancy_getopt [as 別名]
# 或者: from distutils.fancy_getopt import FancyGetopt [as 別名]
def show_compilers():
    """Print list of available compilers (used by the "--help-compiler"
    options to "build", "build_ext", "build_clib").
    """
    # XXX this "knows" that the compiler option it's describing is
    # "--compiler", which just happens to be the case for the three
    # commands that use it.
    from distutils.fancy_getopt import FancyGetopt
    compilers = []
    for compiler in compiler_class.keys():
        compilers.append(("compiler="+compiler, None,
                          compiler_class[compiler][2]))
    compilers.sort()
    pretty_printer = FancyGetopt(compilers)
    pretty_printer.print_help("List of available compilers:") 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:17,代碼來源:ccompiler.py

示例3: _parse_command_opts

# 需要導入模塊: from distutils import fancy_getopt [as 別名]
# 或者: from distutils.fancy_getopt import FancyGetopt [as 別名]
def _parse_command_opts(self, parser, args):
        """Parse the command-line options for a single command.
        'parser' must be a FancyGetopt instance; 'args' must be the list
        of arguments, starting with the current command (whose options
        we are about to parse).  Returns a new version of 'args' with
        the next command at the front of the list; will be the empty
        list if there are no more commands on the command line.  Returns
        None if the user asked for help on this command.
        """
        # late import because of mutual dependence between these modules
        from distutils.cmd import Command

        # Pull the current command from the head of the command line
        command = args[0]
        if not command_re.match(command):
            raise SystemExit, "invalid command name '%s'" % command
        self.commands.append(command)

        # Dig up the command class that implements this command, so we
        # 1) know that it's a valid command, and 2) know which options
        # it takes.
        try:
            cmd_class = self.get_command_class(command)
        except DistutilsModuleError, msg:
            raise DistutilsArgError, msg

        # Require that the command class be derived from Command -- want
        # to be sure that the basic "command" interface is implemented. 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:30,代碼來源:dist.py

示例4: fix_help_options

# 需要導入模塊: from distutils import fancy_getopt [as 別名]
# 或者: from distutils.fancy_getopt import FancyGetopt [as 別名]
def fix_help_options(options):
    """Convert a 4-tuple 'help_options' list as found in various command
    classes to the 3-tuple form required by FancyGetopt.
    """
    new_options = []
    for help_tuple in options:
        new_options.append(help_tuple[0:3])
    return new_options 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:10,代碼來源:dist.py

示例5: show_formats

# 需要導入模塊: from distutils import fancy_getopt [as 別名]
# 或者: from distutils.fancy_getopt import FancyGetopt [as 別名]
def show_formats():
    """Print list of available formats (arguments to "--format" option).
    """
    from distutils.fancy_getopt import FancyGetopt
    formats = []
    for format in bdist.format_commands:
        formats.append(("formats=" + format, None,
                        bdist.format_command[format][1]))
    pretty_printer = FancyGetopt(formats)
    pretty_printer.print_help("List of available distribution formats:") 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:12,代碼來源:bdist.py


注:本文中的distutils.fancy_getopt.FancyGetopt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。