File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/cabal.cpython-310.pyc
Back
o ;j � @ sf d Z ddlZddlZddlmZ e�e�ZddiZ dd� Z ddd �Zddd�Zdd d�Z ddd�ZdS )z^ Manage and query Cabal packages =============================== .. versionadded:: 2015.8.0 � N)�CommandExecutionError�list_�listc C s$ t jj�d�duot jj�d�duS )z4 Only work when cabal-install is installed. ZcabalNzghc-pkg)�salt�utils�path�which� r r �F/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/cabal.py�__virtual__ s �r c C s t d d| |d�S )aa Updates list of known packages. user The user to run cabal update with env Environment variables to set when invoking cabal. Uses the same ``env`` format as the :py:func:`cmd.run <salt.modules.cmdmod.run>` execution function. CLI Example: .. code-block:: bash salt '*' cabal.update �cmd.run_allzcabal update�Zrunas�env)�__salt__)�userr r r r �update s r Fc C sz dg}|r |� d� | r|� d| � d�� n |r#|� d�d�|��� td d�|�||d�}|d d kr;t|d ��|S )a� Install a cabal package. pkg A package name in format accepted by cabal-install. See: https://wiki.haskell.org/Cabal-Install pkgs A list of packages names in same format as ``pkg`` user The user to run cabal install with install_global Install package globally instead of locally env Environment variables to set when invoking cabal. Uses the same ``env`` format as the :py:func:`cmd.run <salt.modules.cmdmod.run>` execution function CLI Example: .. code-block:: bash salt '*' cabal.install shellcheck salt '*' cabal.install shellcheck-0.3.5 z cabal installz--global�"z"{}"z" "r � r �retcoder �stderr)�append�format�joinr r )�pkgZpkgsr Zinstall_globalr �cmd�resultr r r �install4 s r c C s| dg}|r |� d� | r|� d| � d�� td d�|�||d�}i }|d �� D ]}|�� }|d } |d } | || <