Your IP : 216.73.216.172


Current Path : /lib/python3/dist-packages/certbot/plugins/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/certbot/plugins/__pycache__/util.cpython-38.pyc

U

�]��@sNdZddlZddlmZddlmZddlmZe�e	�Z
dd�Zdd	�ZdS)
zPlugin utilities.�N)�util)�os)�STANDARD_BINARY_DIRScCsBtj�|�}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`
    ���)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]$}||kr|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)�cmdrZadded�dZexpandedr
r
r�path_surgery s(	

�

�r)
�__doc__ZloggingZcertbotrZcertbot.compatrZcertbot.compat.miscrZ	getLogger�__name__rrrr
r
r
r�<module>s