U
    [                     @   sV   d dl Z d dlZd dlZddlmZ ejeddd   Zdd Z	dd Z
d	d
 ZdS )    N   )PY2.c                  C   sl   dd l } ttdsdS td}d}|d k	rh|jdddrP|j}|d7 }q$|jj	| j
j@ rh|S qhq$dS )Nr   	_getframer   __name__ zclick.)
__future__hasattrsysr   	f_globalsget
startswithf_backf_codeco_flagsZunicode_literalsZcompiler_flag)r   Zfrmidx r   3/usr/lib/python3/dist-packages/click/_unicodefun.py_find_unicode_literals_frame   s    


r   c                  C   s@   t r
tjrd S t } | dkr d S ddlm} |td| d d S )Nr   )warna  Click detected the use of the unicode_literals __future__ import.  This is heavily discouraged because it can introduce subtle bugs in your code.  You should instead use explicit u"" literals for your unicode strings.  For more information see https://click.palletsprojects.com/python3/)
stacklevel)r   clickZ disable_unicode_literals_warningr   warningsr   Warning)Z	bad_framer   r   r   r   _check_for_unicode_literals    s    
r   c            	      C   s  t rdS zddl} t|  j}W n tk
r<   d}Y nX |dkrJdS d}tjdkrddl}z$|j	ddg|j
|j
d d }W n tk
r   d	}Y nX t }d
}t|tr|dd}| D ]4}| } |  dr||  |  dkrd}q|d7 }|s|d7 }n&|r&|d7 }n|ddt| 7 }d}tjdtjdfD ]0} | rv|  drv| }| dk	rX qqX|dk	r|d| 7 }td| dS )z=Ensures that the environment is good for unicode on Python 3.Nr   asciir   posixlocalez-a)stdoutstderr    Freplace)z.utf-8z.utf8)zc.utf8zc.utf-8Tz

zAdditional information: on this system no suitable UTF-8
locales were discovered.  This most likely requires resolving
by reconfiguring the locale system.zThis system supports the C.UTF-8 locale which is recommended.
You might be able to resolve your issue by exporting the
following environment variables:

    export LC_ALL=C.UTF-8
    export LANG=C.UTF-8zThis system lists a couple of UTF-8 supporting locales that
you can pick from.  The following suitable locales were
discovered: %sz, LC_ALLZLANGz

Click discovered that you exported a UTF-8 locale
but the locale system could not pick up from it because
it does not exist.  The exported locale is "%s" but it
is not supportedzClick will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult https://click.palletsprojects.com/en/7.x/python3/ for mitigation steps.)r   r   codecslookupgetpreferredencodingname	Exceptionos
subprocessPopenPIPEZcommunicateOSErrorset
isinstancebytesdecode
splitlinesstriplowerendswithaddjoinsortedenvironr   RuntimeError)	r   Zfs_encZextrar)   rvZgood_localesZ
has_c_utf8lineZ
bad_localer   r   r   _verify_python3_env2   sv    






r<   )r(   r
   r#   Z_compatr   modulesr   rsplitr   r   r   r<   r   r   r   r   <module>   s   