| Current Path : /lib/python3/dist-packages/certbot/compat/__pycache__/ |
| Current File : //lib/python3/dist-packages/certbot/compat/__pycache__/misc.cpython-38.pyc |
U
�]r � @ s� d Z ddlmZ ddlZddlZzddlmZ dZW n e k
rL dZY nX ddl
mZ ddlm
Z
ertd d
dgng Zdd
� Zdd� Zdddd�Zdddd�Zdd� Zdd� ZdS )zk
This compat module handles various platform specific calls that do not fall into one
particular category.
� )�absolute_importN)�shellFT)�errors)�osz /usr/sbinz/usr/local/binz/usr/local/sbinc C s t st�� dkrt�d��dS )z�
On Windows, raise if current shell does not have the administrative rights.
Do nothing on Linux.
:raises .errors.Error: If the current shell does not have administrative rights on Windows.
r zAError, certbot must be run on a shell with administrative rights.N)�
POSIX_MODE�
shellwin32Z
IsUserAnAdminr �Error� r r �5/usr/lib/python3/dist-packages/certbot/compat/misc.py�+raise_for_non_administrative_windows_rights s r c C s` z<t � tjgg g | �\}}}|s0t�d�|���|d �� W S tk
rZ tj�� Y S X dS )a(
Read user input to return the first line entered, or raise after specified timeout.
:param float timeout: The timeout in seconds given to the user.
:param str prompt: The prompt message to display to the user.
:returns: The first line entered by the user.
:rtype: str
z,Timed out waiting for answer to prompt '{0}'r N)�select�sys�stdinr r �format�readline�OSError)Ztimeout�promptZrlist�_r r r
�readline_with_timeout$ s �r z
C:\CertbotzC:\Certbot\libzC:\Certbot\log)ZconfigZworkZlogsz/etc/letsencryptz/var/lib/letsencryptz/var/log/letsencryptc C s t jdkrt| S t| S )z�
Return the relevant default folder for the current OS
:param str folder_type: The type of folder to retrieve (config, work or logs)
:returns: The relevant default folder.
:rtype: str
�nt)r �name�LINUX_DEFAULT_FOLDERS�WINDOWS_DEFAULT_FOLDERS)Zfolder_typer r r
�get_default_folderN s
r c C s. t jdkr| S t j�| �\}}||�dd� S )z�
Replace unsupported characters in path for current OS by underscores.
:param str path: the path to normalize
:return: the normalized path
:rtype: str
r �:r )r r �path�
splitdrive�replace)r Zdrive�tailr r r
�.underscores_for_unsupported_characters_in_path` s
r )�__doc__Z
__future__r r r
Zwin32com.shellr r r �ImportErrorZcertbotr Zcertbot.compatr ZSTANDARD_BINARY_DIRSr r r r r r r r r r
�<module> s.
��