HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux ip-10-0-8-47 6.8.0-1021-aws #23~22.04.1-Ubuntu SMP Tue Dec 10 16:31:58 UTC 2024 aarch64
User: ubuntu (1000)
PHP: 8.1.2-1ubuntu2.22
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/certbot/plugins/__pycache__/util.cpython-310.pyc
o

6��a��@sNdZddlZddlmZddlmZddlmZe�e	�Z
dd�Zdd	�ZdS)
zPlugin utilities.�N)�util)�os)�STANDARD_BINARY_DIRScCsHtj�|�}g}|r"|�|�tj�|�\}}||dkr 	|S|s
|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`
    ���)r�path�normpath�append�split)r�prefix�prefixes�_�r
�6/usr/lib/python3/dist-packages/certbot/plugins/util.py�get_prefixess
�rcCs�tjd}g}tD]}||vr|tj|7}|�|�q	t|�r0t�d|tj�|��|tjd<t	�
|�r7dSt|�r=dnd}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)�cmdr�added�d�expandedr
r
r�path_surgery"s&
	
��

�r)
�__doc__�logging�certbotr�certbot.compatr�certbot.compat.miscr�	getLogger�__name__rrrr
r
r
r�<module>s