HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/pyenv.cpython-310.pyc
o

�N�g'�@sVdZddlZddd�Zddd�Zddd	�Zdd
d�Zddd
�Zddd�Zddd�ZdS)a�
Managing python installations with pyenv
========================================

This module is used to install and manage python installations with pyenv.
Different versions of python can be installed, and uninstalled. pyenv will
be installed automatically the first time it is needed and can be updated
later. This module will *not* automatically install packages which pyenv
will need to compile the versions of python.

If pyenv is run as the root user then it will be installed to /usr/local/pyenv,
otherwise it will be installed to the users ~/.pyenv directory. To make
pyenv available in the shell you may need to add the pyenv/shims and pyenv/bin
directories to the users PATH. If you are installing as root and want other
users to be able to access pyenv then you will need to add pyenv_ROOT to
their environment.

This is how a state configuration could look like:

.. code-block:: yaml

    pyenv-deps:
      pkg.installed:
        - pkgs:
          - make
          - build-essential
          - libssl-dev
          - zlib1g-dev
          - libbz2-dev
          - libreadline-dev
          - libsqlite3-dev
          - wget
          - curl
          - llvm
    python-2.6:
      pyenv.absent:
        - require:
          - pkg: pyenv-deps

    python-2.7.6:
      pyenv.installed:
        - default: True
        - require:
          - pkg: pyenv-deps

.. note::
    Git needs to be installed and available via PATH if pyenv is to be
    installed automatically by the module.
�NcCs td|�sd|d<d|d<|S)z-
    Check to see if pyenv is installed.
    zpyenv.is_installedF�resultzpyenv is not installed.�comment��__salt__)�ret�user�r�E/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/pyenv.py�_check_pyenv6sr
cCsNtd|d�}td|�D]}||kr$d|d<d|d<||k|d<|Sq
|S)	z4
    Check to see if given python is installed.
    �
pyenv.default�Zrunaszpyenv.versionsTrzRequested python exists.r�defaultr)r�pythonrr
�versionrrr	�_python_installed@s�rFcCsxt|||d�}|ds0td||d�r&d|d<d|d|<d|d	<||d
<n
d|d<d|d	<|S|r:td
||d�|S)zA
    Verify that python is installed, install if unavailable
    �rrzpyenv.install_pythonrTZ	Installed�changeszSuccessfully installed pythonrr
FzCould not install python.r�rr)rrr
rrrr	�_check_and_install_pythonOs
rcCs�|ddid�}|�d�rt�dd|�}tdr!d|�d�|d	<|St||�}|d
dur@td|�s8d
|d	<|St||||d�St||||d�S)aS
    Verify that the specified python is installed with pyenv. pyenv is
    installed if necessary.

    name
        The version of python to install

    default : False
        Whether to make this python the default.

    user: None
        The user to run pyenv as.

        .. versionadded:: 0.17.0

    .. versionadded:: 0.16.0
    N���namerrr�python-�^python-�test�python z is set to be installedrrFz
pyenv.installzpyenv failed to installr)�
startswith�re�sub�__opts__r
rr)rr
rrrrr	�	installedes

r cCs�t|||d�}|dr9|drtdd|d�td||d�r/d|d<d	|d
|<d|d<|Sd
|d<d|d<|Sd|d<d|�d�|d<|S)z+
    Verify that python is uninstalled
    rrr
r�systemrzpyenv.uninstall_pythonTZUninstalledrzSuccessfully removed pythonrFzFailed to uninstall pythonrz is already absentr)rrrrrr	�_check_and_uninstall_python�sr"cCs�|ddid�}|�d�rt�dd|�}tdr!d|�d�|d	<|St||�}|d
dur:d|d
<d
|�d�|d	<|St|||d�S)a
    Verify that the specified python is not installed with pyenv. pyenv
    is installed if necessary.

    name
        The version of python to uninstall

    user: None
        The user to run pyenv as.

        .. versionadded:: 0.17.0

    .. versionadded:: 0.16.0
    Nrrrrrrz is set to be uninstalledrrFTzpyenv not installed, z not eitherr)rrrrr
r"�rrrrrr	�absent�s

r$cCs,|ddid�}tdrd|d<|St||�S)a�
    Install pyenv if not installed. Allows you to require pyenv be installed
    prior to installing the plugins. Useful if you want to install pyenv
    plugins via the git or file modules and need them installed before
    installing any rubies.

    Use the pyenv.root configuration option to set the path for pyenv if you
    want a system wide install that is not in a user home dir.

    user: None
        The user to run pyenv as.
    Nrrrzpyenv is set to be installedr)rrr#rrr	�
install_pyenv�s


r%)N)FN)	�__doc__rr
rrr r"r$r%rrrr	�<module>s2





&
!