%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/pkg_resource.pyo

�
���^c@@s3dZddlmZmZmZddlZddlZddlZddlZddl	Z	ddl
mZddlZ
ddlZ
ddlZ
ddlmZeje�ZdZed�Zed	�Zdddd
ed�Zd�Zd
�Zd�Zd�Zd�Zd�Z d�Z!d�Z"dS(u#
Resources needed by pkg providers
i(tabsolute_importtprint_functiontunicode_literalsN(tsix(tSaltInvocationErrorux86_64unoarchcC@s�|rdtkrtd}n	d�}tgtjtjjj|��D]B\}}|tj|��|dk	r�tj|�n|f^qJ�S(ud
    Repack packages specified using "pkgs" argument to pkg states into a single
    dictionary
    upkg.normalize_namecS@s|S(N((tpkgname((s=/usr/lib/python2.7/site-packages/salt/modules/pkg_resource.pyt<lambda>#sN(
t__salt__tdictRt	iteritemstsalttutilstdatatrepack_dictlistt	text_typetNone(tpkgst	normalizet_normalize_nametxty((s=/usr/lib/python2.7/site-packages/salt/modules/pkg_resource.pyt_repack_pkgss
	cC@s|rdtkrtd}n	d�}t|tj�r�ytjjj|�}Wq�tjjjj	k
r�}t
j|�iSXni}x�|D]x}t|t�s�t
|�dkr�t
jdtj|��t
jd�iStt|��}|||||�<q�W|S(ud
    Accepts list of dicts (or a string representing a list of dicts) and packs
    the key/value pairs into a single dict.

    ``'[{"foo": "salt://foo.rpm"}, {"bar": "salt://bar.rpm"}]'`` would become
    ``{"foo": "salt://foo.rpm", "bar": "salt://bar.rpm"}``

    normalize : True
        Normalize the package name by removing the architecture, if the
        architecture of the package is different from the architecture of the
        operating system. The ability to disable this behavior is useful for
        poorly-created packages which include the architecture as an actual
        part of the name, such as kernel modules which match a specific kernel
        version.

        .. versionadded:: 2015.8.0

    CLI Example:

    .. code-block:: bash

        salt '*' pkg_resource.pack_sources '[{"foo": "salt://foo.rpm"}, {"bar": "salt://bar.rpm"}]'
    upkg.normalize_namecS@s|S(N((R((s=/usr/lib/python2.7/site-packages/salt/modules/pkg_resource.pyRGsiuInvalid input: %su'Input must be a list of 1-element dicts(Rt
isinstanceRtstring_typesR
Rtyamlt	safe_loadtparsertParserErrortlogterrorRtlentpprinttpformattnexttiter(tsourcesRRterrtrettsourcetkey((s=/usr/lib/python2.7/site-packages/salt/modules/pkg_resource.pytpack_sources,s$
	

"
ubasec
K@s�d|kr|jd�ntddkrB|rBtjd�n|jd�}|rn|rntjd�dSd|kr�|r�tjd�dS|dr�|dd	fS|gd	fSn�|r|dk	r�tjd
�nt|d|�}|s�dS|dfSn�|r�tddkr�|dk	r6tjd
�nt|d|�}|sRdSg}x�t	j
|�D]s\}}	td
|	�r�|jtd|	|��qht
jj|	�s�tdj|	|���n|j|	�qhW|dfS|ry|rAtjdd��}
tg|jd�D]}|
|�|f^q�}n.tg|jd�D]}||f^qT�}|dfStjd�dSdS(u:
    Parses the input to pkg.install and returns back the package(s) to be
    installed. Returns a list of packages, as well as a string noting whether
    the packages are to come from a repository or a binary package.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg_resource.parse_targets
    u__env__uosuMacOSu+Parameter "sources" ignored on MacOS hosts.uversionu-Only one of "pkgs" and "sources" can be used.uadvisory_idsu5Cannot use "advisory_ids" and "pkgs" at the same timeuadvisoryu?'version' argument will be ignored for multiple package targetsRu
repositoryuconfig.valid_fileprotou
cp.cache_fileuFPath {0} for package {1} is either not absolute or an invalid protocolufileupkg.normalize_namecS@s|S(N((R((s=/usr/lib/python2.7/site-packages/salt/modules/pkg_resource.pyR�su,uNo package sources providedN(NN(NN(NN(NN(NN(tpopt
__grains__RtwarningtgetRRRR(RR	RtappendtostpathtisabsRtformatRtsplit(
tnameRR#tsaltenvRtkwargstversiontsrcinfotpkg_nametpkg_srcRRtpacked((s=/usr/lib/python2.7/site-packages/salt/modules/pkg_resource.pyt
parse_targets[s\




7.

cO@s*i}tjjj|jdt��}t}t|�dkr�tddt|�}xo|D]d}d|kr�t}xIt	j
||�D]}|j|g�||<q�Wq\|j|g�||<q\Wn|s�td|�nt|�dkr&|r&ytt
j|��SWq&tk
r"dSXn|S(	u
    Common interface for obtaining the version of installed packages.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg_resource.version vim
        salt '*' pkg_resource.version foo bar baz
        salt '*' pkg_resource.version 'python*'
    uversions_as_listiu
pkg.list_pkgstversions_as_listu*upkg_resource.stringifyiu(R
RRtis_trueR)tFalseRRtTruetfnmatchtfilterR,R!Rt
itervaluest
StopIteration(tnamesR5R%R<tpkg_globRR3tmatch((s=/usr/lib/python2.7/site-packages/salt/modules/pkg_resource.pyR6�s&!

cC@sDy|j|g�j|�Wn tk
r?}tj|�nXdS(u�
    Add a package to a dict of installed packages.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg_resource.add_pkg '{}' bind 9
    N(t
setdefaultR-tAttributeErrorRt	exception(RR3tpkgvertexc((s=/usr/lib/python2.7/site-packages/salt/modules/pkg_resource.pytadd_pkg�s
cC@sVy/x(|D] }tt||��||<q
WWn tk
rQ}tj|�nXdS(uC
    Accepts a dict obtained from pkg.list_pkgs() and sorts in place the list of
    versions for any packages that have multiple versions installed, so that
    two package lists can be compared to one another.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg_resource.sort_pkglist '["3.45", "2.13"]'
    N(tsortedtsetRHRRI(RR'RK((s=/usr/lib/python2.7/site-packages/salt/modules/pkg_resource.pytsort_pkglist�s

"cC@sSy,x%|D]}dj||�||<q
WWn tk
rN}tj|�nXdS(u�
    Takes a dict of package name/version information and joins each list of
    installed versions into a string.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg_resource.stringify 'vim: 7.127'
    u,N(tjoinRHRRI(RR'RK((s=/usr/lib/python2.7/site-packages/salt/modules/pkg_resource.pyt	stringifys

cC@s$|r dtkr td|�S|S(u�
    Clean the version string removing extra data.
    This function will simply try to call ``pkg.version_clean``.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg_resource.version_clean <version_string>
    upkg.version_clean(R(tverstr((s=/usr/lib/python2.7/site-packages/salt/modules/pkg_resource.pyt
version_cleanscC@s'|r#dtkr#td||�StS(ug
    Check if the installed package already has the given requirements.
    This function will return the result of ``pkg.check_extra_requirements`` if
    this function exists for the minion, otherwise it will return True.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg_resource.check_extra_requirements <pkgname> <extra_requirements>
    upkg.check_extra_requirements(RR?(RRJ((s=/usr/lib/python2.7/site-packages/salt/modules/pkg_resource.pytcheck_extra_requirements"scC@s-tj|�}|r�ddddddh}|dkrS|t|dg�M}nxr|D]j}g}xQ||D]E}i}x)|D]!}	||	r�||	||	<q�q�W|j|�qqW|||<qZW|SxG|D]?}g||D]$}
t|
d|
d|
d�^q�||<q�W|s)t|�n|S(uA
    Formats packages according to parameters for list_pkgs.
    uepochuversionureleaseuarchuinstall_dateuinstall_date_time_tuall(tcopytdeepcopyRNR-tformat_versionRQ(tpackagesR<tattrR%trequested_attrR3tversionstall_attrt
filtered_attrR'td((s=/usr/lib/python2.7/site-packages/salt/modules/pkg_resource.pytformat_pkg_list4s*



:
cC@s>|rdj||�n|}|r:|dj|�7}n|S(u1
    Formats a version string for list_pkgs.
    u{0}:{1}u-{0}(R1(tepochR6treleasetfull_version((s=/usr/lib/python2.7/site-packages/salt/modules/pkg_resource.pyRWRs(ux86_64unoarch(#t__doc__t
__future__RRRRUR@tloggingR.Rtsalt.extRtsalt.utils.dataR
tsalt.utils.versionstsalt.utils.yamltsalt.exceptionsRt	getLoggert__name__Rt__SUFFIX_NOT_NEEDEDR?RR(RR;R6RLRORQRSRTR_RW(((s=/usr/lib/python2.7/site-packages/salt/modules/pkg_resource.pyt<module>s8/U	%						

Zerion Mini Shell 1.0