HEX
Server: Apache/2.4.67 (Debian)
System: Linux vps-b2547eb4 6.1.0-41-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.158-1 (2025-11-09) x86_64
User: root (0)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/certbot/plugins/__pycache__/util.cpython-311.pyc
�

E��c���dZddlZddlmZddlmZddlmZddlm	Z	ej
e��Zde
dee
fd	�Zd
e
defd�ZdS)zPlugin utilities.�N)�List)�util)�os)�STANDARD_BINARY_DIRS�path�returnc���tj�|��}g}|rF|�|��tj�|��\}}||dkrn|�F|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�_s    �6/usr/lib/python3/dist-packages/certbot/plugins/util.py�get_prefixesrsr���W�
�
�d�
#�
#�F��H�
����������G�M�M�&�)�)�	����X�b�\�!�!�����O��cmdc���tjd}g}tD]-}||vr'|tj|zz
}|�|���.t|��rHt�d|tj�|����|tjd<tj
|��rdSt|��rdnd}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�joinr�
exe_exists)rr�added�d�expandeds     r�path_surgeryr"#s����:�f��D��E�
!�����D�=�=��B�J��N�"�D��L�L��O�O�O��
�5�z�z�"����M��"�*�/�/�%�0�0�	2�	2�	2�!��
�6����s�����t�!�%�j�j�0�{�{�b�H�
�L�L�=�s��4�!�!�!��5r)�__doc__�logging�typingr�certbotr�certbot.compatr�certbot.compat.miscr�	getLogger�__name__r�strr�boolr"�rr�<module>r.s���������������������������4�4�4�4�4�4�	��	�8�	$�	$���s��t�C�y�����.�c��d������r