
z^c           @   s	  d  Z  d d l Z d d l Z y d d l Z Wn e k
 rM d d l Z n Xy e Wn! e k
 ry d d l m	 Z n Xe j
 e j g Z d a d a d a e e d  Z e j d  d k Z e r e e  Z n  d   Z d   Z d	   Z d
   Z d   Z d   Z d d  Z e j
 e j 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, d   Z- d   Z. d    Z/ d!   Z0 e0   d"   Z1 e2 d# k re1   n  d S($   s
  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, it starts with sys.prefix and sys.exec_prefix (if different) and
appends lib/python<version>/site-packages as well as lib/site-python.
It also supports the Debian convention of
lib/python<version>/dist-packages.  On other platforms (mainly Mac and
Windows), it uses just sys.prefix (and sys.exec_prefix, if different,
but this is unlikely).  The resulting directories, if they exist, are
appended to sys.path, and also inspected for path configuration files.

FOR DEBIAN, this sys.path is augmented with directories in /usr/local.
Local addons go into /usr/local/lib/python<version>/site-packages
(resp. /usr/local/lib/site-python), Debian addons install into
/usr/{lib,share}/python<version>/dist-packages.

A path configuration file is a file whose name has the form
<package>.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.X/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.X/site-packages/bar
  /usr/local/lib/python2.X/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.

