b-QcF@sP dZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z yddl m Z m Z Wn'e k rddlm Z m Z nXyeWn!ek rddlmZnXy0edZddlmZeedZWnWek rweZddlmZed Zeed ZddlZejZnXdd lm Z y&dd lm!Z!m"Z"m#Z#e$Z%Wne k re&Z%nXdd lm'Z(ddl)m*Z*m+Z+ej,ddfkoej-j.dkr'ddl/j0Z1neZ1yddl2Z2Wne k rPnXddZ3iZ4dZ5dZ6dZ7dZ8dZ9dZ:dZ;dZ<Z=dZ>ddddd 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_d`gEZ?d7e@fdaYZAd8eAfdbYZBd9eAfdcYZCd:eAfddYZDiZEejFd ZGdZHdeZIdfZJdgZKdZLdhZMdiZNgdjZOdkZPdlZQejRdmZSejRdnZTeQZUdoZVdpZWeWZXdqZYdrZZedsZ[dtZ\dOfduYZ]dPe]fdvYZ^d2e_fdwYZ`d1e_fdxYZaeaZbd;ecfdyYZdd3fdzYZed{Zfd|Zgd}Zhd~ZidZjidgd6dgd6dddgd6gd6gd6gd6Zkidd6dd6dd6dd6dd6dd6dd6ZldZmdZndZoeidZpdZqderkr0eqZpndVfdYZseMe_esdWesfdYZtdXetfdYZueMeveeue1ek reMe1jweundTesfdYZxexZydZzdYetfdYZ{eMej|e{dQexfdYZ}dReufdYZ~dSe{fdYZdfdYZdfdYZdZyddlmZmZWne k rn XeZ[[e5ddidZe&dZe&dZeej|ee&dZee_ee&dZeeee1ek r9ee1jene5ddie5ddidZdZdZedZdZeeeeej|ee1ek ree1jendZee_edZidZdZdZejRdjZejRdjZejRdjZejRdjZejRdjZejRdjZejRdjZejRdjZejRdejejBjZejRdejZidd6dd6dd6dd6dd6jZdZdZd6e_fdYZdZd4e_fdYZdefdYZied6ed6ed6ZdZdZdZd5fdYZidd6dd6dd6dd6dd6dd6ZdZdZdZdZdZeeZdZeere5dd+e`yddlmZWne k rN nXyejeWneBk r e`gZx0ejeeeaD]Zejeq Wx0ejD]%Zeejkr ejenq Wejej(nXejZejZejZejWZWeWZXedge_eeejejdS(sYPackage 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(turlparset urlunparse(t ImmutableSetcCs |jS(N(tnext(to((s1/usr/lib/python2.7/site-packages/pkg_resources.pyts(tStringIOcBsc|dkrBejd}|j}|dkr<|j}n~n|dkrW|}nddUdS(Nisexec code in globs, locs(tNonetsyst _getframet f_globalstf_locals(tcodetglobstlocstframe((s1/usr/lib/python2.7/site-packages/pkg_resources.pytexec_ s      (tBytesIOtexeccCsY|dkrt}n|dkr-|}nttt|j|d||dS(NR(RtglobalsRtcompiletopentread(tfnR R((s1/usr/lib/python2.7/site-packages/pkg_resources.pytexecfile.s     (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/site-packages/pkg_resources.pyR"Ns  cKs>t}x.|jD] \}}|||<|t|(tself((s1/usr/lib/python2.7/site-packages/pkg_resources.pyt__repr__s(Rt __module__t__doc__R(((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRgscBseZdZRS(sAAn already-installed version conflicts with the requested version(RRR(((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRhscBseZdZRS(s&A requested distribution was not found(RRR(((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRiscBseZdZRS(s>Distribution doesn't have an "extra feature" of the given name(RRR(((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRjsiiicCs|t|eZdZdZdZdZdZdZRS(cCsdS(s;Does the package's distribution contain the named metadata?N((R#((s1/usr/lib/python2.7/site-packages/pkg_resources.pyt has_metadatascCsdS(s'The named metadata resource as a stringN((R#((s1/usr/lib/python2.7/site-packages/pkg_resources.pyt get_metadatascCsdS(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/site-packages/pkg_resources.pytget_metadata_linesscCsdS(s>Is the named metadata a directory? (like ``os.path.isdir()``)N((R#((s1/usr/lib/python2.7/site-packages/pkg_resources.pytmetadata_isdirscCsdS(s?List of metadata names in the directory (like ``os.listdir()``)N((R#((s1/usr/lib/python2.7/site-packages/pkg_resources.pytmetadata_listdirscCsdS(s=Execute the named script in the supplied namespace dictionaryN((Rt namespace((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRMs(RRRRRRRRM(((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRs      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/site-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/site-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/site-packages/pkg_resources.pytget_resource_stringscCsdS(s,Does the package contain the named resource?N((R((s1/usr/lib/python2.7/site-packages/pkg_resources.pyt has_resourcescCsdS(s>Is the named resource a directory? (like ``os.path.isdir()``)N((R((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRYscCsdS(s?List of resource names in the directory (like ``os.listdir()``)N((R((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRWs( RRRRRRRRYRW(((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRs     cBseZdZddZdZdZdZddZdZ dZ de dZ ddd Z dde d Zd Zd Zd ZdZdZRS(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 callbacksRRRt add_entry(RRtentry((s1/usr/lib/python2.7/site-packages/pkg_resources.pyt__init__s       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 setdefaultRRR]RtaddR(RRR((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRs cCs|jj|j|kS(s9True if `dist` is the active distribution for its project(RRR9(RR((s1/usr/lib/python2.7/site-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(RRR9RRh(RtreqR((s1/usr/lib/python2.7/site-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(RQRtvalues(RRGR#RRtep((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRSs    cCsQtjdj}|d}|j||d<|j|dj||dS(s?Locate distribution for `requires` and run `script_name` scriptiRiN(RR R R7RLRM(RtrequiresRRR#((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRMs    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(RtseentitemR9((s1/usr/lib/python2.7/site-packages/pkg_resources.pyt__iter__ s  cCs|r|j|j|n|dkr4|j}n|jj|g}|jj|jg}|j|jkrwdS||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. If it's added, any callbacks registered with the ``subscribe()`` method will be called. N( t insert_onRRtlocationRRR9RRt _added_new(RRRtinserttkeystkeys2((s1/usr/lib/python2.7/site-packages/pkg_resources.pyR1s   c CsVt|ddd}i}i}g}x$|rQ|jd}||krUq.n|j|j}|dkr|jj|j}|dkr|dkrt|j}n|j|||}||j<|dkrt |qn|j |n||krt ||n|j |j |jdddt||tchmod(RttempnameR&R$((s1/usr/lib/python2.7/site-packages/pkg_resources.pyt postprocess1scCs%|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(R,RHR.(RR((s1/usr/lib/python2.7/site-packages/pkg_resources.pyR^Zs  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/site-packages/pkg_resources.pyR_tsN((RRRRR.RRXRYRVRURTRWR3R9t staticmethodR4RHR^RR_(((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRcs        ) ) ) 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(RM(RNRO(RO(sHOME((sHOMEN(RQ( RR<RR#Rt expanduserRREt RuntimeError(tapp_datat app_homesRtsubdirR%R9((s1/usr/lib/python2.7/site-packages/pkg_resources.pyR`s0     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/site-packages/pkg_resources.pyRnscCs%|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.]+RW(RRXRY(R((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRoscCstjdd|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(RXRYR(textra((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRtscCs|jddS(s|Convert a project or version name to its filename-escaped form Any '-' characters are currently replaced with '_'. RWR(R(R#((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRusR#RRDRRRtpython_implementationtpython_versiontpython_full_versionRZcCstjS(N(RR#(((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRstos_namecCstjS(N(RRD(((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRst sys_platformcCstjjdS(Ni(RRR(((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRscCsdtjdtjdfS(Ns%s.%sii(Rt version_info(((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRscCs tdS(NR(t _platinfo(((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRstplatform_versioncCs tdS(NR(Ra(((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRstplatform_machinecCstdptS(NR[(Rat_pyimp(((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRscCs;yddl}Wntk r$dSXt||dS(NiRcSsdS(NR((((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRs(RDRR(tattrRD((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRas  cCsDtjdkrdStjjdr)dSdtjkr<dSdSdS(Ntclit IronPythontjavatJythont__pypy__tPyPytCPython(RRDRtbuiltin_module_names(((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRdscCs1yt|Wntk r,tjdSXtS(sHValidate text as a PEP 426 environment marker; return exception or Falsei(Rwt SyntaxErrorRRR(ttext((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRvs  csNs ddlmmddlddlddlfd}fd}fd}fd}ji|j6|j6|j6|j 6dd 6d d 6j d 6j d 6t dr |j (RoRRR9tnew_keytresultte((s1/usr/lib/python2.7/site-packages/pkg_resources.pyt_markerlib_evaluateVs   RcBseZdZdZdZdZdZdZdZ dZ dZ dZ e jdkrodZn d Zd Zd Zd Zd ZdZdZdZdZdZdZdZRS(sETry to implement resources and metadata for arbitrary PEP 302 loaderscCs:t|dd|_tjjt|dd|_dS(NRt__file__R(RRRRRR%t module_path(RR((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRvscCs|j|j|S(N(t_fnR(RRR((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRzscCst|j||S(N(RR(RRR((s1/usr/lib/python2.7/site-packages/pkg_resources.pyR}scCs|j|j|j|S(N(t_getRR(RRR((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRscCs|j|j|j|S(N(t_hasRR(RR((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRscCs%|jo$|j|j|j|S(N(tegg_infoRR(RR#((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRsicCs)|js dS|j|j|j|S(NR(RRR(RR#((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRs cCs2|js dS|j|j|j|jdS(NRsutf-8(RRRtdecode(RR#((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRs cCst|j|S(N(RrR(RR#((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRscCs|j|j|j|S(N(t_isdirRR(RR((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRYscCs%|jo$|j|j|j|S(N(RRR(RR#((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRscCs|j|j|j|S(N(t_listdirRR(RR((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRWscCs)|jr%|j|j|j|SgS(N(RRR(RR#((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRs cCsd|}|j|s,td|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( RtzipfiletZipFiletnamelistRRtseptgetinfoRtAssertionErrorR(Rtzipinfotzfiletzitemtzpath((s1/usr/lib/python2.7/site-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/site-packages/pkg_resources.pyR@scCs@|j|jr#|t|jStd||jfdS(Ns%s is not a subpath of %s(RRRuR(Rtfspath((s1/usr/lib/python2.7/site-packages/pkg_resources.pyt _zipinfo_nameEscCsd|j|}|j|jtjrG|t|jdjtjStd||jfdS(Nis%s is not a subpath of %s(RRRRRRuRR(Rtzip_pathR((s1/usr/lib/python2.7/site-packages/pkg_resources.pyt_partsNs  !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_resourcesRERt_extract_resourcet _eager_to_zip(RRRRteagersR#((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRWs     cCs/|j}|jd}tj|}||fS(Nii(iii(t file_sizet date_timettimetmktime(tzip_stattsizeRt timestamp((s1/usr/lib/python2.7/site-packages/pkg_resources.pyt_get_date_and_sizeds  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_indexRRRRER%RRR R!R9RRt _is_currentt_mkstemptwriteRRRRRHRterrortisfileR#RR3( RRRR#tlastRRt real_pathtoutfttmpnam((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRls@$    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(RRRRRRR=tst_sizetst_mtimeRRRRR( Rt file_pathRRRR=t zip_contentstft file_contents((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRs  cCsa|jdkrZg}x6dD].}|j|r|j|j|qqW||_n|jS(Nsnative_libs.txtseager_resources.txt(snative_libs.txtseager_resources.txt(RRRRR(RRR#((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRs  cCsy |jSWntk ri}x~|jD]s}|jtj}xX|rtjj|d }||kr||j|dPqF|jg||PEP 302 Importer that wraps Python's "normal" import algorithmcCs ||_dS(N(R(RR((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRIscCs|jdd}||kr2|jdkr2dS|jdkrJd}n |jg}ytj||\}}}Wntk rdSXt|||S(NR@i(RRRtimpt find_moduleRt ImpLoader(RtfullnameRtsubnametfileR&tetc((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRLs   N(RRRRRR(((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRFs RcBs eZdZdZdZRS(s<PEP 302 Loader that wraps Python's "normal" import algorithmcCs||_||_||_dS(N(RR&R(RRR&R((s1/usr/lib/python2.7/site-packages/pkg_resources.pyR^s  cCsFz%tj||j|j|j}Wd|jrA|jjnX|S(N(Rt load_moduleRR&RR(RRtmod((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRcs % (RRRRR(((s1/usr/lib/python2.7/site-packages/pkg_resources.pyR[s cCsytj|}WnPtk rcx@tjD]+}y||}Wntk rTq+XPq+Wd}nXtjj|||dkryt|}Wqtk rqXn|S(sRetrieve 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(Rtpath_importer_cacheRt path_hooksRRRR(t path_itemRthook((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRos"     (Rt ImpImporterRt_distribution_finderscCs|t|=?|==|!=)\s*((\w|[-.])+)s\s*,s\s*\[s\s*\]s \w+(\.\w+)*$sL(?P[^-]+)( -(?P[^-]+) (-py(?P[^-]+) (-(?P.+))? )? )?s(\d+ | [a-z]+ | \.| -)tctpretpreviewsfinal-RWtrct@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/site-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. R8s*finalis*final-t00000000(R<RRRRttuple(RRR;((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRms cBseZdZd d d dZdZdZed d dZd d dZ d dZ e e Z d dZ e e Z d dZ e e Z RS( s3Object representing an advertised importable objectcCsnt|std|n||_||_t||_tjddj|j |_ ||_ dS(NsInvalid module namesx[%s]t,( tMODULERHR#t module_nameR>tattrsReRRERR(RR#RARBRR((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRs   "cCsfd|j|jf}|jr<|ddj|j7}n|jrb|ddj|j7}n|S(Ns%s = %st:R@s [%s]R?(R#RARBRER(RR((s1/usr/lib/python2.7/site-packages/pkg_resources.pyt__str__s   cCsdt|S(NsEntryPoint.parse(%r)(R(R((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRscCs|r|j||nt|jttdg}xN|jD]C}yt||}WqDtk rtd||fqDXqDW|S(NRs%r has no %r attribute(RLRRARRBRRR(RRLRRRRe((s1/usr/lib/python2.7/site-packages/pkg_resources.pytloads! cCs]|jr%|j r%td|ntttjtj|jj|j||dS(Ns&Can't require() without a distribution( RRRjRRR[RRR(RRR((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRLs 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[RCR@s9EntryPoint must be in 'name=module:attrs [extras]' formatN(( RReRtspecsRHRR@RR(tclstsrcRRBRR#tvalueR((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRs&         cCst|std|ni}xZt|D]L}|j||}|j|krptd||jn|||jEnsure distribution is importable on `path` (default=sys.path)snamespace_packages.txtN( RRRRRRRRRZRk(RR((s1/usr/lib/python2.7/site-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%sRW(RuRRRR+RD(RR&((s1/usr/lib/python2.7/site-packages/pkg_resources.pyR s  cCs(|jrd||jfSt|SdS(Ns%s (%s)(RR(R((s1/usr/lib/python2.7/site-packages/pkg_resources.pyR s cCsMyt|dd}Wntk r/d}nX|p9d}d|j|fS(NRs[unknown version]s%s %s(RRRHR(RR((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRD s   cCs.|jdrt|nt|j|S(sADelegate all unrecognized public attributes to .metadata providerR(RRRRW(RRe((s1/usr/lib/python2.7/site-packages/pkg_resources.pyt __getattr__ scKs(|jt|tjj|||S(N(RRRRR(RIR&RR*((s1/usr/lib/python2.7/site-packages/pkg_resources.pyR scCstjd|j|jfS(s?Return a ``Requirement`` that matches this distribution exactlys%s==%s(ReRRR(R((s1/usr/lib/python2.7/site-packages/pkg_resources.pyR scCsD|j||}|dkr:td||ffn|jS(s=Return the `name` entry point of `group` or raise ImportErrorsEntry point %r not foundN(RRRRRE(RRGR#R((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRP 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_mapRRfRQRkRR(RRGtep_map((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRQ s    cCs|j|j|S(s<Return the EntryPoint object for `group`+`name`, or ``None``(RQR(RRGR#((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRR sc Csj|p |j}|sdSt|}tjj|}g|D]}|rVt|pY|^q>}d}xt|D]w\}}||krPqu||kru|jtkru|t jkr|j n|j |||j ||PququW|t jkr |j n|j |dSxFy|j ||d} Wntk rNPq X|| =|| =| }q dS(s@Insert self.location in path before its nearest parent directoryNi(RRRRR%Rt enumerateRRzRtcheck_version_conflictRRtindexRH( RRtloctnloctbdirtptnpathtbpRtnp((s1/usr/lib/python2.7/site-packages/pkg_resources.pyR s8 +      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(RRssite( R9RR RkRyRRRRRRRt issue_warning(RtnspRztmodnameR((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRxG s"  cCs8y |jWn&tk r3tdt|tSXtS(NsUnbuilt egg for (RRHRRRR(R((s1/usr/lib/python2.7/site-packages/pkg_resources.pyR#] s   cKsMx*dD]"}|j|t||d qW|jd|j|j|S( s@Copy this distribution, substituting in any changed keyword argsRRRRDRRR(s project_namesversions py_versionsplatformslocations precedenceN(RRRRWR(RR*Re((s1/usr/lib/python2.7/site-packages/pkg_resources.pytclonee s   cCs g|jD]}|r |^q S(N(Rq(Rtdep((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRs sN(((RRRRlRR+RzRRRRtpropertyR`RaRbRcRdReRfRgR9R^RRqRRkRsRRRDRtRRRPRQRRRRxR#RR(((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRd; sT                          )    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.parserRtparsestrRRl(RR((s1/usr/lib/python2.7/site-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/site-packages/pkg_resources.pyRq 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)(RRRXRYtEQEQR(Rt requires_distRtdistverstmark((s1/usr/lib/python2.7/site-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 || ||| R*tlevelR+RB((s1/usr/lib/python2.7/site-packages/pkg_resources.pyR s  c #s#tt|fd}xD]}t|}|sRtd|n|jd}|j}g}t||}|r|j}|tt||dd\}}}n|tt ||d d\}}}g|D]\}} |t | f^q}t |||Vq(WdS( sYield ``Requirement`` objects for each specification in `strs` `strs` must be an instance of ``basestring``, or a (possibly-nested) iterable thereof. cs?g}x|||s t||r`yt}d}Wq`tk r\tdq`Xn|||}|std|d|d||n|j|j||j}t||}|r|j}q |||s td|d||q q W|||}|r2|j}n|||fS(Nis+\ must not appear on the last nonblank lines Expected s intatsExpected ',' or end-of-list in(tCONTINUERt StopIterationRHRRGtendtCOMMA(tITEMt TERMINATORRR}tgroupst item_nameR'RC(RL(s1/usr/lib/python2.7/site-packages/pkg_resources.pyt scan_list s0  $ sMissing distribution specis 'extra' nameis version specN(i(ii( titerRrtDISTRORHRGRtOBRACKETtCBRACKETtVERSIONtLINE_ENDRoRe( R/RRRCRR}RRHRR,((RLs1/usr/lib/python2.7/site-packages/pkg_resources.pyRl s"    $$+cCs\g|D]}|j|f^q}|jg|D]\}}|^q3|dddDO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()!N(Rnt unsafe_nameRRR9Rmt state_machineRRHR>RRtRyRRthashCmpR_t_Requirement__hash( RRRHRRR1RyRSttransRX((s1/usr/lib/python2.7/site-packages/pkg_resources.pyR2 s5 ."4cCsgdjg|jD]}dj|^q}dj|j}|rSd|}nd|j||fS(NR?Rs[%s]s%s%s%s(RERHRR(RRRHR((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRD@ s . cCst|to|j|jkS(N(RReR(RR&((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRfF 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/site-packages/pkg_resources.pyRP stFtTt+RW( RRdR9RRyR^RRmRR( RRRtcompareRSRRRXtaction((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRI s,       cCs|jS(N(R(R((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRa[ scCsdt|S(NsRequirement.parse(%r)(R(R((s1/usr/lib/python2.7/site-packages/pkg_resources.pyR^ scCsWtt|}|rDt|dkr2|dStd|ntd|dS(NiisExpected only one requirementsNo requirements found(RRlRuRH(RRo((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRa s ( RRRRDRfRRaRRRJ(((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRe1 s       s--TtsT+Fs>=sT..s==sF++s!=cCs:t|ts3d|tfdY}|jdS|jS(s&Get an mro for a type or classic classRIcBseZRS((RR(((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRIy si(Rttypetobjectt__mro__(RI((s1/usr/lib/python2.7/site-packages/pkg_resources.pyt_get_mrov s cCsAx:tt|dt|D]}||kr||SqWdS(s2Return an adapter factory for `ob` from `registry`RN(RRR(tregistryR:R((s1/usr/lib/python2.7/site-packages/pkg_resources.pyR} s% cCs8tjj|}tjj|s4tj|ndS(s1Ensure that the parent directory of `path` existsN(RRR%Rtmakedirs(RR%((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRx 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``. RGt]iisInvalid section headingN(RRrRRRRHR(RtsectiontcontentR((s1/usr/lib/python2.7/site-packages/pkg_resources.pyRs s  cOsDddlm}tj}ztt_|||SWd|t_XdS(Ni(tmkstemp(ttempfileRRRtos_open(R>R*Rtold_open((s1/usr/lib/python2.7/site-packages/pkg_resources.pyR s   cCs@x9ttD]+}|jds tt|||s`            '           +                      3      ), )           X  d    !,       (            , )w >?   # = :