//usr/lib64/lib64//lib64/lib64/python2.7/
ٜSec @ sp d Z d d l Z d d l Z d d l Z d d l Z e j e j g Z d a d a
d a d Z d Z
d Z d Z d Z d d Z d Z d
Z d Z d Z d
Z d Z d Z d Z d e f d YZ d Z d e f d YZ d Z d Z d Z d Z! d Z" d Z# e# d Z$ e% d k rle$ n d S( sN Append module search paths for third-party packages to sys.path.
****************************************************************
* This module is automatically imported during initialization. *
****************************************************************
In earlier versions of Python (up to 1.5a3), scripts or modules that
needed to use site-specific modules would place ``import site''
somewhere near the top of their code. Because of the automatic
import, this is no longer necessary (but code that does it still
works).
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 as well as lib/site-python.
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.
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.
After these path manipulations, 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.
iNc G sR t j j | } y t j j | } Wn t k
r; n X| t j j | f S( N( t ost patht joint abspatht OSErrort normcase( t pathst dir( ( s /usr/lib64/python2.7/site.pyt makepathO s
c C si xb t j j D]Q } t | d r+ q n y t j j | j | _ Wq t t f k
r` q Xq Wd S( s6 Set all module' __file__ attribute to an absolute patht
__loader__N(
t syst modulest valuest hasattrR R R t __file__t AttributeErrorR ( t m( ( s /usr/lib64/python2.7/site.pyt abs__file__X s c C sl g } t } xL t j D]A } t | \ } } | | k r | j | | j | q q W| t j (| S( sK Remove duplicate entries from sys.path along with making them
absolute( t setR
R R t appendt add( t Lt known_pathsR t dircase( ( s /usr/lib64/python2.7/site.pyt removeduppathsc s
c C sp t } x` t j D]U } y8 t j j | rP t | \ } } | j | n Wq t k
rg q q Xq W| S( sD Return a set containing all existing directory entries from sys.path( R R
R R t isdirR R t TypeError( t dR R ( ( s /usr/lib64/python2.7/site.pyt _init_pathinfov s
c B s | d k r e d } n d } e j j | | } y e | d } Wn e k
r^ d SX| @x8e | D]*\ } } | j d r qs n y | j d r | d Uws n | j } e
| | \ } } | | k re j j | re j j
| | j | n Wqs e k
r}
e j d j | d | IJxE e j e j D]. } x% | j D] } e j d | IJqlWqYWe j d
IJPqs Xqs WWd QX| rd } n | S( s Process 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 '.
i i t rUNt #s import s import s" Error processing line {:d} of {}:
s s
Remainder of file ignored( s import s import ( t NoneR R R R t opent IOErrort enumeratet
startswitht rstripR t existsR
R R t Exceptiont stderrt formatt tracebackt format_exceptiont exc_infot
splitlines( t sitedirt nameR t resett fullnamet ft nt lineR R t errt record( ( s /usr/lib64/python2.7/site.pyt
addpackage sB
c C s | d k r t } d } n d } t | \ } } | | k rU t j j | n y t j | } Wn t j k
r d SXt j d } g | D] } | j
| r | ^ q } x$ t | D] } t | | | q W| r d } n | S( sT Add 'sitedir' argument to sys.path if missing and handle .pth files in
'sitedir'i i Nt pth(
R R R R
R R R t listdirt errort extsept endswitht sortedR6 ( R- R R/ t sitedircaset namest dotpthR. ( ( s /usr/lib64/python2.7/site.pyt
addsitedir s$
( c C s t j j r t St t d rM t t d rM t j t j k rM d Sn t t d r t t d r t j t j
k r d Sn t S( s, 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
t getuidt geteuidt getgidt getegidN( R
t flagst no_user_sitet FalseR
R RB RA R RD RC t True( ( ( s /usr/lib64/python2.7/site.pyt check_enableusersite s
c C s0 t d k r t Sd d l m } | d a t S( s Returns 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.
i( t get_config_vart userbaseN( t USER_BASER t sysconfigRJ ( RJ ( ( s /usr/lib64/python2.7/site.pyt getuserbase s
c C s t } t d k r t Sd d l m } d d l } t j d k rv d d l m } | d rv | d d a t Sn | d d | j a t S(
s Returns the user-specific site-packages directory path.
If the global variable ``USER_SITE`` is not initialized yet, this
function will also set it.
i( t get_pathNt darwin( RJ t PYTHONFRAMEWORKt purelibt osx_framework_users %s_user(
RN t USER_SITER RM RO R R
t platformRJ R. ( t user_baseRO R RJ ( ( s /usr/lib64/python2.7/site.pyt getusersitepackages s c C s5 t } t r1 t j j | r1 t | | n | S( s Add a per user site-package to sys.path
Each user has its own python directory with site-packages in the
home directory.
( RW t ENABLE_USER_SITER R R R@ ( R t user_site( ( s /usr/lib64/python2.7/site.pyt addusersitepackages s c C s g } t } xt D]} | s | | k r5 q n | j | t j d k rs | j t j j | d d n t j d k r | j t j j | d d t j
d d | j t j j | d d t j
d d | j t j j | d d
nK | j | | j t j j | d d | j t j j | d d t j d k r d d
l m } | d } | r| j t j j d | t j
d d qq q W| S( s+ Returns a list containing all global site-packages directories
(and possibly site-python).
For each directory present in the global ``PREFIXES``, this function
will find its `site-packages` subdirectory depending on the system
environment, and will return a list of full paths.
t os2emxt riscost Libs
site-packagest /t lib64t pythoni t libs site-pythonRP i( RJ RQ s /Library( s os2emxs riscos(
R t PREFIXESR R
RU R R R R t sept versionRM RJ ( t sitepackagest seent prefixRJ t framework( ( s /usr/lib64/python2.7/site.pyt getsitepackages s6
"
"
c C s: x3 t D]( } t j j | r
t | | q
q
W| S( s8 Add site-packages (and possibly site-python) to sys.path( Ri R R R R@ ( R R- ( ( s /usr/lib64/python2.7/site.pyt addsitepackages9 s c C so t j j t j d d } t j d j d } | d rK | j | n
| | d