Spade
Mini Shell
| Directory:~$ /lib/python2.7/site-packages/certbot/compat/ |
| [Home] [System Details] [Kill Me] |
�
���_c@@sDdZddlmZddlZddlZddlZddlZddlmZddl m
Z
ddlmZm
Z
yddlmZeZWnek
r�eZnXeje�Zer�dd d
gngZd�Zd�Zid
d6dd6dd6Zidd6dd6dd6Zd�Zd�Zdd�Z
dS(sk
This compat module handles various platform specific calls that do not fall
into one
particular category.
i(tabsolute_importN(terrors(tos(tTupletOptional(tshells /usr/sbins/usr/local/bins/usr/local/sbincC@s/tr+tj�dkr+tjd��ndS(s�
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.
isAError, certbot must be run on a shell with administrative
rights.N(t
POSIX_MODEt
shellwin32t
IsUserAnAdminRtError(((s7/usr/lib/python2.7/site-packages/certbot/compat/misc.pyt+raise_for_non_administrative_windows_rightsscC@s|yZtjtjggg|�\}}}|sKtjdj|���n|dj�SWntk
rwtjj�SXdS(s(
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
s,Timed out waiting for answer to prompt
'{0}'iN(tselecttsyststdinRR tformattreadlinetOSError(ttimeouttprompttrlistt_((s7/usr/lib/python2.7/site-packages/certbot/compat/misc.pytreadline_with_timeout*s'
s
C:\CertbottconfigsC:\Certbot\libtworksC:\Certbot\logtlogss/etc/letsencrypts/var/lib/letsencrypts/var/log/letsencryptcC@stjdkrt|St|S(s�
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
tnt(RtnametLINUX_DEFAULT_FOLDERStWINDOWS_DEFAULT_FOLDERS(tfolder_type((s7/usr/lib/python2.7/site-packages/certbot/compat/misc.pytget_default_folderTscC@s?tjdkr|Stjj|�\}}||jdd�S(s�
Replace unsupported characters in path for current OS by underscores.
:param str path: the path to normalize
:return: the normalized path
:rtype: str
Rt:R(RRtpatht
splitdrivetreplace(R
tdrivettail((s7/usr/lib/python2.7/site-packages/certbot/compat/misc.pyt.underscores_for_unsupported_characters_in_pathfscC@s2tjd||�trOtj|dtdtjdtjdtd|�}n<dd|g}tj|dtjdtjdtd|�}|j�\}}tj j
|jdd �d
�}|r�tjd|||�n|j
d
kr tjd|||j
�n|r(tjd
|||�n||fS(s�
Run a command:
- on Linux command will be run by the standard shell selected with
Popen(shell=True)
- on Windows command will be run in a Powershell shell
:param str cmd_name: the user facing name of the hook being run
:param str shell_cmd: shell command to execute
:param dict env: environ to pass into Popen
:returns: `tuple` (`str` stderr, `str` stdout)
sRunning %s command:
%sRtstdouttstderrtuniversal_newlinestenvspowershell.exes-CommandiisOutput
from %s command %s:
%ss&%s command "%s" returned error code %ds#Error output from
%s command %s:
%sN(tloggertinfoRt
subprocesstPopentTruetPIPEtcommunicateRR tbasenametsplittNonet
returncodeterror(tcmd_namet shell_cmdR)tcmdtlinetoutterrtbase_cmd((s7/usr/lib/python2.7/site-packages/certbot/compat/misc.pytexecute_commandws$
" (!t__doc__t
__future__RtloggingRR,RtcertbotRtcertbot.compatRtacme.magic_typingRRtwin32com.shellRRtFalseRtImportErrorR.t getLoggert__name__R*tSTANDARD_BINARY_DIRSR
RRRRR%R3R=(((s7/usr/lib/python2.7/site-packages/certbot/compat/misc.pyt<module>s8