ScF@s dZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddl mZyddlmZmZWn'ek r ddlmZmZnXyeWn!ek r9ddlmZnXy!edZddlmZWn6ek reZddlmZe e d Z!nXdd lm"Z"y&dd lm#Z#m$Z$m%Z%e&Z'Wnek re(Z'nXdd lm)Z*dd l+m,Z,m-Z-ej.ddfko.ej/j0dkrCddl1j2Z3ne Z3yddl4Z4Wnek rlnXddZ5iZ6dZ7dZ8dZ9dZ:dZ;dZ<dZ=dZ>Z?dZ@dddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_gEZAd6eBfd`YZCd7eCfdaYZDd8eCfdbYZEd9eCfdcYZFiZGejHd ZIdZJddZKdeZLdfZMdZNdgZOdhZPgdiZQdjZRdkZSejTdlZUejTdmZVeSZWdnZXdoZYeYZZdpZ[dqZ\e drZ]dsZ^dNfdtYZ_dOe_fduYZ`d1eafdvYZbd0eafdwYZcecZdd:eefdxYZfd2fdyYZgdzZhd{Zid|Zjd}Zkd~ZldeafdYZmemjnZoemjpZpdUfdYZqeOeaeqdVeqfdYZrdWerfdYZseOete ese3e k reOe3juesndSeqfdYZvevZwdZxdXerfdYZyeOejzeydPevfdYZ{dQesfdYZ|dReyfdYZ}e7ddidZ~e(dZe(dZe~ejzee(dZe~eaee(dZe~e jee3e k rAe~e3jene7ddie7ddidZdZdZe dZdZee jeeejzee3e k ree3jendZeeaedZidZdZdZejTdjZejTdjZejTdjZejTdjZejTdjZejTdjZejTdjZejTdjZejTdejejBjZejTdejZidd6dd6dd6dd6dd6jZdZdZd5eafdYZdZd3eafdYZdefdYZied6ed6ed6ZdZdZdZd4fdYZidd6dd6dd6dd6dd6dd6ZdZdZdZdZdZegZdZeeebjZe7dd*eejZejZejZejYZYeYZZedge_eeejejdS(sZ 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 get_importer(turlparset urlunparse(t ImmutableSetcCs |jS(N(tnext(to((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyt-s(tStringIO(tBytesIOcBsZ|dkre}n|dkr-|}nee|j|d||fdUdS(Ntexec(tNonetglobalstcompiletopentread(tfntglobstlocs((s1/usr/lib/python2.7/dist-packages/pkg_resources.pytexecfile2s     (tutime(tmkdirtrenametunlink(R (tisdirtsplititcpythonicCs^tstdnt|\}}|rZ|rZt| rZt|t||ndS(Ns*"os.mkdir" not supported on this platform.(t WRITE_SUPPORTtIOErrorRRt_bypass_ensure_directoryR(tnametmodetdirnametfilename((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRPs  cKs-tj|tjtj||dS(N(R tupdatet _state_varstdicttfromkeys(tvartypetkw((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyt_declare_state\scCsLi}t}x6tjD](\}}|d|||||Distribution doesn't have an "extra feature" of the given name(RRR(((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRgsiiicCs|t|R?tdarwinVersionStringRRDtFalse(tprovidedtrequiredtreqMactprovMact provDarwintdversiont macosversion((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRns*$"*cCsNtjdj}|d}|j||deZdZdZdZdZdZdZRS(cCsdS(s;Does the package's distribution contain the named metadata?N((R((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyt has_metadatalscCsdS(s'The named metadata resource as a stringN((R((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyt get_metadataoscCsdS(sYield 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.pytget_metadata_linesrscCsdS(s>Is the named metadata a directory? (like ``os.path.isdir()``)N((R((s1/usr/lib/python2.7/dist-packages/pkg_resources.pytmetadata_isdirxscCsdS(s?List of metadata names in the directory (like ``os.listdir()``)N((R((s1/usr/lib/python2.7/dist-packages/pkg_resources.pytmetadata_listdir{scCsdS(s=Execute the named script in the supplied namespace dictionaryN((Rt namespace((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRJ~s(RRRRRRRRJ(((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR|js      cBsDeZdZdZdZdZdZdZdZRS(s3An object that provides access to package resourcescCsdS(sdReturn a true filesystem path for `resource_name` `manager` must be an ``IResourceManager``N((tmanagert resource_name((s1/usr/lib/python2.7/dist-packages/pkg_resources.pytget_resource_filenamescCsdS(siReturn a readable file-like object for `resource_name` `manager` must be an ``IResourceManager``N((RR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pytget_resource_streamscCsdS(smReturn a string containing the contents of `resource_name` `manager` must be an ``IResourceManager``N((RR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pytget_resource_stringscCsdS(s,Does the package contain the named resource?N((R((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyt has_resourcescCsdS(s>Is the named resource a directory? (like ``os.path.isdir()``)N((R((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRVscCsdS(s?List of resource names in the directory (like ``os.listdir()``)N((R((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRTs( RRRRRRRRVRT(((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR}s     cBseZdZddZedZedZdZdZ dZ ddZ dZ d Z deed Zdded Zdded Zd ZdZdZdZdZRS(sDA collection of active distributions on sys.path (or a similar list)cCs^g|_i|_i|_g|_|dkr<tj}nx|D]}|j|qCWdS(s?Create working set from list of path entries (default=sys.path)N(tentriest entry_keystby_keyt callbacksR R@Rt add_entry(RRtentry((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyt__init__s       cCse|}yddlm}Wntk r1|SXy|j|Wntk r`|j|SX|S(s1 Prepare the master working set. i(t __requires__(t__main__RRRIRet_build_from_requirements(tclstwsR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyt _build_masters   cCs|g}t|}|j|t}x|D]}|j|q4Wx0tjD]%}||jkrU|j|qUqUW|jtj(|S(sQ Build a working set from a requirement spec. Rewrites sys.path. (RitresolveR^taddR@RRR(Rtreq_specRtreqstdistsRR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRs    cCsT|jj|g|jj|x*t|tD]}|j||tq3WdS(sAdd 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(Rt setdefaultRRRZRRR(RRR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRs cCs|jj|j|kS(s9True if `dist` is the active distribution for its project(RRR5(RR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyt __contains__scCsG|jj|j}|dk r?||kr?t||n|SdS(sFind 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(RRR5R Re(RtreqR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRs ccsgx`|D]X}|j|}|dkrGx4|jD] }|Vq5Wq||kr||VqqWdS(sYield 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(RNR tvalues(RRDRRRtep((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRPs    cCsQtjdj}|d}|j||d<|j|dj||dS(s?Locate distribution for `requires` and run `script_name` scriptiRiN(R@RRR4RIRJ(RtrequiresRRR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRJ s    ccspi}xc|jD]X}||jkr+qnx:|j|D]+}||kr9d||<|j|Vq9q9WqWdS(sYield 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. iN(RRR(RtseentitemR5((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyt__iter__s  cCs|r|j|j|n|dkr4|j}n|jj|g}|jj|jg}| r~|j|jkr~dS||j|j<|j|kr|j|jn|j|kr|j|jn|j |dS(sAdd `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, unless `replace=True`. If it's added, any callbacks registered with the ``subscribe()`` method will be called. N( t insert_onRR tlocationRRR5RRt _added_new(RRRtinsertRtkeystkeys2((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR#s   c Cst|ddd}i}i}g}xc|r|jd}||krUq.n|j|j} | dkr?|jj|j} | dks| |kr/|r/|} |dkr| dkrt|j}qtg}tg} n|j || |} ||j<| dkr/t |q/n|j | n| |kr]t | |n|j | j|jdddt||s   cCsW|j|}|dk r|Sx%||jD]}||kr-|Sq-W|j||S(sFind 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(RR R5tobtain(RRRXRR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRGs   cCs|dk r||SdS(sObtain 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 (Rt requirementR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR*\s ccs0x)|jjD]}||r|VqqWdS(s=Yield the unique project names of the available distributionsN(RR(RR5((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRhs cCs{t|tr|j|nXt|trdxF|D](}x||D]}|j|qFWq5Wntd|f|S(s2In-place addition of a distribution or environmentsCan't add %r to environment(RRaRR^R(RtothertprojectR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyt__iadd__ms cCs@|jgdddd}x||fD]}||7}q(W|S(s4Add an environment or distribution to an environmentRAR N(RR (RR,tnewR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyt__add__ysN(RRRR RHtPY_MAJORRR$R%R!R(RRR*RR.R0(((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR^s      cBseZdZRS(sTAn 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 (RRR(((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRhs cBseZdZdZdZdZdZdZdZ dZ dZ dZ dd Z ed Zd Zd Zed ZRS(s'Manage resource extraction and packagescCs i|_dS(N(t cached_files(R((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRscCst|j|S(sDoes the named resource exist?(RKR(Rtpackage_or_requirementR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRUscCst|j|S(s,Is the named resource an existing directory?(RKRV(RR3R((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRVs cCst|j||S(s4Return a true filesystem path for specified resource(RKR(RR3R((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRSs cCst|j||S(s9Return a readable file-like object for specified resource(RKR(RR3R((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRRs cCst|j||S(s%Return specified resource as a string(RKR(RR3R((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRQs cCst|j|S(s1List the contents of the named resource directory(RKRT(RR3R((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRTs cCs]tjd}|jpt}td||f}||_||_||_|dS(s5Give an error message for problems extracting file(s)is}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@Rtextraction_pathR]RhRt cache_pathtoriginal_error(Rtold_excR5terr((s1/usr/lib/python2.7/dist-packages/pkg_resources.pytextraction_errors   cCsn|jpt}tjj||d|}yt|Wn|jnX|j|d|j|<|S(sReturn 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( R4R]RRRBRR9t_warn_unsafe_extraction_pathR2(Rt archive_nametnamest extract_patht target_path((s1/usr/lib/python2.7/dist-packages/pkg_resources.pytget_cache_paths   cCswtjdkr*|jtjd r*dStj|j}|tj@sV|tj@rsd|}tj |t ndS(sN If the default extraction path is overridden and set to an insecure location, such as /tmp, it opens up an opportunity for an attacker to replace an extracted file with an unauthorized payload. Warn the user if a known insecure location is used. See Distribute #375 for more details. tnttwindirNs%s is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).( RRRtenvirontstattst_modetS_IWOTHtS_IWGRPtwarningstwarnt UserWarning(RRtmsg((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR:s &cCs@tjdkr<tj|jdBd@}tj||ndS(s4Perform 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. tposiximiN(RRRCRDtchmod(RttempnameR R((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyt postprocess scCs%|jrtdn||_dS(sSet 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()``.) s5Can't change extraction path, files already extractedN(R2RER4(RR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR[s  cCsdS(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((Rtforce((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR\7sN((RRRR R4RRURVRSRRRQRTR9R?t staticmethodR:RNR[RR\(((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR`s           cCsytjdSWntk r"nXtjdkrBtjjdSd}dd|fd|fd|fdd|fg}x|D]\}}d }xn|D]5}|tjkrtjj|tj|}qPqW|rtjj||}ntjj|d SqWtd dS(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". tPYTHON_EGG_CACHER@s~/.python-eggssApplication DatatAPPDATAt USERPROFILEt HOMEDRIVEtHOMEPATHtHOMEtWINDIRRs Python-Eggss3Please set the PYTHON_EGG_CACHE enviroment variableN(sAPPDATA((sAPPDATAN(RS(RTRU(RU(sHOME((sHOMEN(RW( RRBRRRt expanduserR RBt RuntimeError(tapp_datat app_homesRtsubdirRR5((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR]Ds0     cCstjdd|S(sConvert 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-(tretsub(R((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRkmscCs%|jdd}tjdd|S(sConvert 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. RR<s[^A-Za-z0-9.]+R](RR^R_(R((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRluscCstjdd|jS(sConvert 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&(textra((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRqscCs|jddS(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.pyRrstMarkerEvaluationcBseZidd6dd6dd6dd6ejd6ejd 6ejd 6Zed Ze d Z ed Z edZ edZ edZedZeddZedZdekreZnedZedZRS(cCstjS(N(RR(((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRstos_namecCstjS(N(R@RA(((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRst sys_platformcCstjjdS(Ni(R@RR(((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRstpython_full_versioncCsdtjdtjdfS(Ns%s.%sii(R@t version_info(((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRstpython_versiontplatform_versiontplatform_machinetpython_implementationcCs=y|j|Wn%tk r8|jtjdSXtS(s{ Validate text as a PEP 426 environment marker; return an exception if invalid or False otherwise. i(Rtt SyntaxErrortnormalize_exceptionR@RR(Rttext((s1/usr/lib/python2.7/dist-packages/pkg_resources.pytis_invalid_markers  cCsEidd6dd6}d|_d|_|j|j|j|_|S(s Given a SyntaxError from a marker evaluation, normalize the error message: - Remove indications of filename and line number. - Replace platform-specific error messages with standard error messages. sinvalid syntaxsunexpected EOF while parsingsparenthesis is never closedN(R R tlinenoRRJ(texctsubs((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRks   cCsEtjtjgtdt|dD]}|j||^q%S(Nii(t functoolstreducetoperatortand_trangetlent interpret(Rtnodelistti((s1/usr/lib/python2.7/dist-packages/pkg_resources.pytand_testscCsEtjtjgtdt|dD]}|j||^q%S(Nii(RqRrRstor_RuRvRw(RRxRy((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyttestscCsd|dd}|tjkrT|ddtjkrCtdn|j|dStddS(NiiisEmpty parenthesess5Language feature not supported in environment markers(ttokentLPARtRPARRjRw(RRxtt((s1/usr/lib/python2.7/dist-packages/pkg_resources.pytatoms cCst|dkr!tdn|dd}|d}|dtjkrt|ddkr|dkrwd}qd }qny|j|}Wn'tk rtt|d nX||j|d|j|dS( Nis5Chained comparison not allowed in environment markersiiiitnotsnot insis nots, operator not allowed in environment markers(RvRjR}tNAMEtget_opRRtevaluate(RRxtcomptcop((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyt comparisons     cCsi|jtj6|jtj6|jtj6|jtj6dd6dd6tjd6tjd6}ttdr|j|tj scCst|j||S(N(RR(RRR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRAscCs|j|j|j|S(N(t_getRR(RRR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRDscCs|j|j|j|S(N(t_hasRR(RR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRGscCs%|jo$|j|j|j|S(N(tegg_infoRR(RR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRJsicCs)|js dS|j|j|j|S(NR(RRR(RR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRNs cCs2|js dS|j|j|j|jdS(NRsutf-8(RRRtdecode(RR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRSs cCst|j|S(N(RoR(RR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRXscCs|j|j|j|S(N(t_isdirRR(RR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRV[scCs%|jo$|j|j|j|S(N(RRR(RR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR^scCs|j|j|j|S(N(t_listdirRR(RR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRTascCs)|jr%|j|j|j|SgS(N(RRR(RR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRds cBsd|}|j|s,ed|n|j|jdd}|jdd}|j|j|}||d os.sep on pypy it is the same (one reason why distribute did work in some cases on pypy and win32). * [1] - zipinfo.compress_type * [2] - zipinfo.compress_size * [3] - zipinfo.file_size * [4] - len(utf-8 encoding of filename) if zipinfo & 0x800 len(ascii encoding of filename) otherwise * [5] - (zipinfo.date_time[0] - 1980) << 9 | zipinfo.date_time[1] << 5 | zipinfo.date_time[2] * [6] - (zipinfo.date_time[3] - 1980) << 11 | zipinfo.date_time[4] << 5 | (zipinfo.date_time[5] // 2) * [7] - zipinfo.CRC RN( R#tzipfiletZipFiletnamelistRRtseptgetinfoR tAssertionErrorR(Rtzipinfotzfiletzitemtzpath((s1/usr/lib/python2.7/dist-packages/pkg_resources.pytbuild_zipmanifests  cBseZdZdZdZdZdZdZe dZ dZ dZ dZ d Zd Zd Zd Zd ZdZRS(s"Resource support for zips and eggscCs?tj||t|jj|_|jjtj|_dS(N( RRRRtarchiveRRRtzip_pre(RR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRscCs@|j|jr#|t|jStd||jfdS(Ns%s is not a subpath of %s(RRRvR(Rtfspath((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyt _zipinfo_namescCsd|j|}|j|jtjrG|t|jdjtjStd||jfdS(Nis%s is not a subpath of %s(RRRRRRvRR(Rtzip_pathR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyt_parts s  !cCs|jstdn|j|}|j}dj|j||kr~x*|D]}|j||j|qXWn|j||S(Ns5resource_filename() only supported for .egg, not .zipR(RRt_resource_to_zipt_get_eager_resourcesRBRt_extract_resourcet _eager_to_zip(RRRRteagersR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRs     cCs/|j}|jd}tj|}||fS(Nii(iii(t file_sizet date_timettimetmktime(tzip_stattsizeRt timestamp((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyt_get_date_and_size"s  c Cs||jkr^x9|j|D]'}|j|tjj||}q#Wtjj|S|j|j|\}}tst dny(|j |j |j |}|j ||r|Stddtjj|\}} tj||jj|tj|t| ||f|j| |yt| |Wnltjk rtjj|r|j ||r|Stjdkrt|t| ||SnnXWntjk r|jnX|S(Ns>"os.rename" and "os.unlink" are not supported on this platforms .$extracttdirR@(t_indexRRRRBRRRRRR?RRt _is_currentt_mkstemptwriteRRRRRNRterrortisfileRRR9( RRRRtlastRRt real_pathtoutfttmpnam((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR*s@$    c Cs|j|j|\}}tjj|s2tStj|}|j|ks_|j|krctS|j j |}t |d}|j }|j ||kS(sK Return True if the file_path is current for this zip_path R(RRRRRRRCtst_sizetst_mtimeRRR RR( Rt file_pathRRRRCt zip_contentstft file_contents((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR[s  cCsa|jdkrZg}x6dD].}|j|r|j|j|qqW||_n|jS(Nsnative_libs.txtseager_resources.txt(snative_libs.txtseager_resources.txt(RR RRR(RRR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRls  cCsy |jSWntk ri}x~|jD]s}|jtj}xX|rtjj|d }||kr||j|dPqF|jg||=?|==|!=)\s*((\w|[-.])+)s\s*,s\s*\[s\s*\]s \w+(\.\w+)*$sL(?P[^-]+)( -(?P[^-]+) (-py(?P[^-]+) (-(?P.+))? )? )?s(\d+ | [a-z]+ | \.| -)tctpretpreviewsfinal-R]trct@tdevccsuxitj|D]X}t||}| s|dkr>qn|d dkr_|jdVqd|VqWdVdS(NR<it 0123456789it*s*final(t component_reRRtzfill(Rtpart((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyt_parse_version_partss cCsg}xt|jD]}|jdr|dkrdx'|r`|ddkr`|jq=Wnx'|r|ddkr|jqgWn|j|qWt|S(sConvert 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-t00000000(R2R&RRRttuple(RRR1((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRjs cBseZdZd d d dZdZdZed d dZd d dZ e d dZ e d dZ e d dZ RS( s3Object representing an advertised importable objectcCsnt|std|n||_||_t||_tjddj|j |_ ||_ dS(NsInvalid module namesx[%s]t,( tMODULERERt module_nameR4tattrsRbRRBRR(RRR7R8RR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRs   "cCsfd|j|jf}|jr<|ddj|j7}n|jrb|ddj|j7}n|S(Ns%s = %st:R<s [%s]R5(RR7R8RBR(RR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyt__str__s   cCsdt|S(NsEntryPoint.parse(%r)(R(R((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR#scCs|r|j||nt|jttdg}xN|jD]C}yt||}WqDtk rtd||fqDXqDW|S(NRs%r has no %r attribute(RIRR7R R8RRR(RRIRRRtattr((s1/usr/lib/python2.7/dist-packages/pkg_resources.pytload&s! cCs]|jr%|j r%td|ntttjtj|jj|j||dS(Ns&Can't require() without a distribution( RRRgRR RXRRR(RRR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRI0s cCsyd }}|jdd\}}d|krz|jdd\}}tjd|}|jrntn|j}nd|kr|jdd\}}t|jstn|jjd}nWn tk rtd|n#X||j|j|||SdS( sParse 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=it[sx[R9R<s9EntryPoint must be in 'name=module:attrs [extras]' formatN(( RRbRtspecsRERR6RR(RtsrcRR8RRtvalueR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR6s&         cCst|std|ni}xZt|D]L}|j||}|j|krptd||jn|||jEnsure distribution is importable on `path` (default=sys.path)snamespace_packages.txtN( R R@RRRRR`RRW(RRtpkg((s1/usr/lib/python2.7/dist-packages/pkg_resources.pytactivate s   cCsOdt|jt|j|jp'tf}|jrK|d|j7}n|S(s@Return what this distribution's standard .egg filename should bes %s-%s-py%sR](RrRRR#R1RA(RR ((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR s  cCs(|jrd||jfSt|SdS(Ns%s (%s)(RR(R((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR s cCsMyt|dd}Wntk r/d}nX|p9d}d|j|fS(NRs[unknown version]s%s %s(RR RER(RR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR: s   cCs.|jdrt|nt|j|S(sADelegate all unrecognized public attributes to .metadata providerR(RRRRL(RR;((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyt __getattr__% scKs(|jt|tjj|||S(N(RRRRR(RR RR&((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR+ scCstjd|j|jfS(s?Return a ``Requirement`` that matches this distribution exactlys%s==%s(RbRRR(R((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR2 scCsD|j||}|dkr:td||ffn|jS(s=Return the `name` entry point of `group` or raise ImportErrorsEntry point %r not foundN(ROR RR<(RRDRR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRM6 s cCscy |j}Wn3tk rBtj|jd|}|_nX|dk r_|j|iS|S(s=Return the entry point map for `group`, or the full entry mapsentry_points.txtN(t_ep_mapRRcRGR`R R(RRDtep_map((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRN= s    cCs|j|j|S(s<Return the EntryPoint object for `group`+`name`, or ``None``(RNR(RRDR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyROI sc Csd|p |j}|sdSt|}tjj|}g|D]}|rVt|pY|^q>}xt|D]w\}}||krPqo||kro|jtkro|tjkr|j n|j |||j ||PqoqoW|tjkr|j n|j |dSxFy|j ||d}Wnt k rHPqX||=||=|}qdS(s@Insert self.location in path before its nearest parent directoryNi(RRRRRt enumerateRRwR@tcheck_version_conflictRRtindexRE( RRtloctnloctbdirtptnpathRtnp((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRM s6 +      c Cs|jdkrdStj|jd}t|j}x|jdD]}|tjksJ||ksJ|tkr}qJn|dkrqJnt tj|dd}|rt|j |sJ|j |jrqJnt d|||jfqJWdS( Nt setuptoolssnamespace_packages.txts top_level.txtt pkg_resourcestsiteRsIModule %s was already imported from %s, but %s is being added to sys.path(RvRussite( R5R#R$R`RvRR@RRRR Rt issue_warning(RtnspRotmodnameR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRmt s"  cCs8y |jWn&tk r3tdt|tSXtS(NsUnbuilt egg for (RRERxRRR(R((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR) s   cKsMx*dD]"}|j|t||d qW|jd|j|j|S( s@Copy this distribution, substituting in any changed keyword argsRRR#RARRR(s project_namesversions py_versionsplatformslocations precedenceN(RRR RLR(RR&R;((s1/usr/lib/python2.7/dist-packages/pkg_resources.pytclone s   cCs g|jD]}|r |^q S(N(Re(Rtdep((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR sN(((RRRRaR R1RwRRRtpropertyRURVRWRXRYRZR[R\R5RSRReRR`RhRRR:RiRRRMRNRORRmR)R{R(((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRasL                   '   tDistInfoDistributioncBsSeZdZdZejdZedZedZ dZ dZ RS(sGWrap an actual or potential sys.path entry w/metadata, .dist-info styletMETADATAs([\(,])\s*(\d.*?)\s*([,\)])cCsXy |jSWnFtk rSddlm}|j|j|j|_|jSXdS(sParse and cache metadatai(tParserN(t _pkg_infoRt email.parserRtparsestrRRa(RR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyt_parsed_pkg_info s   !cCs6y |jSWn$tk r1|j|_|jSXdS(N(t_DistInfoDistribution__dep_mapRt_compute_dependencies(R((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRe s   cCsy|jdddg}|dj}|dj}tj|jd|}|jddjdd}||fS(sConvert 'Foobar (1); baz' to ('Foobar ==1', 'baz') Split environment marker, add == prefix to version specifiers as necessary, and remove parenthesis. t;iRis\1==\2\3t(t)(RRR^R_tEQEQR(Rt requires_distRtdistverstmark((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyt_preparse_requirement s c sddlm}igd6}|_gxc|jjdpBgD]I}|j|\}}tt|}|||_ j |qCWfd}t |d}|dj |xR|jjdpgD]8} t | j} tt || ||| DO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()!N(Rkt unsafe_nameR&RR5Rjt state_machineR R?R4R RqRnRRthashCmpRTt_Requirement__hash( RRR?RRR-RnRHttransRM((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR9 s5 ."4cCsgdjg|jD]}dj|^q}dj|j}|rSd|}nd|j||fS(NR5Rs[%s]s%s%s%s(RBR?RR(RRR?R((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR:G s . cCst|to|j|jkS(N(RRbR(RR,((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR[M sc Cs t|tr=|j|jkr%tS|jr[|j}q[nt|tr[t|}nd}d}x|jD]{\}}}}||||}|dkrtS|dkrt S|dkrt }qt|dks|dkrtt}qtqtW|dkrt }n|S(NcSs||k||kS(N((tatb((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRW stFtTt+R]( RRaR5RRnRSRRjR R( RRRtcompareRHRRRMtaction((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRP s,        cCs|jS(N(R(R((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRVd scCsdt|S(NsRequirement.parse(%r)(R(R((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRg scCsWtt|}|rDt|dkr2|dStd|ntd|dS(NiisExpected only one requirementsNo requirements found(RRiRvRE(RR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRi s ( RRRR:R[RRVRRPR(((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRb8 s      s--TtsT+Fs>=sT..s==sF++s!=cCs:t|ts3d|tfdY}|jdS|jS(s&Get an mro for a type or classic classRcBseZRS((RR(((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR si(Rttypetobjectt__mro__(R((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyt_get_mro} s cCsAx:tt|dt|D]}||kr||SqWdS(s2Return an adapter factory for `ob` from `registry`RN(RRR(tregistryR6R((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR s% cCs8tjj|}tjj|s4tj|ndS(s1Ensure that the parent directory of `path` existsN(RRRRtmakedirs(RR((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRu sccsd}g}xt|D]y}|jdr|jdrs|sI|rW||fVn|dd!j}g}qtd|q|j|qW||fVdS(srSplit 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]iisInvalid section headingN(R RoRRRRER(RtsectiontcontentR ((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyRp s  cOsDddlm}tj}ztt_|||SWd|t_XdS(Ni(tmkstemp(ttempfileRRR tos_open(R:R&Rtold_open((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyR s   cCs@x9ttD]+}|jds tt|||RRmRnRJRRLRMRNROR|R}RR_R^RRYRhR`R]RkRlRqRrRaRmRsRtRRRRtSourceFileLoaderRRRRRR~RRRRZRRR t ImpImportert FileFinderRRRWRRRRvRRRoR?RRRRRRRR6tVERBOSEt IGNORECASERQR/RRR2RjRcRIRaR~RPRxRiR'RbRRRRuRpRRRR RRXRIRPRRYRRR RR(((s1/usr/lib/python2.7/dist-packages/pkg_resources.pyts                      '                                 1     Y )    c    !     (           , )h !?   > :