%PDF- %PDF-
Mini Shell

Mini Shell

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

�
���^c,@@s�dZddlmZmZmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlmZddlmZmZeje�Zidd6Zdd	d
dgZejdej �Z!d
�Z"e#d�Z$d�Z%d�Z&d�Z'd�Z(d�Z)d�Z*d�Z+e#e#e#e,e,e#e#e#e#e#e#e#e,e#e#e#e#e#e#e,e,e,e#e,e,e,e#e#e#e#e,e#e,e#e#e,de#e,e#e,e#e#d�+Z-e#e#e#e#e#e#e#e#de,d�
Z.e#e#e#e,e#d�Z/e#e#e#e#e#d�Z0e#d�Z1e#e#e#d�Z2e#e#e#e#d�Z3e#e#e#d�Z4e#e#e#e,d�Z5e#e,e,e,e#e#e#e#d �Z6dS(!ui	
Install Python packages with pip to either the system or a virtualenv

Windows Support
===============

.. versionadded:: 2014.7.4

Salt now uses a portable python. As a result the entire pip module is now
functional on the salt installation itself. You can pip install dependencies
for your custom modules. You can even upgrade salt itself using pip. For this
to work properly, you must specify the Current Working Directory (``cwd``) and
the Pip Binary (``bin_env``) salt should use.  The variable ``pip_bin`` can be
either a virtualenv path or the path to the pip binary itself.

For example, the following command will list all software installed using pip
to your current salt environment:

.. code-block:: bat

   salt <minion> pip.list cwd='C:\salt\bin\Scripts' bin_env='C:\salt\bin\Scripts\pip.exe'

Specifying the ``cwd`` and ``bin_env`` options ensures you're modifying the
salt environment. If these are omitted, it will default to the local
installation of python. If python is not installed locally it will fail saying
it couldn't find pip.

State File Support
------------------

This functionality works in states as well. If you need to pip install colorama
with a state, for example, the following will work:

.. code-block:: yaml

   install_colorama:
     pip.installed:
       - name: colorama
       - cwd: 'C:\salt\bin\scripts'
       - bin_env: 'C:\salt\bin\scripts\pip.exe'
       - upgrade: True

Upgrading Salt using Pip
------------------------

You can now update salt using pip to any version from the 2014.7 branch
forward. Previous version require recompiling some of the dependencies which is
painful in windows.

To do this you just use pip with git to update to the version you want and then
restart the service. Here is a sample state file that upgrades salt to the head
of the 2015.5 branch:

.. code-block:: yaml

   install_salt:
     pip.installed:
       - cwd: 'C:\salt\bin\scripts'
       - bin_env: 'C:\salt\bin\scripts\pip.exe'
       - editable: git+https://github.com/saltstack/salt@2015.5#egg=salt
       - upgrade: True

   restart_service:
     service.running:
       - name: salt-minion
       - enable: True
       - watch:
         - pip: install_salt

.. note::
   If you're having problems, you might try doubling the back slashes. For
   example, cwd: 'C:\\salt\\bin\\scripts'. Sometimes python thinks the single
   back slash is an escape character.

