HEX
Server: LiteSpeed
System: Linux cluster02.load-balancer.x2.network 4.18.0-553.51.1.lve.1.el8.x86_64 #1 SMP Wed May 14 14:34:57 UTC 2025 x86_64
User: kbdhpghp (1098)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //proc/thread-self/root/lib/python3.6/site-packages/certbot/plugins/__pycache__/util.cpython-36.pyc
3

گa�@sndZddlZddlmZddlmZddlmZddlm	Z	ej
e�Ze
ee
d�dd	�Ze
ed
�dd�ZdS)
zPlugin utilities.�N)�List)�util)�os)�STANDARD_BINARY_DIRS)�path�returncCsFtjj|�}g}x0|r@|j|�tjj|�\}}||dkrPqW|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�/usr/lib/python3.6/util.py�get_prefixess
r)�cmdrcCs�tjd}g}x,tD]$}||kr|tj|7}|j|�qWt|�rdtjd|tjj|��|tjd<t	j
|�rrdSt|�r~dnd}tjd|||�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__ZloggingZtypingrZcertbotrZcertbot.compatrZcertbot.compat.miscrZ	getLogger�__name__r�strr�boolrrrrr�<module>s