\dxX@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. Ncbtjjrt|tjdSdS)Nfile)sysflagsverboseprintstderr)messages ..\python\lib\site.py_tracer [s4 y( gCJ''''''((ctjj|} tj|}n#t$rYnwxYw|tj|fSN)ospathjoinabspathOSErrornormcase)pathsdirs r makepathr`se ', C gooc""        %% %%s5 AActtjD]}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>_frozen_importlib_frozen_importlib_external)setrmodulesvalues __loader__ __module__AttributeError__spec__loaderrrr__file__r TypeError __cached__)m loader_modules r abs_pathsr*is3 ##%% & &  L3MM     ! 1 < !       S S S  44AJJ3    D  7??1<88ALL3    D #sW > A. AA. A(%A.'A((A.-A.7)B!!B;:B;?)C))DDcg}t}tjD]B}t|\}}||vr*||||C|tjdd<|S)zK Remove duplicate entries from sys.path along with making them absoluteN)rrrrappendadd)L known_pathsrdircases r removeduppathsr1sv A%%Kx%% }} W + % % HHSMMM OOG $ $ $CHQQQK rct}tjD]Y} tj|r't |\}}||J#t$rYVwxYw|S)zEReturn a set containing all existing file system items from sys.path.)rrrrexistsrr-r&)ditem_itemcases r _init_pathinfor8s{ A w~~d## &tnn 8h    H  HsAA%% A21A2c |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: localeencoding#)zimport zimport z"Error processing line {:d} of {}: rrz z Remainder of file ignored)r8rrrr io TextIOWrapper open_coder enumerate startswithstripexecrstriprr3rr,r- Exceptionr formatr tracebackformat_exceptionexc_info splitlines) sitedirnamer/resetfullnamefnlinerr0rJrecords r addpackagerVs $&& 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!!H00H47H4ctd||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: NTFc<g|]}|d|S)z.pth)endswith).0rOs r zaddsitedir..s) = = =dt}}V'<'< =T = = =r) r r8rrrr,r-rlistdirrsortedrV)rNr/rP sitedircasenamesrOs r addsitedirr`s + + +,,,$&& #G,,G[ + % %     $$$ 7##  = =e = = =Eu //7D+....  s3B BBc|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) rr no_user_sitehasattrrrcrbrerdrr check_enableusersiteris yur8Y!7!7 :<<29;; & &4r8Y!7!7 :<<29;; & &4 4rc tjdd}|r|StjdvrdSd}tjdkr-tjdpd}||dStjdkr9tjr-|dd tjd tjdd zS|dd S) NPYTHONUSERBASE>wasivxworks emscriptencbtjtjj|Sr)rr expanduserr)argss r joinuserz_getuserbase..joinusers!w!!"',"5666rntAPPDATA~PythondarwinLibraryz%d.%dz.local)renvirongetrplatformrO _framework version_info)env_baserrbases r _getuserbasersz~~.55H |888t777 w$z~~i((/Cxh''' |xCNxY#"22A2"6688 8 8C " ""rctj}tjdkr(tjdd}|d|dStjdkrtjr|dS|d|d d|d d S) Nrs.r>z\Pythonz\site-packagesrwz/lib/python/site-packagesz /lib/pythonrr?z/site-packages)rr~rrOwinverreplacer|r})userbaseversion ver_nodots r _get_pathr sG w$J&&sB// >>I>>>> |xCN5555 J J71: J J J J JJrc: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_BASErrhrr getuserbaser-s NN rcbt}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)r USER_SITEENABLE_USER_SITEr)rs r getusersitepackagesr:s5}}H  $  !(++I rctdt}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 rrrrisdirr`)r/ user_sites r addusersitepackagesrKsQ *+++#%%I+BGMM)44+9k*** rc 4g}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. N/libz python%d.%dryz site-packagesLib) rPREFIXESr-rsepr platlibdirr,rrr~)prefixes sitepackagesseenprefixlibdirslibdirrs r getsitepackagesrZs)L 55DNN 4   6S==~&G~&&u%%%! * *w||FF$1C4DRaR4H$H$355##D))))  *    ' ' '    VUO L L M M M M rctdt|D]1}tj|rt ||2|S)zAdd site-packages to sys.pathzProcessing global site-packages)r rrrrr`)r/rrNs r addsitepackagesr{sU ,---"8,,-- 7== ! ! - w , , , rctjdkrd}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. \zCtrl-Z plus ReturnzCtrl-D (i.e. EOF)quitexitN)rr _sitebuiltinsQuitterbuiltinsrr)eofs r setquitrsG v~~"!!)&#66HM!)&#66HMMMrctjdtjt_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 copyrightNjavacreditsz?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. _stdlib_dirr%z LICENSE.txtLICENSElicensez'See https://www.python.org/psf/license/)r_Printerrrrr|rgetattrrgrrdirnamer%extendrpardircurdirr)filesdirsheres r setcopyrightrs/&/ S]KKH |BQB6!!(1  MOO)1)>TUUb4E 3 t , ,D ,GB ++,wr{++ F mY/000 RW\\$ 22D")DEEE$-1 tHrc@tjt_dSr)r_Helperrhelprhrr sethelperrs!)++HMMMrc$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. cJddl} ddlddl}n#t$rYdSwxYwt dd}|d|vrdnd n#t$rYnwxYwdkrtj tj dd  n#t$rYnwxYwfd }||dSdS) Nr__doc__r>libeditzbind ^I rl_completez tab: completeruz.python_historycV dS#t$rYdSwxYwr)write_history_filer)historyreadlinesr write_historyzCenablerlcompleter..register_readline..write_historysF//88888DDs  (()atexitr rlcompleter ImportErrorrparse_and_bindread_init_filerget_current_history_lengthrrrrpread_history_fileregister)rr readline_docrrrs @@r register_readlinez,enablerlcompleter..register_readlines   OOO         FF  xB77  # \(A(A  # #$9 : : : :  # #O 4 4 4   # # % % % %    D    . . 0 0A 5 5 gll27#5#5c#:#:#466G **73333           OOM * * * * *+ 6 5s0 %A:: BB C66 DDN)r__interactivehook__)rs r enablerlcompleterrs".+.+.+`0Crcdtj}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) Nrw__PYVENV_LAUNCHER__z pyvenv.cfgcPg|]#}tj|!|$Srh)rrisfile)rZconffiles r r[zvenv..s>    7>>( # #     rrtruezutf-8r;=zinclude-system-site-packageshomeF)rrzrr|_base_executable executablersplitrr_homeropen partitionrElowerr exec_prefixrrinsertr)r/envrexe_dirr6 site_prefix conf_basenamecandidate_confs virtual_conf system_siterRrTkeyvalues r venvrs3 *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: :  ) rrrOrHrrr excepthookrLr write __class____name__)rexcerrs r execsitecustomizer  /     x?**  /// 9  / NCLNN + + + J   '''. / / / / / / / / / , + + + + +/) + &.+. B*A!B%%B*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 user specific code, if available.rN usercustomizez9Error in usercustomize; set PYTHONVERBOSE for traceback: rr) rrrOrHrrrrrLr rrr)rrrs r execusercustomizer4rrctjdd}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)rrr1r*rrrirrrrrrisolatedrrr) orig_pathr/s r mainrHs I ""KCH  {##K/11%k22K!+..K IIINNN KKK 9 rc.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 ,]cL|!tj|rdSdS)Nr3z doesn't exist)rrr)rs r r3z_script..existss%BGMM$$7$7x&rz USER_BASE: z ()z USER_SITE: zENABLE_USER_SITE: rz --user-basez --user-siteFry )rargvrrr rrrr,rrrpathseprtextwrapdedent)rrq user_baserrr3bufferrs r _scriptrjs D 8ABB>??@@@  r__main__r)'rrrrrr@rrrrrrr rr*r1r8rVr`rirrrrrrrrrrrrrrrrno_siterrrhrr rs&EEN   J (   ((( &&&.&    ,,,^2@###0 K K K   "   B 7 7 7 4,,,909090v111h///(///(> y DFFF444l z GIIIIIr