f_]^dZddlZddlZddlZddlZddlZddlZejejga da da da dZ dZdZdZdZdZdd Zd Zd Zd Zd ZdZdZddZddZdZdZdZdZdZ dZ!dZ"dZ#ejHjJse#dZ&e'dk(re&yy)a Append module search paths for third-party packages to sys.path. **************************************************************** * This module is automatically imported during initialization. * **************************************************************** This will append site-specific paths to the module search path. On Unix (including Mac OSX), it starts with sys.prefix and sys.exec_prefix (if different) and appends lib/python3/dist-packages. On other platforms (such as Windows), it tries each of the prefixes directly, as well as with lib/site-packages appended. The resulting directories, if they exist, are appended to sys.path, and also inspected for path configuration files. For Debian and derivatives, this sys.path is augmented with directories for packages distributed within the distribution. Local addons go into /usr/local/lib/python/dist-packages, Debian addons install into /usr/lib/python3/dist-packages. /usr/lib/python/site-packages is not used. If a file named "pyvenv.cfg" exists one directory above sys.executable, sys.prefix and sys.exec_prefix are set to that directory and it is also checked for site-packages (sys.base_prefix and sys.base_exec_prefix will always be the "real" prefixes of the Python installation). If "pyvenv.cfg" (a bootstrap configuration file) contains the key "include-system-site-packages" set to anything other than "false" (case-insensitive), the system-level prefixes will still also be searched for site-packages; otherwise they won't. All of the resulting site-specific directories, if they exist, are appended to sys.path, and also inspected for path configuration files. A path configuration file is a file whose name has the form .pth; its contents are additional directories (one per line) to be added to sys.path. Non-existing directories (or non-directories) are never added to sys.path; no directory is added to sys.path more than once. Blank lines and lines beginning with '#' are skipped. Lines starting with 'import' are executed. For example, suppose sys.prefix and sys.exec_prefix are set to /usr/local and there is a directory /usr/local/lib/python2.5/site-packages with three subdirectories, foo, bar and spam, and two path configuration files, foo.pth and bar.pth. Assume foo.pth contains the following: # foo package configuration foo bar bletch and bar.pth contains: # bar package configuration bar Then the following directories are added to sys.path, in this order: /usr/local/lib/python2.5/site-packages/bar /usr/local/lib/python2.5/site-packages/foo Note that bletch is omitted because it doesn't exist; bar precedes foo because bar.pth comes alphabetically before foo.pth; and spam is omitted because it is not mentioned in either path configuration file. The readline module is also automatically configured to enable completion for systems that support it. This can be overridden in sitecustomize, usercustomize or PYTHONSTARTUP. Starting Python in isolated mode (-I) disables automatic readline configuration. After these operations, an attempt is made to import a module named sitecustomize, which can perform arbitrary additional site-specific customizations. If this import fails with an ImportError exception, it is silently ignored. Ncptjjrt|tjyy)Nfile)sysflagsverboseprintstderr)messages /usr/lib/python3.12/site.py_tracer bs" yy gCJJ'ctjj|} tjj|}|tjj |fS#t$rY,wxYwN)ospathjoinabspathOSErrornormcase)pathsdirs r makepathrgs[ '',, C ggooc"   % %%    sA A*)A*c<ttjjD]~}d} |jj }|dvr! tjj|j|_ tjj|j|_y#t $r4 |jjj }n#t $rYnwxYwYwxYw#t ttf$rYwxYw#t ttf$rYwxYw)zESet all module __file__ and __cached__ attributes to an absolute pathN>_frozen_importlib_frozen_importlib_external)setrmodulesvalues __loader__ __module__AttributeError__spec__loaderrrr__file__r TypeError __cached__)m loader_modules r abs_pathsr*ps ##% &  LL33M  S S  4AJ 77??1<<8AL!   ! 1 1 < < !   3   3   sYB* .C*9.D* C'4 CC' C!C' C!!C'&C'*DDDDcg}t}tjD]7}t|\}}||vs|j ||j |9|tjdd|S)zK Remove duplicate entries from sys.path along with making them absoluteN)rrrrappendadd)L known_pathsrdircases r removeduppathsr1sf A%Kxx% } W + % HHSM OOG $%CHHQK rct}tjD]A} tjj |rt |\}}|j |C|S#t$rYQwxYw)zEReturn a set containing all existing file system items from sys.path.)rrrrexistsrr-r&)ditem_itemcases r _init_pathinfor8se A ww~~d#&tn 8h  H   s>A!! A-,A-c | t}d}nd}tjj||} tj|}t |ddtjzst |ddtjzrtd|ytd| tjtj|d }|5t|D]\}}|jd r|j!d k(r, |jd r t#|J|j%}t'||\} } | |vrOtjj)| r0t*jj-| |j/| ddd|rd}|S#t $rYywxYw#t $rYywxYw#t0$r} t3dj5|dz|t*j6ddl} | j;| D]5} | j=D] }t3d|zt*j6"7t3dt*j6Yd} ~ d} ~ wwxYw#1swYxYw)zProcess a .pth file within the site-packages directory: For each line in the file, either combine it with sitedir to a path and add that to known_paths, or execute it if it starts with 'import '. NTFst_flagsrst_file_attributeszSkipping hidden .pth file: zProcessing .pth file: localeencoding#)zimport zimport z"Error processing line {:d} of {}: rz z Remainder of file ignored)r8rrrlstatrgetattrstat UF_HIDDENFILE_ATTRIBUTE_HIDDENr io TextIOWrapper open_code enumerate startswithstripexecrstriprr3rr,r- Exceptionr formatr tracebackformat_exception splitlines)sitedirnamer/resetfullnamestfnlinerr0excrQrecords r addpackager^s: $& ww||GT*H XXh  Z #dnn 4 )1 -0J0J J,XL9: #H< 01   R\\(3h G  | GAts#zz|r! ??#:;J{{}'6 W+-"''..2EHHOOC(OOG, 0  O  " ;BB1Q3Q::' '88=:F & 1 1 3:d4icjj9::3#**E sgF&"*F58I1G#I1$A2GI1& F21F25 GG I. BI)#I1)I..I11I:ctd|| t}d}nd}t|\}}||vr0tjj ||j | tj|}|Dcgc]&}|jdr|jds|(}}t|D]}t||||rd}|S#t$rYywxYwcc}w)zTAdd 'sitedir' argument to sys.path if missing and handle .pth files in 'sitedir'zAdding directory: NTFz.pth.)r r8rrrr,r-rlistdirrendswithrKsortedr^)rTr/rV sitedircasenamesrUs r addsitedirrfs { +,$& #G,G[ + %   $ 7#$ Dd f%dooc.B DE Du /7D+./    Ds#C <+C CCcbtjjryttdr:ttdr*t j t j k7ryttdr:ttdr*t jt jk7ryy)a,Check if user site directory is safe for inclusion The function tests for the command line flag (including environment var), process uid/gid equal to effective uid/gid. None: Disabled for security reasons False: Disabled by user (command line option) True: Safe and enabled FgetuidgeteuidNgetgidgetegidT) rr no_user_sitehasattrrrirhrkrjrr check_enableusersiterosk yyr8Y!7 ::<299; &r8Y!7 ::<299; & rc tjjdd}|r|Stjdvryd}tj dk(r,tjjdxsd}||dStjdk(r=tj r-|dd tj d tjdd zS|dd S) NPYTHONUSERBASE>wasivxworks emscriptencttjjtjj|Sr)rr expanduserr)argss r joinuserz_getuserbase..joinuser!s$ww!!"'',,"566rntAPPDATA~PythondarwinLibraryz%d.%dz.local)renvirongetrplatformrU _framework version_info)env_baserxbases r _getuserbaserszz~~.5H ||887 ww$zz~~i(/Ch'' ||xCNNY#"2"22A"668 8 C ""rc tj}tjdk(r(tjj dd}|d|dStj dk(rtjr|dS|d|d d|d d S) Nryr`r@z\Pythonz\site-packagesr}z/lib/python/site-packagesz /lib/pythonrrAz/site-packages)rrrrUwinverreplacerr)userbaseversion ver_nodots r _get_pathr0sG ww$JJ&&sB/ 8I;o>> ||xCNN455Z{71:,a |> JJrc.t tatS)zReturns the `user base` directory path. The `user base` directory can be used to store data. If the global variable ``USER_BASE`` is not initialized yet, this function will also set it. ) USER_BASErrnrr getuserbaser=s N rcXt}t|datSt|atS)zReturns the user-specific site-packages directory path. If the global variable ``USER_SITE`` is not initialized yet, this function will also set it. F)r USER_SITEENABLE_USER_SITEr)rs r getusersitepackagesrJs7}H  $  "(+I rctdt}tr+tjj |r t |||S)zAdd a per user site-package to sys.path Each user has its own python directory with site-packages in the home directory. zProcessing user site-packages)r rrrrisdirrf)r/ user_sites r addusersitepackagesr[s7 *+#%IBGGMM)49k* rc g}t}|t}tjtjk7xst td}|D]}|r||vr |j |tjdk(rBtjg}tjdk7r|jd|rE|jtjj|ddtjddzd|jtjj|ddtjddzd |jtjj|dd d |D]I}tjj||dtjddzd }|j|Kr|j||jtjj|d d|S) aReturns a list containing all global site-packages directories. For each directory present in ``prefixes`` (or the global ``PREFIXES``), this function will find its `site-packages` subdirectory depending on the system environment, and will return a list of full paths. N real_prefix/libz python%d.%drz site-packagesz local/libz dist-packagespython3Lib)rPREFIXESr base_prefixprefixrmr-rsep platlibdirr,rrr)prefixes sitepackagesseenis_virtual_environmentrlibdirslibdirrs r getsitepackagesrjsL 5D __ :Ygc=>YN4   66S=~~&G~~&u%%##BGGLL1>AQAQRTSTAU1U1@%BC    V[-:S=M=Mbq=Q-Q-<!> ?    VU-6-<!> ?" *ww||FF$1C4D4DRa4H$H$35##D)  *    '    VUO L M9N: rctdt|D].}tjj |s#t ||0|S)zAdd site-packages to sys.pathzProcessing global site-packages)r rrrrrf)r/rrTs r addsitepackagesrsA ,-"8,- 77== ! w ,- rctjdk(rd}nd}tjd|t_tjd|t_y)zDefine new builtins 'quit' and 'exit'. These are objects which make the interpreter exit when called. The repr of each object contains a hint at how it works. \zCtrl-Z plus ReturnzCtrl-D (i.e. EOF)quitexitN)rr _sitebuiltinsQuitterbuiltinsrr)eofs r setquitrsA vv~"!!))&#6HM!))&#6HMrcLtjdtjt_tjddt_gg}}t tdd}|s=ttdr-tjjtj}|ra|jddg|jtjj|tj|tjgtjd d ||t_y) z)Set 'copyright' and 'credits' in builtins copyrightcreditsz Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands for supporting Python development. See www.python.org for more information. _stdlib_dirNr%z LICENSE.txtLICENSElicensez'See https://www.python.org/psf/license/)r_PrinterrrrrrCrmrrdirnamer%extendrpardircurdirr)filesdirsheres r setcopyrightrs&// S]]KH$--i:TUHb4E 3 t ,D GB +wwr{{+  mY/0 RWW\\$ 2D"))DE$--1 tHrc>tjt_yr)r_Helperrhelprnrr sethelperrs!))+HMrc d}|t_y)ajEnable default readline configuration on interactive prompts, by registering a sys.__interactivehook__. If the readline module can be imported, the hook will set the Tab key as completion key and register ~/.python_history as history file. This can be overridden in the sitecustomize or usercustomize module, or in a PYTHONSTARTUP file. cddl} ddlddl}t dd}|d|vrj dnj d j jdk(rgtjjtjjdd jfd }|j|yy#t$rYywxYw#t$rYwxYw#t$rYBwxYw) Nr__doc__r@libeditzbind ^I rl_completez tab: completer{z.python_historycH jy#t$rYywxYwr)write_history_filer)historyreadlinesr write_historyzCenablerlcompleter..register_readline..write_historys*//8s  !!)atexitr rlcompleter ImportErrorrCparse_and_bindread_init_filerget_current_history_lengthrrrrvread_history_fileregister)rr readline_docrrrs @@r register_readlinez,enablerlcompleter..register_readlines    xB7  # \(A  # #$9 :  # #O 4   # # %  . . 0A 5 ggll277#5#5c#:#46G **73  OOM *+ 6)       "  s5CC!(C0 CC! C-,C-0 C<;C<N)r__interactivehook__)rs r enablerlcompleterrs.+`0CrcBtj}tjdk(r#d|vrtjdx}t_ntj }tj jtj j|}tj j|}dt_ d}tdtj j||tj j||fDd}|r|}d}t|d5} | D]q} d| vs| jd\} } } | jj} | j} | d k(r| j}a| d k(sg| t_ s ddd|xt_t_t%|tj g|dk(r&t&j)d tj |Stj gad a|S#1swYzxYw) Nr}__PYVENV_LAUNCHER__z pyvenv.cfgc3^K|]%}tjj|r|'ywr)rrisfile).0conffiles r zvenv..s* !ww~~h'  s+-truezutf-8r==zinclude-system-site-packageshomerF)rrrr_base_executable executablerrr_homenextropen partitionrLlowerr exec_prefixrrinsertr)r/envrexe_dir site_prefix conf_basenamecandidate_conf virtual_conf system_siterYr[keyr6values r venvrs **C ||x$9S$@,.JJ7L,MM S)^^ ggoobggooj9:G''//'*KCI M  Wm4 [-8&   N%  , 1 *Q *$;$(NN3$7MCE))+++-C!KKME<<&+kkm $)  * *(32 S_  cjj\2 & OOAszz *  |H$  1 * *s$ H/AH HHc ddl}y#t$r}|jdk(rnYd}~yd}~wwxYw#t$r}tj j r%t jt jn?tjjd|jjd|dYd}~yYd}~yd}~wwxYw)z,Run custom site specific code, if available.rN sitecustomizez9Error in sitecustomize; set PYTHONVERBOSE for traceback: :  ) rrrUrOrrr excepthookexc_infor write __class____name__)rr\errs r execsitecustomizer;/   xx?*  / 99   NNCLLN + JJ  ''. / / ,/) ,'/,/ CA9B;;Cc ddl}y#t$r}|jdk(rnYd}~yd}~wwxYw#t$r}tj j r%t jt jn?tjjd|jjd|dYd}~yYd}~yd}~wwxYw)z,Run custom user specific code, if available.rN usercustomizez9Error in usercustomize; set PYTHONVERBOSE for traceback: rr) r rrUrOrrrrrr rrr)r r\rs r execusercustomizer Orrctjdd}t}|tjk7r tt |}t t at|}t|}ttttjjs ttt r t!yy)zAdd standard site-specific directories to the module search path. This function is called automatically when this module is imported, unless the python interpreter was started with the -S flag. N)rrr1r*rrrorrrrrrisolatedrrr ) orig_pathr/s r mainrcs I "KCHH  {#K/1%k2K!+.K IN K 99  rcd}tjdd}|st}t}t dtj D]}t d|dt dd}t d|d ||d t d |d ||d t d t tjd g}d|vr|jtd|vr|jt|rt tjj|t rtjd yt durtjdyt tjdytjdyd dl}t |j|tjd tjfztjdy)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 - user site directory is disabled by super user or for security reasons >2 - unknown error rAz sys.path = [z ,]cH| tjj|ryy)Nr3z doesn't exist)rrr)rs r r3z_script..existssBGGMM$$7&rz USER_BASE: z ()z USER_SITE: zENABLE_USER_SITE: rz --user-basez --user-siteFr )rargvrrr rrrr,rrrpathseprtextwrapdedent)rrw user_baserrr3bufferrs r _scriptrsn D 88AB>?@  r__main__r)(rrrrrrGrDrrrrrrr rr*r1r8r^rfrorrrrrrrrrrrrrr rrno_siterrrnrr r sKZ   JJ (   ( &.&  4n4@#0 K " ,\ 7 *,90v4n/(/(> yyF4l z Ir