U ]^WUc@s"ddlZddlZddlZddlZddlZejejgadada da ddZ ddZ ddZ dd Zd d Zd1d d ZddZddZddZddZddZddZd2ddZd3ddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Z ej!j"se d.d/Z#e$d0kre#dS)4NcGsBtjj|}ztj|}Wntk r0YnX|tj|fSN)ospathjoinabspathOSErrorZnormcase)Zpathsdirr/usr/lib64/python3.8/site.pymakepath[s  r c CsttjD]~}tt|dddddkr,qztj|j|_Wnt t t fk rZYnXztj|j |_ Wqt t t fk rYqXqdS)NZ __loader__Z __module__)Z_frozen_importlibZ_frozen_importlib_external) setsysZmodulesZvaluesgetattrrrr__file__ZAttributeErrorr TypeErrorZ __cached__)Zmrrr abs_pathsdsrcCsPg}t}tjD],}t|\}}||kr||||q|tjdd<|Sr)r r rr appendadd)ZL known_pathsrdircaserrr removeduppathsts    rc CsVt}tjD]D}z&tj|r4t|\}}||Wq tk rNYq Yq Xq |Sr)r r rrexistsr rr)ZdZitem_Zitemcaserrr _init_pathinfos    rc Csr|dkrt}d}nd}tj||}ztt|}Wntk rPYdSX|t|D]\}}| drvqbzZ| drt |Wqb| }t ||\}} | |krtj |rtj||| Wqbtk rVtd|d|tjdddl} | jtD](} | D]}td |tjdqqtd tjdYqZYqbXqbW5QRX|rnd}|S) NTFz#)zimport zimport z"Error processing line {:d} of {}: )Zfilerz z Remainder of file ignored)rrrrioZ TextIOWrapperZ open_coderZ enumerateZ startswithZexecZrstripr rr rr ExceptionprintZformatstderr tracebackZformat_exceptionexc_infoZ splitlines) sitedirnamerresetZfullnamefZnlinerrrZrecordrrr addpackagesF    r%cCs|dkrt}d}nd}t|\}}||krBtj|||zt|}Wntk rfYdSXdd|D}t |D]}t |||q~|rd}|S)NTFcSsg|]}|dr|qS)z.pth)Zendswith).0r!rrr s zaddsitedir..) rr r rrrrZlistdirrZsortedr%)r rr"Z sitedircaseZnamesr!rrr addsitedirs$    r(cCs`tjjr dSttdr4ttdr4ttkr4dSttdr\ttdr\ttkr\dSdS)NFgetuidgeteuidgetgidgetegidT) r flagsZ no_user_sitehasattrrr*r)r,r+rrrr check_enableusersites r/cCsztjdd}|r|Sdd}tjdkrBtjdp6d}||dStjdkrptjrp|dd tjd tjdd S|dd S) NZPYTHONUSERBASEcWstjtjj|Sr)rr expanduserr)argsrrr joinuserz_getuserbase..joinuserntZAPPDATA~ZPythondarwinZLibraryz%d.%dz.local)renvironZgetr!r platform _framework version_info)Zenv_baser2Zbaserrr _getuserbases   r<cCsdtj}tjdkr,|d|d|ddStjdkrFtjrF|dS|d|dd |dd S) Nr4z\Pythonrrz\site-packagesr6z/lib/python/site-packagesz /lib/pythonZ.z/site-packages)r r;rr!r9r:)userbaseversionrrr _get_path s   r?cCstdkrtatSr) USER_BASEr<rrrr getuserbasesrAcCst}tdkrt|atSr)rA USER_SITEr?)r=rrr getusersitepackages#srCcCs$t}tr tj|r t|||Sr)rCENABLE_USER_SITErrisdirr()r user_siterrr addusersitepackages1s rGc Csg}t}|dkrt}|D]}|r||kr,q||tjdkr|tj|ddtj ddd|tj|ddtj dddq|||tj|dd|tj|ddq|S) Nz/Zlib64Zpythonz site-packagesZlibz python%d.%dr7) r PREFIXESrrseprrrr r>r;)prefixesZ sitepackagesZseenprefixrrr getsitepackages?s*    rMcCsBtrdtjkrtddt|D]}tj|r"t||q"|S)NZRPM_BUILD_ROOTrz /usr/local) rDrr8rIinsertrMrrEr()rrKr rrr addsitepackages^s     rOcCs4tjdkrd}nd}td|t_td|t_dS)Nz\zCtrl-Z plus ReturnzCtrl-D (i.e. EOF)quitexit)rrJ _sitebuiltinsZQuitterbuiltinsrPrQ)Zeofrrr setquitms  rTcCstdtjt_tjdddkr2tddt_ntddt_gg}}ttdrtj tj }| dd g| tj |tj|tjgtd d ||t_dS) N copyrightiZjavacreditsz?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.txtZLICENSElicensez'See https://www.python.org/psf/license/)rRZ_Printerr rUrSr9rVr.rrdirnamerZextendrZpardirZcurdirrW)ZfilesZdirsZhererrr setcopyright}s$  rYcCstt_dSr)rRZ_HelperrShelprrrr sethelperr3r[cCsdd}|t_dS)Ncsddl}zddlddl}Wntk r2YdSXtdd}|dk r\d|kr\dn dz Wntk rYnXdkrt j t j ddz Wntk rYnXfd d }||dS) NrZ__doc__ZZlibeditzbind ^I rl_completez tab: completer5z.python_historyc s,zWnttfk r&YnXdSr)Zwrite_history_fileZFileNotFoundErrorZPermissionErrorrZhistoryreadlinerr write_historyszCenablerlcompleter..register_readline..write_history)atexitr] rlcompleter ImportErrorr Zparse_and_bindZread_init_filerZget_current_history_lengthrrrr0Zread_history_fileZregister)r_r`Z readline_docr^rr\r register_readlines0      z,enablerlcompleter..register_readline)r Z__interactivehook__)rbrrr enablerlcompleters 0rcc CsHtj}tjdkr*d|kr*tjd}t_ntj}tjtj|\}}tj |}dt_ d}ddtj ||tj ||fD}|rD|d}d} t |dd \} | D]P} d | kr| d \} }} | } | } | d kr| } q| d kr| t_ qW5QRX|t_t_t|tjg| dkr8tdtjn tjgad a|S)Nr6Z__PYVENV_LAUNCHER__z pyvenv.cfgcSsg|]}tj|r|qSr)rrZisfile)r&Zconffilerrr r's zvenv..rZtruezutf-8)Zencodingz=zinclude-system-site-packagesZhomeF)rr8r r9Z_base_executable executablerZsplitrrXZ_homerZopenZ partitionZstripZlowerrL exec_prefixrOrIrNrD)rZenvrdZexe_dirrZ site_prefixZ conf_basenameZcandidate_confsZ virtual_confZ system_siter#r$ZkeyZvaluerrr venvsB       rfc CzBz ddl}Wn0tk r>}z|jdkr,nW5d}~XYnXWnRtk r}z4tjjrltjtntj d|j j |fW5d}~XYnXdS)Nr sitecustomizez@Error in sitecustomize; set PYTHONVERBOSE for traceback: %s: %s ) rhrar!rr r-verbose excepthookrrwrite __class____name__)rhexcerrrrr execsitecustomize   rpc Crg)Nr usercustomizez@Error in usercustomize; set PYTHONVERBOSE for traceback: %s: %s ) rrrar!rr r-rirjrrrkrlrm)rrrnrorrr execusercustomizerqrscCs~tjdd}t}|tjkr$tt|}tdkr:tat|}t|}t t t tj j sjtttrztdSr)r rrrrfrDr/rGrOrTrYr[r-Zisolatedrcrprs)Z orig_pathrrrr main/s" rtcCs\d}tjdd}|st}t}tdtjD]}td|fq0tdtd|tj|rbdndftd |tj|rdndftd tt d g}d |kr| t d |kr| t |r(ttj |trt d n6tdkrt dn tdkrt 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 rz sys.path = [z %r,z]zUSER_BASE: %r (%s)rz doesn't existzUSER_SITE: %r (%s)zENABLE_USER_SITE: %rrz --user-basez --user-siteFr7rHi )r ZargvrArCrrrrErDrQrr@rBZpathseprtextwrapZdedent)rZr1Z user_baserFrZbufferrurrr _scriptQsD           rvZ__main__rrr)%r rrSrRrrLrerIrDrBr@r rrrr%r(r/r<r?rArCrGrMrOrTrYr[rcrfrprsrtr-Zno_sitervrmrrrr ZHsF   *      ;4 3