%PDF- %PDF-
Mini Shell

Mini Shell

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

�
���^c@@s�dZddlmZmZmZddlmZmZddlZddl	m
Z
d�Zddde
ddd�Zddd�Zded	�Zdde
d
�ZdS(u�
Installation of NPM Packages
============================

These states manage the installed packages for node.js using the Node Package
Manager (npm). Note that npm must be installed for these states to be
available, so npm states should include a requisite to a pkg.installed state
for the package which provides npm (simply ``npm`` in most cases). Example:

.. code-block:: yaml

    npm:
      pkg.installed

    yaml:
      npm.installed:
        - require:
          - pkg: npm
i(tabsolute_importtunicode_literalstprint_function(tCommandExecutionErrortCommandNotFoundErrorN(tsixcC@sdtkrdntdfS(u>
    Only load if the npm module is available in __salt__
    unpm.listunpmu 'npm' binary not found on system(t__salt__tFalse(((s3/usr/lib/python2.7/site-packages/salt/states/npm.pyt__virtual__sc	@s�i|d6d$d6dd6id6}|r.|n|g}y)tdd|d|d	|d
d�}	Wn:ttfk
r�}
t|d<dj||
�|d<|SXtd
�tj|	�D��}	g}g}�fd�}
x�|D]�}t	j
d|�}|jd�|jd�pd$�}|tkr:|j
|�q�n|
||	�s\|j
|�q�ndj�|	�d�}|r�|	�jd�|kr�|j
|�q�|j
|�q�q�|j
|�q�q�Wtdr{d$|d<g}|r&|j
djdj|���igd6|d6|d<n|rd|j
djdj|�dj|���t|d<ndj|�|d<|S|s�t|d<djdj|�dj|��|d<|Sy=i|d6|d6|d6|d6|d6}td |�}WnCttfk
r9}
t|d<d!jdj|�|
�|d<|SX|r�t|t�s^t|t�r�t|d<igd6|d6|d<d"jdj|��|d<n&t|d<d#jdj|��|d<|S(%u�
    Verify that the given package is installed and is at the correct version
    (if specified).

    .. code-block:: yaml

        coffee-script:
          npm.installed:
            - user: someuser

        coffee-script@1.0.1:
          npm.installed: []

    name
        The package to install

        .. versionchanged:: 2014.7.2
            This parameter is no longer lowercased by salt so that
            case-sensitive NPM package names will work.

    pkgs
        A list of packages to install with a single npm invocation; specifying
        this argument will ignore the ``name`` argument

        .. versionadded:: 2014.7.0

    dir
        The target directory in which to install the package, or None for
        global installation

    user
        The user to run NPM with

        .. versionadded:: 0.17.0

    registry
        The NPM registry from which to install the package

        .. versionadded:: 2014.7.0

    env
        A list of environment variables to be set prior to execution. The
        format is the same as the :py:func:`cmd.run <salt.states.cmd.run>`.
        state function.

        .. versionadded:: 2014.7.0

    force_reinstall
        Install the package even if it is already installed
    unameuresultuucommentuchangesunpm.listtdirtrunastenvtdepthiuError looking up '{0}': {1}cs@s!|]\}}||fVqdS(N((t.0tptinfo((s3/usr/lib/python2.7/site-packages/salt/states/npm.pys	<genexpr>jsc@s��|kr d|�kr tSd�kr�x�|j�D]�}yl|jdd�jd�d}|jd�r��jd�r�|d7}n�jd�d|kr�tSWq9tk
r�q9Xq9WntS(uv
        Helper function to determine if a package is installed

        This performs more complex comparison than just checking
        keys, such as examining source repos to see if the package
        was installed by a different name from the same repo

        :pkg str: The package to compare
        :installed_pkgs: A dictionary produced by npm list --json
        uversionu://ufromuiu.gitugit://(tTruetvaluestgettsplittendswitht
startswitht
IndexErrorR(tpkgtinstalled_pkgstpkg_detailstpkg_from(tpkg_name(s3/usr/lib/python2.7/site-packages/salt/states/npm.pyt_pkg_is_installedps

u^(@?[^@\s]+)(?:@(\S+))?iiu{0}@{1}uversionutestu,NPM package(s) '{0}' are set to be installedu, uoldunewu!Package(s) '{0}' satisfied by {1}u. udirurunasuregistryuenvupkgsunpm.installuError installing '{0}': {1}u'Package(s) '{0}' successfully installedu"Could not install package(s) '{0}'N(tNoneRRRRtformattdictRt	iteritemstretsearchtgroupRtappendRt__opts__tjoint
isinstancetlist(tnametpkgsR	tusertforce_reinstalltregistryRtrettpkg_listRterrtpkgs_satisfiedtpkgs_to_installRRtmatchestpkg_vertinstalled_name_vertcomment_msgtcmd_argstcall((Rs3/usr/lib/python2.7/site-packages/salt/states/npm.pyt	installed&s�9")
	
%

	





"

$

cC@sBi|d6dd6dd6id6}ytdd|dd	�}Wn:ttfk
r{}t|d<d
j||�|d<|SX||kr�t|d<dj|�|d<|Stdr�d|d<d
j|�|d<|Stdd|d|d|�r!t|d<d|d|<dj|�|d<nt|d<dj|�|d<|S(u�
    Verify that the given package is not installed.

    dir
        The target directory in which to install the package, or None for
        global installation

    user
        The user to run NPM with

        .. versionadded:: 0.17.0
    unameuresultuucommentuchangesunpm.listR	RiuError uninstalling '{0}': {1}uPackage '{0}' is not installedutestu"Package '{0}' is set to be removedu
npm.uninstallRR
uRemovedu&Package '{0}' was successfully removeduError removing package '{0}'N(RRRRRRRR%(R)R	R+R.RR0((s3/usr/lib/python2.7/site-packages/salt/states/npm.pytremoved�s,
"





cC@s�i|d6dd6dd6id6}tdr�y�tdd|d	|d
dd|dt�}|r�d|d<igd
6|d6|d<dj|�|d<nt|d<dj|�|d<Wn9ttfk
r�}t|d<dj||�|d<nX|Sy)tdd|d	|d
dd|�}Wn:ttfk
r[}t|d<dj||�|d<|SX|szt|d<d|d<|St|t	j
�r�t|d<||d<d|d<n%t|d<id|6|d<d|d<|S(u�
    Bootstraps a node.js application.

    Will execute 'npm install --json' on the specified directory.

    user
        The user to run NPM with

        .. versionadded:: 0.17.0
    unameuresultuucommentuchangesutestunpm.installR	R
Rtsilenttdry_runuoldunewu{0} is set to be bootstrappedu{0} is already bootstrappeduError Bootstrapping '{0}': {1}u!Directory is already bootstrappeduCould not bootstrap directoryuBootstrappedu'Directory was successfully bootstrappedN(RR%RRRRRRR'Rtstring_types(R)R+R;R.R8R0((s3/usr/lib/python2.7/site-packages/salt/states/npm.pyt	bootstrap
s@"
+


)







c	C@s�i|d6dd6dd6id6}d}ytdd|d|�}Wn@ttfk
r�}t|d<d	j|pvd
|�|d<|SX|r�tdddd|�}|d}dj||�}||kr�t|d<d
j|�|d<|Sntdr$d|d<dj|pd
�|d<|Stdd|d|�rwt|d<d|d|pZd<dj|pjd
�|d<n#t|d<dj|p�d
�|d<|S(uz
    Ensure that the given package is not cached.

    If no package is specified, this ensures the entire cache is cleared.

    name
        The name of the package to remove from the cache, or None for all packages

    user
        The user to run NPM with

    force
        Force cleaning of cache.  Required for npm@5 and greater

        .. versionadded:: 2016.11.6
    unameuresultuucommentuchangesunpm.cache_listtpathR
u Error looking up cached {0}: {1}upackagesiu{0}/{1}/uPackage {0} is not in the cacheutestuCached {0} set to be removedunpm.cache_cleanuRemoveducacheuCached {0} successfully removeduError cleaning cached {0}N(RRRRRRRR%(	R)R+tforceR.tspecific_pkgtcached_pkgsR0tall_cached_pkgstcache_root_path((s3/usr/lib/python2.7/site-packages/salt/states/npm.pyt
cache_cleanedBs:"






(t__doc__t
__future__RRRtsalt.exceptionsRRR!tsalt.extRRRRR9R:RR>RE(((s3/usr/lib/python2.7/site-packages/salt/states/npm.pyt<module>s 	�+5

Zerion Mini Shell 1.0