
&>Oc        C   @   s6	  d  Z  d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z m	 Z	 y e
 Wn! e k
 r d d l m Z
 n Xd d l m Z y& d d l m Z m Z m Z e Z Wn e k
 r e Z n Xd d l m Z d d l m Z m Z e Z d	 d
  Z d   Z d d d d d d d d d d d d d d d d d d d d d  d! d" d# d$ d% d& d' d( d) d* d+ d, d- d. d/ d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d: d; d< d= d> d? d@ dA dB dC dD dE dF dG dH dI dJ dK dL dM dN gC Z d' e f dO     YZ  d( e  f dP     YZ! d) e  f dQ     YZ" d* e  f dR     YZ# i  Z$ e j% dS  Z& dS Z' dT Z( dU Z) dV Z* d Z+ dW   Z, dX   Z- g  dY  Z. dZ   Z/ d[   Z0 e j1 d\  Z2 e j1 d]  Z3 e0 Z4 d^   Z5 d_   Z6 e6 Z7 d`   Z8 da   Z9 e: db  Z; dc   Z< d= f  dd     YZ= d> e= f de     YZ> d" e? f df     YZ@ d! e? f dg     YZA eA ZB d+ eC f dh     YZD d# f  di     YZE dj   ZF dk   ZG dl   ZH dm   ZI dn   ZJ dD f  do     YZK e, e? eK  dE eK f dp     YZL dF eL f dq     YZM e, eN e:  eM  dB eK f dr     YZO eO   ZP dG eL f ds     YZQ e, e jR eQ  d? eO f dt     YZS d@ eM f du     YZT dA eQ f dv     YZU dw f  dx     YZV dy f  dz     YZW d{   ZX y d d| lY mX ZX mZ ZZ Wn e k
 rn XeZ ZV [W [Z i  Z[ d}   Z\ e d~  Z] e d  Z^ e\ e jR e^  d   a_ e d  Z` e\ e? e`  e d  Za e\ eV ea  i  Zb i  Zc d   Zd d   Ze d   Zf e: d  Zg d   Zh ed eV eh  ed e jR eh  d   Zi ed e? ei  d   Zj i  d  Zk d   Zl d   Zm e j1 d  jn Zo e j1 d  jn Zp e j1 d  jn Zq e j1 d  jn Zr e j1 d  jn Zs e j1 d  jn Zt e j1 d  jn Zu e j1 d  jn Zv e j1 d e jw e jx B jn Zy e j1 d e jw  Zz i d d 6d d 6d d 6d d 6d d 6j{ Z| d   Z} d   Z~ d& e? f d     YZ d   Z d$ e? f d     YZ d   Z d   Z d   Z d% f  d     YZ i d d 6d d 6d d 6d d 6d d 6d d 6Z d   Z d   Z d   Z d   Z d   Z d   Z eE   Z d   Z e e    e@   Z y d d l m Z Wn e k
 r:n Xy e j e  Wn e! k
 re@ g   Z x0 e j e e  eA    D] Z e j e  qWx0 e j D]% Z e e j k re j e  n  qWe j e j (n Xe j Z e j Z e j Z e j6 Z6 e6 Z7 e d    g  e _ e e j e j  d S(   sY  Package resource API
--------------------

A resource is a logical file contained within a package, or a logical
subdirectory thereof.  The package resource API expects resource names
to have their path parts separated with ``/``, *not* whatever the local
path separator is.  Do not use os.path operations to manipulate resource
names being passed into the API.

The package resource API is designed to work with normal filesystem packages,
.egg files, and unpacked .egg files.  It can also work in a limited way with
.zip files and with custom PEP 302 loaders that support the ``get_data()``
method.
iN(   t   urlparset
   urlunparse(   t   ImmutableSet(   t   utime(   t   mkdirt   renamet   unlink(   t   open(   t   isdirt   spliti  c         C   s^   t  s t d   n  t |   \ } } | rZ | rZ t |  rZ t |  t | |  n  d  S(   Ns*   "os.mkdir" not supported on this platform.(   t   WRITE_SUPPORTt   IOErrorR	   R   t   _bypass_ensure_directoryR   (   t   namet   modet   dirnamet   filename(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR   -   s    
c          C   s{   t    }  t j |   } | d k	 rw t j d k rw y- d d j t   d   | j d  f }  Wqw t	 k
 rs qw Xn  |  S(   sZ  Return this platform's maximum compatible version.

    distutils.util.get_platform() normally reports the minimum version
    of Mac OS X that would be required to *use* extensions produced by
    distutils.  But what we want when checking compatibility is to know the
    version of Mac OS X that we are *running*.  To allow usage of packages that
    explicitly require a newer version of Mac OS X, we must also know the
    current version of the OS.

    If this condition occurs for any other platform with a version in its
    platform strings, this function should be extended accordingly.
    t   darwins   macosx-%s-%st   .i   i   N(
   t   get_build_platformt   macosVersionStringt   matcht   Nonet   syst   platformt   joint   _macosx_verst   groupt
   ValueError(   t   platt   m(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   get_supported_platform=   s    	 -t   requiret
   run_scriptt   get_providert   get_distributiont   load_entry_pointt   get_entry_mapt   get_entry_infot   iter_entry_pointst   resource_stringt   resource_streamt   resource_filenamet   resource_listdirt   resource_existst   resource_isdirt   declare_namespacet   working_sett   add_activation_listenert   find_distributionst   set_extraction_patht   cleanup_resourcest   get_default_cachet   Environmentt
   WorkingSett   ResourceManagert   Distributiont   Requirementt
   EntryPointt   ResolutionErrort   VersionConflictt   DistributionNotFoundt   UnknownExtrat   ExtractionErrort   parse_requirementst   parse_versiont	   safe_namet   safe_versiont   get_platformt   compatible_platformst   yield_linest   split_sectionst
   safe_extrat   to_filenamet   ensure_directoryt   normalize_patht   EGG_DISTt   BINARY_DISTt   SOURCE_DISTt   CHECKOUT_DISTt   DEVELOP_DISTt   IMetadataProvidert   IResourceProvidert   FileMetadatat   PathMetadatat   EggMetadatat   EmptyProvidert   empty_providert   NullProvidert   EggProvidert   DefaultProvidert   ZipProvidert   register_findert   register_namespace_handlert   register_loader_typet   fixup_namespace_packagest   get_importert   run_maint   AvailableDistributionsc           B   s   e  Z d  Z d   Z RS(   s.   Abstract base for dependency resolution errorsc         C   s   |  j  j t |  j  S(   N(   t	   __class__t   __name__t   reprt   args(   t   self(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   __repr__   s    (   Rd   t
   __module__t   __doc__Rh   (    (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR;      s   c           B   s   e  Z d  Z RS(   sA   An already-installed version conflicts with the requested version(   Rd   Ri   Rj   (    (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR<      s   c           B   s   e  Z d  Z RS(   s&   A requested distribution was not found(   Rd   Ri   Rj   (    (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR=      s   c           B   s   e  Z d  Z RS(   s>   Distribution doesn't have an "extra feature" of the given name(   Rd   Ri   Rj   (    (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR>      s   i   i   i   i    c         C   s   | t  |  <d S(   s  Register `provider_factory` to make providers for `loader_type`

    `loader_type` is the type or class of a PEP 302 ``module.__loader__``,
    and `provider_factory` is a function that, passed a *module* object,
    returns an ``IResourceProvider`` for that module.
    N(   t   _provider_factories(   t   loader_typet   provider_factory(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR^      s    c         C   s   t  |  t  r2 t j |   p1 t t |    d Sy t j |  } Wn( t k
 rm t	 |   t j |  } n Xt
 | d d  } t t |  |  S(   s?   Return an IResourceProvider for the named module or requirementi    t
   __loader__N(   t
   isinstanceR9   R/   t   findR    t   strR   t   modulest   KeyErrort
   __import__t   getattrR   t   _find_adapterRk   (   t   moduleOrReqt   modulet   loader(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR"      s    #
c         C   s   |  s d d  l  } | j   d } | d k r d d  l } d } t j j |  r t | d  r | j |  } d | k r | d } q q q n  |  j | j	 d   n  |  d S(   Nii    t    s0   /System/Library/CoreServices/SystemVersion.plistt	   readPlistt   ProductVersionR   (
   R   t   mac_vert   plistlibt   ost   patht   existst   hasattrR{   t   appendR	   (   t   _cacheR   t   versionR~   t   plistt   plist_content(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR      s    c         C   s   i d d 6d d 6j  |  |   S(   Nt   ppct   PowerPCt   Power_Macintosh(   t   get(   t   machine(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   _macosx_arch   s    c          C   s   y d d l  m }  Wn! t k
 r7 d d l m }  n X|    } t j d k r | j d  r yT t   } t j	   d j
 d d  } d t | d	  t | d
  t |  f SWq t k
 r q Xn  | S(   s   Return this platform's string for platform-specific distributions

    XXX Currently this is the same as ``distutils.util.get_platform()``, but it
    needs some hacks for Linux and Mac OS X.
    i(   RD   R   s   macosx-i   t    t   _s   macosx-%d.%d-%si    i   (   t   distutils.utilRD   t   ImportErrort	   sysconfigR   R   t
   startswithR   R   t   unamet   replacet   intR   R   (   RD   R   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR      s    		s   macosx-(\d+)\.(\d+)-(.*)s   darwin-(\d+)\.(\d+)\.(\d+)-(.*)c      
   C   sO  |  d	 k s$ | d	 k s$ |  | k r( t St j |  } | rKt j |   } | s t j |   } | r t | j d   } d | j d  | j d  f } | d k r | d k s | d k r | d k r t Sn  t S| j d  | j d  k s| j d  | j d  k rt St | j d   t | j d   k rGt St St S(
   s   Can code for the `provided` platform run on the `required` platform?

    Returns true if either platform is ``None``, or the platforms are equal.

    XXX Needs compatibility checks for Linux and other unixy OSes.
    i   s   %s.%si   i   s   10.3i   s   10.4i   N(   R   t   TrueR   R   t   darwinVersionStringR   R   t   False(   t   providedt   requiredt   reqMact   provMact
   provDarwint   dversiont   macosversion(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRE      s*    $"*c         C   sN   t  j d  j } | d } | j   | | d <t |   d j | |  d S(   s@   Locate distribution `dist_spec` and run its `script_name` scripti   Rd   i    N(   R   t	   _getframet	   f_globalst   clearR    R!   (   t	   dist_spect   script_namet   nsR   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR!     s
    


c         C   sd   t  |  t  r! t j |   }  n  t  |  t  r? t |   }  n  t  |  t  s` t d |    n  |  S(   s@   Return a current distribution object for a Requirement or strings-   Expected string, Requirement, or Distribution(   Ro   t
   basestringR9   t   parseR"   R8   t	   TypeError(   t   dist(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR#   '  s      c         C   s   t  |   j | |  S(   sD   Return `name` entry point of `group` for `dist` or raise ImportError(   R#   R$   (   R   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR$   /  s    c         C   s   t  |   j |  S(   s=   Return the entry point map for `group`, or the full entry map(   R#   R%   (   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR%   3  s    c         C   s   t  |   j | |  S(   s<   Return the EntryPoint object for `group`+`name`, or ``None``(   R#   R&   (   R   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR&   7  s    c           B   s>   e  Z d    Z d   Z d   Z d   Z d   Z d   Z RS(   c         C   s   d S(   s;   Does the package's distribution contain the named metadata?N(    (   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   has_metadata>  s    c         C   s   d S(   s'   The named metadata resource as a stringN(    (   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   get_metadataA  s    c         C   s   d S(   s   Yield named metadata resource as list of non-blank non-comment lines

       Leading and trailing whitespace is stripped from each line, and lines
       with ``#`` as the first non-blank character are omitted.N(    (   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   get_metadata_linesD  s    c         C   s   d S(   s>   Is the named metadata a directory?  (like ``os.path.isdir()``)N(    (   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   metadata_isdirJ  s    c         C   s   d S(   s?   List of metadata names in the directory (like ``os.listdir()``)N(    (   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   metadata_listdirM  s    c         C   s   d S(   s=   Execute the named script in the supplied namespace dictionaryN(    (   R   t	   namespace(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR!   P  s    (   Rd   Ri   R   R   R   R   R   R!   (    (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRQ   <  s   					c           B   sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   s3   An object that provides access to package resourcesc         C   s   d S(   sd   Return a true filesystem path for `resource_name`

        `manager` must be an ``IResourceManager``N(    (   t   managert   resource_name(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   get_resource_filename_  s    c         C   s   d S(   si   Return a readable file-like object for `resource_name`

        `manager` must be an ``IResourceManager``N(    (   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   get_resource_streamd  s    c         C   s   d S(   sm   Return a string containing the contents of `resource_name`

        `manager` must be an ``IResourceManager``N(    (   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   get_resource_stringi  s    c         C   s   d S(   s,   Does the package contain the named resource?N(    (   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   has_resourcen  s    c         C   s   d S(   s>   Is the named resource a directory?  (like ``os.path.isdir()``)N(    (   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR-   q  s    c         C   s   d S(   s?   List of resource names in the directory (like ``os.listdir()``)N(    (   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR+   t  s    (	   Rd   Ri   Rj   R   R   R   R   R-   R+   (    (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRR   \  s   					c           B   s   e  Z d  Z d d  Z d   Z d   Z d   Z d d  Z d   Z	 d   Z
 d e d  Z d d e d	  Z d d e d
  Z d   Z d   Z d   Z RS(   sD   A collection of active distributions on sys.path (or a similar list)c         C   s^   g  |  _  i  |  _ i  |  _ g  |  _ | d k r< t j } n  x | D] } |  j |  qC Wd S(   s?   Create working set from list of path entries (default=sys.path)N(   t   entriest
   entry_keyst   by_keyt	   callbacksR   R   R   t	   add_entry(   Rg   R   t   entry(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   __init__  s    				c         C   sT   |  j  j | g   |  j j |  x* t | t  D] } |  j | | t  q3 Wd S(   s  Add a path item to ``.entries``, finding any distributions on it

        ``find_distributions(entry,True)`` is used to find distributions
        corresponding to the path entry, and they are added.  `entry` is
        always appended to ``.entries``, even if it is already present.
        (This is because ``sys.path`` can contain the same value more than
        once, and the ``.entries`` of the ``sys.path`` WorkingSet should always
        equal ``sys.path``.)
        N(   R   t
   setdefaultR   R   R1   R   t   addR   (   Rg   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    
c         C   s   |  j  j | j  | k S(   s9   True if `dist` is the active distribution for its project(   R   R   t   key(   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   __contains__  s    c         C   sG   |  j  j | j  } | d k	 r? | | k r? t | |   n | Sd S(   s  Find a distribution matching requirement `req`

        If there is an active distribution for the requested project, this
        returns it as long as it meets the version requirement specified by
        `req`.  But, if there is an active distribution for the project and it
        does *not* meet the `req` requirement, ``VersionConflict`` is raised.
        If there is no active distribution for the requested project, ``None``
        is returned.
        N(   R   R   R   R   R<   (   Rg   t   reqR   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRp     s    
c         c   sg   x` |  D]X } | j  |  } | d k rG x4 | j   D] } | Vq5 Wq | | k r | | Vq q Wd S(   s  Yield entry point objects from `group` matching `name`

        If `name` is None, yields all entry points in `group` from all
        distributions in the working set, otherwise only ones matching
        both `group` and `name` are yielded (in distribution order).
        N(   R%   R   t   values(   Rg   R   R   R   R   t   ep(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR'     s    c         C   sQ   t  j d  j } | d } | j   | | d <|  j |  d j | |  d S(   s?   Locate distribution for `requires` and run `script_name` scripti   Rd   i    N(   R   R   R   R   R    R!   (   Rg   t   requiresR   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR!     s
    


c         c   s[   i  } xN |  j  D]C } x: |  j | D]+ } | | k r$ d | | <|  j | Vq$ q$ Wq Wd S(   s   Yield distributions for non-duplicate projects in the working set

        The yield order is the order in which the items' path entries were
        added to the working set.
        i   N(   R   R   R   (   Rg   t   seent   itemR   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   __iter__  s    
c         C   s   | r | j  |  j |  n  | d k r4 | j } n  |  j j | g   } |  j j | j g   } | j |  j k rw d S| |  j | j <| j | k r | j | j  n  | j | k r | j | j  n  |  j	 |  d S(   s  Add `dist` to working set, associated with `entry`

        If `entry` is unspecified, it defaults to the ``.location`` of `dist`.
        On exit from this routine, `entry` is added to the end of the working
        set's ``.entries`` (if it wasn't already present).

        `dist` is only added to the working set if it's for a project that
        doesn't already have a distribution in the set.  If it's added, any
        callbacks registered with the ``subscribe()`` method will be called.
        N(
   t	   insert_onR   R   t   locationR   R   R   R   R   t
   _added_new(   Rg   R   R   t   insertt   keyst   keys2(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    c   
      C   sz  t  |  d d d  } i  } i  } g  } xH| ru| j d  } t |  rg | rg t j d  } n  | | k ry q. n  | j | j  }	 |	 d k r$|  j j | j  }	 |	 d k r| d k r t	 |  j
  } n  | j | |  |  }	 | | j <|	 d k rt |   qn  | j |	  n  |	 | k rBt |	 |   n  | j |	 j | j  d d d   t | | <q. W| S(   s  List all distributions needed to (recursively) meet `requirements`

        `requirements` must be a sequence of ``Requirement`` objects.  `env`,
        if supplied, should be an ``Environment`` instance.  If
        not supplied, it defaults to all distributions available within any
        entry or distribution in the working set.  `installer`, if supplied,
        will be invoked with each requirement that cannot be met by an
        already-installed distribution; it should return a ``Distribution`` or
        ``None``.
        Nii    t
   distribute(   t   listt   popt   _override_setuptoolsR9   R   R   R   R   R   R5   R   t
   best_matchR=   R   R<   t   extendR   t   extrasR   (
   Rg   t   requirementst   envt	   installert   replacementt	   processedt   bestt   to_activateR   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   resolve   s2    	 &c         C   s5  t  |  } | j   i  } i  } | d k rJ t |  j  } | | 7} n
 | | } |  j g   }	 t |	 j |   x | D] }
 x | |
 D] } | j   g } y |	 j	 | | |  } Wn* t
 k
 r } | | | <| r q qPq Xt |	 j |  | j t j |   Pq Wqz Wt  |  } | j   | | f S(   sb  Find all activatable distributions in `plugin_env`

        Example usage::

            distributions, errors = working_set.find_plugins(
                Environment(plugin_dirlist)
            )
            map(working_set.add, distributions)  # add plugins+libs to sys.path
            print 'Could not load', errors        # display errors

        The `plugin_env` should be an ``Environment`` instance that contains
        only distributions that are in the project's "plugin directory" or
        directories. The `full_env`, if supplied, should be an ``Environment``
        contains all currently-available distributions.  If `full_env` is not
        supplied, one is created automatically from the ``WorkingSet`` this
        method is called on, which will typically mean that every directory on
        ``sys.path`` will be scanned for distributions.

        `installer` is a standard installer callback as used by the
        ``resolve()`` method. The `fallback` flag indicates whether we should
        attempt to resolve older versions of a plugin if the newest version
        cannot be resolved.

        This method returns a 2-tuple: (`distributions`, `error_info`), where
        `distributions` is a list of the distributions found in `plugin_env`
        that were loadable, along with any other distributions that are needed
        to resolve their dependencies.  `error_info` is a dictionary mapping
        unloadable plugin distributions to an exception instance describing the
        error that occurred. Usually this will be a ``DistributionNotFound`` or
        ``VersionConflict`` instance.
        N(   R   t   sortR   R5   R   Rc   t   mapR   t   as_requirementR   R;   t   updatet   dictt   fromkeys(   Rg   t
   plugin_envt   full_envR   t   fallbackt   plugin_projectst
   error_infot   distributionsR   t
   shadow_sett   project_nameR   R   t	   resolveest   v(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   find_plugins2  s4    #


	
c         G   s7   |  j  t |   } x | D] } |  j |  q W| S(   s  Ensure that distributions matching `requirements` are activated

        `requirements` must be a string or a (possibly-nested) sequence
        thereof, specifying the distributions and versions required.  The
        return value is a sequence of the distributions that needed to be
        activated to fulfill the requirements; all relevant distributions are
        included, even if they were already activated in this working set.
        (   R   R@   R   (   Rg   R   t   neededR   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR      s    
c         C   sB   | |  j  k r d S|  j  j |  x |  D] } | |  q* Wd S(   sA   Invoke `callback` for all distributions (including existing ones)N(   R   R   (   Rg   t   callbackR   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt	   subscribe  s
    c         C   s"   x |  j  D] } | |  q
 Wd  S(   N(   R   (   Rg   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    N(   Rd   Ri   Rj   R   R   R   R   Rp   R'   R!   R   R   R   R   R   R    R   R   (    (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR6     s   				
	3Q			c           B   s   e  Z d  Z d e   e d  Z d   Z d   Z d d  Z	 d   Z
 d   Z d d  Z d d  Z d	   Z d
   Z d   Z RS(   s5   Searchable snapshot of distributions on a search pathc         C   s5   i  |  _  i  |  _ | |  _ | |  _ |  j |  d S(   s!  Snapshot distributions available on a search path

        Any distributions found on `search_path` are added to the environment.
        `search_path` should be a sequence of ``sys.path`` items.  If not
        supplied, ``sys.path`` is used.

        `platform` is an optional string specifying the name of the platform
        that platform-specific distributions must be compatible with.  If
        unspecified, it defaults to the current platform.  `python` is an
        optional string naming the desired version of Python (e.g. ``'2.4'``);
        it defaults to the current version.

        You may explicitly set `platform` (and/or `python`) to ``None`` if you
        wish to map *all* distributions, not just those compatible with the
        running platform or Python version.
        N(   t   _distmapR   R   t   pythont   scan(   Rg   t   search_pathR   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s
    				c         C   sC   |  j  d k s0 | j d k s0 | j |  j  k oB t | j |  j  S(   s   Is distribution `dist` acceptable for this environment?

        The distribution must match the platform and python version
        requirements specified when this environment was created, or False
        is returned.
        N(   R   R   t
   py_versionRE   R   (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   can_add  s    c         C   s   |  j  | j j |  d S(   s"   Remove `dist` from the environmentN(   R   R   t   remove(   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    c         C   sQ   | d k r t j } n  x2 | D]* } x! t |  D] } |  j |  q2 Wq Wd S(   sd  Scan `search_path` for distributions usable in this environment

        Any distributions found are added to the environment.
        `search_path` should be a sequence of ``sys.path`` items.  If not
        supplied, ``sys.path`` is used.  Only distributions conforming to
        the platform/python version defined at initialization are added.
        N(   R   R   R   R1   R   (   Rg   R   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s
    c         C   s   y |  j  | SWn0 t k
 rA | j   } | |  j k rB g  Sn X| |  j  k rv |  j | } |  j  | <t |  n  |  j  | S(   sK   Return a newest-to-oldest list of distributions for `project_name`
        (   R   Rs   t   lowerR   t   _sort_dists(   Rg   R   t   dists(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   __getitem__  s    c         C   s   |  j  |  r{ | j   r{ |  j j | j g   } | | k r{ | j |  | j |  j k rx t |  j | j  qx q{ n  d S(   s<   Add `dist` if we ``can_add()`` it and it isn't already addedN(   R   t   has_versionR   R   R   R   R   R   (   Rg   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    c         C   sW   | j  |  } | d k	 r | Sx% |  | j D] } | | k r- | Sq- W|  j | |  S(   s  Find distribution best matching `req` and usable on `working_set`

        This calls the ``find(req)`` method of the `working_set` to see if a
        suitable distribution is already active.  (This may raise
        ``VersionConflict`` if an unsuitable version of the project is already
        active in the specified `working_set`.)  If a suitable distribution
        isn't active, this method returns the newest distribution in the
        environment that meets the ``Requirement`` in `req`.  If no suitable
        distribution is found, and `installer` is supplied, then the result of
        calling the environment's ``obtain(req, installer)`` method will be
        returned.
        N(   Rp   R   R   t   obtain(   Rg   R   R/   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    c         C   s   | d k	 r | |  Sd S(   s  Obtain a distribution matching `requirement` (e.g. via download)

        Obtain a distro that matches requirement (e.g. via download).  In the
        base ``Environment`` class, this routine just returns
        ``installer(requirement)``, unless `installer` is None, in which case
        None is returned instead.  This method is a hook that allows subclasses
        to attempt other ways of obtaining a distribution before falling back
        to the `installer` argument.N(   R   (   Rg   t   requirementR   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    	c         c   s0   x) |  j  j   D] } |  | r | Vq q Wd S(   s=   Yield the unique project names of the available distributionsN(   R   R   (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR      s    
 c         C   s{   t  | t  r |  j |  nX t  | t  rd xF | D]( } x | | D] } |  j |  qF Wq5 Wn t d | f   |  S(   s2   In-place addition of a distribution or environments   Can't add %r to environment(   Ro   R8   R   R5   R   (   Rg   t   othert   projectR   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   __iadd__(  s    c         C   s@   |  j  g  d d d d } x |  | f D] } | | 7} q( W| S(   s4   Add an environment or distribution to an environmentR   R   N(   Rc   R   (   Rg   R   t   newR   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   __add__4  s    N(   Rd   Ri   Rj   R   R   t   PY_MAJORR   R   R   R   R   R   R   R   R   R  R  (    (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR5     s   				
		c           B   s   e  Z d  Z RS(   sT  An error occurred extracting a resource

    The following attributes are available from instances of this exception:

    manager
        The resource manager that raised this exception

    cache_path
        The base directory for resource extraction

    original_error
        The exception instance that caused extraction to fail
    (   Rd   Ri   Rj   (    (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR?   ?  s   c           B   s   e  Z d  Z d Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z d   Z d d	  Z d
   Z d   Z e d  Z RS(   s'   Manage resource extraction and packagesc         C   s   i  |  _  d  S(   N(   t   cached_files(   Rg   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR   U  s    c         C   s   t  |  j |  S(   s   Does the named resource exist?(   R"   R   (   Rg   t   package_or_requirementR   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR,   X  s    c         C   s   t  |  j |  S(   s,   Is the named resource an existing directory?(   R"   R-   (   Rg   R  R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR-   \  s    c         C   s   t  |  j |  |  S(   s4   Return a true filesystem path for specified resource(   R"   R   (   Rg   R  R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR*   b  s    c         C   s   t  |  j |  |  S(   s9   Return a readable file-like object for specified resource(   R"   R   (   Rg   R  R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR)   h  s    c         C   s   t  |  j |  |  S(   s%   Return specified resource as a string(   R"   R   (   Rg   R  R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR(   n  s    c         C   s   t  |  j |  S(   s1   List the contents of the named resource directory(   R"   R+   (   Rg   R  R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR+   t  s    c         C   s]   t  j   d } |  j p t   } t d | | f  } |  | _ | | _ | | _ |  d S(   s5   Give an error message for problems extracting file(s)i   s}  Can't extract file(s) to egg cache

The following error occurred while trying to extract file(s) to the Python egg
cache:

  %s

The Python egg cache directory is currently set to:

  %s

Perhaps your account does not have write access to this directory?  You can
change the cache directory by setting the PYTHON_EGG_CACHE environment
variable to point to an accessible directory.
N(   R   t   exc_infot   extraction_pathR4   R?   R   t
   cache_patht   original_error(   Rg   t   old_excR
  t   err(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   extraction_errorz  s    			c         C   sa   |  j  p t   } t j j | | d |  } y t |  Wn |  j   n Xd |  j | <| S(   s  Return absolute location in cache for `archive_name` and `names`

        The parent directory of the resulting path will be created if it does
        not already exist.  `archive_name` should be the base filename of the
        enclosing egg (which may not be the name of the enclosing zipfile!),
        including its ".egg" extension.  `names`, if provided, should be a
        sequence of path name parts "under" the egg's extraction location.

        This method should only be called by resource providers that need to
        obtain an extraction location, and only for names they intend to
        extract, as it tracks the generated names for possible cleanup later.
        s   -tmpi   (   R	  R4   R   R   R   R   R  R  (   Rg   t   archive_namet   namest   extract_patht   target_path(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   get_cache_path  s    c         C   s@   t  j d k r< t  j |  j d Bd @} t  j | |  n  d S(   s4  Perform any platform-specific postprocessing of `tempname`

        This is where Mac header rewrites should be done; other platforms don't
        have anything special they should do.

        Resource providers should call this method ONLY after successfully
        extracting a compressed resource.  They must NOT call it on resources
        that are already in the filesystem.

        `tempname` is the current (temporary) name of the file, and `filename`
        is the name it will be renamed to by the caller after this routine
        returns.
        t   posixim  i  N(   R   R   t   statt   st_modet   chmod(   Rg   t   tempnameR   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   postprocess  s    c         C   s%   |  j  r t d   n  | |  _ d S(   s  Set the base path where resources will be extracted to, if needed.

        If you do not call this routine before any extractions take place, the
        path defaults to the return value of ``get_default_cache()``.  (Which
        is based on the ``PYTHON_EGG_CACHE`` environment variable, with various
        platform-specific fallbacks.  See that routine's documentation for more
        details.)

        Resources are extracted to subdirectories of this path based upon
        information given by the ``IResourceProvider``.  You may set this to a
        temporary directory, but then you must call ``cleanup_resources()`` to
        delete the extracted files when done.  There is no guarantee that
        ``cleanup_resources()`` will be able to remove all extracted files.

        (Note: you may not change the extraction path for a given resource
        manager once resources have been extracted, unless you first call
        ``cleanup_resources()``.)
        s5   Can't change extraction path, files already extractedN(   R  R   R	  (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR2     s    	c         C   s   d S(   sB  
        Delete all extracted resource files and directories, returning a list
        of the file and directory names that could not be successfully removed.
        This function does not have any concurrency protection, so it should
        generally only be called when the extraction path is a temporary
        directory exclusive to a single process.  This method is not
        automatically called; you must call it explicitly or register it as an
        ``atexit`` function if you wish to ensure cleanup of a temporary
        directory used for extractions.
        N(    (   Rg   t   force(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR3     s    N(    (   Rd   Ri   Rj   R   R	  R   R,   R-   R*   R)   R(   R+   R  R  R  R2   R   R3   (    (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR7   Q  s   								))	)	c          C   s  y t  j d SWn t k
 r" n Xt  j d k rB t  j j d  Sd }  d d |  f d |  f d |  f d d |  f g } x | D] \ } } d } xn | D]5 } | t  j k r t  j j | t  j |  } q Pq W| r t  j j | |  } n  t  j j | d  Sq Wt d   d S(   s  Determine the default cache location

    This returns the ``PYTHON_EGG_CACHE`` environment variable, if set.
    Otherwise, on Windows, it returns a "Python-Eggs" subdirectory of the
    "Application Data" directory.  On all other systems, it's "~/.python-eggs".
    t   PYTHON_EGG_CACHEt   nts   ~/.python-eggss   Application Datat   APPDATAt   USERPROFILEt	   HOMEDRIVEt   HOMEPATHt   HOMEt   WINDIRRz   s   Python-Eggss3   Please set the PYTHON_EGG_CACHE enviroment variableN(   s   APPDATA(   (   s   APPDATAN(   R  (   R  R   (   R   (   s   HOME(   (   s   HOMEN(   R"  (	   R   t   environRs   R   R   t
   expanduserR   R   t   RuntimeError(   t   app_datat	   app_homesR   t   subdirR   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR4     s0    			c         C   s   t  j d d |   S(   s   Convert an arbitrary string to a standard distribution name

    Any runs of non-alphanumeric/. characters are replaced with a single '-'.
    s   [^A-Za-z0-9.]+t   -(   t   ret   sub(   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRB   G  s    c         C   s%   |  j  d d  }  t j d d |   S(   s   Convert an arbitrary string to a standard version string

    Spaces become dots, and all other non-alphanumeric characters become
    dashes, with runs of multiple dashes condensed to a single dash.
    R   R   s   [^A-Za-z0-9.]+R)  (   R   R*  R+  (   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRC   O  s    c         C   s   t  j d d |   j   S(   s   Convert an arbitrary string to a standard 'extra' name

    Any runs of non-alphanumeric characters are replaced with a single '_',
    and the result is always lowercased.
    s   [^A-Za-z0-9.]+R   (   R*  R+  R   (   t   extra(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRH   Y  s    c         C   s   |  j  d d  S(   s|   Convert a project or version name to its filename-escaped form

    Any '-' characters are currently replaced with '_'.
    R)  R   (   R   (   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRI   b  s    c           B   s   e  Z d  Z d Z d Z d Z d   Z d   Z d   Z	 d   Z
 d   Z d   Z e j d k ro d   Z n	 d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   sE   Try to implement resources and metadata for arbitrary PEP 302 loadersc         C   s:   t  | d d   |  _ t j j t  | d d   |  _ d  S(   NRn   t   __file__Rz   (   Ru   R   Ry   R   R   R   t   module_path(   Rg   Rx   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR   w  s    c         C   s   |  j  |  j |  S(   N(   t   _fnR.  (   Rg   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR   {  s    c         C   s   t  |  j | |   S(   N(   t   StringIOR   (   Rg   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR   ~  s    c         C   s   |  j  |  j |  j |   S(   N(   t   _getR/  R.  (   Rg   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    c         C   s   |  j  |  j |  j |   S(   N(   t   _hasR/  R.  (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    c         C   s%   |  j  o$ |  j |  j |  j  |   S(   N(   t   egg_infoR2  R/  (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    i   c         C   s)   |  j  s d S|  j |  j |  j  |   S(   NRz   (   R3  R1  R/  (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    	c         C   s2   |  j  s d S|  j |  j |  j  |   j d  S(   NRz   s   utf-8(   R3  R1  R/  t   decode(   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    	c         C   s   t  |  j |   S(   N(   RF   R   (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    c         C   s   |  j  |  j |  j |   S(   N(   t   _isdirR/  R.  (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR-     s    c         C   s%   |  j  o$ |  j |  j |  j  |   S(   N(   R3  R5  R/  (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    c         C   s   |  j  |  j |  j |   S(   N(   t   _listdirR/  R.  (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR+     s    c         C   s)   |  j  r% |  j |  j |  j  |   Sg  S(   N(   R3  R6  R/  (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    	c         B   s   d | } |  j  |  s, e d |   n  |  j |  j d d  } | j d d  } |  j |  j |  } | | d <e j j |  r e	 | | |  nQ d d l
 m } e |  d	 | j d  | f | | <e | | d
  } | | | Ud  S(   Ns   scripts/s   No script named %rs   
s   
s   R-  i(   t   cachei    t   exec(   R   R;   R   R   R/  R3  R   R   R   t   execfilet	   linecacheR7  t   lenR	   t   compile(   Rg   R   R   t   scriptt   script_textt   script_filenameR7  t   script_code(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR!     s    

%c         C   s   t  d   d  S(   Ns9   Can't perform this operation for unregistered loader type(   t   NotImplementedError(   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR2    s    c         C   s   t  d   d  S(   Ns9   Can't perform this operation for unregistered loader type(   RA  (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR5    s    c         C   s   t  d   d  S(   Ns9   Can't perform this operation for unregistered loader type(   RA  (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR6    s    c         C   s&   | r" t  j j | | j d   S| S(   Nt   /(   R   R   R   R	   (   Rg   t   baseR   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR/    s    c         C   s2   t  |  j d  r" |  j j |  St d   d  S(   Nt   get_datas=   Can't perform this operation for loaders without 'get_data()'(   R   Ry   RD  RA  (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR1    s    N(   i   (   Rd   Ri   Rj   R   t   egg_nameR3  Ry   R   R   R   R   R   R   R   t   version_infoR   R   R-   R   R+   R   R!   R2  R5  R6  R/  R1  (    (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRX   p  s0   																	c           B   s    e  Z d  Z d   Z d   Z RS(   s&   Provider based on a virtual filesystemc         C   s   t  j |  |  |  j   d  S(   N(   RX   R   t   _setup_prefix(   Rg   Rx   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    c         C   s   |  j  } d  } x} | | k r | j   j d  rm t j j |  |  _ t j j | d  |  _	 | |  _
 Pn  | } t j j |  \ } } q Wd  S(   Ns   .eggs   EGG-INFO(   R.  R   R   t   endswithR   R   t   basenameRE  R   R3  t   egg_rootR	   (   Rg   R   t   oldRC  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRG    s    		(   Rd   Ri   Rj   R   RG  (    (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRY     s   	c           B   s;   e  Z d  Z d   Z d   Z d   Z d   Z d   Z RS(   s6   Provides access to package resources in the filesystemc         C   s   t  j j |  S(   N(   R   R   R   (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR2    s    c         C   s   t  j j |  S(   N(   R   R   R   (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR5    s    c         C   s   t  j |  S(   N(   R   t   listdir(   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR6    s    c         C   s   t  |  j |  j |  d  S(   Nt   rb(   R   R/  R.  (   Rg   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    c         C   s/   t  | d  } z | j   SWd  | j   Xd  S(   NRM  (   R   t   readt   close(   Rg   R   t   stream(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR1     s    (   Rd   Ri   Rj   R2  R5  R6  R   R1  (    (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRZ     s   				c           B   s<   e  Z d  Z d   Z Z d   Z d   Z d Z d   Z	 RS(   s.   Provider that returns nothing for all requestsc         C   s   t  S(   N(   R   (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   <lambda>  s    c         C   s   d S(   NRz   (    (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRQ    s    c         C   s   g  S(   N(    (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRQ    s    c         C   s   d  S(   N(    (   Rg   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    N(
   Rd   Ri   Rj   R5  R2  R1  R6  R   R.  R   (    (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRV   
  s   		c           B   s   e  Z d  Z d Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z d   Z d	   Z d
   Z d   Z d   Z RS(   s"   Resource support for zips and eggsc         C   s@   t  j |  |  t j |  j j |  _ |  j j t j |  _	 d  S(   N(
   RY   R   t	   zipimportt   _zip_directory_cacheRy   t   archivet   zipinfoR   t   sept   zip_pre(   Rg   Rx   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    c         C   s@   | j  |  j  r# | t |  j  St d | |  j f   d  S(   Ns   %s is not a subpath of %s(   R   RW  R;  t   AssertionError(   Rg   t   fspath(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   _zipinfo_name$  s    c         C   sd   |  j  | } | j |  j t j  rG | t |  j  d j t j  St d | |  j f   d  S(   Ni   s   %s is not a subpath of %s(   RW  R   RJ  R   RV  R;  R	   RX  (   Rg   t   zip_pathRY  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   _parts-  s
    !c         C   s   |  j  s t d   n  |  j |  } |  j   } d j |  j |   | k r~ x* | D] } |  j | |  j |   qX Wn  |  j | |  S(   Ns5   resource_filename() only supported for .egg, not .zipRB  (   RE  RA  t   _resource_to_zipt   _get_eager_resourcesR   R\  t   _extract_resourcet   _eager_to_zip(   Rg   R   R   R[  t   eagersR   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR   6  s    	 c      	   C   s  | |  j    k r^ x9 |  j    | D]' } |  j | t j j | |   } q# Wt j j |  S|  j | } | d | d | d } } } | d ?d | d ?d @| d @| d @d	 ?| d ?d
 @| d @d d d d f	 }	 t j |	  }
 yt	 s t
 d   n  | j |  j |  j |   } t j j |  rct j |  } | j | k rc| j |
 k rc| Sn  t d d t j j |  \ } } t j | |  j j |   t j |  t | |
 |
 f  | j | |  y t | |  Wn t j k
 rmt j j |  rgt j |  } | j | k r:| j |
 k r:| St j d k rgt |  t | |  | Sn    n XWn t j k
 r| j   n X| S(   Ni   i   i   i	   i  i   i   i  i   i?   i   i    is>   "os.rename" and "os.unlink" are not supported on this platforms	   .$extractt   dirR  (   t   _indexR_  R   R   R   R   RU  t   timet   mktimeR
   R   R  RE  R\  t   isfileR  t   st_sizet   st_mtimet   _mkstempt   writeRy   RD  RO  R   R  R   t   errorR   R   R  (   Rg   R   R[  R   t   lastt   zip_statt   tt   dt   sizet	   date_timet	   timestampt	   real_pathR  t   outft   tmpnam(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR_  C  sN     0$
c         C   sa   |  j  d  k rZ g  } x6 d D]. } |  j |  r | j |  j |   q q W| |  _  n  |  j  S(   Ns   native_libs.txts   eager_resources.txt(   s   native_libs.txts   eager_resources.txt(   Ra  R   R   R   R   (   Rg   Ra  R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR^    s    c         C   s   y |  j  SWn t k
 r i  } x~ |  j D]s } | j t j  } xX | r t j j | d   } | | k r | | j | d  PqF | j   g | | <qF Wq+ W| |  _  | SXd  S(   Ni(	   t	   _dirindext   AttributeErrorRU  R	   R   RV  R   R   R   (   Rg   t   indR   t   partst   parent(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRc    s    		c         C   s.   |  j  |  } | |  j k p- | |  j   k S(   N(   RZ  RU  Rc  (   Rg   RY  R[  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR2    s    c         C   s   |  j  |  |  j   k S(   N(   RZ  Rc  (   Rg   RY  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR5    s    c         C   s%   t  |  j   j |  j |  d   S(   N(    (   R   Rc  R   RZ  (   Rg   RY  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR6    s    c         C   s   |  j  |  j |  j |   S(   N(   RZ  R/  RJ  (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR`    s    c         C   s   |  j  |  j |  j |   S(   N(   RZ  R/  R.  (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR]    s    N(   Rd   Ri   Rj   R   Ra  R   RZ  R\  R   R_  R^  Rc  R2  R5  R6  R`  R]  (    (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR[     s   							<							c           B   s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   s*  Metadata handler for standalone PKG-INFO files

    Usage::

        metadata = FileMetadata("/path/to/PKG-INFO")

    This provider rejects all data and metadata requests except for PKG-INFO,
    which is treated as existing, and will be the contents of the file at
    the provided location.
    c         C   s   | |  _  d  S(   N(   R   (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    c         C   s
   | d k S(   Ns   PKG-INFO(    (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    c         C   sH   | d k r8 t  |  j d  } | j   } | j   | St d   d  S(   Ns   PKG-INFOt   rUs(   No metadata except PKG-INFO is available(   R   R   RN  RO  Rs   (   Rg   R   t   ft   metadata(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    
c         C   s   t  |  j |   S(   N(   RF   R   (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    (   Rd   Ri   Rj   R   R   R   R   (    (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRS     s
   
			c           B   s   e  Z d  Z d   Z RS(   sq  Metadata provider for egg directories

    Usage::

        # Development eggs:

        egg_info = "/path/to/PackageName.egg-info"
        base_dir = os.path.dirname(egg_info)
        metadata = PathMetadata(base_dir, egg_info)
        dist_name = os.path.splitext(os.path.basename(egg_info))[0]
        dist = Distribution(basedir,project_name=dist_name,metadata=metadata)

        # Unpacked egg directories:

        egg_path = "/path/to/PackageName-ver-pyver-etc.egg"
        metadata = PathMetadata(egg_path, os.path.join(egg_path,'EGG-INFO'))
        dist = Distribution.from_filename(egg_path, metadata=metadata)
    c         C   s   | |  _  | |  _ d  S(   N(   R.  R3  (   Rg   R   R3  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    	(   Rd   Ri   Rj   R   (    (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRT     s   c           B   s   e  Z d  Z d   Z RS(   s    Metadata provider for .egg filesc         C   ss   t  j | j |  _ | j t j |  _ | |  _ | j rY t j	 j
 | j | j  |  _ n | j |  _ |  j   d S(   s-   Create a metadata provider from a zipimporterN(   RR  RS  RT  RU  R   RV  RW  Ry   t   prefixR   R   R.  RG  (   Rg   t   importer(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR   
  s    		!(   Rd   Ri   Rj   R   (    (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRU     s   t
   ImpWrapperc           B   s&   e  Z d  Z d d  Z d d  Z RS(   s>   PEP 302 Importer that wraps Python's "normal" import algorithmc         C   s   | |  _  d  S(   N(   R   (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    c         C   s   | j  d  d } | | k r2 |  j d  k r2 d  S|  j d  k rJ d  } n |  j g } y t j | |  \ } } } Wn t k
 r d  SXt | | |  S(   NR   i(   R	   R   R   t   impt   find_moduleR   t	   ImpLoader(   Rg   t   fullnameR   t   subnamet   fileR   t   etc(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR    s    	N(   Rd   Ri   Rj   R   R   R  (    (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR    s   R  c           B   s    e  Z d  Z d   Z d   Z RS(   s<   PEP 302 Loader that wraps Python's "normal" import algorithmc         C   s   | |  _  | |  _ | |  _ d  S(   N(   R  R   R  (   Rg   R  R   R  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR   /  s    		c         C   sF   z% t  j | |  j |  j |  j  } Wd  |  j rA |  j j   n  X| S(   N(   R  t   load_moduleR  R   R  RO  (   Rg   R  t   mod(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR  4  s
    %	 (   Rd   Ri   Rj   R   R  (    (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR  ,  s   	c         C   s   y t  j |  } WnP t k
 rc x@ t  j D]+ } y | |   } Wn t k
 rT q+ XPq+ Wd } n Xt  j j |  |  | d k r y t |   } Wq t k
 r q Xn  | S(   s   Retrieve a PEP 302 "importer" for the given path item

    If there is no importer, this returns a wrapper around the builtin import
    machinery.  The returned importer is only cached if it was created by a
    path hook.
    N(   R   t   path_importer_cacheRs   t
   path_hooksR   R   R   R  (   t	   path_itemR  t   hook(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR`   @  s"    
(   R`   t   ImpImporterc         C   s   | t  |  <d S(   sx  Register `distribution_finder` to find distributions in sys.path items

    `importer_type` is the type or class of a PEP 302 "Importer" (sys.path item
    handler), and `distribution_finder` is a callable that, passed a path
    item and the importer instance, yields ``Distribution`` instances found on
    that path item.  See ``pkg_resources.find_on_path`` for an example.N(   t   _distribution_finders(   t   importer_typet   distribution_finder(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR\   k  s    c         C   s+   t  |   } t t |  } | | |  |  S(   s.   Yield distributions accessible via `path_item`(   R`   Rv   R  (   R  t   onlyR  t   finder(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR1   u  s    c         c   s   t  |   } | j d  r2 t j | d | Vn  | r< d  Sxf | j d  D]U } | j d  rL t j j | |  } x( t	 t
 j |  |  D] } | Vq WqL qL Wd  S(   Ns   PKG-INFOR}  RB  s   .egg(   RU   R   R8   t   from_filenameR+   RH  R   R   R   t   find_in_zipRR  t   zipimporter(   R  R  R  R}  t   subitemt   subpathR   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR  {  s    c          O   sE   y d d l  m a Wn! t k
 r7 d d l m a n Xt |  |   S(   s)   Thunk to load the real StringIO on demandi(   R0  (   t	   cStringIOR0  R   (   Rf   t   kw(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR0    s
    c         C   s   d S(   N(    (    (   R  R  R  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   find_nothing  s    c   
   	   c   s  t  |  } t j j |  rt j | t j  r| j   j d  rw t j	 | d t
 | t j j | d   Vqx^t j |  D]J} | j   } | j d  r
t j j | |  } t j j |  r t
 | |  } n t |  } t j | | | d t Vq | rN| j d  rNx t t j j | |   D] } | Vq<Wq | r | j d  r xj t t j j | |   D]J } | j   sqn  x. t t j j | | j     D] }	 |	 VqWPqWq q Wn  d S(   s6   Yield distributions accessible on a sys.path directorys   .eggR}  s   EGG-INFOs	   .egg-infot
   precedences	   .egg-linkN(   t   _normalize_cachedR   R   R   t   accesst   R_OKR   RH  R8   R  RT   R   RL  RS   t   from_locationRP   R1   R   t   stript   rstrip(
   R  R  R  R   R   t   fullpathR}  R   t   lineR   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   find_on_path  s2    '	 "" (	c         C   s   | t  |  <d S(   s  Register `namespace_handler` to declare namespace packages

    `importer_type` is the type or class of a PEP 302 "Importer" (sys.path item
    handler), and `namespace_handler` is a callable like this::

        def namespace_handler(importer,path_entry,moduleName,module):
            # return a path_entry to use for child packages

    Namespace handlers are only called if the importer object has already
    agreed that it can handle the relevant path item, and they should only
    return a subpath if the module __path__ does not already contain an
    equivalent subpath.  For an example namespace handler, see
    ``pkg_resources.file_ns_handler``.
    N(   t   _namespace_handlers(   R  t   namespace_handler(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR]     s    c         C   s  t  |  } | d k r d S| j |   } | d k r; d St j j |   } | d k r t j |   } t j |  <g  | _ t	 |   n! t
 | d  s t d |    n  t t |  } | | | |  |  } | d k	 r	| j } | j |  | j |   | | _ n  | S(   sE   Ensure that named package includes a subpath of path_item (if needed)t   __path__s   Not a package:N(   R`   R   R  R   Rr   R   t   typest
   ModuleTypeR  t   _set_parent_nsR   R   Rv   R  R   R  (   t   packageNameR  R  Ry   Rx   t   handlerR  R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt
   _handle_ns  s*    	 	  c         C   s  t  j   z |  t k r d St j d } } d |  k r d j |  j d  d   } t |  | t k r t	 |  y t j
 | j } Wq t k
 r t d |   q Xq n  t j | g   j |   t j |  g   x | D] } t |  |  q WWd t  j   Xd S(   s9   Declare that package 'packageName' is a namespace packageNR   is   Not a package:(   R  t   acquire_lockt   _namespace_packagesR   R   R   R   R	   R.   Rt   Rr   R  Rw  R   R   R   R  t   release_lock(   R  R   Rz  R  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR.     s&    


c         C   sb   t  j   zF x? t j | d  D]+ } t | |   } | r  t | |  q  q  WWd t  j   Xd S(   sD   Ensure that previously-declared namespace packages include path_itemN(    (   R  R  R  R   R  R_   R  (   R  Rz  t   packageR  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR_     s    
 c         C   s`   t  j j | | j d  d  } t |  } x+ | j D] } t |  | k r8 Pq8 q8 W| Sd S(   sB   Compute an ns-package subpath for a filesystem or zipfile importerR   iN(   R   R   R   R	   R  R  (   R  R  R  Rx   R  t
   normalizedR   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   file_ns_handler  s    "c         C   s   d  S(   N(   R   (   R  R  R  Rx   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   null_ns_handler  s    c         C   s   t  j j t  j j |    S(   s1   Normalize a file/dir name for comparison purposes(   R   R   t   normcaset   realpath(   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRK   $  s    c         C   s9   y | |  SWn& t  k
 r4 t |   | |  <} | SXd  S(   N(   Rs   RK   (   R   R   t   result(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR  (  s
    c         C   sU   |  j  d  } | j   } | rQ d j |  } t t j | | t j |   n  d  S(   NR   (   R	   R   R   t   setattrR   Rr   (   R  Ry  R   Rz  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR  /  s
    c         c   s   t  |  t  rS xn |  j   D]0 } | j   } | r | j d  r | Vq q Wn- x* |  D]" } x t |  D] } | Vqm WqZ Wd S(   sA   Yield non-empty/non-comment lines of a ``basestring`` or sequencet   #N(   Ro   R   t
   splitlinesR  R   RF   (   t   strst   st   ss(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRF   7  s    s
   \s*(#.*)?$s   \s*\\\s*(#.*)?$s   \s*((\w|[-.])+)s!   \s*(<=?|>=?|==|!=)\s*((\w|[-.])+)s   \s*,s   \s*\[s   \s*\]s   \w+(\.\w+)*$sL   (?P<name>[^-]+)( -(?P<ver>[^-]+) (-py(?P<pyver>[^-]+) (-(?P<plat>.+))? )? )?s   (\d+ | [a-z]+ | \.| -)t   ct   pret   previews   final-R)  t   rct   @t   devc         c   su   xi t  j |   D]X } t | |  } | s | d k r> q n  | d  d k r_ | j d  Vq d | Vq Wd Vd  S(   NR   i   t
   0123456789i   t   *s   *final(   t   component_reR	   R   t   zfill(   R  t   part(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   _parse_version_partsT  s    c         C   s   g  } x t  |  j    D] } | j d  r | d k  rd x' | r` | d d k r` | j   q= Wn  x' | r | d d k r | j   qg Wn  | j |  q Wt |  S(   s  Convert a version string to a chronologically-sortable key

    This is a rough cross between distutils' StrictVersion and LooseVersion;
    if you give it versions that would work with StrictVersion, then it behaves
    the same; otherwise it acts like a slightly-smarter LooseVersion. It is
    *possible* to create pathological version coding schemes that will fool
    this parser, but they should be very rare in practice.

    The returned value will be a tuple of strings.  Numeric portions of the
    version are padded to 8 digits so they will compare numerically, but
    without relying on how numbers compare relative to strings.  Dots are
    dropped, but dashes are retained.  Trailing zeros between alpha segments
    or dashes are suppressed, so that e.g. "2.4.0" is considered the same as
    "2.4". Alphanumeric parts are lower-cased.

    The algorithm assumes that strings like "-" and any alpha string that
    alphabetically follows "final"  represents a "patch level".  So, "2.4-1"
    is assumed to be a branch or patch of "2.4", and therefore "2.4.1" is
    considered newer than "2.4-1", which in turn is newer than "2.4".

    Strings like "a", "b", "c", "alpha", "beta", "candidate" and so on (that
    come before "final" alphabetically) are assumed to be pre-release versions,
    so that the version "2.4" is considered newer than "2.4a1".

    Finally, to handle miscellaneous cases, the strings "pre", "preview", and
    "rc" are treated as if they were "c", i.e. as though they were release
    candidates, and therefore are not as new as a version string that does not
    contain them, and "dev" is replaced with an '@' so that it sorts lower than
    than any other pre-release tag.
    R  s   *finalis   *final-t   00000000(   R  R   R   R   R   t   tuple(   R  Ry  R  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRA   `  s     c           B   s   e  Z d  Z d	 d
 d d  Z d   Z d   Z e d d d  Z d d d  Z	 d d  Z
 e e
  Z
 d d  Z e e  Z d d  Z e e  Z RS(   s3   Object representing an advertised importable objectc         C   sn   t  |  s t d |   n  | |  _ | |  _ t |  |  _ t j d d j |   j	 |  _	 | |  _
 d  S(   Ns   Invalid module names   x[%s]t   ,(   t   MODULER   R   t   module_nameR  t   attrsR9   R   R   R   R   (   Rg   R   R  R  R   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    		"c         C   sf   d |  j  |  j f } |  j r< | d d j |  j  7} n  |  j rb | d d j |  j  7} n  | S(   Ns   %s = %st   :R   s    [%s]R  (   R   R  R  R   R   (   Rg   R  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   __str__  s    		c         C   s   d t  |   S(   Ns   EntryPoint.parse(%r)(   Rq   (   Rg   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRh     s    c         C   s   | r |  j  | |  n  t |  j t   t   d g  } xN |  j D]C } y t | |  } WqD t k
 r t d | | f   qD XqD W| S(   NRd   s   %r has no %r attribute(   R    Rt   R  t   globalsR  Ru   Rw  R   (   Rg   R    R   R   R   t   attr(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   load  s     !c         C   sW   |  j  r% |  j r% t d |    n  t t j t j |  j j |  j   | |   d  S(   Ns&   Can't require() without a distribution(   R   R   R>   R   R/   R   R   R   (   Rg   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR      s    	c         C   s  y d	 } } | j  d d  \ } } d | k rz | j  d d  \ } } t j d |  } | j rn t  n  | j } n  d | k r | j  d d  \ } } t | j    s t  n  | j   j  d  } n  Wn  t k
 r t d |   n# X|  | j   | j   | | |  Sd S(
   s  Parse a single entry point from string `src`

        Entry point syntax follows the form::

            name = some.module:some.attr [extra1,extra2]

        The entry name and module name are required, but the ``:attrs`` and
        ``[extras]`` parts are optional
        t   =i   t   [s   x[R  R   s9   EntryPoint must be in 'name=module:attrs [extras]' formatN(    (	   R	   R9   R   t   specsR   R   R  R  R  (   t   clst   srcR   R  R   R   t   valueR   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s&    

	 		c         C   s   t  |  s t d |   n  i  } xZ t |  D]L } |  j | |  } | j | k rp t d | | j   n  | | | j <q1 W| S(   s   Parse an entry point groups   Invalid group names   Duplicate entry point(   R  R   RF   R   R   (   R  R   t   linesR   t   thisR  R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   parse_group  s    c         C   s   t  | t  r | j   } n t |  } i  } x~ | D]v \ } } | d k rj | s[ q7 n  t d   n  | j   } | | k r t d |   n  |  j | | |  | | <q7 W| S(   s!   Parse a map of entry point groupss%   Entry points must be listed in groupss   Duplicate group nameN(   Ro   R   t   itemsRG   R   R   R  R  (   R  t   dataR   t   mapsR   R  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt	   parse_map  s    (    (    N(   Rd   Ri   Rj   R   R   R  Rh   R   R  R    R   t   classmethodR  R  (    (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR:     s   			
	
c         C   s?   |  s
 d St  |   } | d j d  r; t | d  d  S|  S(   NRz   is   md5=(   Rz   (   R    R   R   (   R   t   parsed(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   _remove_md5_fragment  s    c           B   s  e  Z d  Z d  d  d  d  e d  e d  Z d  d  Z e e  Z e	 d    Z
 d   Z d   Z d   Z d   Z d   Z d	   Z d
   Z d   Z e	 e  Z d   Z e	 e  Z d   Z e	 e  Z d   Z e	 e  Z d! d  Z d   Z d  d  Z d   Z d   Z d   Z d   Z d  d  Z e e  Z d   Z d   Z d  d  Z  d   Z! d  d  Z" d   Z# d   Z$ d   Z% d   Z& e	 e&  Z& RS("   s5   Wrap an actual or potential sys.path entry w/metadatac         C   sj   t  | p d  |  _ | d  k	 r3 t |  |  _ n  | |  _ | |  _ | |  _ | |  _ | p` t	 |  _
 d  S(   Nt   Unknown(   RB   R   R   RC   t   _versionR   R   R   R  RW   t	   _provider(   Rg   R   R}  R   R   R   R   R  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    				c         K   s   d  g d \ } } } } t j j |  \ } }	 |	 j   d k r t |  }
 |
 r |
 j d d d d  \ } } } } q n  |  | | d | d	 | d
 | d | | S(   Ni   s   .eggs	   .egg-infoR   t   vert   pyverR   R   R   R   R   (   s   .eggs	   .egg-info(   R   R   R   t   splitextR   t   EGG_NAMER   (   R  R   RI  R}  R  R   R   R   R   t   extR   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR    s    $c         C   s7   t  |  d d  |  j |  j t |  j  |  j |  j f S(   Nt   parsed_version(    (   Ru   R  R   R  R   R   R   (   Rg   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRQ  +  s    c         C   s   t  |  j  S(   N(   t   hasht   hashcmp(   Rg   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   __hash__4  s    c         C   s   |  j  | j  k  S(   N(   R  (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   __lt__5  s    c         C   s   |  j  | j  k S(   N(   R  (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   __le__7  s    c         C   s   |  j  | j  k S(   N(   R  (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   __gt__9  s    c         C   s   |  j  | j  k S(   N(   R  (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   __ge__;  s    c         C   s&   t  | |  j  s t S|  j | j k S(   N(   Ro   Rc   R   R  (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   __eq__=  s    c         C   s   |  | k S(   N(    (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   __ne__B  s    c         C   s:   y |  j  SWn( t k
 r5 |  j j   |  _  } | SXd  S(   N(   t   _keyRw  R   R   (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR   J  s
    c         C   s:   y |  j  SWn( t k
 r5 t |  j  |  _  } | SXd  S(   N(   t   _parsed_versionRw  RA   R   (   Rg   t   pv(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR  S  s
    c         C   s   y |  j  SWn{ t k
 r xk |  j d  D]G } | j   j d  r+ t | j d d  d j    |  _  |  j  Sq+ Wt d |    n Xd  S(   Ns   PKG-INFOs   version:R  i   s.   Missing 'Version:' header and/or PKG-INFO file(	   R  Rw  t   _get_metadataR   R   RC   R	   R  R   (   Rg   R  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR   ]  s    %c         C   s   y |  j  SWn t k
 r i g  d  6} |  _  xh d D]` } xW t |  j |   D]@ \ } } | rs t |  } n  | j | g   j t |   qR Wq6 W| SXd  S(   Ns   requires.txts   depends.txt(   s   requires.txts   depends.txt(	   t   _Distribution__dep_mapRw  R   RG   R  RH   R   R   R@   (   Rg   t   dmR   R,  t   reqs(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   _dep_mapo  s    " 'c         C   s   |  j  } g  } | j | j d d   xS | D]K } y | j | t |   Wq/ t k
 ry t d |  | f   q/ Xq/ W| S(   s@   List of Requirements needed for this distro if `extras` are useds   %s has no such extra feature %rN(    (   R  R   R   R   RH   Rs   R>   (   Rg   R   R  t   depsR  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR   {  s    	c         c   s5   |  j  |  r1 x |  j |  D] } | Vq Wn  d  S(   N(   R   R   (   Rg   R   R  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR    s    c         C   s^   | d k r t j } n  |  j |  | t j k rZ t |  j  t t |  j d   n  d S(   s>   Ensure distribution is importable on `path` (default=sys.path)s   namespace_packages.txtN(	   R   R   R   R   R_   R   R   R.   R  (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   activate  s     c         C   sO   d t  |  j  t  |  j  |  j p' t f } |  j rK | d |  j 7} n  | S(   s@   Return what this distribution's standard .egg filename should bes
   %s-%s-py%sR)  (   RI   R   R   R   R  R   (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRE    s    	c         C   s(   |  j  r d |  |  j  f St |   Sd  S(   Ns   %s (%s)(   R   Rq   (   Rg   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRh     s    	c         C   sM   y t  |  d d   } Wn t k
 r/ d  } n X| p9 d } d |  j | f S(   NR   s   [unknown version]s   %s %s(   Ru   R   R   R   (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR    s      
c         C   s+   | j  d  r t |  n  t |  j |  S(   sA   Delegate all unrecognized public attributes to .metadata providerR   (   R   Rw  Ru   R  (   Rg   R  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   __getattr__  s    c         K   s(   |  j  t |  t j j |  | |  S(   N(   R  R  R   R   RI  (   R  R   R}  R  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR    s    c         C   s   t  j d |  j |  j f  S(   s?   Return a ``Requirement`` that matches this distribution exactlys   %s==%s(   R9   R   R   R   (   Rg   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     s    c         C   sD   |  j  | |  } | d k r: t d | | f f   n  | j   S(   s=   Return the `name` entry point of `group` or raise ImportErrors   Entry point %r not foundN(   R&   R   R   R  (   Rg   R   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR$     s    c         C   sc   y |  j  } Wn3 t k
 rB t j |  j d  |   } |  _  n X| d k	 r_ | j | i   S| S(   s=   Return the entry point map for `group`, or the full entry maps   entry_points.txtN(   t   _ep_mapRw  R:   R  R  R   R   (   Rg   R   t   ep_map(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR%     s     c         C   s   |  j  |  j |  S(   s<   Return the EntryPoint object for `group`+`name`, or ``None``(   R%   R   (   Rg   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR&     s    c         C   s  | p |  j  } |  j d k rp y |  j } Wn t k
 rD d } n Xd | k rp t d t |  j     qp n  | sz d S| t j k r |  j   n  t |  } t	 j j
 |  } t t |  } d } xz t |  D][ \ } }	 |	 | k r Pq |	 | k r |  j t k r | j | |  | j | |  Pq q W| j |  d SxF y | j | | d  }
 Wn t k
 rwPqIX| |
 =| |
 =|
 } qId S(   s@   Insert self.location in path before its nearest parent directoryt
   setuptoolsRz   s   0.7sL   A 0.7-series setuptools cannot be installed with distribute. Found one at %sNi   (   R   R   R   R   Rq   R   R   t   check_version_conflictR  R   R   R   R   t	   enumerateR  RL   R   R   t   index(   Rg   R   t   locR   t   nloct   bdirt   npatht   bpt   pR   t   np(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR     sF    
	c      
   C   s   |  j  d k r d  St j |  j d   } t |  j  } x |  j d  D] } | t j k sJ | | k sJ | t k r} qJ n  | d	 k r qJ n  t	 t j | d d   } | r t |  j |  sJ | j |  j  r qJ n  t d | | |  j f  qJ Wd  S(
   NR   s   namespace_packages.txts   top_level.txtt   pkg_resourcesR  t   siteR-  sI   Module %s was already imported from %s, but %s is being added to sys.path(   R  s
   setuptoolss   site(   R   R   R   R  RK   R   R   Rr   R  Ru   R   R   t   issue_warning(   Rg   t   nspR	  t   modnamet   fn(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR  	  s"    c         C   s8   y |  j  Wn& t k
 r3 t d t |    t SXt S(   Ns   Unbuilt egg for (   R   R   R  Re   R   R   (   Rg   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR   3	  s    c         K   sM   x* d D]" } | j  | t |  | d	   q W| j  d |  j  |  j |   S(
   s@   Copy this distribution, substituting in any changed keyword argsR   R   R   R   R   R  R}  (   s   project_names   versions
   py_versions   platforms   locations
   precedenceN(   R   Ru   R   R  Rc   (   Rg   R  R  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   clone;	  s     
 c         C   s    g  |  j  D] } | r
 | ^ q
 S(   N(   R  (   Rg   t   dep(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR   I	  s    N(    ('   Rd   Ri   Rj   R   R  RL   R   R  R  t   propertyR  R  R  R  R  R  R  R  R   R  R   R  R   R  R  RE  Rh   R  R  R  R   R$   R%   R&   R   R  R   R  R   (    (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR8   
  sR   												
									4				c          O   s{   d } t    } y- x& t j |  j | k r: | d 7} q WWn t k
 rO n Xd d l m } | d | d |  |  d  S(   Ni   i(   t   warnt
   stacklevel(   R  R   R   R   R   t   warningsR  (   Rf   R  t   levelt   gR  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR  N	  s    	c   
      #   s#  t  t |        f d   } x   D] } t |  } | sR t d |   n  | j d  } | j   } g  } t | |  } | r | j   } | t t | | d d  \ } } } n  | t t	 | | d	 d  \ } } } g  | D] \ } }	 | t
 |	  f ^ q } t | | |  Vq( Wd S(
   s   Yield ``Requirement`` objects for each specification in `strs`

    `strs` must be an instance of ``basestring``, or a (possibly-nested)
    iterable thereof.
    c            s?  g  } x| | |  st  | |  r` y   j   } d } Wq` t k
 r\ t d   q` Xn  |  | |  } | s t d | d | d | |   n  | j | j |    | j   } t | |  } | r | j   } q	 | | |  s	 t d | d | |   q	 q	 W| | |  } | r2| j   } n  | | | f S(   Ni    s+   \ must not appear on the last nonblank lines	   Expected s    int   ats   Expected ',' or end-of-list in(   t   CONTINUEt   nextt   StopIterationR   R   R   t   endt   COMMA(   t   ITEMt
   TERMINATORR  R  t   groupst	   item_nameR  R   (   R  (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt	   scan_listz	  s0     
$ s   Missing distribution speci   s   'extra' namei   s   version specN(   i   (   i   i   (   t   iterRF   t   DISTROR   R   R"  t   OBRACKETt   CBRACKETt   VERSIONt   LINE_ENDRC   R9   (
   R  R(  R  R   R   R  R   R  t   opt   val(    (   R  s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR@   q	  s"     $$+c         C   s\   g  |  D] } | j  | f ^ q } | j   g  | D] \ } } | ^ q3 |  d  d  d  <d  S(   Ni(   R  R   (   R   R   t   tmpt   hcRo  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR   	  s    "
c           B   sV   e  Z d    Z d   Z d   Z d   Z d   Z d   Z e d  Z	 e
 e	  Z	 RS(   c   
      C   s  | t  |  |  _ } | | j   |  _ |  _ g  | D]( \ } } t |  t | | | f ^ q6 } | j   g  | D] \ } } } }	 | |	 f ^ qu |  _ | t	 t
 t |   |  _ |  _ |  j t	 g  | D] \ } } } }	 | | f ^ q  t |  j  f |  _ t |  j  |  _ d S(   s>   DO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()!N(   RB   t   unsafe_nameR   R   R   RA   t   state_machineR   R  R  R   RH   R  R   t	   frozensett   hashCmpR  t   _Requirement__hash(
   Rg   R   R  R   R/  R   R  R  t   transR  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR   	  s    5
."4c         C   sg   d j  g  |  j D] } d j  |  ^ q  } d j  |  j  } | rS d | } n  d |  j | | f S(   NR  Rz   s   [%s]s   %s%s%s(   R   R  R   R   (   Rg   R  R  R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR  	  s
    . c         C   s   t  | t  o |  j | j k S(   N(   Ro   R9   R6  (   Rg   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR  	  s    c   	      C   s  t  | t  r= | j |  j k r% t S|  j r[ | j } q[ n t  | t  r[ t |  } n  d  } d   } x |  j D]{ \ } } } } | | | |  } | d k r t S| d k r t	 S| d k r t	 } qt | d k s | d  k rt t } qt qt W| d  k rt	 } n  | S(   Nc         S   s   |  | k |  | k  S(   N(    (   t   at   b(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRQ  	  s    t   Ft   Tt   +R)  (
   Ro   R8   R   R   R  R  R   RA   R   R   (	   Rg   R   Rl  t   compareR  R8  R/  R  t   action(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR   	  s,     	 	   	  	c         C   s   |  j  S(   N(   R7  (   Rg   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR  	  s    c         C   s   d t  |   S(   Ns   Requirement.parse(%r)(   Rq   (   Rg   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRh   	  s    c         C   s   t  t |    } | r t |  d k r} | d } t |  rv | rv t  t d   } t |  d k rr | d S| S| Sn  t d |    n  t d |    d  S(   Ni   i    R   s   Expected only one requirements   No requirements found(   R   R@   R;  R   R   (   R  R   R  t   founded_reqR   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR   	  s    
(   Rd   Ri   R   R  R  R   R  Rh   R   R   t   staticmethod(    (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR9   	  s   						s   --Tt   <s   T-Ts   <=s   F+Ft   >s   T+Fs   >=s   T..s   ==s   F++s   !=c         C   sc   |  j  d k r_ t |  j  s" t Sx6 |  j D]+ \ } } | d k r, d | k rW t Sq, q, Wt St S(   s   Return True when distribute wants to override a setuptools dependency.

    We want to override when the requirement is setuptools and the version is
    a variant of 0.6.

    R  s   ==s   >=RC  s   0.7(   s   ==s   >=RC  (   R   R;  R  R   R   (   R   t
   comparatorR   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR   
  s    c         C   s:   t  |  t  s3 d |  t f d     Y}  |  j d S|  j S(   s&   Get an mro for a type or classic classR  c           B   s   e  Z RS(    (   Rd   Ri   (    (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyR  *
  s    i   (   Ro   t   typet   objectt   __mro__(   R  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   _get_mro'
  s    c         C   sA   x: t  t | d t |    D] } | |  k r |  | Sq Wd S(   s2   Return an adapter factory for `ob` from `registry`Rc   N(   RH  Ru   RE  (   t   registryt   obRn  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRv   .
  s    %c         C   s8   t  j j |   } t  j j |  s4 t  j |  n  d S(   s1   Ensure that the parent directory of `path` existsN(   R   R   R   R   t   makedirs(   R   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRJ   5
  s    c         c   s   d } g  } x t |   D]y } | j d  r | j d  rs | sI | rW | | f Vn  | d d !j   } g  } q t d |   q | j |  q W| | f Vd S(   sr  Split a string or iterable thereof into (section,content) pairs

    Each ``section`` is a stripped version of the section header ("[section]")
    and each ``content`` is a list of stripped lines excluding blank lines and
    comment-only lines.  If there are any such lines before the first section
    header, they're returned in a first ``section`` of ``None``.
    R  t   ]i   is   Invalid section headingN(   R   RF   R   RH  R  R   R   (   R  t   sectiont   contentR  (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRG   ;
  s    	c          O   sD   d d l  m } t j } z t t _ | |  |   SWd  | t _ Xd  S(   Ni(   t   mkstemp(   t   tempfileRO  R   R   t   os_open(   Rf   R  RO  t   old_open(    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRi  T
  s    		c         C   s@   x9 t  t  D]+ } | j d  s t t |  |  | <q q Wd  S(   NR   (   Rb  t   _managerR   Ru   (   R  R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   _initialize`
  s    (   t   __requires__c         C   s
   |  j    S(   N(   R  (   R   (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyRQ  
  s    (   Rj   R   R   RR  Rd  R*  R  R  R    R   R5  t	   NameErrort   setsR   R   R   R   R   R   R
   R   R   R   RQ  t   os.pathR   R	   t   _distributeR   R   t   __all__t	   ExceptionR;   R<   R=   R>   Rk   R   R  RL   RM   RN   RO   RP   R^   R"   R   R   R   R<  R   R   RD   RE   R!   Ra   R#   R$   R   R%   R&   RQ   RR   RF  R6   R5   Rb   R%  R?   R7   R4   RB   RC   RH   RI   RX   RY   RZ   RE  RV   RW   R[   R  RS   RT   RU   R  R  R`   t   pkgutilR  R  R\   R1   R  R0  R  R  R  R  R]   R  R.   R_   R  R  RK   R  R  RF   R   R.  R  R*  R-  R#  R+  R,  R  t   VERBOSEt
   IGNORECASER  R  R   R   R  RA   R:   R  R8   R  R@   R   R9   R4  R   RH  Rv   RJ   RG   Ri  RS  RT  R  R/   t   __main__RU  R    R   R   R   R   R   R   R   R'   R   R0   R   (    (    (    s1   /usr/lib/python2.7/dist-packages/pkg_resources.pyt   <module>   sv  T

		+														3				 ) )	)		
			d	,		
		#			 
					,		*w		 E	#	=	E
															 