当前位置: 首页>>代码示例>>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;未经允许,请勿转载。