iN(   t   Sett   pypy_version_infoi   t   javac          G   se   t  j j |    } t r= | d k s3 | j d  r= | | f St  j j |  } | t  j j |  f S(   Nt   __classpath__t   __pyclasspath__(   t   ost   patht   joint
   _is_jythont
   startswitht   abspatht   normcase(   t   pathst   dir(    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt   makepath[   s    
c          C   s   x{ t  j j   D]j }  t r, t |  t  s t |  d  rA q n  t |  d d  } | d k re q n  t	 j
 j |  |  _ q Wd S(   s6   Set all module' __file__ attribute to an absolute patht
   __loader__t   __file__N(   t   syst   modulest   valuesR   t
   isinstancet
   ModuleTypet   hasattrt   getattrt   NoneR   R   R
   R   (   t   mt   f(    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt   abs__file__c   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/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt   removeduppathsp   s    	
c          C   s~   d d l  m }  d |    t j f } t t d  rB | d 7} n  t j j t j j t j d  |  } t j j	 |  d S(   sb   Append ./build/lib.<platform> in case we're running in the build dir
    (especially for Guido :-)i(   t   get_platforms   build/lib.%s-%.3st   gettotalrefcounts   -pydebugN(
   t   distutils.utilR#   R   t   versionR   R   R   R   t   dirnameR   (   R#   t   s(    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt   addbuilddir   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/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt   _init_pathinfo   s    	c   	      B   s&  | d k r e   d } n d } e j j |  |  } y e | d  } Wn e k
 r^ d SXz x | D] } | j d  r qi n  | j d  r | d Uqi n  | j   } e	 |  |  \ } } | | k ri e j j
 |  ri e j j |  | j |  qi qi WWd | j   X| r"d } n  | S(   so   Add a new path to known_paths by combining sitedir and 'name' or execute
    sitedir if it starts with 'import'i   i    t   rUNt   #t   import(   R   R-   R   R   R   t   opent   IOErrorR	   t   rstripR   t   existsR   R   R   t   close(	   t   sitedirt   nameR    t   resett   fullnameR   t   lineR   R!   (    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt
   addpackage   s2    		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 SX| j	   x7 | D]/ } | j
 t j d  r t |  | |  q 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   sortt   endswitht   extsepR;   (   R6   R    R8   t   sitedircaset   namesR7   (    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt
   addsitedir   s$    		
	c   
      C   s  t  j j | d  | g } | | k rF | j t  j j | d   n  xa| D]Y} | rM t j d k sn t r t  j j | d d  g } n|t r t  j j | d  g } n[t j d k r@| | k r@| j d  rt  j j d t j	 d	  d  t  j j | d
 d d  g } qt  j j | d d t j	 d	  d  g } nt  j
 d k rt  j j | d d t j	 d	  d  t  j j | d d  t  j j | d t j	 d	  d  g } t  j j | d d t j	 d	  d  } t  j j |  r,t  j j |  g  | D] } t  j j |  ^ qk r,| j |  n  y. t j | j d t  j j | d d   Wn t k
 rmn X| 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   n | t  j j | d d  g } t j d k rpd | k rpt  j j d  } | rm| j t  j j | d d t j	 d	  d   qmqpn  x3 | D]( }	 t  j j |	  rwt |	 |   qwqwWqM qM Wd S(   s8   Add site-packages (and possibly site-python) to sys.patht   localt   os2emxt   riscost   Libs   site-packagest   darwins   /System/Library/Frameworks/s   /Library/Pythoni   t   Extrast   libt   pythont   /s   site-pythons   lib-dynloadt   lib64i    t   debugs   dist-packagess	   local/libs   dist-pythons   Python.frameworkt   HOMEt   Libraryt   Python(   RF   RG   N(   R   R   R   R   R   t   platformR   t   _is_pypyR	   R&   t   sepR4   t   realpatht
   getobjectst   insertt   AttributeErrort   environt   getR*   RD   R   (
   R    t
   sys_prefixt   exec_prefixt   prefixest   prefixt   sitedirst	   lib64_dirt   pt   homeR6   (    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt   addsitepackages   sj    !&&7'

"
c           C   s   t  t d  r( t t j d t  r( t St  t d  re t  t d  re t j   t j   k re 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   flagst   no_user_sitet   getuidt   geteuidt   getgidt   getegidN(   R   R   R   Re   t   FalseR   Rh   Rg   R   Rj   Ri   t   True(    (    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt   check_enableusersite  s    
$c      	   C   sf  t  j j d d  } d   } t  j d k r t  j j d  pB d } | rT | a n | | d  a t  j j t d t j	 d t j	 d d	  a
 nD | r | a n | d d
  a t  j j t d d t j	 d  d	  a
 t r t  j j t
  r t t
 |   n  t rbxY d D]N } t  j j t | d t j	 d  d  } t  j j |  rt | |   qqWn  |  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.

    USER_BASE is the root directory for all Python versions

    USER_SITE is the user specific site-packages directory

    USER_SITE/.. can be used for data.
    t   PYTHONUSERBASEc          W   s   t  j j t  j j |     S(   N(   R   R   t
   expanduserR   (   t   args(    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt   joinuser;  s    t   ntt   APPDATAt   ~RR   i    i   s   site-packagess   .localRK   RL   i   s	   local/libs   dist-packagesN(   s   libs	   local/lib(   R   RZ   R[   R   R7   t	   USER_BASER   R   R   R&   t	   USER_SITEt   ENABLE_USER_SITER*   RD   (   R    t   env_baseRq   t   baset   dist_libdirt	   user_site(    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt   addusersitepackages,  s4    					c          C   so   t  j j t j d d  }  t  j d j d  } | d rK | j |   n
 |  | d <d j |  t  j d <d S(   sE  The OS/2 EMX port has optional extension modules that do double duty
    as DLLs (and must use the .DLL file extension) for other extensions.
    The library search path needs to be amended so these will be found
    during module import.  Use BEGINLIBPATH so that these are at the start
    of the library search path.

    RH   s   lib-dynloadt   BEGINLIBPATHt   ;iN(   R   R   R   R   R_   RZ   t   splitR   (   t   dllpatht   libpath(    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt   setBEGINLIBPATHa  s    

c             st   t  j d k r d   n t  j d k r0 d   n d   d t f   f d     Y}  |  d  t _ |  d	  t _ d
 S(   sn   Define new built-ins 'quit' and 'exit'.
    These are simply strings that display a hint on how to exit.

    t   :s   Cmd-Qs   \s   Ctrl-Z plus Returns   Ctrl-D (i.e. EOF)t   Quitterc              s,   e  Z d    Z   f d   Z d d  Z RS(   c         S   s   | |  _  d  S(   N(   R7   (   t   selfR7   (    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt   __init__  s    c            s   d |  j    f S(   Ns   Use %s() or %s to exit(   R7   (   R   (   t   eof(    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt   __repr__  s    c         S   s+   y t  j j   Wn n Xt |   d  S(   N(   R   t   stdinR5   t
   SystemExit(   R   t   code(    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt   __call__  s
    N(   t   __name__t
   __module__R   R   R   R   (    (   R   (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyR   ~  s   	t   quitt   exitN(   R   RU   t   objectt   builtinsR   R   (   R   (    (   R   s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt   setquitr  s    		t   _Printerc           B   s>   e  Z d  Z d Z d d d  Z d   Z d   Z d   Z RS(   sn   interactive prompt objects for printing the license text, a list of
    contributors and the copyright notice.i   c         C   s1   | |  _  | |  _ | |  _ | |  _ d  |  _ d  S(   N(   t   _Printer__namet   _Printer__datat   _Printer__filest   _Printer__dirsR   t   _Printer__lines(   R   R7   t   datat   filest   dirs(    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyR     s
    				c         C   s   |  j  r d  Sd  } x |  j D]w } xd |  j D]Y } t j j | |  } y* t | d  } | j   } | j	   PWq- t
 k
 r q- Xq- W| r Pq q W| s |  j } n  | j d  |  _  t |  j   |  _ d  S(   NR.   s   
(   R   R   R   R   R   R   R   t   filet   readR5   R2   R   R   t   lent   _Printer__linecnt(   R   R   R   t   filenamet   fp(    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt   __setup  s&    	
c         C   sH   |  j    t |  j  |  j k r2 d j |  j  Sd |  j f d Sd  S(   Ns   
s!   Type %s() to see the full %s texti   (   t   _Printer__setupR   R   t   MAXLINESR   R   (   R   (    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyR     s    
c         C   s   |  j    d } d } x y1 x* t | | |  j  D] } |  j | GHq3 WWn t k
 r^ Pq X| |  j 7} d  } xU | d  k r y t |  } Wn t k
 r t |  } n X| d k ru d  } qu qu W| d k r Pq q d  S(   Ns0   Hit Return for more, or q (and Return) to quit: i    t    t   q(   R   R   (	   R   t   rangeR   R   t
   IndexErrorR   t	   raw_inputt	   NameErrort   input(   R   t   promptt   linenot   it   key(    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyR     s(    
(    (    (   R   R   t   __doc__R   R   R   R   R   (    (    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyR     s   		c          C   s   t  d t j  t _ t r0 t  d d  t _ n- t rK t  d d  t _ n t  d d  t _ t j j	 t j
  }  t  d d t j d d	 g t j j |  t j  |  t j g  t _ d
 S(   s,   Set 'copyright' and 'credits' in __builtin__t	   copyrightt   creditss?   Jython is maintained by the Jython developers (www.jython.org).sD   PyPy is maintained by the PyPy developers: http://codespeak.net/pypys       Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
    for supporting Python development.  See www.python.org for more information.t   licenses+   See http://www.python.org/%.3s/license.htmls   LICENSE.txtt   LICENSEN(   R   R   R   R   R   R   RT   R   R   R'   R   R&   R   t   pardirt   curdirR   (   t   here(    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt   setcopyright  s     	t   _Helperc           B   s    e  Z d  Z d   Z d   Z RS(   sY   Define the built-in 'help'.
    This is a wrapper around pydoc.help (with a twist).

    c         C   s   d S(   NsH   Type help() for interactive help, or help(object) for help about object.(    (   R   (    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyR     s    c         O   s   d d  l  } | j | |   S(   Ni(   t   pydoct   help(   R   Rp   t   kwdsR   (    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyR     s    (   R   R   R   R   R   (    (    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyR     s   	c           C   s   t    t _ d  S(   N(   R   R   R   (    (    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt	   sethelper  s    c          C   s   t  j d k r d d l }  d d l } |  j   d } | j d  r y | j |  Wq t k
 r d d l } | j	 | j
 | <d | j j | <q Xq n  d S(   s   On Windows, some default encodings are not provided by Python,
    while they are always available as "mbcs" in each locale. Make
    them usable by aliasing to "mbcs" in such a case.t   win32iNi   t   cpt   mbcs(   R   RS   t   localet   codecst   getdefaultlocaleR	   t   lookupt   LookupErrort	   encodingst   _unknownt   _cachet   aliases(   R   R   t   encR   (    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt	   aliasmbcs  s    c          C   s&   d }  |  d k r" t  j |   n  d S(   s   Set the string encoding used by the Unicode implementation.  The
    default is 'ascii', but if you're willing to experiment, you can
    change this.t   asciiN(   R   t   setdefaultencoding(   t   encoding(    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt   setencoding  s    c          C   s(   y d d l  }  Wn t k
 r# n Xd S(   s,   Run custom site specific code, if available.iN(   t   sitecustomizet   ImportError(   R   (    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt   execsitecustomize  s    c          C   sa  t  t j j t j j t  d   }  |  j   j   t _	 |  j
   d } g  } t j d d k rr | d 7} n  t j d k r t j j t j	 d  t j j t j	 d  g } nt r t j j t j	 d  g } nt rt j d k rd
 t j d  } n d t j d  } t j j t j	 d  t j j t j	 d d |  t j j t j	 d |  g } | } x| D]D } t j j | d t j  } t j j |  rp| j |  qpqpWn t j j t j	 d d t j d   g } | } t j j t j	 d d t j d   } t j j |  r3| j |  n  t j j t j	 d d t j d  d t j  } t j j |  r| j |  n  xK t |  D]= } t j j | d  } t j j |  r| j |  qqWt j d k rMg  | D]( }	 d D] }
 t j j |	 |
  ^ qq} x3 | D]( } t j j |  r| j |  qqWn  t j j |  d  S(   Ns   orig-prefix.txti   i    R   i   R   RH   t   DLLsi   s   %d.%ds   %d.%d.%di   t   lib_pypys
   lib-pythons   modified-%ss   plat-%sRK   RL   RN   s   lib-tkRI   s   plat-darwins   plat-macs   plat-mac/lib-scriptpackages(   i   i   (   s   plat-darwins   plat-macs   plat-mac/lib-scriptpackages(   R1   R   R   R   R'   R   R   t   stripR   t   real_prefixR5   RS   R   RT   R   t   version_infoR4   R   R&   t   listt   extend(   R   t   post   hardcoded_relative_dirsR   t   cpyverR   t	   plat_patht
   lib64_patht   tk_dirt   relative_dirt   modulet   hardcoded_paths(    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt   virtual_install_main_packages  sX    '
3)& 
(c          C   sj   t  t d d  }  xD t t j  D]3 \ } } | |  k r" | j t j  r" | }  q" q" W|  d t _ d S(   s  
    Force easy_installed eggs in the global environment to get placed
    in sys.path after all packages inside the virtualenv.  This
    maintains the "least surprise" result that packages in the
    virtualenv always mask global packages, never the other way
    around.
    
    t   __egginserti    i   N(   R   R   t	   enumerateR   R	   R_   R   (   t	   egginsertR   R   (    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt+   force_global_eggs_after_local_site_packagesY  s
    	c         C   s   t    t |  d t j S(   NR\   (   R   Rd   R   R   (   R    (    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt   virtual_addsitepackagesh  s    c          C   su   g  }  g  } xI t  j D]> } | d k s7 | j d  rG | j |  q |  j |  q W|  t  _ t  j j |  d S(   s   Adjust the special classpath sys.path entries for Jython. These
    entries should follow the base virtualenv lib directories.
    R   R   N(   R   R   R	   R   R   (   R   t
   classpathsR   (    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt   fixclasspathl  s    	c          C   s(   y d d l  }  Wn t k
 r# n Xd S(   s,   Run custom user specific code, if available.iN(   t   usercustomizeR   (   R   (    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt   execusercustomizez  s    c          C   sY  t    t   t   }  t j d k rX t j rX t j j t j d  d k rX t   n  t	 rh t
   n  t j j t j j t j j t  d   } | s t a n  t d  k r t   a n  t |   }  t |   }  | r t |   }  n  t j d k rt   n  t   t   t   t   t   t   t r=t   n  t t d  rUt `  n  d  S(   Nt   posixit   Moduless   no-global-site-packages.txtRF   R   (!   R   R   R"   R   R7   R   R   t   basenameR)   R   R   R4   R   R'   R   Rk   Rw   R   Rm   Rd   R|   R   RS   R   R   R   R   R   R   R   R   R   R   (   t   paths_in_syst   GLOBAL_SITE_PACKAGES(    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt   main  s:    	

.	

c          C   s  d }  t  j d } | s d GHx t  j D] } d | f GHq( Wd GHd   } d t | t  f GHd t | t  f GHd	 t GHt  j d
  n  g  } d | k r | j t  n  d | k r | j t  n  | rBt j	 j
 |  GHt r t  j d
  q}t t k rt  j d  q}t d  k r2t  j d  q}t  j d  n; d d  l } | j |  t  j d
 t j	 f  GHt  j d  d  S(   Ns      %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
    i   s   sys.path = [s       %r,t   ]c         S   s   t  j j |   r d Sd Sd  S(   NR4   s   doesn't exist(   R   R   R*   (   R   (    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyR4     s    s   USER_BASE: %r (%s)s   USER_SITE: %r (%s)s   ENABLE_USER_SITE: %ri    s   --user-bases   --user-sitei   i   ii
   (   R   t   argvR   Ru   Rv   Rw   R   R   R   t   pathsepR   Rk   R   t   textwrapt   dedent(   R   Rp   R   R4   t   bufferR   (    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt   _script  s:    		"t   __main__(3   R   R   R   t   __builtin__R   R   R   R   t   setsR    R_   R]   t   PREFIXESR   Rw   Rv   Ru   R   RT   RS   R   t   typeR   R   R   R"   R)   R-   R;   RD   Rd   Rm   R|   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   (    (    (    s/   /opt/eff.org/certbot/venv/lib/python2.7/site.pyt   <module>@   s^   				
		D		5		@						:					#	4