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__/bower.cpython-310.pyc
o

�N�gk�@s�dZddlZddlZddlZddlZddlmZddlm	Z	e�
e�ZddiZ
dd�Zd	d
�Zdd�Zdd
d�Zddd�Zddd�Zddd�ZdS)z�
Manage and query Bower packages
===============================

This module manages the installed packages using Bower.
Note that npm, git and bower must be installed for this module to be
available.

�N)�CommandExecutionError)�Version�list_�listcCstjj�d�durdSdS)z+
    Only work when Bower is installed
    �bowerN)Fz=The bower module could not be loaded: bower command not foundT)�salt�utils�path�which�rr�F/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/bower.py�__virtual__sr
cCsDttdd�tjj�d����}td�}||kr td�||���dS)zw
    Check the version of Bower to ensure this module will work. Currently
    bower must be at least version 1.3.
    zcmd.runz{} --versionrz1.3z6'bower' is not recent enough({} < {}). Please Upgrade.N)r�__salt__�formatrrr	r
r)Z
bower_versionZ
valid_versionrrr�_check_valid_version"s����rcCs8|std��tjj�d�gt�|�}|�gd��|S)z*
    Create bower command line string
    z.bower_command, e.g. install, must be specifiedr)z--config.analytics�falsez--config.interactiverz--allow-rootz--json)rrrr	r
�shlex�split�extend)Z
bower_command�cmdrrr�_construct_bower_command5s�
rcCstt�td�}|r|�|�n|r|�|�td||||dd�}|ddkr-t|d��tjj�	|d�}|ikS)	a2
    Install a Bower package.

    If no package is specified, the dependencies (from bower.json) of the
    package in the given directory will be installed.

    pkg
        A package name in any format accepted by Bower, including a version
        identifier

    dir
        The target directory in which to install the package

    pkgs
        A list of package names in the same format as the ``pkg`` parameter

    runas
        The user to run Bower with

    env
        Environment variables to set when invoking Bower. Uses the same ``env``
        format as the :py:func:`cmd.run <salt.modules.cmdmod.run>` execution
        function.

    CLI Example:

    .. code-block:: bash

        salt '*' bower.install underscore /path/to/project

        salt '*' bower.install jquery#2.0 /path/to/project

    �install�cmd.run_allF��cwd�runas�envZpython_shell�retcoder�stderr�stdout)
rr�appendrrrrr�json�loads)�pkg�dirZpkgsrrr�resultrrrrrJs"

�rcCs`t�td�}|�|�td||||dd�}|ddkr#t|d��tjj�|d�}|ikS)	a�
    Uninstall a Bower package.

    pkg
        A package name in any format accepted by Bower

    dir
        The target directory from which to uninstall the package

    runas
        The user to run Bower with

    env
        Environment variables to set when invoking Bower. Uses the same ``env``
        format as the :py:func:`cmd.run <salt.modules.cmdmod.run>` execution
        function.

    CLI Example:

    .. code-block:: bash

        salt '*' bower.uninstall underscore /path/to/project

    �	uninstallrFrrrrr�	rrr rrrrr!r")r#r$rrrr%rrrrr&�s

�r&cCs\t�td�}|�d�td||||dd�}|ddkr#t|d��tjj�|d	�d
S)a�
    List installed Bower packages.

    dir
        The directory whose packages will be listed

    runas
        The user to run Bower with

    env
        Environment variables to set when invoking Bower. Uses the same ``env``
        format as the :py:func:`cmd.run <salt.modules.cmdmod.run>` execution
        function.

    CLI Example:

    .. code-block:: bash

        salt '*' bower.list /path/to/project

    rz	--offlinerFrrrrrZdependenciesr'�r$rrrr%rrrr�s

�cCsNt�td�}td||||dd�}|ddkrt|d��tjj�|d�S)	a�
    .. versionadded:: 2017.7.0

    Remove extraneous local Bower packages, i.e. those not referenced in bower.json

    dir
        The directory whose packages will be pruned

    runas
        The user to run Bower with

    env
        Environment variables to set when invoking Bower. Uses the same ``env``
        format as the :py:func:`cmd.run <salt.modules.cmdmod.run>` execution
        function.

    CLI Example:

    .. code-block:: bash

        salt '*' bower.prune /path/to/project

    �prunerFrrrrr)rrrrrrr!r"r(rrrr)�s
�r))NNN)NN)�__doc__�loggingrZsalt.utils.jsonrZsalt.utils.pathZsalt.exceptionsrZsalt.utils.versionsr�	getLogger�__name__�logZ__func_alias__r
rrrr&rr)rrrr�<module>s 

	

7
*%