HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/cabal.cpython-310.pyc
o

�N�g�@sfdZddlZddlZddlmZe�e�ZddiZ	dd�Z
ddd	�Zddd�Zdd
d�Z
ddd�ZdS)z^
Manage and query Cabal packages
===============================

.. versionadded:: 2015.8.0

�N)�CommandExecutionError�list_�listcCs$tjj�d�duotjj�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�rcCstdd||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_allzcabal update�Zrunas�env)�__salt__)�userrr	r	r
�updatesrFcCszdg}|r
|�d�|r|�d|�d��n
|r#|�d�d�|���tdd�|�||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�joinrr)�pkgZpkgsrZinstall_globalr�cmd�resultr	r	r
�install4s
rcCs|dg}|r
|�d�|r|�d|�d��tdd�|�||d�}i}|d��D]}|��}|d}	|d	}
|
||	<q)|S)
a
    List packages matching a search string.

    pkg
        Search string for matching package names
    user
        The user to run cabal list with
    installed
        If True, only return installed packages.
    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.list
        salt '*' cabal.list ShellCheck
    zcabal list --simple-outputz--installedrrrr
�stdoutr�)rrr�
splitlines�split)rrZ	installedrrrZpackages�line�dataZpackage_nameZpackage_versionr	r	r
rds

cCsLdg}|�d|�d��tdd�|�||d�}|ddkr$t|d��|S)	a�
    Uninstall a cabal package.

    pkg
        The package to uninstall
    user
        The user to run ghc-pkg unregister 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.uninstall ShellCheck

    zghc-pkg unregisterrrrr
rrr)rrrr)rrrrrr	r	r
�	uninstall�sr#)NN)NNNFN)NNFN)�__doc__�loggingZsalt.utils.pathrZsalt.exceptionsr�	getLogger�__name__�loggerZ__func_alias__rrrrr#r	r	r	r
�<module>s

	

0*