%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/utils/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/utils/versions.pyc

�
���^c@@s3dZddlmZmZmZddlZddlZddlZddlZddl	m
Zddl	mZ
ddlZddlmZeje�Zdefd��YZ
d	e
fd
��YZedded�Zedded�Zed
�Zdddded�Zdddeed�ZdS(uV
    :copyright: Copyright 2017 by the SaltStack Team, see AUTHORS for more details.
    :license: Apache 2.0, see LICENSE for more details.


    salt.utils.versions
    ~~~~~~~~~~~~~~~~~~~

    Version parsing based on distutils.version which works under python 3
    because on python 3 you can no longer compare strings against integers.
i(tabsolute_importtprint_functiontunicode_literalsN(t
StrictVersion(tLooseVersion(tsixRcB@seZd�Zd�ZRS(cC@stj||�dS(N(t_StrictVersiontparse(tselftvstring((s7/usr/lib/python2.7/site-packages/salt/utils/versions.pyR#scC@s1t|tj�r!t|�}ntj||�S(N(t
isinstanceRtstring_typesRRt_cmp(Rtother((s7/usr/lib/python2.7/site-packages/salt/utils/versions.pyR&s(t__name__t
__module__RR(((s7/usr/lib/python2.7/site-packages/salt/utils/versions.pyR"s	RcB@s&eZd�Zejr$d�ZnRS(cC@sftj||�tjrbg|jD]3}t|t�rPtj|�jd�n|^q#|_	ndS(Ni(
t
_LooseVersionRRtPY3tversionR
tintt	text_typetzfillt_str_version(RR	tvp((s7/usr/lib/python2.7/site-packages/salt/utils/versions.pyR.s	cC@s�t|tj�r!t|�}nt}x1|j|jD]}t|t�s8t}Pq8q8W|tkrwtj	||�S|j
|j
kr�dS|j
|j
kr�dS|j
|j
kr�dSdS(Nii����i(R
RRRtFalseRRtTrueRRR(RR
tstring_in_versiontpart((s7/usr/lib/python2.7/site-packages/salt/utils/versions.pyR7s(RRRRRR(((s7/usr/lib/python2.7/site-packages/salt/utils/versions.pyR,s		c
C@s�t|ttjtjjf�s0td��nNt|t�rTtjj|�}n*t|tj�r~tjjj|�}n|dkr�d}n|dkr�tjj
}ntjj|�}||kr-ddl}|jt
j|d��}tdjd|jd|jd	|jd
|j���n|tkr�dd�}	tj}
|	t_tj|jd|j�|d
|�|
t_ndS(u'
    Helper function to raise a warning, by default, a ``DeprecationWarning``,
    until the provided ``version``, after which, a ``RuntimeError`` will
    be raised to remind the developers to remove the warning because the
    target version has been reached.

    :param version: The version info or name after which the warning becomes a
                    ``RuntimeError``. For example ``(0, 17)`` or ``Hydrogen``
                    or an instance of :class:`salt.version.SaltStackVersion`.
    :param message: The warning message to be displayed.
    :param category: The warning class to be thrown, by default
                     ``DeprecationWarning``
    :param stacklevel: There should be no need to set the value of
                       ``stacklevel``. Salt should be able to do the right thing.
    :param _version_info_: In order to reuse this function for other SaltStack
                           projects, they need to be able to provide the
                           version info to compare to.
    :param _dont_call_warnings: This parameter is used just to get the
                                functionality until the actual error is to be
                                issued. When we're only after the salt version
                                checks to raise a ``RuntimeError``.
    umThe 'version' argument should be passed as a tuple, string or an instance of 'salt.version.SaltStackVersion'.iiNiu�The warning triggered on filename '{filename}', line number {lineno}, is supposed to be shown until version {until_version} is released. Current version is now {salt_version}. Please remove the warning.tfilenametlinenot
until_versiontsalt_versioncS@sdj|||j|�S(u
            Replacement for warnings.formatwarning that disables the echoing of
            the 'line' parameter.
            u{0}:{1}: {2}: {3}
(tformatR(tmessagetcategoryRRtline((s7/usr/lib/python2.7/site-packages/salt/utils/versions.pyt_formatwarning�s	Rt
stacklevel(R
ttupleRRtsaltRtSaltStackVersiontRuntimeErrort	from_nametNonet__version_info__tinspecttgetframeinfotsyst	_getframeR RRtformatted_versionRtwarningst
formatwarningtwarn(RR!R"R%t_version_info_t_dont_call_warningst	_version_R-tcallerR$tsaved((s7/usr/lib/python2.7/site-packages/salt/utils/versions.pyt
warn_untilNs@								c
C@s2t|ttjtjjf�s0td��nNt|t�rTtjj|�}n*t|tj�r~tjjj|�}n|dkr�d}n|dkr�tjj
}ntjj|�}|s�|j|jkr.djd�|D��}t
|ddj|j|�d|d|d	|jd
|�ndS(u�
    Helper function to raise a warning (by default, a ``DeprecationWarning``)
    when unhandled keyword arguments are passed to function, until the
    provided ``version_info``, after which, a ``RuntimeError`` will be raised
    to remind the developers to remove the ``**kwargs`` because the target
    version has been reached.
    This function is used to help deprecate unused legacy ``**kwargs`` that
    were added to function parameters lists to preserve backwards compatibility
    when removing a parameter. See
    :ref:`the deprecation development docs <deprecations>`
    for the modern strategy for deprecating a function parameter.

    :param kwargs: The caller's ``**kwargs`` argument value (a ``dict``).
    :param version: The version info or name after which the warning becomes a
                    ``RuntimeError``. For example ``(0, 17)`` or ``Hydrogen``
                    or an instance of :class:`salt.version.SaltStackVersion`.
    :param category: The warning class to be thrown, by default
                     ``DeprecationWarning``
    :param stacklevel: There should be no need to set the value of
                       ``stacklevel``. Salt should be able to do the right thing.
    :param _version_info_: In order to reuse this function for other SaltStack
                           projects, they need to be able to provide the
                           version info to compare to.
    :param _dont_call_warnings: This parameter is used just to get the
                                functionality until the actual error is to be
                                issued. When we're only after the salt version
                                checks to raise a ``RuntimeError``.
    umThe 'version' argument should be passed as a tuple, string or an instance of 'salt.version.SaltStackVersion'.iu, cs@s|]}dj|�VqdS(u'{0}'N(R (t.0tkey((s7/usr/lib/python2.7/site-packages/salt/utils/versions.pys	<genexpr>�sR!uRThe following parameter(s) have been deprecated and will be removed in '{0}': {1}.R"R%R5R6N(R
R&RRR'RR(R)R*R+R,tinfotjoinR:R tstring(tkwargsRR"R%R5R6R7t	arg_names((s7/usr/lib/python2.7/site-packages/salt/utils/versions.pytkwargs_warn_until�s2"				c@s��fd�}||�}||�}yXt|�t|�krFdSt|�t|�krbdSt|�t|�kr~dSWn tk
r�}tj|�nXdS(uT
    Compares two version strings using salt.utils.versions.LooseVersion. This
    is a fallback for providers which don't have a version comparison utility
    built into them.  Return -1 if version1 < version2, 0 if version1 ==
    version2, and 1 if version1 > version2. Return None if there was a problem
    making the comparison.
    c@s0�r#tj|�jdd�dStj|�S(Nu:ii����(RRtsplit(tx(tignore_epoch(s7/usr/lib/python2.7/site-packages/salt/utils/versions.pyt<lambda>�si����iiN(Rt	Exceptiontlogt	exceptionR+(tpkg1tpkg2REt	normalizetexc((REs7/usr/lib/python2.7/site-packages/salt/utils/versions.pytversion_cmp�suu==cC@sidd6dd6dd6dd6dd6}|dkrU||krUtjd
|�tS|d
krjt}n|||d|�}|d
kr�tSt|tj�s�tjd�tS|d	kr�||dkS|dkr�d}n|dkr�d}n|||kSd
S(u�
    Compares two version numbers. Accepts a custom function to perform the
    cmp-style version comparison, otherwise uses version_cmp().
    i����u<iu<=u==iu>=u>u!=u,Invalid operator '%s' for version comparisonREu?The version comparison function did not return an integer/long.N(i����(i����i(i(ii(i(u!=(RHterrorRR+RNR
tnumberstIntegral(tver1topertver2tcmp_funcREtcmp_mapt
cmp_result((s7/usr/lib/python2.7/site-packages/salt/utils/versions.pytcompares(	
		c
C@s\|tkr�yddl}t}Wntk
r;t}nX|dkrQd}n|spt|j|�dkr�tdj|�fSn|tkrXy"ddl}ddl	}t}	Wntk
r�t}	nX|dkr�d}n|dkr�d}n|	st|j|�dkr*tdj|�fSt|j|�dkrXtd	j|�fSntS(
u�
    Checks for the version of various required boto libs in one central location. Most
    boto states and modules rely on a single version of the boto, boto3, or botocore libs.
    However, some require newer versions of any of these dependencies. This function allows
    the module to pass in a version to override the default minimum required version.

    This function is useful in centralizing checks for ``__virtual__()`` functions in the
    various, and many, boto modules and states.

    boto_ver
        The minimum required version of the boto library. Defaults to ``2.0.0``.

    boto3_ver
        The minimum required version of the boto3 library. Defaults to ``1.2.6``.

    botocore_ver
        The minimum required version of the botocore library. Defaults to ``1.3.23``.

    check_boto
        Boolean defining whether or not to check for boto deps. This defaults to ``True`` as
        most boto modules/states rely on boto, but some do not.

    check_boto3
        Boolean defining whether or not to check for boto3 (and therefore botocore) deps.
        This defaults to ``True`` as most boto modules/states rely on boto3/botocore, but
        some do not.
    iNu2.0.0i����u*A minimum version of boto {0} is required.u1.2.6u1.3.23u+A minimum version of boto3 {0} is required.u-A minimum version of botocore {0} is required(
RtbototImportErrorRR+RNt__version__R tboto3tbotocore(
tboto_vert	boto3_vertbotocore_vert
check_bototcheck_boto3RYthas_botoR\R]t	has_boto3((s7/usr/lib/python2.7/site-packages/salt/utils/versions.pytcheck_boto_reqs)s4 


	


		(t__doc__t
__future__RRRtloggingRPR/R2tdistutils.versionRRRRtsalt.versionR'tsalt.extRt	getLoggerRRHtDeprecationWarningR+RR:RBRNRXRRe(((s7/usr/lib/python2.7/site-packages/salt/utils/versions.pyt<module>s6
$TA$

Zerion Mini Shell 1.0