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

�N�g0)�@s�dZddlZddlZddlZddlZddlmZm	Z	m
Z
e�e�Z
ddiZdd�Zdd	�Zd
d�Z												
		ddd�Z											
	ddd�Z											
	ddd�Zddd�ZdS)z:
Use composer to install PHP dependencies for a directory
�N)�CommandExecutionError�CommandNotFoundError�SaltInvocationErrorZlist_�listcCsdS)z
    Always load
    T�rrr�I/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/composer.py�__virtual__srcCstjj�|�r	dSdS)z5
    Validate the composer file is indeed there.
    TF)�salt�utils�path�which)�composerrrr�_valid_composersrcCs|�d�}tj�|�r
dSdS)z�
    Test to see if the vendor directory exists in this directory

    dir
        Directory location of the composer.json file

    CLI Example:

    .. code-block:: bash

        salt '*' composer.did_composer_install /var/www/application
    z/vendorTF)�osr�exists)�dirZlockFilerrr�did_composer_install&s

rF�/rootcCs�|dur|dur
d}nd}t|�std�||���|dur!td��|dur0|dkr0td|����||dd	g}|
durD|�tjj�|
��|durM|g|}|durX|�d
|g�|dura|�	d�|
durj|�	d
�|durs|�	d�|dur||�	d�|dur�|�	d�|dur�|�	d�|	dur�|�	d�|dur�tjj
�|�}||d<nd|i}td|||dd�}|ddkr�t
|d��|dur�dS|S)a
    Run PHP's composer with a specific action.

    If composer has not been installed globally making it available in the
    system PATH & making it executable, the ``composer`` and ``php`` parameters
    will need to be set to the location of the executables.

    action
        The action to pass to composer ('install', 'update', 'selfupdate', etc).

    directory
        Directory location of the composer.json file.  Required except when
        action='selfupdate'

    composer
        Location of the composer.phar file. If not set composer will
        just execute "composer" as if it is installed globally.
        (i.e. /path/to/composer.phar)

    php
        Location of the php executable to use with composer.
        (i.e. /usr/bin/php)

    runas
        Which system user to run composer as.

    prefer_source
        --prefer-source option of composer.

    prefer_dist
        --prefer-dist option of composer.

    no_scripts
        --no-scripts option of composer.

    no_plugins
        --no-plugins option of composer.

    optimize
        --optimize-autoloader option of composer. Recommended for production.

    no_dev
        --no-dev option for composer. Recommended for production.

    quiet
        --quiet option for composer. Whether or not to return output from composer.

    composer_home
        $COMPOSER_HOME environment variable

    extra_flags
        None, or a string containing extra flags to pass to composer.

    env
        A list of environment variables to be set prior to execution.
    N�phpr
z3'composer.{}' is not available. Couldn't find '{}'.z!The 'action' argument is required�
selfupdatez2The 'directory' argument is required for composer.z--no-interactionz	--no-ansiz
--working-dirTz--quietz--no-devz--prefer-sourcez
--prefer-distz--no-scriptsz--no-pluginsz--optimize-autoloaderZ
COMPOSER_HOMEzcmd.run_allF)�runas�envZpython_shell�retcoder�stderr)rr�formatr�extendr	r
�argsZshlex_split�append�dataZrepack_dictlistZ__salt__r)�action�	directoryr
rr�
prefer_source�prefer_dist�
no_scripts�
no_plugins�optimize�no_dev�quiet�
composer_home�extra_flagsr�cmd�resultrrr�
_run_composer9s`I����








r,c
Cs(td||||||||||	|
||d�}
|
S)a�
    Install composer dependencies for a directory.

    If composer has not been installed globally making it available in the
    system PATH & making it executable, the ``composer`` and ``php`` parameters
    will need to be set to the location of the executables.

    directory
        Directory location of the composer.json file.

    composer
        Location of the composer.phar file. If not set composer will
        just execute "composer" as if it is installed globally.
        (i.e. /path/to/composer.phar)

    php
        Location of the php executable to use with composer.
        (i.e. /usr/bin/php)

    runas
        Which system user to run composer as.

    prefer_source
        --prefer-source option of composer.

    prefer_dist
        --prefer-dist option of composer.

    no_scripts
        --no-scripts option of composer.

    no_plugins
        --no-plugins option of composer.

    optimize
        --optimize-autoloader option of composer. Recommended for production.

    no_dev
        --no-dev option for composer. Recommended for production.

    quiet
        --quiet option for composer. Whether or not to return output from composer.

    composer_home
        $COMPOSER_HOME environment variable

    env
        A list of environment variables to be set prior to execution.

    CLI Example:

    .. code-block:: bash

        salt '*' composer.install /var/www/application

        salt '*' composer.install /var/www/application             no_dev=True optimize=True
    �install)
r r
rrr!r"r#r$r%r&r'r(r�r,�r r
rrr!r"r#r$r%r&r'r(rr+rrrr-�s"I�r-c
Cs*td|d|||||||||	|
||d�}
|
S)aF
    Update composer dependencies for a directory.

    If `composer install` has not yet been run, this runs `composer install`
    instead.

    If composer has not been installed globally making it available in the
    system PATH & making it executable, the ``composer`` and ``php`` parameters
    will need to be set to the location of the executables.

    directory
        Directory location of the composer.json file.

    composer
        Location of the composer.phar file. If not set composer will
        just execute "composer" as if it is installed globally.
        (i.e. /path/to/composer.phar)

    php
        Location of the php executable to use with composer.
        (i.e. /usr/bin/php)

    runas
        Which system user to run composer as.

    prefer_source
        --prefer-source option of composer.

    prefer_dist
        --prefer-dist option of composer.

    no_scripts
        --no-scripts option of composer.

    no_plugins
        --no-plugins option of composer.

    optimize
        --optimize-autoloader option of composer. Recommended for production.

    no_dev
        --no-dev option for composer. Recommended for production.

    quiet
        --quiet option for composer. Whether or not to return output from composer.

    composer_home
        $COMPOSER_HOME environment variable

    env
        A list of environment variables to be set prior to execution.

    CLI Example:

    .. code-block:: bash

        salt '*' composer.update /var/www/application

        salt '*' composer.update /var/www/application             no_dev=True optimize=True
    �update�
--no-progress)r r)r
rrr!r"r#r$r%r&r'r(rr.r/rrrr0*s$L�r0c	Cstdd|||||d�}|S)a=
    Update composer itself.

    If composer has not been installed globally making it available in the
    system PATH & making it executable, the ``composer`` and ``php`` parameters
    will need to be set to the location of the executables.

    composer
        Location of the composer.phar file. If not set composer will
        just execute "composer" as if it is installed globally.
        (i.e. /path/to/composer.phar)

    php
        Location of the php executable to use with composer.
        (i.e. /usr/bin/php)

    runas
        Which system user to run composer as.

    quiet
        --quiet option for composer. Whether or not to return output from composer.

    composer_home
        $COMPOSER_HOME environment variable

    CLI Example:

    .. code-block:: bash

        salt '*' composer.selfupdate
    rr1)r)r
rrr'r(r.)r
rrr'r(r+rrrr�s �	r)NNNNNNNNNNFrNN)NNNNNNNNNFrN)NNNFr)�__doc__�loggingZos.pathrZsalt.utils.argsr	Zsalt.utils.pathZsalt.exceptionsrrr�	getLogger�__name__�logZ__func_alias__rrrr,r-r0rrrrr�<module>sl
	
�
�^
�`