i(tabsolute_importtprint_functiontunicode_literalsN(tsix(tCommandExecutionErrortCommandNotFoundErrorulistulist_uhttpuhttpsuftpufileu-r\s(.*)\n?cC@sdS(u�
    There is no way to verify that pip is installed without inspecting the
    entire filesystem.  If it's not installed in a conventional location, the
    user is required to provide the location of pip each time it is used.
    upip((((s4/usr/lib/python2.7/site-packages/salt/modules/pip.pyt__virtual__qscC@s;d}|dk	r'dj||�}ntj|d�dS(u'
    Remove the cached pip version
    upip.versionu{0}.{1}N(tNonetformatt__context__tpop(tbin_envt
contextkey((s4/usr/lib/python2.7/site-packages/salt/modules/pip.pyt_clear_contextzsc@s�|s/tjd�tjjtj�ddgStjj	j
�rGdnd��fd�}tjj|�rxw||�D]i}tjj|�r{tj
|tj�r�tjd|�tjj|�ddgStjd|�q{q{Wtd	j|���n�tj
|tj�r�tjj|�rkdtjj|�krXtjj|�ddgStjj|�gStd
j|���ntdj|���dS(
u�
    Locate the pip binary, either from `bin_env` as a virtualenv, as the
    executable itself, or from searching conventional filesystem locations
    u,pip: Using pip from currently-running Pythonu-mupipu
python.exeupythonc@sdg}xW|D]O}|jtjj|��tjj|d��tjj|d��g�q
W|S(NubinuScripts(textendtostpathtjoin(tbasedirstretR(t
python_bin(s4/usr/lib/python2.7/site-packages/salt/modules/pip.pyt
_search_paths�s
 upip: Found python binary: %su=pip: Found python binary by name but it is not executable: %su-Could not find a pip binary in virtualenv {0}u&Could not find a pip binary within {0}u1Access denied to {0}, could not find a pip binaryN(tloggertdebugRRtnormpathtsyst
executabletsalttutilstplatformt
is_windowstisdirtisfiletaccesstX_OKRRtbasenameR(RRtbin_path((Rs4/usr/lib/python2.7/site-packages/salt/modules/pip.pyt_get_pip_bin�s2
cC@s�tjjj|�\}}|r*|}n|td|�krDtStd||�}|sstd||�}ntd||�td||�kr�td||�}n|S(uO
    Get the location of a cached requirements file; caching if necessary.
    ucp.list_masterucp.is_cachedu
cp.cache_fileucp.hash_file(RRturltparset__salt__tFalse(trequirementstsaltenvtreq_filetsenvtcached_requirements((s4/usr/lib/python2.7/site-packages/salt/modules/pip.pyt_get_cached_requirements�s	cC@s�|std��ntjj|�r�tjjj�rTtjj|dd�}ntjj|dd�}tjj	|�r�|Sntd��dS(u0
    Return the path to the activate binary
    u"Could not find a `activate` binaryuScriptsuactivate.batubinuactivateN(
RRRRRRRRRR (Rtactivate_bin((s4/usr/lib/python2.7/site-packages/salt/modules/pip.pyt_get_env_activate�scC@s�tjd|�tjjj|��+}tjtjjj	|j
���}WdQXtjj
|�}g|D]}tjj||�^qk}|S(Nu_find_req -- link = %s(RtinfoRRtfilestfopentrex_pip_chain_readtfindalltstringutilst
to_unicodetreadRRtdirnameR(tlinktfh_linktchild_linkst	base_pathtd((s4/usr/lib/python2.7/site-packages/salt/modules/pip.pyt	_find_req�s$(cC@s_g}t|tj�r$|g}nx4|D],}|j|�|jtt|���q+W|S(u�
    Return an array of requirements file paths that can be used to complete
    the no_chown==False && user != None conundrum
    (t
isinstanceRtstring_typestappendRt_resolve_requirements_chainR@(R*tchainR,((s4/usr/lib/python2.7/site-packages/salt/modules/pip.pyRD�s

cC@s�g}|dk	r�t|tj�rOg|jd�D]}|j�^q4}nt|t�smtd��nd}x!|D]}tj	d|�|j
d�r�t||�}	|	s�itd6dj
|�d6}
d|
fS|	}n|r_|s�tj�}ntd||d�tjjj�rEtd	d
|d|dd
�nd}|sitjjtj�}ntjd||�|dkr�|}|}tjj|�}
tjj|
�}tjj|�}tj	d||||�ntj|�t|�}tj|�tjd|�x@|D]5}tjj|�sStjj ||�}ntj	d|||�tjj |tjj|��}tj	d|�tj	d|�tjj|�}tjj!|�s�tj"|dd�td||d�ntjj!|�s1tj	d||�td||�ntj	d||�td||d�q#Wn|rztjj ||�n|}|j#d|g�qzW|j$|�ntj	d|�|dfS(u+
    Process the requirements argument
    u,u%requirements must be a string or listuTREQ IS: %susalt://uresultu%pip requirements file '{0}' not founducommentu
file.chownudacl.set_permissionstobj_namet	principaltpermissionsuread_executeu;_process_requirements from directory, %s -- requirement: %su'
	cwd: %s -> %s
	requirement: %s -> %s
