$WciYcs@dZddlZddlZddlZddlZddlZejejgada da da dZ dZ dZdZdZdZdd Zd Zd Zd Zd ZdZdZddZddZdZdZdZdZdZdZ dZ!dZ"ej#j$s e"dZ%e&dkr e%dSdS)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/python/site-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. 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. Ncsbtjjrt|tjdSdS)NZfile)sysflagsverboseprintstderr)Zmessage /usr/lib64/python3.11/site.py_tracer [s4 y( gCJ''''''((cstjj|} tj|}n#t$rYnwxYw|tj|fSN)ospathjoinabspathOSErrorZnormcase)Zpathsdir rmakepathr`se ', C gooc""        %% %%s5 AAcsttjD]}d} |jj}n3#t $r& |jjj}n#t $rYnwxYwYnwxYw|dvrJ tj |j |_ n#t ttf$rYnwxYw tj |j|_#t ttf$rYwxYwdS)zESet all module __file__ and __cached__ attributes to an absolute pathN>Z_frozen_importlibZ_frozen_importlib_external)setrZmodulesZvaluesZ __loader__Z __module__ZAttributeErrorZ__spec__Zloaderr r r__file__r TypeErrorZ __cached__)ZmZ loader_modulerr abs_pathsris5 ##%% & &  L3MM     ! 1 < !       S S   44AJJ3    D  7??1<88ALL3    D #sW > A. AA. A(%A.'A((A.-A.7)B!!B;:B;?)C))DDcsg}t}tjD]B}t|\}}||vr*||||C|tjdd<|S)zK Remove duplicate entries from sys.path along with making them absoluteN)rrr rappendadd)ZL known_pathsrdircase rremoveduppathsrsx A%%Kx%% }} W + % % HHSMMM OOG $ $ $CHQQQK r cst}tjD]Y} tj|r't |\}}||J#t$rYVwxYw|S)zEReturn a set containing all existing file system items from sys.path.)rrr r existsrrr)ZdZitem_Zitemcaserr_init_pathinfor s{ A w~~d## &tnn 8h    H  HsAA%% A21A2c s|t}d}nd}tj||}t d| t jt j|d}n#t$rYdSwxYw|5t|D]\}}| dr| dkr5 | d rt|[| }t||\}} | |vrStj|r4t j||| #t&$rt)d |d z|t j d dl} | jt!jD]7} | D] }t)d|zt j !8t)dt j YnwxYwdddn #1swxYwY|rd}|S)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 '. NTFzProcessing .pth file: ZlocaleZencodingz#)zimport zimport z"Error processing line {:d} of {}: rrz z Remainder of file ignored)r r r rr ioZ TextIOWrapperZ open_coderZ enumerateZ startswithstripZexecZrstriprrrrr ExceptionrZformatr tracebackZformat_exceptionexc_infoZ splitlines) sitedirnamerresetZfullnamefZnlinerrr'Zrecords r addpackager.s $&& w||GT**H 0H 0 0111  R\(33h G G G   ||  GAts## zz||r!  ??#:;;JJJ{{}}'66 W+--"'..2E2E-HOOC(((OOG,,,   ;BB1Q3QQ:''''    8i8#,..I::F & 1 1 3 3::d4icj99999:3#*EEEE 0  sW (A22 B?BAH0 $E//H00A>E/.H0/B.H!H0 H!!H00H47H4cstd||t}d}nd}t|\}}||vr4tj||| tj|}n#t$rYdSwxYwd|D}t|D]}t||||rd}|S)zTAdd 'sitedir' argument to sys.path if missing and handle .pth files in 'sitedir'zAdding directory: NTFcs<g|]}|d|S)z.pth)Zendswith).0r*rr zaddsitedir..s) = = =dt}}V'<'< =T = = =r ) r r rrr rrr ZlistdirrZsortedr.)r)rr+Z sitedircaseZnamesr*s r addsitedirr1s + + +,,,$&& #G,,G[ + %%     $$$ 7##  = =e = = =Eu //7D+....  s3B BBcs|tjjrdSttdr?ttdr*t jt jkrdSttdr?ttdr*t jt jkrdSdS)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) rrZ no_user_sitehasattrr r3r2r5r4r rcheck_enableusersiter8s yur8Y!7!7 :<<29;; & 4r8Y!7!7 :<<29;; & 4 4r c stjdd}|r|StjdvrdSd}tjdkr-tjdpd}||dStjdkr9tjr-|dd tjd tjdd zS|dd S) NZPYTHONUSERBASE>ZwasiZvxworksZ emscriptencsbtjtjj|Sr )r r expanduserr)argsrrjoinuserz_getuserbase..joinusers!w!!"',"5666r ntZAPPDATA~ZPythondarwinZLibraryz%d.%dz.local)r environZgetrplatformr* _framework version_info)Zenv_baser;Zbase r _getuserbaserEsz~~.55H |88t777 w$(z~~i((/Cxh''' |x8CN8xY#"22A2"6688 8 8C " ""r cstj}tjdkr(tjdd}|d|dStjdkrtjr|dS|d|d d|d d S) Nr<z.r"z\Pythonz\site-packagesr>z/lib/python/site-packagesz /lib/pythonrr#z/site-packages)rrCr r*ZwinverZreplacerArB)userbaseZversionZ ver_nodotrDr _get_pathrG sG w$?J&&sB// >>I>>>> |x6CN65555 J J71: J J J J JJr cs:ttatS)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_BASErEr7r r getuserbaserI-s# NN r csbt}t|dant|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. NF)rI USER_SITEENABLE_USER_SITErG)rFrrgetusersitepackagesrL:s9}}H,  ,$  !(++I r cstdt}tr/tj|rt |||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 rLrKr r isdirr1)r user_siterraddusersitepackagesrOKsQ *+++#%%I+BGMM)44+9k*** r c s4g}t}|t}|D]}|r||vr ||tjdkrt jg}t jdkr|d|D]N}tj ||dt j ddzd}||O|||tj |dd|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. Nz/Zlibz python%d.%dr?z site-packagesZLib) rPREFIXESrr seprZ platlibdirrr rrC)prefixesZ sitepackagesZseenprefixZlibdirsZlibdirr s rgetsitepackagesrTZs4L 55DNN 4    6S= N~&G~& &u%%%! * *w||FF$1C4DRaR4H$H$355##D))))  *    ' ' '    VUO L L M M M M r cstdtr)dtjvrtddt |D]1}tj|rt||2|S)zAdd site-packages to sys.path '/usr/local' is included in PREFIXES if RPM build is not detected to make packages installed into this location visible. zProcessing global site-packagesZRPM_BUILD_ROOTrz /usr/local) r rKr r@rPinsertrTr rMr1)rrRr)rDraddsitepackagesrV{s ,---),BJ>)<((("8,,-- 7== ! ! - w , , , r cstjdkrd}nd}tjd|t_tjd|t_dS)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. z\zCtrl-Z plus ReturnzCtrl-D (i.e. EOF)quitexitN)r rQ _sitebuiltinsZQuitterbuiltinsrWrX)Zeofrrsetquitr[sJ v~""!!)&#66HM!)&#66HMMMr cstjdtjt_tjdddkr tjddt_ntjddt_gg}}ttdd}|s>ttd r)tj tj }|ra| d d g| tj |tj|tjgtjd d ||t_dS)z)Set 'copyright' and 'credits' in builtins copyrightNiZjavacreditsz?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.Z _stdlib_dirrz LICENSE.txtZLICENSElicensez'See https://www.python.org/psf/license/)rYZ_Printerrr\rZrAr]getattrr6r r dirnamerZextendrZpardirZcurdirr^)ZfilesZdirsZhererDr setcopyrightras2&/ S]KKH |BQB6!U(1  MOO)1)>TUUb4E 3 t , ,D ,GB ++,wr{++ F mY/000 RW\\$ 22D")DEEE$-1 tHr cs@tjt_dSr )rYZ_HelperrZhelpr7r r sethelperrcs!)++HMMMr cs$d}|t_dS)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. csJddl} ddlddl}n#t$rYdSwxYwt dd}|d|vrdnd n#t$rYnwxYwdkrtj tj dd  n#t$rYnwxYwfd }||dSdS) Nr__doc__r"Zlibeditzbind ^I rl_completez tab: completer=z.python_historycsV dS#t$rYdSwxYwr )Zwrite_history_filer)historyreadlinesr write_historyzCenablerlcompleter..register_readline..write_historysF//88888DDs  (()atexitrf rlcompleter ImportErrorr_Zparse_and_bindZread_init_filerZget_current_history_lengthr r rr9Zread_history_fileZregister)rhriZ readline_docrgrerfs @@rregister_readlinez,enablerlcompleter..register_readlines   OOO         FF  xB77  5 \(A 5  # #$9 : : : :  # #O 4 4 4   # # % % % %    D    . . 0 0A 5 + gll27#5#5c#:#:#466G **73333           OOM * * * * *+ + +s0 %A:: BB C66 DDN)rZ__interactivehook__)rkrrenablerlcompleterrls".+.+.+`0Cr csdtj}tjdkr#d|vrtjdx}t_n tj}tjtj|\}}tj |}dt_ d}dtj ||tj ||fD}|r+|d}d} t|d5} | D]} d | vr| d \} }} | } | } | d kr| } t| d kr | t_ dddn #1swxYwY|xt_t_t%|tjg| dkr&t&dtjntjgad a|S) Nr>Z__PYVENV_LAUNCHER__z pyvenv.cfgcsPg|]#}tj|!|$Sr7)r r Zisfile)r/Zconffilerrr0zvenv..s>    7>>( # #     r rZtruezutf-8r!z=zinclude-system-site-packagesZhomeF)r r@rrAZ_base_executable executabler Zsplitrr`Z_homerZopenZ partitionr%ZlowerrS exec_prefixrVrPrUrK)rZenvrmZexe_dirrZ site_prefixZ conf_basenameZcandidate_confsZ virtual_confZ system_siter,r-ZkeyZvalues rvenvrosA *C |x$$9S$@$,.J7L,MM S))^ rwz::;;JGQ'//'**KCI M  GLL- 0 0 GLLm 4 4"   O%&q)  , 1 1 1 *Q * *$;*$(NN3$7$7MCE))++++--C!KKMME<<*&+kkmm *$)  * * * * * * * * * * * * * * * *(32 S_  cj\222 &  % OOAsz * * * * |H$  s B F77F;>F;cZ ddl}dS#t$r}|jdkrnYd}~dSd}~wwxYw#t$rr}tjjr t jt jn6tj d|j j d|dYd}~dSYd}~dSd}~wwxYw)z,Run custom site specific code, if available.rN sitecustomizez9Error in sitecustomize; set PYTHONVERBOSE for traceback: :  ) rqrjr*r&rrr excepthookr(rwrite __class____name__)rqexcerrrDrexecsitecustomizerz'/     x?*   /// 9  / NCLNN + + + J   '''. / / / / / / / / / , + + + + +/) + &.+. B*A!B%%B*crp)z,Run custom user specific code, if available.rN usercustomizez9Error in usercustomize; set PYTHONVERBOSE for traceback: rrrs) r}rjr*r&rrrrtr(rrurvrw)r}rxryrDrexecusercustomizer~;r{r|cstjdd}t}|tjkrtt |}t t at|}t|}ttttj j sttt rt!dSdS)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)rr rrrorKr8rOrVr[rarcrZisolatedrlrzr~)Z orig_pathrrrmainrOs I ""KCH  {##K2/11%k22K!+..K IIINNN KKK 9 r cs.d}tjdd}|st}t}t dtjD]}t d|dt dd}t d|d ||d t d |d ||d t d t tjd g}d|vr|td|vr|t|rt tj |t rtjd dSt durtjddSt tjddStjddSd dl}t ||tjd tj fztjddS)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 r#z sys.path = [z z,z]csL|!tj|rdSdS)Nrz doesn't exist)r r rM)r rrrz_script..existss) 'BGMM$$7$7 'x&r z USER_BASE: z (z)z USER_SITE: zENABLE_USER_SITE: rz --user-basez --user-siteFr?ii )rZargvrIrLrr rKrXrrHrJr ZpathseprtextwrapZdedent)rbr:Z user_baserNrrZbufferrs r_scriptrqs D 8ABB>??@@@  r Z__main__r )'rdrr rZrYr$rSrnrPrKrJrHr rrrr r.r1r8rErGrIrLrOrTrVr[rarcrlrorzr~rrZno_siterrwr7r rrs*EEN   J (   ((( &&&.&    ,,,^2@###0 K K K   "   B 7 7 7 4,,,909090v111h///(///(> y DFFF444l z GIIIIIr