当前位置: 首页>>代码示例>>Python>>正文


Python version.versionToLongString函数代码示例

本文整理汇总了Python中pykickstart.version.versionToLongString函数的典型用法代码示例。如果您正苦于以下问题:Python versionToLongString函数的具体用法?Python versionToLongString怎么用?Python versionToLongString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了versionToLongString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: add_argument

    def add_argument(self, *args, **kwargs):
        if "introduced" in kwargs:
            warnings.warn("The option 'introduced' will be removed in a future release. "
                          "Use 'version' instead.", PendingDeprecationWarning)

        if "removed" in kwargs:
            warnings.warn("The option 'removed' will be removed in a future release. "
                          "Use 'remove_argument' instead.", PendingDeprecationWarning)

        introduced = kwargs.pop("introduced", None)
        deprecated = kwargs.pop("deprecated", False)

        if deprecated:
            version = versionToLongString(deprecated)
        else:
            # fail fast if version is missing
            version = versionToLongString(introduced or kwargs.pop("version"))

        candidate = None
        for action in self._actions:
            for arg in args:
                if arg in action.option_strings:
                    candidate = action
                    break

        if candidate:
            if deprecated:
                _help = candidate.help or ""
                _help += "\n\n    .. deprecated:: %s" % version
                kwargs["help"] = _help
            else:
                # this is a modified argument, which is already present
                _help = candidate.help or ""
                _help += "\n\n    .. versionchanged:: %s\n\n%s" % (version, kwargs.pop("help"))
                kwargs["help"] = _help
        else:
            # this is a new argument which is added for the first time
            _help = kwargs.pop("help")
            _help += "\n\n    .. versionadded:: %s" % version
            # there are some argumets which are deprecated on first declaration
            if deprecated:
                _help += "\n\n    .. deprecated:: %s" % version
            kwargs["help"] = _help

        notest = kwargs.pop("notest", False)
        removed = kwargs.pop("removed", None)

        action = ArgumentParser.add_argument(self, *args, **kwargs)
        action.deprecated = deprecated
        action.introduced = introduced
        action.notest = notest
        action.removed = removed
        return action
开发者ID:phracek,项目名称:pykickstart,代码行数:53,代码来源:options.py

示例2: _getParser

    def _getParser(self):
        op = super(self.__class__, self)._getParser()
        for action in op._actions:
            # mark the fact that --iface is available since F17
            # while RHEL6 is based on F12
            if '--iface' in action.option_strings:
                action.help = action.help.replace(
                                versionToLongString(RHEL6),
                                versionToLongString(F17)
                            )

        return op
开发者ID:piyush1911,项目名称:pykickstart,代码行数:12,代码来源:iscsi.py

示例3: _getParser

    def _getParser(self):
        "Only necessary for the type change documentation"
        op = F29_AutoPart._getParser(self)
        for action in op._actions:
            if "--type" in action.option_strings:
                action.help += """

                    .. versionchanged:: %s

                    Partitioning scheme 'btrfs' was removed.""" % versionToLongString(RHEL8)
            if "--fstype" in action.option_strings:
                action.help += """

                    .. versionchanged:: %s

                    Partitioning scheme 'btrfs' was removed.""" % versionToLongString(RHEL8)
        return op
开发者ID:atodorov,项目名称:pykickstart,代码行数:17,代码来源:autopart.py

示例4: _getParser

    def _getParser(self):
        "Only necessary for the type change documentation"
        op = F18_AutoPart._getParser(self)
        for action in op._actions:
            if "--type" in action.option_strings:
                action.help += """

                    .. versionchanged:: %s

                    Partitioning scheme 'thinp' was added.""" % versionToLongString(F20)
        return op
开发者ID:piyush1911,项目名称:pykickstart,代码行数:11,代码来源:autopart.py

示例5: _getParser

    def _getParser(self):
        "Only necessary for the type change documentation"
        op = F29_LogVol._getParser(self)
        for action in op._actions:
            if "--fstype" in action.option_strings:
                action.help += """

                    .. versionchanged:: %s

                    Btrfs support was removed.""" % versionToLongString(RHEL8)
        return op
开发者ID:atodorov,项目名称:pykickstart,代码行数:11,代码来源:logvol.py

示例6: _getParser

    def _getParser(self):
        op = F12_Raid._getParser(self)
        for action in op._actions:
            if "--level" in action.option_strings:
                action.help += dedent("""

                .. versionchanged:: %s

                The "RAID4" level was added.""" % versionToLongString(F13))
                break
        return op
