B 19L@sddlZddlZddlZddlZejejgadadada ddZ ddZ ddZ dd Z d d Zd1d d ZddZddZddZddZddZddZd2ddZd3ddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zej j!s㧐d.d/Z"e#d0kre"dS)4NcGsBtjj|}ytj|}Wntk r0YnX|tj|fS)N)ospathjoinabspathOSErrornormcase)pathsdirr '/opt/alt/python37/lib/python3.7/site.pymakepathZs  r c Csx恡tjD]~}tt|dddddkr.qytj|j|_Wnt t t fk r\YnXytj|j |_ Wqt t t fk rYqXqWdS)N __loader__ __module__)_frozen_importlib_frozen_importlib_external) setsysmodulesvaluesgetattrrrr__file__AttributeErrorr TypeError __cached__)mr r r abs_pathscsrcCsTg}t}x6tjD],}t|\}}||kr||||qW|tjdd<|S)N)rrrr appendadd)L known_pathsr dircaser r r removeduppathsss   r!c CsXt}xLtjD]B}y&tj|r6t|\}}||Wqtk rNwYqXqW|S)N)rrrrexistsr rr)ditem_itemcaser r r _init_pathinfos    r'c Csp|dkrt}d}nd}tj||}yt|d}Wntk rHdSX| xt|D]鯸}}|drrq^yX|dr坱|w^| }t ||\}} | |kr萾j |r萾 j ||| Wq^tk rRtd|d|t jdd dl} x>| jt D],} x$| D]}td |t jdqWqWtd t jdPYq^Xq^WWdQRX|rld}|S) NTFr#)zimport zimport z"Error processing line {:d} of {}: )filerz z Remainder of file ignored)r'rrropenr enumerate startswithexecrstripr r"rrr Exceptionprintformatstderr tracebackformat_exceptionexc_info splitlines) sitedirnamerresetfullnamefnliner r r5recordr r r addpackagesD    rAcCs|dkrt}d}nd}t|\}}||krBtj|||yt|}Wntk rddSXdd|D}xt |D]}t |||q~W|r歞}|S)NTFcSsg|]}|dr|qS)z.pth)endswith).0r:r r r szaddsitedir..) r'r rrrrrlistdirrsortedrA)r9rr; sitedircasenamesr:r r r addsitedirs$   rIcCs`tjjr dSttdr4ttdr4ttkr4dSttdr\ttdr\ttkr\dSdS)NFgetuidgeteuidgetgidgetegidT) rflags no_user_sitehasattrrrKrJrMrLr r r r check_enableusersites rQcCsztjdd}|r|Sdd}tjdkrBtjdp6d}||dStjdkrptjrp|dd tjd tjdd S|dd S) NPYTHONUSERBASEcWstjtjj|S)N)rr expanduserr)argsr r r joinusersz_getuserbase..joinuserntAPPDATA~PythondarwinLibraryz%d.%dz.local)renvirongetr:rplatform _framework version_info)env_baserUbaser r r _getuserbases   rdcCsdtj}tjdkr,|d|d|ddStjdkrFtjrF|dS|d|dd |dd S) NrVz\Pythonrr*z\site-packagesrZz/lib/python/site-packagesz /lib/python.z/site-packages)rrarr:r_r`)userbaseversionr r r _get_path s   rhcCstdkrtatS)N) USER_BASErdr r r r getuserbasesrjcCst}tdkrt|atS)N)rj USER_SITErh)rfr r r getusersitepackages"srlcCs$t}tr tj|r t|||S)N)rlENABLE_USER_SITErrisdirrI)r user_siter r r addusersitepackages0s rpc Csg}t}|dkrt}xv|D]n}|r||kr.q||tjdkrj|tj|ddtj dddq|||tj|ddqW|S)N/libz python%d.%dr\z site-packages) rPREFIXESrrseprrrrra)prefixes sitepackagesseenprefixr r r getsitepackages>s      rycCs,x&t|D]}tj|r t||q W|S)N)ryrrrnrI)rrur9r r r addsitepackagesYs rzcCs4tjdkrd}nd}td|t_td|t_dS)N\zCtrl-Z plus ReturnzCtrl-D (i.e. EOF)quitexit)rrt _sitebuiltinsQuitterbuiltinsr|r})eofr r r setquitas  rcCstdtjt_tjdddkr2tddt_ntddt_gg}}ttdr巘j tj }| dd g| tj |tj|tjgtd d ||t_dS) N copyrightjavacreditsz?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.txtLICENSElicensez'See https://www.python.org/psf/license/)r~_Printerrrrr_rrPrrdirnamerextendrpardircurdirr)filesdirsherer r r setcopyrightqs    rcCstt_dS)N)r~_Helperrhelpr r r r sethelpersrcCsdd}|t_dS)Ncsddl}yddlddl}Wntk r0dSXtdd}|dk rZd|krZdn dy Wntk rYnXdkr鋞 j t j ddy Wntk rYnXfd d }||dS) Nr__doc__libeditzbind ^I rl_completez tab: completerXz.python_historyc s,yWnttfk r&YnXdS)N)write_history_fileFileNotFoundErrorPermissionErrorr )historyreadliner r write_historyszCenablerlcompleter..register_readline..write_history)atexitr rlcompleter ImportErrorrparse_and_bindread_init_filerget_current_history_lengthrrrrSread_history_fileregister)rr readline_docrr )rrr register_readlines.      z,enablerlcompleter..register_readline)r__interactivehook__)rr r r enablerlcompleters 0rc CsLtj}tjdkr*d|kr*tjd}t_ntj}tjtj|\}}tj |}dt_ d}ddtj ||tj ||fD}|rH|d}d} t |dd 廯} xX| D]P} d | kr獆 d \} }} | } | } | d kr靯 } q獆 d kr獆 t_ q猈WdQRX|t_t_t|tjg| dkr.rtruezutf-8)encoding=zinclude-system-site-packageshomeF)rr]rr__base_executable executablersplitrr_homerr, partitionstriplowerrx exec_prefixrzrsinsertrm)renvrexe_dirr% site_prefix conf_basenamecandidate_confs virtual_conf system_siter=r?keyvaluer r r venvs>       rc CsyBy ddl}Wn0tk r>}z|jdkr,nWdd}~XYnXWnRtk r}z4tjjrltjtntj d|j j |fWdd}~XYnXdS)Nr sitecustomizez@Error in sitecustomize; set PYTHONVERBOSE for traceback: %s: %s ) rrr:r1rrNverbose excepthookr7r4write __class____name__)rexcerrr r r execsitecustomizes  rc CsyBy ddl}Wn0tk r>}z|jdkr,nWdd}~XYnXWnRtk r}z4tjjrltjtntj d|j j |fWdd}~XYnXdS)Nr usercustomizez@Error in usercustomize; set PYTHONVERBOSE for traceback: %s: %s ) rrr:r1rrNrrr7r4rrr)rrrr r r execusercustomizes  rcCs~tjdd}t}|tjkr$tt|}tdkr:tat|}t|}t t t tj j sjtttrztdS)N)rrr!rrrmrQrprzrrrrNisolatedrrr) orig_pathrr r r main#s" rcCs`d}tjdd}|s}t}tdxtjD]}td|fq2Wtdtd|tj|rfdndftd |tj|r哾ndftd tt d g}d |kr紎 t d |kr蝲 t |r,ttj |tr魌 d n6tdkr t dn tdkr t dn t dn0d dl}t||tjd tj ft ddS)Na %s [--user-base] [--user-site] Without arguments print some useful information With arguments print the value of USER_BASE and/or USER_SITE separated by '%s'. Exit codes with --user-base or --user-site: 0 - user site directory is enabled 1 - user site directory is disabled by user 2 - uses site directory is disabled by super user or for security reasons >2 - 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-siteFr\ )rargvrjrlr2rrrnrmr}rrirkpathseprtextwrapdedent)rrT user_baseror bufferrr r r _scriptEs@           r__main__)N)N)N)$rrrr~rxrrsrmrkrir rr!r'rArIrQrdrhrjrlrpryrzrrrrrrrrrNno_siterrr r r r HsD   *      ;4 3