%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/cyg.pyc

�
���^c@@stdZddlmZmZmZddlZddlZddlZddlZddl	m
ZddlZ
ddlZ
ddlZ
ddlmZddlmZeje�ZdZdZd	Zd
�Zidd6Zd
d�Zd
d�Zed
d�Zd
dd�Z d
ddd�Z!d
d�Z"dd
dd�Z#d
dd�Z$d
dd�Z%dd
d�Z&dS(uB
Manage cygwin packages.

Module file to accompany the cyg state.
i(tabsolute_importtprint_functiontunicode_literalsN(turlopen(tSaltInvocationError(tsixu+ftp://mirrors.kernel.org/sourceware/cygwin/uucygcC@s tjjj�rtStdfS(u'
    Only works on Windows systems
    u1Module cyg: module only works on Windows systems.(tsalttutilstplatformt
is_windowst__virtualname__tFalse(((s4/usr/lib/python2.7/site-packages/salt/modules/cyg.pyt__virtual__%sulistulist_ux86_64cC@s<|dkrdS|dkr dStdjd|���dS(uH
    Return the cygwin install directory based on the architecture.
    ux86_64ucygwin64ux86ucygwinuInvalid architecture {arch}tarchN(Rtformat(tcyg_arch((s4/usr/lib/python2.7/site-packages/salt/modules/cyg.pyt_get_cyg_dir3scC@satjjdt|�ddg�}tjdj|��tjj|�s]tjd�t	St
S(u�
    Return True or False if cygwin is installed.

    Use the cygcheck executable to check install. It is installed as part of
    the base package, and we use it to check packages
    uC:ubinucygcheck.exeuPath to cygcheck.exe: {0}uCould not find cygcheck.exe(tostseptjoinRtLOGtdebugRtpathtexistsRtTrue(Rtpath_to_cygcheck((s4/usr/lib/python2.7/site-packages/salt/modules/cyg.pyt_check_cygwin_installed@s	
cC@s�dtkritd<n|tdkr:gtd|<nttd|�s�dj||dg�}t|�j�}tj|�jddd�j�}g|D]3}t	j
d|�r�t	jd|�jd	�^q�}|td|<ntd|S(
uC
    Return the list of packages based on the mirror provided.
    ucyg.all_packagesu/u	setup.bz2uutf_8terrorsureplaceu^@ [^ ]+u
^@ ([^ ]+)i(
t__context__tlenRt_urlopentreadtbz2t
decompresstdecodet
splitlinestretmatchtsearchtgroup(tmirrorRt
pkg_sourcet	file_datat
file_linestlinetpackages((s4/usr/lib/python2.7/site-packages/salt/modules/cyg.pyt_get_all_packagesQs
=cC@s�|dkritt6g}ntjdj|��xD|D]<}x3|j�D]%\}}|t||�krOtSqOWq<Wt	S(uZ
    Check if the package is valid on the given mirrors.

    Args:
        package: The name of the package
        cyg_arch: The cygwin architecture
        mirrors: any mirrors to check

    Returns (bool): True if Valid, otherwise False

    CLI Example:

    .. code-block:: bash

        salt '*' cyg.check_valid_package <package name>
    uChecking Valid Mirrors: {0}N(
tNonetDEFAULT_MIRROR_KEYtDEFAULT_MIRRORRRRtitemsR.RR(tpackageRtmirrorsR(t
mirror_urltkey((s4/usr/lib/python2.7/site-packages/salt/modules/cyg.pytcheck_valid_packagejs
cC@stjjddg�}dj|�}tjj||g�}dj|�}tjj|�sptj|�n"tjj|�r�tj|�nt|�}t	j
jj|d��}|j
|j��WdQX|}	g}
|
jdj|��|dkritt6g}nx`|D]X}xO|j�D]A\}}
|
jdj|��|
r-|
jd	j|
��q-q-WqW|
jd
�|
jd�|
jd�|dk	r�x|D]}|
j|�q�Wnd
j|
�}d
j||g�}	td|	�}|ddkr|dStSdS(u�
    Retrieve the correct setup.exe.

    Run it with the correct arguments to get the bare minimum cygwin
    installation up and running.
    uc:ucygcacheu
setup-{0}.exeuhttp://cygwin.com/{0}uwbNu--local-package-dir {0}u
--site {0}u--pubkey {0}u--no-desktopu--quiet-modeu--disable-buggy-antivirusu ucmd.run_alluretcodeiustdout(RRRRRRtmkdirtremoveRRRtfilestfopentwriteRtappendR/R0R1R2t__salt__R(RtargsR4t
cyg_cache_dirt	cyg_setuptcyg_setup_pathtcyg_setup_sourceR*tfhwt
setup_commandtoptionsR(R5R6targtcmdline_argstret((s4/usr/lib/python2.7/site-packages/salt/modules/cyg.pyt_run_silent_cygwin�sD	
!



	cC@sfdjtjjdt|�ddg�d|g�}td|�}|ddkr^|d	StSd
S(u&
    Run the cygcheck executable.
    u uc:ubinucygchecku-cucmd.run_alluretcodeiustdoutN(RRRRR>R(R?RtcmdRI((s4/usr/lib/python2.7/site-packages/salt/modules/cyg.pyt	_cygcheck�s!cC@scg}|dk	rJ|jdjd|��t|�sJtd|�qJntd|d|d|�S(u�
    Install one or several packages.

    packages : None
        The packages to install

    cyg_arch : x86_64
        Specify the architecture to install the package under
        Current options are x86 and x86_64

    CLI Example:

    .. code-block:: bash

        salt '*' cyg.install dos2unix
        salt '*' cyg.install dos2unix mirrors="[{'http://mirror': 'http://url/to/public/key}]'
    u--packages {pkgs}tpkgsRR?R4N(R/R=RRRJ(R-RR4R?((s4/usr/lib/python2.7/site-packages/salt/modules/cyg.pytinstall�scC@szg}|dk	ra|jdjd|��tjdj|��t|�satjd�tSntd|d|d|�S(	u�
    Uninstall one or several packages.

    packages
        The packages to uninstall.

    cyg_arch : x86_64
        Specify the architecture to remove the package from
        Current options are x86 and x86_64

    CLI Example:

    .. code-block:: bash

        salt '*' cyg.uninstall dos2unix
        salt '*' cyg.uninstall dos2unix mirrors="[{'http://mirror': 'http://url/to/public/key}]"
    u--remove-packages {pkgs}RMu	args: {0}u&We're convinced cygwin isn't installedRR?R4N(R/R=RRRRRRJ(R-RR4R?((s4/usr/lib/python2.7/site-packages/salt/modules/cyg.pyt	uninstall�s
cC@sRg}|jd�t|�s9tjdj|��tStd|d|d|�S(u6
    Update all packages.

    cyg_arch : x86_64
        Specify the cygwin architecture update
        Current options are x86 and x86_64

    CLI Example:

    .. code-block:: bash

        salt '*' cyg.update
        salt '*' cyg.update dos2unix mirrors="[{'http://mirror': 'http://url/to/public/key}]"
    u--upgrade-alsou=Cygwin ({0}) not installed,                  could not updateRR?R4(R=RRRRRRJ(RR4R?((s4/usr/lib/python2.7/site-packages/salt/modules/cyg.pytupdates
c
C@s�i}djdd|g�}t|d|�}g}t|tj�rftjjj|�j	�}nxQ|D]I}t
jd|�}|rm|jd�}|jd�}	|	||<qmqmW|S(u
    List locally installed packages.

    package : ''
        package name to check. else all

    cyg_arch :
        Cygwin architecture to use
        Options are x86 and x86_64

    CLI Example:

    .. code-block:: bash

        salt '*' cyg.list
    u u-cu-dRu^([^ ]+) *([^ ]+)ii(
RRLt
isinstanceRtstring_typesRRtstringutilst
to_unicodeR#R$R%R'(
R3RRMR?tstdouttlinesR,R%tpkgtversion((s4/usr/lib/python2.7/site-packages/salt/modules/cyg.pytlist_,s
('t__doc__t
__future__RRRtloggingR$RR t!salt.ext.six.moves.urllib.requestRRtsalt.utils.filesRtsalt.utils.platformtsalt.utils.stringutilstsalt.exceptionsRtsalt.extRt	getLoggert__name__RR1R0R
Rt__func_alias__RRR.R/R7RJRLRNRORPRY(((s4/usr/lib/python2.7/site-packages/salt/modules/cyg.pyt<module>sF		

7

Zerion Mini Shell 1.0