开发者ID:piyush1911,项目名称:pykickstart,代码行数:11,代码来源:raid.py

示例7: _getParser

    def _getParser(self):
        op = FC6_Network._getParser(self)
        for action in op._actions:
            if "--bootproto" in action.option_strings:
                action.help += dedent("""

                        .. versionchanged:: %s

                        The 'query' value was added.""" % versionToLongString(RHEL5))
                break
        return op
开发者ID:atodorov,项目名称:pykickstart,代码行数:11,代码来源:network.py

示例8: _getParser

    def _getParser(self):
        op = F11_Upgrade._getParser(self)
        op.description += dedent("""

                        .. deprecated:: %s

                        Starting with F18, upgrades are no longer supported in
                        anaconda and should be done with FedUp, the Fedora update
                        tool. Starting with F21, the DNF system-upgrade plugin is
                        recommended instead.  Therefore, the upgrade command
                        essentially does nothing.""" % versionToLongString(F20))
        return op
开发者ID:piyush1911,项目名称:pykickstart,代码行数:12,代码来源:upgrade.py

示例9: _getParser

    def _getParser(self):
        op = super(F28_Authconfig, self)._getParser()
        op.description += dedent("""

            .. versionchanged:: %s

            The authconfig program is deprecated. This command will use the
            authconfig compatibility tool, but you should use the authselect
            command instead.

        """ % versionToLongString(F28))
        return op
开发者ID:atodorov,项目名称:pykickstart,代码行数:12,代码来源:authconfig.py

示例10: _getParser

    def _getParser(self):
        op = F14_Repo._getParser(self)
        for action in op._actions:
            for option in ['--baseurl', '--mirrorlist']:
                if option in action.option_strings:
                    action.help += dedent("""

                    .. versionchanged:: %s

                    ``--mirrorlist`` and ``--baseurl`` are not required anymore!
                    """ % versionToLongString(F15))
        return op
开发者ID:atodorov,项目名称:pykickstart,代码行数:12,代码来源:repo.py

示例11: remove_argument

    def remove_argument(self, arg, **kwargs):
        candidate = None

        for action in self._actions:
            if arg in action.option_strings:
                candidate = action
                break

        if candidate:
            if not candidate.help:
                candidate.help = ""
            candidate.help += "\n\n    .. versionremoved:: %s" % versionToLongString(kwargs.pop("version"))
            self._remove_action(candidate)
            self._option_string_actions.pop(arg)
开发者ID:atodorov,项目名称:pykickstart,代码行数:14,代码来源:options.py

示例12: __init__

    def __init__(self, *args, **kwargs):
        """Create a new KSOptionParser instance.  Each KickstartCommand
           subclass should create one instance of KSOptionParser, providing
           at least the lineno attribute.  version is not required.

           Instance attributes:

           version -- The version when the kickstart command was introduced.

        """
        # Overridden to allow for the version kwargs, to skip help option generation,
        # and to resolve conflicts instead of override earlier options.
        int_version = kwargs.pop("version")  # fail fast if no version is specified
        version = versionToLongString(int_version)

        # always document the version
        if "addVersion" in kwargs:
            warnings.warn("The option 'addVersion' will be removed in a future release.",
                          PendingDeprecationWarning)

        addVersion = kwargs.pop('addVersion', True)

        # remove leading spaced from description and epilog.
        # fail fast if we forgot to add description
        kwargs['description'] = textwrap.dedent(kwargs.pop("description"))
        if addVersion:
            kwargs['description'] = "\n.. versionadded:: %s\n%s" % (version,
                                                                    kwargs['description'])
        kwargs['epilog'] = textwrap.dedent(kwargs.pop("epilog", ""))

        # fail fast if we forgot to add prog
        kwargs['prog'] = kwargs.pop("prog")

        # remove leading spaced from description and epilog.
        # fail fast if we forgot to add description
        kwargs['description'] = textwrap.dedent(kwargs.pop("description"))
        kwargs['epilog'] = textwrap.dedent(kwargs.pop("epilog", ""))

        # fail fast if we forgot to add prog
        kwargs['prog'] = kwargs.pop("prog")

        ArgumentParser.__init__(self, add_help=False, conflict_handler="resolve",
                                formatter_class=KSHelpFormatter, *args, **kwargs)
        # NOTE: On Python 2.7 ArgumentParser has a deprecated version parameter
        # which always defaults to self.version = None which breaks deprecation
        # warnings in pykickstart. That's why we always set this value after
        # ArgumentParser.__init__ has been executed
        self.version = int_version
        self.lineno = None
