HEX
Server: LiteSpeed
System: Linux ws4.angoweb.net 5.14.0-611.13.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 11 04:57:59 EST 2025 x86_64
User: tswangoe (2287)
PHP: 8.1.33
Disabled: show_source, system, shell_exec, passthru, exec, phpinfo, popen, proc_open
Upload Files
File: //lib/python3.9/site-packages/certbot/plugins/__pycache__/util.cpython-39.opt-1.pyc
a

}|�g�@sndZddlZddlmZddlmZddlmZddlm	Z	e�
e�Ze
ee
d�dd	�Ze
ed
�dd�ZdS)
zPlugin utilities.�N)�List)�util)�os)�STANDARD_BINARY_DIRS)�path�returncCsBtj�|�}g}|r>|�|�tj�|�\}}||dkrq>q|S)a�Retrieves all possible path prefixes of a path, in descending order
    of length. For instance:

      * (Linux) `/a/b/c` returns `['/a/b/c', '/a/b', '/a', '/']`
      * (Windows) `C:\a\b\c` returns `['C:\a\b\c', 'C:\a\b', 'C:\a', 'C:']`

    :param str path: the path to break into prefixes

    :returns: all possible path prefixes of given path in descending order
    :rtype: `list` of `str`
    ���)rr�normpath�append�split)r�prefix�prefixes�_�r�8/usr/lib/python3.9/site-packages/certbot/plugins/util.py�get_prefixess
r)�cmdrcCs�tjd}g}tD]$}||vr|tj|7}|�|�qt|�r`t�d|tj�|��|tjd<t	�
|�rndSt|�rzdnd}t�d|||�dS)z�Attempt to perform PATH surgery to find cmd

    Mitigates https://github.com/certbot/certbot/issues/1833

    :param str cmd: the command that is being searched for in the PATH

    :returns: True if the operation succeeded, False otherwise
    �PATHz6Can't find %s, attempting PATH mitigation by adding %sTz	 expanded�z*Failed to find executable %s in%s PATH: %sF)r�environr�pathsepr
�any�logger�debug�joinrZ
exe_exists)rrZadded�dZexpandedrrr�path_surgery#s$	
�

�r)�__doc__Zlogging�typingrZcertbotrZcertbot.compatrZcertbot.compat.miscrZ	getLogger�__name__r�strr�boolrrrrr�<module>s