Ë
    M/Åe  ã                   óŠ   — d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z	  ej                  e«      Zdedee   fd	„Zd
edefd„Zy)zPlugin utilities.é    N)ÚList)Úutil)Úos)ÚSTANDARD_BINARY_DIRSÚpathÚreturnc                 óÎ   — t         j                  j                  | «      }g }|rA|j                  |«       t         j                  j	                  |«      \  }}||d   k(  r	 |S |rŒA|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   r   ÚnormpathÚappendÚsplit)r   ÚprefixÚprefixesÚ_s       ú6/usr/lib/python3/dist-packages/certbot/plugins/util.pyÚget_prefixesr      sb   € ô �W‰W×Ñ˜dÓ#€FØ€HÙ
Ø�‰˜ÔÜ—G‘G—M‘M &Ó)‰	ˆ�à�X˜b‘\Ò!ØØ€Oò ð €Oó    Úcmdc                 óº  — t         j                  d   }g }t        D ].  }||vsŒ|t         j                  |z   z  }|j	                  |«       Œ0 t        |«      rGt        j                  d| t         j                  j                  |«      «       |t         j                  d<   t        j                  | «      ryt        |«      rdnd}t        j                  d| ||«       y)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)r   r   ÚaddedÚdÚexpandeds        r   Úpath_surgeryr"   #   s·   € ô �:‰:�fÑ€DØ€EÜ!ò ˆØ�DŠ=Ø”B—J‘J ‘NÑ"ˆDØ�L‰L˜�Oðô
 ˆ5„zÜ�‰ÐMØœ"Ÿ*™*Ÿ/™/¨%Ó0ô	2à!Œ�
‰
�6Ñä‡��sÔØÜ! %œj‰{¨b€HÜ
‡L�LÐ=¸sØ˜4ô!àr   )Ú__doc__ÚloggingÚtypingr   Úcertbotr   Úcertbot.compatr   Úcertbot.compat.miscr   Ú	getLoggerÚ__name__r   Ústrr   Úboolr"   © r   r   ú<module>r.      sS   ðÙ Û Ý å Ý Ý 4à	ˆ×	Ñ	˜8Ó	$€ð�sð ˜t C™yó ð.�cð ˜dô r   