开发者ID:phracek,项目名称:pykickstart,代码行数:49,代码来源:options.py

示例13: _getParser

    def _getParser(self):
        op = FC3_Keyboard._getParser(self)
        op.description += dedent("""

        .. versionchanged:: %s

        See the documentation of ``--vckeymap`` option and the tip at the end
        of this section for a guide how to get values accepted by this command.

        Either ``--vckeymap`` or ``--xlayouts`` must be used.

        Alternatively, use the older format, ``arg``, which is still supported.
        ``arg`` can be an X layout or VConsole keymap name.

        Missing values will be automatically converted from the given one(s).
        """ % versionToLongString(F18))

        op.add_argument("--vckeymap", dest="vc_keymap", default="", help="""
                        Specify VConsole keymap that should be used. is a keymap
                        name which is the same as the filename under
                        ``/usr/lib/kbd/keymaps/`` without the ``.map.gz`` extension.
                        """, version=F18)
        op.add_argument("--xlayouts", dest="x_layouts", type=commaSplit,
                        version=F18, help="""
                        Specify a list of X layouts that should be used
                        (comma-separated list without spaces). Accepts the same
                        values as ``setxkbmap(1)``, but uses either the layout format
                        (such as cz) or the 'layout (variant)' format (such as
                        'cz (qwerty)'). For example::

                        ``keyboard --xlayouts=cz,'cz (qwerty)'`""")
        op.add_argument("--switch", dest="switch_options", type=commaSplit,
                        version=F18, help="""
                        Specify a list of layout switching options that should
                        be used (comma-separated list without spaces). Accepts
                        the same values as ``setxkbmap(1)`` for layout switching.
                        For example::

                        ``keyboard --xlayouts=cz,'cz (qwerty)' --switch=grp:alt_shift_toggle``
                        """)
        op.epilog = dedent("""
        *If you know only the description of the layout (e.g. Czech (qwerty)),
        you can use http://vpodzime.fedorapeople.org/layouts_list.py to list
        all available layouts and find the one you want to use. The string in
        square brackets is the valid layout specification as Anaconda accepts
        it. The same goes for switching options and
        http://vpodzime.fedorapeople.org/switching_list.py*""")
        return op
开发者ID:piyush1911,项目名称:pykickstart,代码行数:48,代码来源:keyboard.py

示例14: _getParser

    def _getParser(self):
        op = FC6_Reboot._getParser(self)
        op.prog += "|halt"
        op.description += dedent("""

        ``halt``

        At the end of installation, display a message and wait for the user to
        press a key before rebooting. This is the default action.

        .. versionchanged:: %s

        The 'halt' command was added!

        """ % versionToLongString(F18))
        return op
开发者ID:phracek,项目名称:pykickstart,代码行数:16,代码来源:reboot.py

示例15: _getParser

    def _getParser(self):
        op = F9_Network._getParser(self)
        for action in op._actions:
            if "--bootproto" in action.option_strings:
                action.help += dedent("""

                        .. versionchanged:: %s

                        The 'ibft' value was added.""" % \
                        versionToLongString(RHEL6))
                break
        op.add_argument("--activate", action="store_true", version=RHEL6,
                        default=False, help="""
                        As noted above, using this option ensures any matching
                        devices beyond the first will also be activated.""")
        op.add_argument("--nodefroute", action="store_true", version=RHEL6,
                        default=False, help="""
                        Prevents grabbing of the default route by the device.
                        It can be useful when activating additional devices in
                        installer using ``--activate`` option.""")
        op.add_argument("--vlanid", version=RHEL6, help="""
                        Id (802.1q tag) of vlan device to be created using parent
                        device specified by ``--device`` option. For example::

                            ``network --device=eth0 --vlanid=171``

                        will create vlan device ``eth0.171``.""")
        op.add_argument("--bondslaves", version=RHEL6, help="""
                        Bonded device with name specified by ``--device`` option
                        will be created using slaves specified in this option.
                        Example::

                            ``--bondslaves=eth0,eth1``.
                        """)
        op.add_argument("--bondopts", version=RHEL6, help="""
                        A comma-separated list of optional parameters for bonded
                        interface specified by ``--bondslaves`` and ``--device``
                        options. Example::

                            ``--bondopts=mode=active-backup,primary=eth1``.

                        If an option itself contains comma as separator use
                        semicolon to separate the options.""")
        return op
开发者ID:cathywife,项目名称:pykickstart,代码行数:44,代码来源:network.py


注:本文中的pykickstart.version.versionToLongString函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。