urequest files: %suTREQ N CWD: %s -- %s -- for %suS: %suT: %stmodei�uCopying %s to %su	file.copyu9Changing ownership of requirements file '%s' to user '%s'u
--requirementuCLEANUP_REQUIREMENTS: %sN(%RRARRBtsplittstriptlistt	TypeErrorRRt
startswithR/R)RttempfiletmkdtempR(RRRRt	__utils__RRtabspathtcurdirR2R:R#tchdirRDtisabsRtexiststmakedirsRRC(R*tcmdtcwdR+tusertcleanup_requirementstrttreqtrequirementR.Rtcurrent_directorytctrequirement_abspathtreqsR,ttarget_pathttarget_basetreq_args((s4/usr/lib/python2.7/site-packages/salt/modules/pip.pyt_process_requirementss�+



	

	
	


!

!cC@s�i}|r�t|t�r�x�tj|�D]X\}}t|tj�sXt|�}nt|tj�syt|�}n|||<q+Wq�tdj|���n|S(Nu env_vars {0} is not a dictionary(RAtdictRt	iteritemsRBtstrRR(tenv_varsRtkeytval((s4/usr/lib/python2.7/site-packages/salt/modules/pip.pyt_format_env_varsysubasec+E
K@s5t|�},|,jd�td|d|,d|d|$d|�\}-}.|.rP|.St|�}/|r�d}0d}1tjjjd	|/d
dd|0�}2tjjjd	|/d
d
d|1�}3|2s�|3r�tj	d|0|1|/�q�|,jd�n|rzd}0d}1tjjjd	|/d
dd|0�}2tjjjd	|/d
d
d|1�}3|2sQ|3rjtj	d|0|1|/�qz|,jd�n|*r�d}0tjjjd	|/d
dd|0�}2|2r�tj	d|0|/�q�t
|*t�r�dj|*�}*n|,j
d|*g�n|rptjj|�r-tdj|���n-tj|tj�sZtdj|���n|,j
d|g�n|r�|,j
d|g�n|r�y,t
|t�r�td��nt|�Wn&tk
r�tdj|���nX|,j
d|g�n|	r�t
|	tj�r@g|	jd�D]}4|4j�^q%}	nxf|	D][}5tjjj|5t�pttjj|5�s�t dj|5���n|,j
d|5g�qGWn|r�|
s�|r�t d��n|
rtjjj|
t�st d j|
���n|,j
d!|
g�n|rbtjjj|t�sLt d j|���n|,j
d"|g�n|rx|,jd#�n|
rItjjjd	|/d
d$dd�r�t d%��nt
|
tj�r�g|
jd�D]}6|6j�^q�}
n|,jd&�xK|
D]@}7|7j!d'�s/t d j|7���n|,j
d(|7g�qWn|re|,j
d)|g�n|r�|,j
d*|g�n|r�|,j
d+|g�n|s�|)r�|,j
tjjjd	|/d
d$dd,�r�d-nd.|p�|)g�n|r|,j
d/|g�n|r!|,jd0�n|r7|,jd1�n|rM|,jd2�n|r�|j"�d[kr}t d7j|���n|,j
d8|g�n|r�|,jd9�n|r�|,jd:�n|r�|,jd;�n|(r�|,jd<�n|r.|/}8tjjjd	|8d
d$dd�r.|,jd=�q.n|rJ|,j
d>|g�n|r�t
|tj�r�g|jd�D]}9|9j�^qr}nx$|D]}:|,j
d?|:g�q�Wn|rt
|tj�r�g|jd�D]};|;j�^q�}nx$|D]}:|,j
d@|:g�q�Wn|r�t
|t�s�y,g|jd�D]}<|<j�^qF}Wq�t#k
r�gtj$|�jd�D]}<|<j�^q�}q�Xntjj%j&tjj%j'|��}|,j
g|D]}<|<j(dAd�^q��n$t)||g�s	idBdC6dDdE6S|r�	t*j+dF�}=t
|tj�rp	g|jd�D]}>|>j�^qU	}nxw|D]l}?|?dGkp�	|?j!d\�s�	|=j,|?�}@|@s�	|@j-dJ�r�	t dK��q�	n|,j
dL|?g�qw	Wn| r
|,jdM�n|!rj
t
|!tj�rC
g|!jd�D]}<|<j�^q(
}!nx$|!D]}A|,j
dN|Ag�qJ
Wn|"r�
t
|"tj�r�
g|"jd�D]}<|<j�^q�
}"nx$|"D]}A|,j
dO|Ag�q�
Wn|#r�
|,jdP�n|'r|,j
dQ|'g�nt.d|$dR|&dS|�}B|+r7|Bj/|+�n|%r_|Bj0dTi�j/t1|%��nzr|ru||BdU<n|r�tjj|�r�||Bj0dTi�dV<ntj2dW|,|B�t3dX|,dYt4|B�SWdZt5|�xOg|-D]}C|CdZk	r�|C^q�D](}Dtjj|D�rt7j8|D�qqWXdZS(]u
    Install packages with pip

    Install packages individually or from a pip requirements file. Install
    packages globally or to a virtualenv.

    pkgs
        Comma separated list of packages to install

    requirements
        Path to requirements

    bin_env
        Path to pip (or to a virtualenv). This can be used to specify the path
        to the pip to use when more than one Python release is installed (e.g.
        ``/usr/bin/pip-2.7`` or ``/usr/bin/pip-2.6``. If a directory path is
        specified, it is assumed to be a virtualenv.

        .. note::

            For Windows, if the pip module is being used to upgrade the pip
            package, bin_env should be the path to the virtualenv or to the
            python binary that should be used.  The pip command is unable to
            upgrade itself in Windows.

    use_wheel
        Prefer wheel archives (requires pip>=1.4)

    no_use_wheel
        Force to not use wheel archives (requires pip>=1.4,<10.0.0)

    no_binary
        Force to not use binary packages (requires pip >= 7.0.0)
        Accepts either :all: to disable all binary packages, :none: to empty the set,
        or one or more package names with commas between them

    log
        Log file where a complete (maximum verbosity) record will be kept

    proxy
        Specify a proxy in the form ``user:passwd@proxy.server:port``. Note
        that the ``user:password@`` is optional and required only if you are
        behind an authenticated proxy. If you provide
        ``user@proxy.server:port`` then you will be prompted for a password.

    timeout
        Set the socket timeout (default 15 seconds)

    editable
        install something editable (e.g.
        ``git+https://github.com/worldcompany/djangoembed.git#egg=djangoembed``)

    find_links
        URL to search for packages

    index_url
        Base URL of Python Package Index

    extra_index_url
        Extra URLs of package indexes to use in addition to ``index_url``

    no_index
        Ignore package index

    mirrors
        Specific mirror URL(s) to query (automatically adds --use-mirrors)

        .. warning::

            This option has been deprecated and removed in pip version 7.0.0.
            Please use ``index_url`` and/or ``extra_index_url`` instead.

    build
        Unpack packages into ``build`` dir

    target
        Install packages into ``target`` dir

    download
        Download packages into ``download`` instead of installing them

    download_cache | cache_dir
        Cache downloaded packages in ``download_cache`` or ``cache_dir`` dir

    source
        Check out ``editable`` packages into ``source`` dir

    upgrade
        Upgrade all packages to the newest available version

    force_reinstall
        When upgrading, reinstall all packages even if they are already
        up-to-date.

    ignore_installed
        Ignore the installed packages (reinstalling instead)

    exists_action
        Default action when a path already exists: (s)witch, (i)gnore, (w)ipe,
        (b)ackup

    no_deps
        Ignore package dependencies

    no_install
        Download and unpack all packages, but don't actually install them

    no_download
        Don't download any packages, just install the ones already downloaded
        (completes an install run with ``--no-install``)

    install_options
        Extra arguments to be supplied to the setup.py install command (e.g.
        like ``--install-option='--install-scripts=/usr/local/bin'``).  Use
        multiple --install-option options to pass multiple options to setup.py
        install. If you are using an option with a directory path, be sure to
        use absolute path.

    global_options
        Extra global options to be supplied to the setup.py call before the
        install command.

    user
        The user under which to run pip

    cwd
        Directory from which to run pip

    pre_releases
        Include pre-releases in the available versions

    cert
        Provide a path to an alternate CA bundle

    allow_all_external
        Allow the installation of all externally hosted files

    allow_external
        Allow the installation of externally hosted files (comma separated
        list)

    allow_unverified
        Allow the installation of insecure and unverifiable files (comma
        separated list)

    process_dependency_links
        Enable the processing of dependency links

    env_vars
        Set environment variables that some builds will depend on. For example,
        a Python C-module may have a Makefile that needs INCLUDE_PATH set to
        pick up a header file while compiling.  This must be in the form of a
        dictionary or a mapping.

        Example:

        .. code-block:: bash

            salt '*' pip.install django_app env_vars="{'CUSTOM_PATH': '/opt/django_app'}"

    trusted_host
        Mark this host as trusted, even though it does not have valid or any
        HTTPS.

    use_vt
        Use VT terminal emulation (see output while installing)

    no_cache_dir
        Disable the cache.

    CLI Example:

    .. code-block:: bash

        salt '*' pip.install <package name>,<package2 name>
        salt '*' pip.install requirements=/path/to/requirements.txt
        salt '*' pip.install <package name> bin_env=/path/to/virtualenv
        salt '*' pip.install <package name> bin_env=/path/to/pip_bin

    Complicated CLI example::

        salt '*' pip.install markdown,django                 editable=git+https://github.com/worldcompany/djangoembed.git#egg=djangoembed upgrade=True no_deps=True

    uinstallR*RXRYR+RZu1.4u9.0.3tver1toperu<tver2u>u�The --use-wheel option is only supported in pip between %s and %s. The version of pip detected is %s. This option will be ignored.u--use-wheelu�The --no-use-wheel option is only supported in pip between %s and %s. The version of pip detected is %s. This option will be ignored.u--no-use-wheelu7.0.0u}The --no-binary option is only supported in pip %s and newer. The version of pip detected is %s. This option will be ignored.u,u--no-binaryu,'{0}' is a directory. Use --log path_to_fileu'{0}' is not writeableu--logu--proxyuTimeout cannot be a floatu0'{0}' is not a valid timeout, must be an integeru	--timeoutu '{0}' is not a valid URL or pathu--find-linksuI'no_index' and ('index_url' or 'extra_index_url') are mutually exclusive.u'{0}' is not a valid URLu--index-urlu--extra-index-urlu
--no-indexu>=u[pip >= 7.0.0 does not support mirror argument: use index_url and/or extra_index_url insteadu
--use-mirrorsuhttp://u	--mirrorsu--buildu--targetu
--downloadu6.0u--cache-diru--download-cacheu--sourceu	--upgradeu--force-reinstallu--ignore-installedusuiuwubuYThe exists_action pip option only supports the values s, i, w, and b. '{0}' is not valid.u--exists-actionu	--no-depsu--no-installu
--no-downloadu--no-cache-diru--preu--certu--global-optionu--install-optionu;iuretcodeuNo packages to install.ustdoutu(?:#|#.*?&)egg=([^&]*)u.ufile://u/iu)You must specify an egg for this editableu
--editableu--allow-all-externalu--allow-externalu--allow-unverifiedu--process-dependency-linksu--trusted-hosttuse_vttrunasuenvucwduVIRTUAL_ENVu8TRY BLOCK: end of pip.install -- cmd: %s, cmd_kwargs: %sucmd.run_alltpython_shellN(usuiuwub(ufile://u/(9R%RCRftversionRRtversionstcompareRterrorRARLRRRRRtIOErrorRR!tW_OKtfloatt
ValueErrortintRRBRJRKR&tvalidatetVALID_PROTOSRVRRNtlowertAttributeErrort	text_typetdatat	stringifytdecode_listtreplacetanytretcompiletsearchtgroupRgtupdatet
setdefaultRmRR(R)R
Rtshutiltrmtree(EtpkgsR*Rt	use_wheeltno_use_wheeltlogtproxyttimeoutteditablet
find_linkst	index_urltextra_index_urltno_indextmirrorstbuildttargettdownloadtdownload_cachetsourcetupgradetforce_reinstalltignore_installedt
exists_actiontno_depst
no_installtno_downloadtglobal_optionstinstall_optionsRZRYtpre_releasestcerttallow_all_externaltallow_externaltallow_unverifiedtprocess_dependency_linksR+RjRqttrusted_hosttno_cache_dirt	cache_dirt	no_binarytkwargsRXR[Rwtcur_versiontmin_versiontmax_versionttoo_lowttoo_hightlR;tmtmirrortpip_versiontgotopttiotpt	egg_matchtetentrytmatchtpkgt
cmd_kwargstcrttempdir((s4/usr/lib/python2.7/site-packages/salt/modules/pip.pytinstall�s��
$$$$$

+
*$+

$+
+
,
8$/+
+
+
"


,c
C@s�t|�}
|
jddg�td|d|
d|d|d|�\}}|rV|S|r�ytjj|�Wn&tk
r�tdj|���nX|
jd	|g�n|r�|
jd
|g�n|r<y,t|t	�r�t
d��nt|�Wn&t
k
r%t
dj|���nX|
jd
|g�n|r6t|tj
�rg|jd�D]}
|
j�^qd}n|r&x�|D]�}tjjj|��v}xl|D]d}tjjj|�}y5|jd�\}}||kr|j|�nWq�t
k
rq�Xq�WWdQXq�Wn|
j|�ntdtd|d|d|d|	�}|r�tjj|�r�i|d6|d<nztd|
|�SWdt|�x<|D]4}|r�ytj|�Wq�tk
r�q�Xq�q�WXdS(u�
    Uninstall packages individually or from a pip requirements file

    pkgs
        comma separated list of packages to install

    requirements
        Path to requirements file

    bin_env
        Path to pip (or to a virtualenv). This can be used to specify the path
        to the pip to use when more than one Python release is installed (e.g.
        ``/usr/bin/pip-2.7`` or ``/usr/bin/pip-2.6``. If a directory path is
        specified, it is assumed to be a virtualenv.

    log
        Log file where a complete (maximum verbosity) record will be kept

    proxy
        Specify a proxy in the format ``user:passwd@proxy.server:port``. Note
        that the ``user:password@`` is optional and required only if you are
        behind an authenticated proxy.  If you provide
        ``user@proxy.server:port`` then you will be prompted for a password.

    timeout
        Set the socket timeout (default 15 seconds)

    user
        The user under which to run pip

    cwd
        Directory from which to run pip

    use_vt
        Use VT terminal emulation (see output while installing)

    CLI Example:

    .. code-block:: bash

        salt '*' pip.uninstall <package name>,<package2 name>
        salt '*' pip.uninstall requirements=/path/to/requirements.txt
        salt '*' pip.uninstall <package name> bin_env=/path/to/virtualenv
        salt '*' pip.uninstall <package name> bin_env=/path/to/pip_bin
    u	uninstallu-yR*RXR+RZRYu'{0}' is not writeableu--logu--proxyuTimeout cannot be a floatu0'{0}' is not a valid timeout, must be an integeru	--timeoutu,u==NRsRrRquVIRTUAL_ENVuenvucmd.run_all(R%RRfRRRVRxRRARzR{R|RRBRJRKRRR3R4R7R8tremoveRgR)RR(R
tOSError(R�R*RR�R�R�RZRYR+RqRXR[RwR�R^trq_treqtreq_pkgt_R�((s4/usr/lib/python2.7/site-packages/salt/modules/pip.pyt	uninstall�sj7

+





c	K@sAt|�}|jd�d}t|�}tjjjd|ddd|�retjd||�n
|jd�t	d	|d
|d|dt
�}	|r�|	j|�n|r�tj
j|�r�i|d
6|	d<n|r�|	jdi�jt|��ntd||	�}
|
dr3t|
dd|
��n|
dj�S(u4
    Return a list of installed packages either globally or in the specified
    virtualenv

    bin_env
        Path to pip (or to a virtualenv). This can be used to specify the path
        to the pip to use when more than one Python release is installed (e.g.
        ``/usr/bin/pip-2.7`` or ``/usr/bin/pip-2.6``. If a directory path is
        specified, it is assumed to be a virtualenv.

    user
        The user under which to run pip

    cwd
        Directory from which to run pip

    .. note::
        If the version of pip available is older than 8.0.3, the list will not
        include the packages ``pip``, ``wheel``, ``setuptools``, or
        ``distribute`` even if they are installed.

    CLI Example:

    .. code-block:: bash

        salt '*' pip.freeze bin_env=/home/code/path/to/virtualenv
    ufreezeu8.0.3RnRou<Rpu�The version of pip installed is %s, which is older than %s. The packages pip, wheel, setuptools, and distribute will not be included in the output of pip.freezeu--allRrRYRqRsuVIRTUAL_ENVuenvucmd.run_alluretcodeustderrR2ustdout(R%RCRtRRRuRvRtwarningRgR)R�RRRR�RmR(Rt
splitlines(RRZRYRqRjR�RXR�R�R�tresult((s4/usr/lib/python2.7/site-packages/salt/modules/pip.pytfreezes(!
$

!"
c
K@sGi}|dks!dj|�r4t|�|d<nxtd|d|d|d||�D]�}|jd�sY|jd�r�qYn�|jd�r�qYnl|jd	�ri|jd
�d}d|kr�|jd�\}}	qt|jd
��dkr"|jd
�d}	|jd
�d}qt|jd��dkr|jd�d}	|jd�d}qn�t|jd
��dkr�|jd
�d}	|jd
�d}nWt|jd��dkr�|jd�d}	|jd�d}ntjd|�qY|r5|	j�j|j��r?|||	<q?qY|||	<qYW|S(u6
    Filter list of installed apps from ``freeze`` and check to see if
    ``prefix`` exists in the list of packages installed.

    .. note::

        If the version of pip available is older than 8.0.3, the packages
        ``wheel``, ``setuptools``, and ``distribute`` will not be reported by
        this function even if they are installed. Unlike :py:func:`pip.freeze
        <salt.modules.pip.freeze>`, this function always reports the version of
        pip which is installed.

    CLI Example:

    .. code-block:: bash

        salt '*' pip.list salt
    upipRRZRYRju-fu#u-e hg+not trustu-eu-e iu#egg=u===iiu==uCan't parse line '%s'N(	RRNRtR�RJtlenRRwR(
tprefixRRZRYRjR�tpackagestlinetversion_tname((s4/usr/lib/python2.7/site-packages/salt/modules/pip.pytlist_RsF
cC@s�d}|dk	r'dj||�}n|tkr;t|St|�}|jd�td|dt�}|dr�td��ny#tj	d|d	�j
d
�}Wntk
r�d}nX|t|<|S(u0
    .. versionadded:: 0.17.0

    Returns the version of pip. Use ``bin_env`` to specify the path to a
    virtualenv and get the version of pip in that virtualenv.

    If unable to detect the pip version, returns ``None``.

    CLI Example:

    .. code-block:: bash

        salt '*' pip.version
    upip.versionu{0}.{1}u	--versionucmd.run_allRsuretcodeuCould not find a `pip` binaryu
^pip (\S+)ustdoutiN(RRR	R%RCR(R)RR�R�R�R�(RRRXRR�((s4/usr/lib/python2.7/site-packages/salt/modules/pip.pyRt�s 


#


cC@s]t|�}|jddg�t|�}d}tjjjd|ddd|�re|jd�ntd	|d
|�}|r�t	j
j|�r�i|d6|d<ntd
||�}|dr�t
|dd|��ni}tjjjd|dddd�r�tjjjd|dddd�rItjd�tjd�}	ntjd�tjd�}	x�|dj�D]S}
|	j|
�}|r�|j�\}}
ntjdj|
��qv|
||<qvWn�tjd�y#tjjj|ddt�}Wn#tk
r%t
dd|��nXx0|D](}dj|d|d�||d <q-W|S(!u�
    Check whether or not an upgrade is available for all packages

    CLI Example:

    .. code-block:: bash

        salt '*' pip.list_upgrades
    ulistu
--outdatedu9.0RnRou>=Rpu
--format=jsonRYRruVIRTUAL_ENVuenvucmd.run_alluretcodeustderrR2u<u9.0.0u8.0.0upip module: Old output formatu(\S*)\s+\(.*Latest:\s+(.*)\)upip module: New output formatu#(\S*)\s+\(.*\)\s+-\s+Latest:\s+(.*)ustdoutuCan't parse line '{0}'upip module: JSON output formattstrictuInvalid JSONu	{0} [{1}]ulatest_versionulatest_filetypeuname(R%RRtRRRuRvRCRgRRRR(RRRR�R�R�R�tgroupsRwRtjsontloadsR)R{(RRZRYRXR�R�R�R�R�tpatR�R�R�R�R�R�((s4/usr/lib/python2.7/site-packages/salt/modules/pip.pyt
list_upgrades�sJ	
$$
	

#


cC@sWxPtd|d|d|�D]3}|jd�s|jd�rFqn�|jd�r[qn�|jd�r�|jd�d	}|jd
�\}}n�t|jd��dkr�|jd�d
}|jd�d	}nWt|jd��dkr|jd�d
}|jd�d	}ntjd|�q|r||j�krOtSqqWtS(u[
    .. versionadded:: 2018.3.0

    Filter list of installed apps from ``freeze`` and return True or False  if
    ``pkgname`` exists in the list of packages installed.

    .. note::
        If the version of pip available is older than 8.0.3, the packages
        wheel, setuptools, and distribute will not be reported by this function
        even if they are installed. Unlike :py:func:`pip.freeze
        <salt.modules.pip.freeze>`, this function always reports the version of
        pip which is installed.

    CLI Example:

    .. code-block:: bash

        salt '*' pip.is_installed salt
    RRZRYu-fu#u-e hg+not trustu-eu-e iu#egg=u===iiu==uCan't parse line '%s'(	R�RNRJR�RRwRtTrueR)(tpkgnameRRZRYR�R�R�((s4/usr/lib/python2.7/site-packages/salt/modules/pip.pytis_installed
s("cC@s|td|d|d|�kS(u�
    .. versionadded:: 2015.5.0

    Check whether or not an upgrade is available for a given package

    CLI Example:

    .. code-block:: bash

        salt '*' pip.upgrade_available <package name>
    RRZRY(R�(R�RRZRY((s4/usr/lib/python2.7/site-packages/salt/modules/pip.pytupgrade_available@scC@s�iid6td6dd6}t|�}|jddg�td|d|d	|�}td	|d
|�}|r�tjj|�r�i|d6|d<nt}x�t	d|d|d	|�D]�}	|	d
kr�t
jjj
�r�q�q�ntd||	g|�}
|
ddkrt}nd|
kr�|dc|
d7<q�q�W|rRt|d<nt|�td|d|d	|�}t
jjj||�|d<|S(u�
    .. versionadded:: 2015.5.0

    Upgrades outdated pip packages.

    .. note::
        On Windows you can't update salt from pip using salt, so salt will be
        skipped

    Returns a dict containing the changes.

        {'<package>':  {'old': '<old-version>',
                        'new': '<new-version>'}}


    CLI Example:

    .. code-block:: bash

        salt '*' pip.upgrade
    uchangesuresultuucommentuinstallu-URRZRYRquVIRTUAL_ENVuenvusaltucmd.run_alluretcodeiustderr(R�R%RR�RgRRRR)R�RRRRR(R
R�t
compare_dicts(RRZRYRqRRXtoldR�terrorsR�R�tnew((s4/usr/lib/python2.7/site-packages/salt/modules/pip.pyR�Rs2

"		

c		C@s?t|�}	|	jddj|�g�|rttjjj|t�s^tdj|���n|	jd|g�n|r�tjjj|t�s�tdj|���n|	jd|g�nt	d|d|dd	d
t
�}
|r
tjj
|�r
i|d6|
d<ntd
|	|
�}g}|s<|jd�n|sR|jd�n|sh|jd�n|r�tjdjdj|���}
ntjd�}
g}x�|dj�D]u}tjd|�}|r�g|jd�jd�D]!}|r�|
j|�r�|^q�}|jdtj�Pq�q�W|s;dS|S(u�
    .. versionadded:: 2017.7.3

    List all available versions of a pip package

    pkg
        The package to check

    bin_env
        Path to pip (or to a virtualenv). This can be used to specify the path
        to the pip to use when more than one Python release is installed (e.g.
        ``/usr/bin/pip-2.7`` or ``/usr/bin/pip-2.6``. If a directory path is
        specified, it is assumed to be a virtualenv.

    include_alpha
        Include alpha versions in the list

    include_beta
        Include beta versions in the list

    include_rc
        Include release candidates versions in the list

    user
        The user under which to run pip

    cwd
        Directory from which to run pip

    index_url
        Base URL of Python Package Index
        .. versionadded:: 2019.2.0

    extra_index_url
        Additional URL of Python Package Index
        .. versionadded:: 2019.2.0

    CLI Example:

    .. code-block:: bash

       salt '*' pip.list_all_versions <package name>
    uinstallu
{0}==versionsu'{0}' is not a valid URLu--index-urlu--extra-index-urlRYRrtoutput_logleveluquiettredirect_stderruVIRTUAL_ENVuenvucmd.run_alluauburcu
^((?!{0}).)*$u|uustdoutu5\s*Could not find a version.* \(from versions: (.*)\)iu, RkN(R%RRRRR&R}R~RRgR�RRRR(RCR�R�RR�R�R�RJR�tsortt
pkg_resourcest
parse_versionR(R�Rt
include_alphatinclude_betat
include_rcRZRYR�R�RXR�R�tfilteredtexcludesRuR�R�tv((s4/usr/lib/python2.7/site-packages/salt/modules/pip.pytlist_all_versions�sH4!$@(7t__doc__t
__future__RRRtloggingRR�R�R�RROtsalt.utils.dataRtsalt.utils.filestsalt.utils.jsontsalt.utils.localestsalt.utils.platformtsalt.utils.stringutilstsalt.utils.urltsalt.utils.versionstsalt.extRtsalt.exceptionsRRt	getLoggert__name__Rt__func_alias__R~R�t	MULTILINER5RRR
R%R/R1R@RDRfRmR)R�R�R�R�RtR�R�R�R�R�(((s4/usr/lib/python2.7/site-packages/salt/modules/pip.pyt<module>Ls�
		
	7					m	��t;C&L18

Zerion Mini Shell 1.0