%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/macpackage.pyo

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddlZ	ddl
mZeje
�ZdZd�Zdeeeedddeedd�Zd	�ZdS(
u�
Installing of mac pkg files
===========================

Install any kind of pkg, dmg or app file on macOS:

.. code-block:: yaml

    /mnt/test.pkg:
      macpackage.installed:
        - store: True

    /mnt/test.dmg:
      macpackage.installed:
        - dmg: True

    /mnt/xcode.dmg:
      macpackage.installed:
        - dmg: True
        - app: True
        - target: /Applications/Xcode.app
        - version_check: xcodebuild -version=Xcode 7.1\n.*7B91b

i(tabsolute_importtunicode_literalstprint_functionN(tCommandExecutionErroru
macpackagecC@stjjj�rtStS(u
    Only work on Mac OS
    (tsalttutilstplatformt	is_darwint__virtualname__tFalse(((s:/usr/lib/python2.7/site-packages/salt/states/macpackage.pyt__virtual__(suLocalSystemc	@s�i�d6td6dd6id6�g}g}
�}i|d6td6}dtkretd|d<nt|||�}t|t�r��j|��S|d-k	ru|jd	�}t|�d
kru|d}|d}y,t	d
|dddt�}|j
�}Wntk
rd}nXtj
||�d-k	rS�dcdj|�7<�S�dcdj||�7<qun|r�|dkr�d}nd-}|rt	d��\�}d�kr�t�d<�dcdj��7<�S|r�|d}q|r|d}q|d}nzk|r_|r�d}t	d
|d|dt��d�kr|t�d<�dcdj|�7<�S�jd �}n'tjj��g}tjj��}|d-krV|d-krV|d-krVx�|D]o}|d!dkr�|}ntjj||�}tjj|�rB|	tkrB|j|�q�|
j|�q�Wq|}
n�t	d"�}|r�t	d#|�}nt	d$|�}t|�dkrxC|D];}||kr�|	tkr�|j|�q�|
j|�q�Wt|�t|�kr�Sn|r	���fd%�}xX|
D]�}y�tjd&j||��t	d'tjj||�|��t��dkr�||�nR�dcd(j|�7<d)�dkr��dd)j|�n|g�dd)<Wq.tk
r||�q.Xq.Wnyt	d*||||
���d+dkr[t�d<�dcd,j���7<n'�dcd(j��7<|
�dd)<Wd-|r�t	d.|�nX�S(/uX
    Install a Mac OS Package from a pkg or dmg file, if given a dmg file it
    will first be mounted in a temporary location

    name
        The pkg or dmg file to install

    target
        The location in which to install the package. This can be a path or LocalSystem

    dmg
        Is the given file a dmg file?

    store
        Should the pkg be installed as if it was from the Mac OS Store?

    app
        Is the file a .app? If so then we'll just copy that to /Applications/ or the given
        target

    mpkg
        Is the file a .mpkg? If so then we'll check all of the .pkg files found are installed

    user
        Name of the user performing the unless or onlyif checks

    onlyif
        A command to run as a check, run the named command only if the command
        passed to the ``onlyif`` option returns true

    unless
        A command to run as a check, only run the named command if the command
        passed to the ``unless`` option returns false

    force
        Force the package to be installed even if its already been found installed

    allow_untrusted
        Allow the installation of untrusted packages

    version_check
        The command and version that we want to check against, the version number can use regex.

        .. code-block:: yaml

            version_check: python --version_check=2.7.[0-9]

    unameuresultuucommentuchangesurunasupython_shellushellu=iiiucmd.runtoutput_logleveluquiettignore_retcodeuVersion already matches {0}uVersion {0} doesn't match {1}. uLocalSystemu/Applications/umacpackage.mountu
attach faileduUnable to mount {0}u/*.appu/*.mpkgu/*.pkguls -d *.apptcwdtpython_shellu.appuUnable to find .app in {0}u
i����umacpackage.installed_pkgsumacpackage.get_mpkg_idsumacpackage.get_pkg_idc@sct�d<�dcdj���7<d�dkrN�ddj|�n|g�dd<dS(Nuresultucommentu{0} failed to install: {1}ufaileduchanges(R	tformattappend(tf_pkg(tnametouttret(s:/usr/lib/python2.7/site-packages/salt/states/macpackage.pyt
failed_pkg�s

uCopying {0} to {1}umacpackage.install_appu
{0} installedu	installedumacpackage.installuretcodeu. {0} failed to install: {1}Numacpackage.unmount(tTruet
__grains__t_mod_run_checkt
isinstancetdicttupdatetNonetsplittlent__salt__tstripRtretmatchRR	tostpathtbasenametdirnametjointexistsRtlogtinfotOSError(Rttargettdmgtstoretapptmpkgtusertonlyiftunlesstforcetallow_untrustedt
version_checktfoundt
installingtreal_pkgtrun_check_cmd_kwargstcretRtversion_cmdtexpected_versiontversion_outtmount_pointtcmdtpkg_idstptinstall_dirtinstalled_pkgsR((RRRs:/usr/lib/python2.7/site-packages/salt/states/macpackage.pyt	installed1s�2






"	




$
		

	
"


cC@sz|r;td||�dkr;idd6td6td6Sn|rvtd||�dkrvidd6td6td6SntS(u�
    Execute the onlyif and unless logic.
    Return a result dict if:
    * onlyif failed (onlyif != 0)
    * unless succeeded (unless == 0)
    else return True
    ucmd.retcodeiuonlyif condition is falseucommentu
skip_watchuresultuunless condition is true(RR(t
cmd_kwargsR2R3((s:/usr/lib/python2.7/site-packages/salt/states/macpackage.pyR�s

(t__doc__t
__future__RRRtloggingR#R!tsalt.utils.platformRtsalt.exceptionsRt	getLoggert__name__R)RR
R	RRER(((s:/usr/lib/python2.7/site-packages/salt/states/macpackage.pyt<module>s		�

Zerion Mini Shell 1.0