a X�ZgEV�@s*ddlZddlZddlZddlZddlZddlZejejgada da da dd�Z dd�Z dd�Zdd �Zd d �Zd1d d �Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd2dd�Zd3dd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Z d,d-�Z!ej"j#�se!�d.d/�Z$e%d0k�r&e$�dS)4�NcGs@tjj|�}ztj�|�}Wnty.Yn0|tj�|�fS�N)�os�path�join�abspath�OSError�normcase)�paths�dir�r �/usr/lib64/python3.9/site.py�makepath\s   r c Cs�ttj���D]z}tt|dd�dd�dvr,qztj�|j�|_Wnt t t fyXYn0ztj�|j �|_ Wqt t t fy�Yq0qdS)N� __loader__� __module__)�_frozen_importlib�_frozen_importlib_external) �set�sys�modules�values�getattrrrr�__file__�AttributeErrorr� TypeError� __cached__)�mr r r � abs_pathses�rcCsPg}t�}tjD],}t|�\}}||vr|�|�|�|�q|tjdd�<|Sr)rrrr �append�add)�L� known_pathsr �dircaser r r �removeduppathsus    r"c CsTt�}tjD]B}z&tj�|�r4t|�\}}|�|�Wq tyLYq Yq 0q |Sr)rrrr�existsr rr)�d�item�_�itemcaser r r �_init_pathinfo�s     r(c Cs�|durt�}d}nd}tj�||�}zt�|�}WntyHYdS0t|dd�tj@snt|dd�tj @rrdSzt � t � |��}Wnty�YdS0|��t |�D]�\}}|�d�r�q�z^|�d�r�t|�Wq�|��}t||�\} } | |v�rtj�| ��rtj�| �|�| �Wq�t�y�td�|d |�tjd �ddl} | jt���D](} | ��D]}td |tjd ��qj�q^td tjd �Y�q�Yq�0q�Wd�n1�s�0Y|�r�d}|S) NTF�st_flagsr�st_file_attributes�#)zimport zimport z"Error processing line {:d} of {}: �)�filez z Remainder of file ignored)r(rrr�lstatrr�stat� UF_HIDDEN�FILE_ATTRIBUTE_HIDDEN�io� TextIOWrapper� open_code� enumerate� startswith�exec�rstripr r#rrr� Exception�print�format�stderr� traceback�format_exception�exc_info� splitlines) �sitedir�namer �reset�fullname�st�f�n�liner r!r=�recordr r r � addpackage�sV �    � 0rJcCs�|durt�}d}nd}t|�\}}||vrBtj�|�|�|�zt�|�}WntydYdS0dd�|D�}t |�D]}t |||�q||r�d}|S)NTFcSs$g|]}|�d�r|�d�s|�qS)z.pth�.)�endswithr6)�.0rBr r r � �s�zaddsitedir..) r(r rrrrr�listdirr�sortedrJ)rAr rC� sitedircase�namesrBr r r � addsitedir�s$     rScCs`tjjr dSttd�r4ttd�r4t��t��kr4dSttd�r\ttd�r\t��t��kr\dSdS)NF�getuid�geteuid�getgid�getegidT) r�flags� no_user_site�hasattrrrUrTrWrVr r r r �check_enableusersite�s r[cCsztj�dd�}|r|Sdd�}tjdkrBtj�d�p6d}||d�Stjdkrptjrp|dd tjd tjdd ��S|dd �S) N�PYTHONUSERBASEcWstj�tjj|��Sr)rr� expanduserr)�argsr r r �joinusersz_getuserbase..joinuser�nt�APPDATA�~�Python�darwin�Libraryz%d.%d�z.local)r�environ�getrBr�platform� _framework� version_info)�env_baser_�baser r r � _getuserbase�s   �rncCsdtj}tjdkr,|�d|d�|d�d�StjdkrFtjrF|�d�S|�d|d�d |d�d �S) Nr`z\Pythonrr,z\site-packagesrdz/lib/python/site-packagesz /lib/pythonrKz/site-packages)rrkrrBrirj)�userbase�versionr r r � _get_paths   rqcCstdurt�atSr)� USER_BASErnr r r r � getuserbasesrscCst�}tdurt|�atSr)rs� USER_SITErq)ror r r �getusersitepackages,srucCs$t�}tr tj�|�r t||�|Sr)ru�ENABLE_USER_SITErr�isdirrS)r � user_siter r r �addusersitepackages:s ryc Cs�g}t�}|durt}|D]�}|r||vr,q|�|�tjg}tjdkrR|�d�tjdkr�|D].}tj� ||dtj dd�d�}|�|�q`q|�|�|D]}tj� ||d�}|�|�q�q|S)N�lib�/z python%d.%drfz site-packages) r�PREFIXESrr� platlibdirrr�seprrrk)�prefixes� sitepackages�seen�prefix�libdirs�libdirrr r r �getsitepackagesHs.      � r�cCsBtrdtjvrt�dd�t|�D]}tj�|�r"t||�q"|S)N�RPM_BUILD_ROOTrz /usr/local) rvrrgr|�insertr�rrwrS)r rrAr r r �addsitepackagesls     r�cCs4tjdkrd}nd}t�d|�t_t�d|�t_dS)N�\zCtrl-Z plus ReturnzCtrl-D (i.e. EOF)�quit�exit)rr~� _sitebuiltins�Quitter�builtinsr�r�)�eofr r r �setquit{s  r�cCs�t�dtj�t_tjdd�dkr2t�dd�t_nt�dd�t_gg}}ttd�r�tj � tj �}|� dd g�|� tj � |tj�|tjg�t�d d ||�t_dS) N� copyright��java�creditsz?Jython is maintained by the Jython developers (www.jython.org).z� Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands for supporting Python development. See www.python.org for more information.rz LICENSE.txt�LICENSE�licensez'See https://www.python.org/psf/license/)r��_Printerrr�r�rir�rZrr�dirnamer�extendr�pardir�curdirr�)�files�dirs�herer r r � setcopyright�s"�  �r�cCst��t_dSr)r��_Helperr��helpr r r r � sethelper�sr�cCsdd�}|t_dS)Ncs�ddl}zddl�ddl}Wnty0YdS0t�dd�}|durZd|vrZ��d�n ��d�z ���Wnty�Yn0���dkr�t j � t j � d�d��z�� ��Wnty�Yn0��fd d �}|�|�dS) Nr�__doc__��libeditzbind ^I rl_completez tab: completerbz.python_historycs&z����Wnty Yn0dSr)�write_history_filerr ��history�readliner r � write_history�s zCenablerlcompleter..register_readline..write_history)�atexitr�� rlcompleter� ImportErrorr�parse_and_bind�read_init_filer�get_current_history_lengthrrrr]�read_history_file�register)r�r�� readline_docr�r r�r �register_readline�s0        � z,enablerlcompleter..register_readline)r�__interactivehook__)r�r r r �enablerlcompleter�s 0r�cCs^tj}tjdkr*d|vr*tjd}t_ntj}tj�tj�|��\}}tj� |�}dt_ d}dd�tj� ||�tj� ||�fD�}|�rZ|d}d} t |dd ��f} | D]P} d | vr�| � d �\} }} | ����} | ��} | d kr�| ��} q�| d kr�| t_ q�Wd�n1�s0Y|t_t_t|tjg�| dk�rNt�dtj�n tjgad a|S)Nrd�__PYVENV_LAUNCHER__z pyvenv.cfgcSsg|]}tj�|�r|�qSr )rr�isfile)rM�conffiler r r rN�s �zvenv..r�truezutf-8)�encoding�=zinclude-system-site-packages�homeF)rrgrri�_base_executable� executabler�splitrr��_homer�open� partition�strip�lowerr�� exec_prefixr�r|r�rv)r �envr��exe_dirr&� site_prefix� conf_basename�candidate_confs� virtual_conf� system_siterFrH�key�valuer r r �venv�sB   ��  (  r�c Cs�zDz ddl}Wn2ty@}z|jdkr*n�WYd}~n d}~00WnTty�}z2 - unknown error r,z sys.path = [z %r,�]zUSER_BASE: %r (%s)r#z doesn't existzUSER_SITE: %r (%s)zENABLE_USER_SITE: %rrz --user-basez --user-siteFrf�� )r�argvrsrur:rrrwrvr�rrrrt�pathsepr�textwrap�dedent)r�r^� user_baserxr �bufferr�r r r �_script_sD ��          r��__main__)N)N)N)&rrr�r�r2r/r�r�r|rvrtrrr rr"r(rJrSr[rnrqrsruryr�r�r�r�r�r�r�r�r�r�rX�no_siter�r�r r r r �HsH   1     $ ;4 3