U ]^WU@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)ospathjoinabspathOSErrornormcase)pathsdirr /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)N __loader__ __module__)_frozen_importlib_frozen_importlib_external) setsysmodulesvaluesgetattrrrr__file__AttributeErrorr TypeError __cached__)mr r r abs_pathsdsrcCsPg}t}tjD],}t|\}}||kr||||q|tjdd<|Sr)rrrr appendadd)L known_pathsr dircaser r r removeduppathsts    r"c CsVt}tjD]D}z&tj|r4t|\}}||Wq tk rNYq Yq Xq |Sr)rrrrexistsr rr)ditem_itemcaser r r _init_pathinfos    r(c 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) NTF#)zimport zimport z"Error processing line {:d} of {}: )filerz z Remainder of file ignored)r(rrrio TextIOWrapper open_coder enumerate startswithexecrstripr r#rrr Exceptionprintformatstderr tracebackformat_exceptionexc_info splitlines) sitedirnamer resetfullnamefnliner r!r7recordr r r addpackagesF    rCcCs|dkrt}d}nd}t|\}}||krBtj|||zt|}Wntk rfYdSXdd|D}t |D]}t |||q~|rd}|S)NTFcSsg|]}|dr|qS)z.pth)endswith).0r<r r r s zaddsitedir..) r(r rrrrrlistdirrsortedrC)r;r r= sitedircasenamesr<r r r addsitedirs$    rKcCs`tjjr dSttdr4ttdr4ttkr4dSttdr\ttdr\ttkr\dSdS)NFgetuidgeteuidgetgidgetegidT) rflags no_user_sitehasattrrrMrLrOrNr r r r check_enableusersites rScCsztjdd}|r|Sdd}tjdkrBtjdp6d}||dStjdkrptjrp|dd tjd tjdd S|dd S) NPYTHONUSERBASEcWstjtjj|Sr)rr expanduserr)argsr r r joinusersz_getuserbase..joinuserntAPPDATA~PythondarwinLibraryz%d.%dz.local)renvirongetr<rplatform _framework version_info)env_baserWbaser r r _getuserbases   rfcCsdtj}tjdkr,|d|d|ddStjdkrFtjrF|dS|d|dd |dd S) NrXz\Pythonrr*z\site-packagesr\z/lib/python/site-packagesz /lib/python.z/site-packages)rrcrr<rarb)userbaseversionr r r _get_path s   rjcCstdkrtatSr) USER_BASErfr r r r getuserbasesrlcCst}tdkrt|atSr)rl USER_SITErj)rhr r r getusersitepackages#srncCs$t}tr tj|r t|||Sr)rnENABLE_USER_SITErrisdirrK)r user_siter r r addusersitepackages1s rrc Csg}t}|dkrt}|D]}|r||kr,q||tjdkr|tj|ddtj ddd|tj|ddtj dddq|||tj|dd|tj|ddq|S) N/lib64pythonz site-packageslibz python%d.%dr^) rPREFIXESrrseprrrrrirc)prefixes sitepackagesseenprefixr r r getsitepackages?s*    r~cCsBtrdtjkrtddt|D]}tj|r"t||q"|S)NRPM_BUILD_ROOTrz /usr/local) rorr_rxinsertr~rrprK)r rzr;r r r addsitepackages^s     rcCs4tjdkrd}nd}td|t_td|t_dS)N\zCtrl-Z plus ReturnzCtrl-D (i.e. EOF)quitexit)rry _sitebuiltinsQuitterbuiltinsrr)eofr r r setquitms  rcCstdtjt_tjdddkr2tddt_ntddt_gg}}ttdrtj 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_PrinterrrrrarrRrrdirnamerextendrpardircurdirr)filesdirsherer r r setcopyright}s$  rcCstt_dSr)r_Helperrhelpr r r r sethelpersrcCsdd}|t_dS)Ncsddl}zddlddl}Wntk r2YdSXtdd}|dk r\d|kr\dn dz Wntk rYnXdkrt j t j ddz Wntk rYnXfd d }||dS) Nr__doc__libeditzbind ^I rl_completez tab: completerZz.python_historyc s,zWnttfk r&YnXdSr)write_history_fileFileNotFoundErrorPermissionErrorr historyreadliner r write_historyszCenablerlcompleter..register_readline..write_history)atexitr rlcompleter ImportErrorrparse_and_bindread_init_filerget_current_history_lengthrrrrUread_history_fileregister)rr readline_docrr rr register_readlines0      z,enablerlcompleter..register_readline)r__interactivehook__)rr r r enablerlcompleters 0rc 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)Nr\__PYVENV_LAUNCHER__z pyvenv.cfgcSsg|]}tj|r|qSr )rrisfile)rEconffiler r r rFs zvenv..rtruezutf-8)encoding=zinclude-system-site-packageshomeF)rr_rra_base_executable executablersplitrr_homeropen partitionstriplowerr} exec_prefixrrxrro)r envrexe_dirr& site_prefix conf_basenamecandidate_confs virtual_conf system_siter?rAkeyvaluer r r venvsB       rc CszBz 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 ) rrr<r3rrPverbose excepthookr9r6write __class____name__)rexcerrr r r execsitecustomizes   rc CszBz ddl}Wn0tk r>}z|jdkr,nW5d}~XYnXWnRtk r}z4tjjrltjtntj d|j j |fW5d}~XYnXdS)Nr usercustomizez@Error in usercustomize; set PYTHONVERBOSE for traceback: %s: %s ) rrr<r3rrPrrr9r6rrr)rrrr r r execusercustomizes   rcCs~tjdd}t}|tjkr$tt|}tdkr:tat|}t|}t t t tj j sjtttrztdSr)rrr"rrrorSrrrrrrrPisolatedrrr) orig_pathr r r r main/s" rcCs\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 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^rv )rargvrlrnr4rrrprorrrkrmpathseprtextwrapdedent)rrV user_baserqr bufferrr r r _scriptQsD           r__main__)N)N)N)%rrrrr,r}rrxrormrkr rr"r(rCrKrSrfrjrlrnrrr~rrrrrrrrrrPno_siterrr r r r HsF   *      ;4 3