File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/pkgin.cpython-310.pyc
o
�N�g�D � @ s` d Z ddlZddlZddlZddlZddlZddlm m Z ddl
ZddlZddlZddl
mZmZ e�d�Ze�e�ZdZe jdd� �Ze jdd � �Ze jd
d� �Ze jdd
� �Zdd� Zdd� Zdd� Zdd� Zejj� ed�Z!dd� Z"d3dd�Z#dd� Z$d3dd�Z%d4d!d"�Z&d5d#d$�Z'd6d%d&�Z(d7d'd(�Z)d7d)d*�Z*d+d,� Z+d-d.� Z,d/d0� Z-d1d2� Z.dS )8aL
Package support for pkgin based systems, inspired from freebsdpkg module
.. important::
If you feel that Salt should be using this module to manage packages on a
minion, and it is using a different module (or gives an error similar to
*'pkg.install' is not available*), see :ref:`here
<module-provider-override>`.
� N)�CommandExecutionError�MinionErrorz%pkgin(?:[\s]+)([\d.]+)(?:[\s]+)(?:.*)�pkgc C sp t jj�d�} | du r6z td ddd�}|dur&|� d�} tj�| �s)W dS W | S W | S ty5 Y dS w | S )zJ
Looks to see if pkgin is present on the system, return full path
�pkginN�cmd.runzpkg_info -Q LOCALBASE pkgin�trace��output_loglevelz
/bin/pkgin)�salt�utils�path�which�__salt__�os�existsr )ZppathZ localbase� r �F/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/pkgin.py�_check_pkgin s$ �
����r c C sD t d t� dgdd�} | du rdS t�| �}|sdS |�d��d�S ) z
Get the pkgin version
r z-vr r NF� �.)r r �
VERSION_MATCH�search�group�split)Zversion_stringZ
version_matchr r r �_get_version3 s
�
r c C � t dd� t� D ��dkS )z!
Check support of regexp
c s � � | ]}t |�V qd S �N��int��.0�ir r r � <genexpr>K � � z"_supports_regex.<locals>.<genexpr>)r � ��tupler r r r r �_supports_regexF � r( c C r )z"
Check support of parsing
c s r r r r r r r r# S r$ z$_supports_parsing.<locals>.<genexpr>)r � r&