File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/ports.cpython-310.pyc
o
�N�gZ � @ s� d Z ddlZddlZddlZddlZddlZddlmZm Z ddl
mZmZ e�
e�Zdd� Zdd� Zd d
� Zdd� Zdd
d�ZdS )a;
Manage software from FreeBSD ports
.. versionadded:: 2014.1.0
.. note::
It may be helpful to use a higher timeout when running a
:mod:`ports.installed <salt.states.ports>` state, since compiling the port
may exceed Salt's timeout.
.. code-block:: bash
salt -t 1200 '*' state.highstate
� N)�CommandExecutionError�SaltInvocationError)�
_normalize�_options_file_existsc C s t �dd�dkrdtv rdS dS )N�os� ZFreeBSD�
ports.installZports)Fz ports module could not be loaded)Z
__grains__�get�__salt__� r r �E/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/ports.py�__virtual__ s r
c C s dd� t jj�| ��� D �S )z!
Repack the options data
c S s i | ]\}}t |�t|��qS r )�strr ��.0�x�yr r r �
<dictcomp>) s ��z#_repack_options.<locals>.<dictcomp>)�salt�utils�dataZrepack_dictlist�items��optionsr r r �_repack_options% s �r c C s d� dd� | �� D ��S )zv
Returns the key/value pairs in the passed dict in a commaspace-delimited
list in the format "key=value".
�, c S s g | ]\}}|� d |� ��qS )�=r r r r r �
<listcomp>4 s z$_get_option_list.<locals>.<listcomp>)�joinr r r r r �_get_option_list/ s r c C s | r dt | �� �S dS )zS
Common function to get a string to append to the end of the state comment
z"with the following build options: zwith the default build options)r r r r r �_build_option_string7 s r c
s | i d| � d�d�}z(t d | ddd�}t d | ddd�� |r'|tt|�� }� r1� tt� �� � W n" ttfyT } zd|d<