PKЉ455³ÀøÁÁsite.pyc;ò ­Ec@s(d„Zedjoeƒ[ndS(cCs÷dk}dk}dk}dk}|iidƒ}|tjp|idjo| o g}n|i |i ƒ}t |dhƒ}|i t|ƒ} |i itƒ} xü| D]è}|| jp| oqµn|i|ƒ} | tj o2| idƒ}|tj o|idƒPqqµy"|id|gƒ\}}}Wntj o qµnX|tjoqµnz|id|||ƒWd|iƒXPqµWtdƒ‚tgi}|i D] }|t|ƒddfƒqÁ~ƒ}t |ddƒ} d|_"x|D]}t#|ƒqW|i"| 7_"t| dƒ\}}t}g}x’|i D]‡}t|ƒ\}} | |jo |tjot|ƒ}n| |jp |tjo|i|ƒq^|i*||ƒ|d7}q^W||i (dS( Ns PYTHONPATHswin32spath_importer_cachessites$Couldn't find the real 'site' moduleis __egginserti(+ssyssimpsossos.pathsenvironsgets PYTHONPATHsNonesplatformssplitspathsepsgetattrspicspathslensstdpathsdirnames__file__smydirsitemsimporters find_modulesloaders load_modulesstreamsdescrs ImportErrorsclosesdictsappends_[1]smakepaths known_pathssoldposs __egginserts addsitedirsdsnds insert_atsnew_pathspsnpsinsert(spsstreams known_pathsspicsloadersnew_pathsdescrsimpsndsmydirsstdpathsimportersoldpossnps PYTHONPATHssysspaths insert_atsds_[1]sitemsos((s"build/bdist.linux-i686/egg/site.pys__bootsd$%     "   @  ssiteN(s__boots__name__(s__boot((s"build/bdist.linux-i686/egg/site.pys?s G PKЉ45sk_Sݬݬpkg_resources.pyc;ò ­EcC@s‡dZdkZdkZdkZdkZdkZdkZdkZdkl Z dkl Z l Z l Z dkl Zd„Zdddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHgCZd!efdI„ƒYZd"efdJ„ƒYZd#efdK„ƒYZd$efdL„ƒYZhZeidM ZdMZdNZdOZdPZdQZdR„ZdS„ZgdT„Z dU„Z!dV„Z"ei#dWƒZ$ei#dXƒZ%e"Z&dY„Z'dZ„Z(e(Z)d[„Z*d\„Z+e,d]„Z-d^„Z.d7fd_„ƒYZ/d8e/fd`„ƒYZ0de1fda„ƒYZ2de1fdb„ƒYZ3e3Z4d%e5fdc„ƒYZ6dfdd„ƒYZ7de„Z8df„Z9dg„Z:dh„Z;di„Z<d>fdj„ƒYZ=ee1e=ƒd?e=fdk„ƒYZ>d@e>fdl„ƒYZ?ee@e,ƒe?ƒd<e=fdm„ƒYZAeAƒZBdAe>fdn„ƒYZCeeiDeCƒd9eAfdo„ƒYZEd:e?fdp„ƒYZFd;eCfdq„ƒYZGdrfds„ƒYZHdtfdu„ƒYZIdv„ZJydwkKlJZJlLZLWneMj onXeLZH[I[LhZNdx„ZOePdy„ZQePdz„ZReOeiDeRƒd{„aSePd|„ZTeOe1eTƒePd}„ZUeOeHeUƒhZVhZWd~„ZXd„ZYd€„ZZe,d„Z[d‚„Z\eXeHe\ƒeXeiDe\ƒdƒ„Z]eXe1e]ƒd„„Z^hd…„Z_d†„Z`d‡„Zaei#dˆƒibZcei#d‰ƒibZdei#dŠƒibZeei#d‹ƒibZfei#dŒƒibZgei#dƒibZhei#dŽƒibZiei#dƒibZjei#deikeilBƒibZmei#d‘eikƒZnhd’d“<d”d“<d•d–<d—d“Distribution doesn't have an "extra feature" of the given name(s__name__s __module__s__doc__(((s+build/bdist.linux-i686/egg/pkg_resources.pys UnknownExtra]s iiiiiÿÿÿÿcCs|t|+cCsNtidƒi}|d}|iƒ||dtZd„Zd„Zd„Zd„Zd„Zd„ZRS(NcCsdS(s;Does the package's distribution contain the named metadata?N((sname((s+build/bdist.linux-i686/egg/pkg_resources.pys has_metadataùscCsdS(s'The named metadata resource as a stringN((sname((s+build/bdist.linux-i686/egg/pkg_resources.pys get_metadataüscCsdS(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((sname((s+build/bdist.linux-i686/egg/pkg_resources.pysget_metadata_linesÿscCsdS(s>Is the named metadata a directory? (like ``os.path.isdir()``)N((sname((s+build/bdist.linux-i686/egg/pkg_resources.pysmetadata_isdirscCsdS(s?List of metadata names in the directory (like ``os.listdir()``)N((sname((s+build/bdist.linux-i686/egg/pkg_resources.pysmetadata_listdirscCsdS(s=Execute the named script in the supplied namespace dictionaryN((s script_names namespace((s+build/bdist.linux-i686/egg/pkg_resources.pys run_script s(s__name__s __module__s has_metadatas get_metadatasget_metadata_linessmetadata_isdirsmetadata_listdirs run_script(((s+build/bdist.linux-i686/egg/pkg_resources.pysIMetadataProvider÷s      cBsDtZdZd„Zd„Zd„Zd„Zd„Zd„ZRS(s3An object that provides access to package resourcescCsdS(sdReturn a true filesystem path for `resource_name` `manager` must be an ``IResourceManager``N((smanagers resource_name((s+build/bdist.linux-i686/egg/pkg_resources.pysget_resource_filename#scCsdS(siReturn a readable file-like object for `resource_name` `manager` must be an ``IResourceManager``N((smanagers resource_name((s+build/bdist.linux-i686/egg/pkg_resources.pysget_resource_stream(scCsdS(smReturn a string containing the contents of `resource_name` `manager` must be an ``IResourceManager``N((smanagers resource_name((s+build/bdist.linux-i686/egg/pkg_resources.pysget_resource_string-scCsdS(s,Does the package contain the named resource?N((s resource_name((s+build/bdist.linux-i686/egg/pkg_resources.pys has_resource2scCsdS(s>Is the named resource a directory? (like ``os.path.isdir()``)N((s resource_name((s+build/bdist.linux-i686/egg/pkg_resources.pysresource_isdir5scCsdS(s?List of resource names in the directory (like ``os.listdir()``)N((s resource_name((s+build/bdist.linux-i686/egg/pkg_resources.pysresource_listdir8s( s__name__s __module__s__doc__sget_resource_filenamesget_resource_streamsget_resource_strings has_resourcesresource_isdirsresource_listdir(((s+build/bdist.linux-i686/egg/pkg_resources.pysIResourceProvider s      cBsžtZdZed„Zd„Zd„Zd„Zed„Zd„Z d„Z ee d„Z eed „Z eee d „Zd „Zd „Zd „ZRS(sDA collection of active distributions on sys.path (or a similar list)cCs`g|_h|_h|_g|_|tjo ti}nx|D]}|i |ƒqEWdS(s?Create working set from list of path entries (default=sys.path)N( sselfsentriess entry_keyssby_keys callbackssNonessysspathsentrys add_entry(sselfsentriessentry((s+build/bdist.linux-i686/egg/pkg_resources.pys__init__Ls      cCsT|ii|gƒ|ii|ƒx*t|tƒD]}|i ||t ƒq3WdS(sÝAdd a path item to ``.entries``, finding any distributions on it ``find_distributions(entry,False)`` 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( sselfs entry_keyss setdefaultsentrysentriessappendsfind_distributionssTruesdistsaddsFalse(sselfsentrysdist((s+build/bdist.linux-i686/egg/pkg_resources.pys add_entryZs cCs|ii|iƒ|jSdS(s9True if `dist` is the active distribution for its projectN(sselfsby_keysgetsdistskey(sselfsdist((s+build/bdist.linux-i686/egg/pkg_resources.pys __contains__jscCsJ|ii|iƒ}|tj o ||jot||ƒ‚n|SdS(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(sselfsby_keysgetsreqskeysdistsNonesVersionConflict(sselfsreqsdist((s+build/bdist.linux-i686/egg/pkg_resources.pysfindrs ccsixb|D]Z}|i|ƒ}|tjox5|iƒD] }|Vq6Wq||jo ||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( sselfsdists get_entry_mapsgroupsentriessnamesNonesvaluessep(sselfsgroupsnamesdistsentriessep((s+build/bdist.linux-i686/egg/pkg_resources.pysiter_entry_points‚s    cCsQtidƒi}|d}|iƒ||d<|i|ƒdi ||ƒdS(s?Locate distribution for `requires` and run `script_name` scriptis__name__iN( ssyss _getframes f_globalssnssnamesclearsselfsrequiresrequiress run_scripts script_name(sselfsrequiress script_namesnamesns((s+build/bdist.linux-i686/egg/pkg_resources.pys run_script‘s    ccs\h}xO|iD]D}x;|i|D],}||jod||<|i|Vq$q$WqWdS(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. iN(sseensselfsentriessitems entry_keysskeysby_key(sselfsseenskeysitem((s+build/bdist.linux-i686/egg/pkg_resources.pys__iter__›s   cCsé|o|i|i|ƒn|tjo |i}n|ii |gƒ}|ii |igƒ}|i |i jodSn||i |i <|i |jo|i|i ƒn|i |jo|i|i ƒn|i|ƒdS(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(sinsertsdists insert_onsselfsentriessentrysNoneslocations entry_keyss setdefaultskeysskeys2skeysby_keysappends _added_new(sselfsdistsentrysinsertskeysskeys2((s+build/bdist.linux-i686/egg/pkg_resources.pysadd¨s   c Csht|ƒddd…}h}h}g}x2|o*|idƒ}||joq.n|i|iƒ}|t jo”|i i|iƒ}|t joa|t jot|iƒ}n|i|||ƒ}||i<|t jot|ƒ‚qún|i|ƒn||jot||ƒ‚n|i|i|iƒddd…ƒt||™scCsdS(Ns((sselfspath((s+build/bdist.linux-i686/egg/pkg_resources.pysšscCsgS(N((sselfspath((s+build/bdist.linux-i686/egg/pkg_resources.pys›scCsdS(N((sself((s+build/bdist.linux-i686/egg/pkg_resources.pys__init__žs( s__name__s __module__s__doc__s_isdirs_hass_gets_listdirsNones module_paths__init__(((s+build/bdist.linux-i686/egg/pkg_resources.pys EmptyProvider–s    cBs€tZdZeZd„Zd„Zd„Zd„Zd„Z d„Z d„Z d„Z d „Z d „Zd „Zd „ZRS( s"Resource support for zips and eggscCs@ti||ƒti|ii|_|iit i |_ dS(N( s EggProviders__init__sselfsmodules zipimports_zip_directory_cachesloadersarchiveszipinfososssepszip_pre(sselfsmodule((s+build/bdist.linux-i686/egg/pkg_resources.pys__init__«scCsE|i|iƒo|t|iƒSntd||ifƒ‚dS(Ns%s is not a subpath of %s(sfspaths startswithsselfszip_preslensAssertionError(sselfsfspath((s+build/bdist.linux-i686/egg/pkg_resources.pys _zipinfo_name°scCsi|i|}|i|itiƒo%|t|iƒdi tiƒSnt d||ifƒ‚dS(Nis%s is not a subpath of %s( sselfszip_preszip_pathsfspaths startswithsegg_rootsosssepslenssplitsAssertionError(sselfszip_pathsfspath((s+build/bdist.linux-i686/egg/pkg_resources.pys_parts¹s %cCs—|i otdƒ‚n|i|ƒ}|iƒ}di|i |ƒƒ|jo.x+|D]}|i ||i |ƒƒq\Wn|i ||ƒSdS(Ns5resource_filename() only supported for .egg, not .zips/(sselfsegg_namesNotImplementedErrors_resource_to_zips resource_nameszip_paths_get_eager_resourcesseagerssjoins_partssnames_extract_resourcesmanagers _eager_to_zip(sselfsmanagers resource_nameszip_pathseagerssname((s+build/bdist.linux-i686/egg/pkg_resources.pysget_resource_filenameÂs  !c Cs¥||iƒjoPx9|iƒ|D]'}|i|tii||ƒƒ}q$Wtii |ƒSn|i |}|d|d|df\} } } | d?d| d?d@| d@| d@d ?| d?d @| d@d d d d f }ti|ƒ}yŠ|i|i|i|ƒƒ}tii|ƒo;ti|ƒ}|i| jo |i|jo|Sq_ntddtii |ƒƒ\} } ti| |i i!|ƒƒti"| ƒt#| ||fƒ|i$| |ƒyt%| |ƒWn–ti&j o‡tii|ƒojti|ƒ}|i| jo |i|jo|Sqqtidjot'|ƒt%| |ƒ|Sqqn‚nXWn ti&j o|i(ƒnX|SdS(Niiii i¼iiiÿÿi i?iiiÿÿÿÿs .$extractsdirsnt()szip_pathsselfs_indexsnames_extract_resourcesmanagersosspathsjoinslastsdirnameszipinfoszip_statstsdssizes date_timestimesmktimes timestampsget_cache_pathsegg_names_partss real_pathsisfilesstatsst_sizesst_mtimes_mkstempsoutfstmpnamswritesloadersget_datasclosesutimes postprocesssrenameserrorsunlinksextraction_error(sselfsmanagerszip_paths date_timesstatslastsnames real_paths timestampstmpnamsdstsoutfssizeszip_stat((s+build/bdist.linux-i686/egg/pkg_resources.pys_extract_resourceÏsF% $M  $      cCso|itjoTg}x>ddfD]0}|i|ƒo|i|i|ƒƒq#q#W||_n|iSdS(Nsnative_libs.txtseager_resources.txt(sselfseagerssNonesnames has_metadatasextendsget_metadata_lines(sselfseagerssname((s+build/bdist.linux-i686/egg/pkg_resources.pys_get_eager_resourcess  cCs½y |iSWn«tj oŸh}x‚|iD]w}|itiƒ}x\|oTtii |d ƒ}||jo||i |dƒPqG|i ƒg||PEP 302 Importer that wraps Python's "normal" import algorithmcCs ||_dS(N(spathsself(sselfspath((s+build/bdist.linux-i686/egg/pkg_resources.pys__init__ŸscCs«|idƒd}||jo |itjotSn|itjo t}n |ig}yti||ƒ\}}}Wnt j o tSnXt |||ƒSdS(Ns.iÿÿÿÿ( sfullnamessplitssubnamesselfspathsNonesimps find_modulesfilesfilenamesetcs ImportErrors ImpLoader(sselfsfullnamespathsfilenamesetcssubnamesfile((s+build/bdist.linux-i686/egg/pkg_resources.pys find_module¢s   (s__name__s __module__s__doc__sNones__init__s find_module(((s+build/bdist.linux-i686/egg/pkg_resources.pys ImpWrapperœs  s ImpLoadercBs tZdZd„Zd„ZRS(s<PEP 302 Loader that wraps Python's "normal" import algorithmcCs||_||_||_dS(N(sfilesselfsfilenamesetc(sselfsfilesfilenamesetc((s+build/bdist.linux-i686/egg/pkg_resources.pys__init__´s  cCsLz%ti||i|i|iƒ}Wd|io|iiƒnX|SdS(N( simps load_modulesfullnamesselfsfilesfilenamesetcsmodsclose(sselfsfullnamesmod((s+build/bdist.linux-i686/egg/pkg_resources.pys load_module¹s % (s__name__s __module__s__doc__s__init__s load_module(((s+build/bdist.linux-i686/egg/pkg_resources.pys ImpLoader±s  cCsºyti|}WnTtj oHxCtiD]-}y||ƒ}Wntj oq,XPq,Wt}nXtii ||ƒ|tjo*yt |ƒ}Wq²tj oq²Xn|SdS(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( ssysspath_importer_caches path_itemsimportersKeyErrors path_hooksshooks ImportErrorsNones setdefaults ImpWrapper(s path_itemshooksimporter((s+build/bdist.linux-i686/egg/pkg_resources.pys get_importerÅs&    (s get_importers ImpImportercCs|t|y ||SWn+tj ot|ƒ||<}|SnXdS(N(s_cachesfilenamesKeyErrorsnormalize_pathsresult(sfilenames_cachesresult((s+build/bdist.linux-i686/egg/pkg_resources.pys_normalize_cached¬s  cCsW|idƒ}|iƒ}|o1di|ƒ}tti ||ti |ƒndS(Ns.( s packageNamessplitspartsspopsnamesjoinsparentssetattrssyssmodules(s packageNamesparentsnamesparts((s+build/bdist.linux-i686/egg/pkg_resources.pys_set_parent_ns³s  ccs‡t|tƒoGxp|iƒD]2}|iƒ}|o|idƒ o|VqqWn-x)|D]!}xt|ƒD] }|VqqWq^WdS(sAYield non-empty/non-comment lines of a ``basestring`` or sequences#N( s isinstancesstrss basestrings splitlinessssstrips startswithssss yield_lines(sstrssssss((s+build/bdist.linux-i686/egg/pkg_resources.pys yield_lines»s   s \s*(#.*)?$s\s*\\\s*(#.*)?$s\s*((\w|[-.])+)s!\s*(<=?|>=?|==|!=)\s*((\w|[-.])+)s\s*,s\s*\[s\s*\]s \w+(\.\w+)*$sL(?P[^-]+)( -(?P[^-]+) (-py(?P[^-]+) (-(?P.+))? )? )?s(\d+ | [a-z]+ | \.| -)sprescspreviews-sfinal-srcccswxlti|ƒD][}t||ƒ}| p |djoqn|d djo|idƒVqd|VqWdVdS(Ns.is 0123456789is*s*final(s component_ressplitssspartsreplaceszfill(ssspart((s+build/bdist.linux-i686/egg/pkg_resources.pys_parse_version_partsØs cCs·g}x t|iƒƒD]Œ}|idƒoi|djo.x+|o|ddjo|iƒq?Wnx+|o|ddjo|iƒqmWn|i|ƒqWt|ƒSdS(sYConvert 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", whic 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. s*s*finaliÿÿÿÿs*final-s00000000N( spartss_parse_version_partsssslowersparts startswithspopsappendstuple(ssspartsspart((s+build/bdist.linux-i686/egg/pkg_resources.pys parse_versionäs cBs›tZdZffed„Zd„Zd„Zeeed„Zeed„Z ed„Z e e ƒZ ed„Z e e ƒZ ed„Z e e ƒZ RS( s3Object representing an advertised importable objectcCsqt|ƒ otd|ƒ‚n||_||_t|ƒ|_tiddi |ƒƒi |_ ||_ dS(NsInvalid module namesx[%s]s,( sMODULEs module_names ValueErrorsnamesselfstuplesattrss Requirementsparsesjoinsextrassdist(sselfsnames module_namesattrssextrassdist((s+build/bdist.linux-i686/egg/pkg_resources.pys__init__s  "cCsnd|i|if}|io|ddi|iƒ7}n|io|ddi|iƒ7}n|SdS(Ns%s = %ss:s.s [%s]s,(sselfsnames module_namesssattrssjoinsextras(sselfss((s+build/bdist.linux-i686/egg/pkg_resources.pys__str__s   cCsdt|ƒSdS(NsEntryPoint.parse(%r)(sstrsself(sself((s+build/bdist.linux-i686/egg/pkg_resources.pys__repr__!scCs—|o|i||ƒnt|itƒtƒdgƒ}xP|iD]E}yt ||ƒ}WqFt j ot d||fƒ‚qFXqFW|SdS(Ns__name__s%r has no %r attribute( srequiresselfsenvs installers __import__s module_namesglobalssentrysattrssattrsgetattrsAttributeErrors ImportError(sselfsrequiresenvs installersattrsentry((s+build/bdist.linux-i686/egg/pkg_resources.pysload$s! cCsZ|io|i otd|ƒ‚nttiti|ii|iƒ||ƒƒdS(Ns&Can't require() without a distribution( sselfsextrassdists UnknownExtrasmaps working_setsaddsresolvesrequiressenvs installer(sselfsenvs installer((s+build/bdist.linux-i686/egg/pkg_resources.pysrequire.s cCs&yÛf}}|iddƒ\}}d|joL|iddƒ\}}tid|ƒ}|i o t ‚n|i}nd|joO|iddƒ\}}t |i ƒƒ o t ‚n|i ƒidƒ}nWn"t j ot d|ƒ‚n$X||iƒ|iƒ|||ƒ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 s=is[sx[s:s.s9EntryPoint must be in 'name=module:attrs [extras]' formatN(sattrssextrasssrcssplitsnamesvalues Requirementsparsesreqsspecss ValueErrorsMODULEsrstripsclssstripsdist(sclsssrcsdistsnamesreqsvaluesextrassattrs((s+build/bdist.linux-i686/egg/pkg_resources.pysparse7s&       cCsŽt|ƒ otd|ƒ‚nh}x\t|ƒD]N}|i||ƒ}|i |jotd||i ƒ‚n|||i ¨scCst|i|ƒSdS(N(scmpsselfshashcmpsother(sselfsother((s+build/bdist.linux-i686/egg/pkg_resources.pys__cmp__®scCst|iƒSdS(N(shashsselfshashcmp(sself((s+build/bdist.linux-i686/egg/pkg_resources.pys__hash__¯scCs?y |iSWn-tj o!|iiƒ|_}|SnXdS(N(sselfs_keysAttributeErrors project_nameslowerskey(sselfskey((s+build/bdist.linux-i686/egg/pkg_resources.pyskey¶s  cCs?y |iSWn-tj o!t|iƒ|_}|SnXdS(N(sselfs_parsed_versionsAttributeErrors parse_versionsversionspv(sselfspv((s+build/bdist.linux-i686/egg/pkg_resources.pysparsed_version¿s  cCs”y |iSWn‚tj ovxq|idƒD]L}|iƒidƒo0t|iddƒdi ƒƒ|_|iSq,q,Wt d|ƒ‚nXdS(NsPKG-INFOsversion:s:is.Missing 'Version:' header and/or PKG-INFO file( sselfs_versionsAttributeErrors _get_metadataslineslowers startswiths safe_versionssplitsstrips ValueError(sselfsline((s+build/bdist.linux-i686/egg/pkg_resources.pysversionÉs %cCs²y |iSWn tj o”htg<}|_xpddfD]b}xYt|i|ƒƒD]B\}}|ot |ƒ}n|i |gƒi t |ƒƒq[Wq?W|SnXdS(Ns requires.txts depends.txt(sselfs_Distribution__dep_mapsAttributeErrorsNonesdmsnamessplit_sectionss _get_metadatasextrasreqss safe_extras setdefaultsextendsparse_requirements(sselfsdmsnamesextrasreqs((s+build/bdist.linux-i686/egg/pkg_resources.pys_dep_mapÛs   'cCsˆ|i}g}|i|itfƒƒxU|D]M}y|i|t |ƒƒWq/t j ot d||fƒ‚q/Xq/W|SdS(s@List of Requirements needed for this distro if `extras` are useds%s has no such extra feature %rN( sselfs_dep_mapsdmsdepssextendsgetsNonesextrassexts safe_extrasKeyErrors UnknownExtra(sselfsextrassdmsextsdeps((s+build/bdist.linux-i686/egg/pkg_resources.pysrequiresçs ccs6|i|ƒo"x|i|ƒD] }|Vq WndS(N(sselfs has_metadatasnamesget_metadata_linessline(sselfsnamesline((s+build/bdist.linux-i686/egg/pkg_resources.pys _get_metadataõscCsb|tjo ti}n|i|ƒ|tijo't|iƒtt|i dƒƒndS(s>Ensure distribution is importable on `path` (default=sys.path)snamespace_packages.txtN( spathsNonessyssselfs insert_onsfixup_namespace_packagesslocationsmapsdeclare_namespaces _get_metadata(sselfspath((s+build/bdist.linux-i686/egg/pkg_resources.pysactivateús   cCsVdt|iƒt|iƒ|iptf}|io|d|i7}n|SdS(s@Return what this distribution's standard .egg filename should bes %s-%s-py%ss-N(s to_filenamesselfs project_namesversions py_versionsPY_MAJORsfilenamesplatform(sselfsfilename((s+build/bdist.linux-i686/egg/pkg_resources.pysegg_names / cCs-|iod||ifSn t|ƒSdS(Ns%s (%s)(sselfslocationsstr(sself((s+build/bdist.linux-i686/egg/pkg_resources.pys__repr__s cCsTyt|dtƒ}Wntj o t}nX|pd}d|i|fSdS(Nsversions[unknown version]s%s %s(sgetattrsselfsNonesversions ValueErrors project_name(sselfsversion((s+build/bdist.linux-i686/egg/pkg_resources.pys__str__s   cCs1|idƒo t|‚nt|i|ƒSdS(sADelegate all unrecognized public attributes to .metadata providers_N(sattrs startswithsAttributeErrorsgetattrsselfs _provider(sselfsattr((s+build/bdist.linux-i686/egg/pkg_resources.pys __getattr__s cKs,|it|ƒtii|ƒ||SdS(N( sclss from_locations_normalize_cachedsfilenamesosspathsbasenamesmetadataskw(sclssfilenamesmetadataskw((s+build/bdist.linux-i686/egg/pkg_resources.pys from_filename!scCs!tid|i|ifƒSdS(s?Return a ``Requirement`` that matches this distribution exactlys%s==%sN(s Requirementsparsesselfs project_namesversion(sself((s+build/bdist.linux-i686/egg/pkg_resources.pysas_requirement(scCsJ|i||ƒ}|tjotd||ffƒ‚n|iƒSdS(s=Return the `name` entry point of `group` or raise ImportErrorsEntry point %r not foundN(sselfsget_entry_infosgroupsnamesepsNones ImportErrorsload(sselfsgroupsnamesep((s+build/bdist.linux-i686/egg/pkg_resources.pysload_entry_point,s  cCsny |i}Wn5tj o)ti|idƒ|ƒ}|_nX|tj o|i |hƒSn|SdS(s=Return the entry point map for `group`, or the full entry mapsentry_points.txtN( sselfs_ep_mapsep_mapsAttributeErrors EntryPoints parse_maps _get_metadatasgroupsNonesget(sselfsgroupsep_map((s+build/bdist.linux-i686/egg/pkg_resources.pys get_entry_map3s ' cCs|i|ƒi|ƒSdS(s<Return the EntryPoint object for `group`+`name`, or ``None``N(sselfs get_entry_mapsgroupsgetsname(sselfsgroupsname((s+build/bdist.linux-i686/egg/pkg_resources.pysget_entry_info?sc Cs?|p|i}| odSn|tijo|iƒnt|ƒ}tii |ƒ} t t|ƒ}t }xot|ƒD]P\}}||joPq~|| jo%|i||ƒ|i||ƒPq~q~W|i|ƒdSxQnoIy|i||dƒ}Wntj oPqæX||=||=|}qíWdSdS(s@Insert self.location in path before its nearest parent directoryNi(slocsselfslocationspathssysscheck_version_conflicts_normalize_cachedsnlocsossdirnamesbdirsmapsnpathsNonesbps enumeratespsitemsinsertsappendsindexsnps ValueError( sselfspathslocsnlocsnpathspsbpsitemsnpsbdir((s+build/bdist.linux-i686/egg/pkg_resources.pys insert_onUs:       cCså|idjodSnti|idƒƒ}t|iƒ}xŸ|idƒD]Ž}|t i jp||jp |t joqOnt t i |dtƒ}|ot|ƒi|ƒoqOntd|||ifƒqOWdS(Ns setuptoolssnamespace_packages.txts top_level.txts__file__sIModule %s was already imported from %s, but %s is being added to sys.path(sselfskeysdictsfromkeyss _get_metadatasnspsnormalize_pathslocationslocsmodnamessyssmoduless_namespace_packagessgetattrsNonesfns startswiths issue_warning(sselfslocsmodnamesnspsfn((s+build/bdist.linux-i686/egg/pkg_resources.pyscheck_version_conflict~s*cCsAy |iWn+tj otdt|ƒƒtSnXtSdS(NsUnbuilt egg for (sselfsversions ValueErrors issue_warningsreprsFalsesTrue(sself((s+build/bdist.linux-i686/egg/pkg_resources.pys has_version’s   cKscx<ddddddfD]"}|i|t||tƒƒqW|id|iƒ|i|SdS( s@Copy this distribution, substituting in any changed keyword argss project_namesversions py_versionsplatformslocations precedencesmetadataN(sattrskws setdefaultsgetattrsselfsNones _providers __class__(sselfskwsattr((s+build/bdist.linux-i686/egg/pkg_resources.pysclonešs  cCs7gi}|iD]}|o||ƒqq~SdS(N(sappends_[1]sselfs_dep_mapsdep(sselfs_[1]sdep((s+build/bdist.linux-i686/egg/pkg_resources.pysextras¨s("s__name__s __module__s__doc__sNonesPY_MAJORsEGG_DISTs__init__s from_locations classmethodspropertyshashcmps__cmp__s__hash__skeysparsed_versionsversions_dep_mapsrequiress _get_metadatasactivatesegg_names__repr__s__str__s __getattr__s from_filenamesas_requirementsload_entry_points get_entry_mapsget_entry_infos insert_onscheck_version_conflicts has_versionsclonesextras(((s+build/bdist.linux-i686/egg/pkg_resources.pys DistributionˆsD                     )    cOs|d}tƒ}y/x(ti|ƒi|jo|d7}qWWntj onXdkl}|d|d||ŽdS(Ni(swarns stacklevel( slevelsglobalssgssyss _getframes f_globalss ValueErrorswarningsswarnsargsskw(sargsskwswarnsgslevel((s+build/bdist.linux-i686/egg/pkg_resources.pys issue_warning­s  c #s;tt|ƒƒ‰‡d†}xˆD]}t|ƒ}| otd|ƒ‚n|i dƒ}|i ƒ} g} t|| ƒ}|o7|i ƒ} |tt|| dfdƒ\}} } n|tt|| ddfdƒ\}} }gi}|D]"\} }|| t|ƒfƒqø~}t||| ƒVq%WdS(s£Yield ``Requirement`` objects for each specification in `strs` `strs` must be an instance of ``basestring``, or a (possibly-nested) iterable thereof. csTg}x|||ƒ ot||ƒo<yˆiƒ}d}Wqftj otdƒ‚qfXn|||ƒ}| o%td|d|d||ƒ‚n|i |i |Œƒ|iƒ}t||ƒ}|o|iƒ}q |||ƒ otd|d||ƒ‚q q W|||ƒ}|o|iƒ}n|||fSdS(Nis+\ must not appear on the last nonblank lines Expected s insatsExpected ',' or end-of-list in(sitemss TERMINATORslinespsCONTINUEslinessnexts StopIterations ValueErrorsITEMsmatchs item_namesappendsgroupsgroupssendsCOMMA(sITEMs TERMINATORslinespsgroupss item_namesitemssmatch(slines(s+build/bdist.linux-i686/egg/pkg_resources.pys scan_listÙs,% "sMissing distribution specis 'extra' nameis version specN(siters yield_linessstrssliness scan_listslinesDISTROsmatchs ValueErrorsgroups project_namesendspsextrassOBRACKETsCBRACKETsVERSIONsLINE_ENDsspecssappends_[1]sopsvals safe_versions Requirement( sstrssspecssvals scan_listsmatchs project_nameslinesliness_[1]spsextrassop((sliness+build/bdist.linux-i686/egg/pkg_resources.pysparse_requirementsÐs$    +*9cCsxgi}|D]}||i|fƒq~}|iƒgi}|D]\}}||ƒqH~|ddd…DO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()!N(s project_names safe_namesselfs unsafe_nameslowerskeysappends_[1]sspecssopsvs parse_versions state_machinesindexssortsparsedstranssverstuplesmaps safe_extrasextrass ImmutableSetshashCmpshashs_Requirement__hash( sselfs project_namesspecssextrassindexsversparseds_[1]svstranssop((s+build/bdist.linux-i686/egg/pkg_resources.pys__init__# sC <'WcCs{digi}|iD]}|di|ƒƒq~ƒ}di|iƒ}|od|}nd|i||fSdS(Ns,ss[%s]s%s%s%s(sjoinsappends_[1]sselfsspecssssextrass project_name(sselfs_[1]sssextrassspecs((s+build/bdist.linux-i686/egg/pkg_resources.pys__str__1 s <cCs$t|tƒo|i|ijSdS(N(s isinstancesothers RequirementsselfshashCmp(sselfsother((s+build/bdist.linux-i686/egg/pkg_resources.pys__eq__7 scCs#t|tƒo6|i|ijotSn|io |i}qfn!t|tƒot |ƒ}nt }x•|iD]Š\}}}}|t||ƒ}|djotSqv|djotSqv|djo t}qv|djp |t jo t}qvqvW|t jo t}n|SdS(NsFsTs+s-(s isinstancesitems DistributionskeysselfsFalsesindexsparsed_versions basestrings parse_versionsNoneslastsparsedstranssopsverscmpsactionsTrue(sselfsitemstransslastsactionsparsedsversop((s+build/bdist.linux-i686/egg/pkg_resources.pys __contains__: s,      cCs |iSdS(N(sselfs_Requirement__hash(sself((s+build/bdist.linux-i686/egg/pkg_resources.pys__hash__K scCsdt|ƒSdS(NsRequirement.parse(%r)(sstrsself(sself((s+build/bdist.linux-i686/egg/pkg_resources.pys__repr__N scCs^tt|ƒƒ}|o2t|ƒdjo |dSntd|ƒ‚ntd|ƒ‚dS(NiisExpected only one requirementsNo requirements found(slistsparse_requirementssssreqsslens ValueError(sssreqs((s+build/bdist.linux-i686/egg/pkg_resources.pysparseQ s  ( s__name__s __module__s__init__s__str__s__eq__s __contains__s__hash__s__repr__sparses staticmethod(((s+build/bdist.linux-i686/egg/pkg_resources.pys Requirement" s       ssF+Fs>=sT+Fs==sT..s!=sF++cCsDt|tƒ o(d|tfd„ƒY}|idSn|iSdS(s&Get an mro for a type or classic classsclscBstZRS(N(s__name__s __module__(((s+build/bdist.linux-i686/egg/pkg_resources.pysclsi siN(s isinstancesclsstypesobjects__mro__(scls((s+build/bdist.linux-i686/egg/pkg_resources.pys_get_mrof s cCsFx?tt|dt|ƒƒƒD]}||jo ||SqqWdS(s2Return an adapter factory for `ob` from `registry`s __class__N(s_get_mrosgetattrsobstypestsregistry(sregistrysobst((s+build/bdist.linux-i686/egg/pkg_resources.pys _find_adapterm s  cCs;tii|ƒ}tii|ƒ oti|ƒndS(s1Ensure that the parent directory of `path` existsN(sosspathsdirnamesisdirsmakedirs(spathsdirname((s+build/bdist.linux-i686/egg/pkg_resources.pysensure_directoryt sccsªt}g}xt|ƒD]}|idƒo\|idƒo9|p|o||fVn|dd!iƒ}g}q˜t d|ƒ‚q|i |ƒ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``. s[s]iiÿÿÿÿsInvalid section headingN( sNonessectionscontents yield_linesssslines startswithsendswithsstrips ValueErrorsappend(ssssectionscontentsline((s+build/bdist.linux-i686/egg/pkg_resources.pyssplit_sectionsz s  cOsAdkl}ti}ztt_|||ŽSWd|t_XdS(N(smkstemp(stempfilesmkstempsossopensold_opensos_opensargsskw(sargsskwsold_opensmkstemp((s+build/bdist.linux-i686/egg/pkg_resources.pys_mkstemp“ s   cCsCx<ttƒD].}|idƒ ott|ƒ||à s(‘s__doc__ssyssoss zipimportstimesresimpsnewssetss ImmutableSetsutimesrenamesunlinksopensos_opensget_supported_platforms__all__s ExceptionsResolutionErrorsVersionConflictsDistributionNotFounds UnknownExtras_provider_factoriessversionsPY_MAJORsEGG_DISTs BINARY_DISTs SOURCE_DISTs CHECKOUT_DISTs DEVELOP_DISTsregister_loader_types get_providers _macosx_verss _macosx_archsget_build_platformscompilesmacosVersionStringsdarwinVersionStrings get_platformscompatible_platformss run_scriptsrun_mainsget_distributionsload_entry_pointsNones get_entry_mapsget_entry_infosIMetadataProvidersIResourceProvidersobjects WorkingSets EnvironmentsAvailableDistributionss RuntimeErrorsExtractionErrorsResourceManagersget_default_caches safe_names safe_versions safe_extras to_filenames NullProviders EggProvidersDefaultProviderstypes EmptyProvidersempty_providers ZipProviders zipimporters FileMetadatas PathMetadatas EggMetadatas ImpWrappers ImpLoaders get_importerspkgutils ImpImporters ImportErrors_distribution_finderssregister_findersFalsesfind_distributionss find_in_zipsStringIOs find_nothings find_on_paths_namespace_handlerss_namespace_packagessregister_namespace_handlers _handle_nssdeclare_namespacesfixup_namespace_packagessfile_ns_handlersnull_ns_handlersnormalize_paths_normalize_cacheds_set_parent_nss yield_linessmatchsLINE_ENDsCONTINUEsDISTROsVERSIONsCOMMAsOBRACKETsCBRACKETsMODULEsVERBOSEs IGNORECASEsEGG_NAMEs component_resgetsreplaces_parse_version_partss parse_versions EntryPoints Distributions issue_warningsparse_requirementss _sort_distss Requirements state_machines_get_mros _find_adaptersensure_directoryssplit_sectionss_mkstemps_managers _initializesglobalss working_sets__main__s __requires__srequiresresolvesdistsaddspathsentrysentriess add_entrysiter_entry_pointss subscribesadd_activation_listenersmap(usempty_providersdistsExtractionErrors safe_extras BINARY_DISTs _sort_distss ImpWrappersadd_activation_listeners SOURCE_DISTs ImmutableSets zipimports get_providersMODULEs CHECKOUT_DISTsget_build_platformsutimes NullProvidersDefaultProvidersResourceManagers FileMetadatasget_entry_infos ImpImporters_normalize_cachedsload_entry_points find_on_pathsOBRACKETs_distribution_finderss EmptyProviders__all__sdarwinVersionStringsresmacosVersionStrings EggProvidersnewsfixup_namespace_packagessDISTROs_namespace_packagess run_scriptssplit_sectionsscompatible_platformssregister_finders_set_parent_nss Distributions _handle_nssAvailableDistributionss _macosx_archsrun_mains __requires__sCBRACKETsensure_directorys find_nothingsCONTINUEsoss PathMetadatas safe_namesreplaces EnvironmentsIResourceProvidersregister_loader_typesimpsfind_distributionss WorkingSetsfile_ns_handlersdeclare_namespaces issue_warnings to_filenamesResolutionErrors get_platformsparse_requirementss state_machines yield_liness Requirements _find_adapters _initializesnormalize_paths_namespace_handlerss UnknownExtrasos_opensnull_ns_handlers_mkstempsDistributionNotFoundsrenames find_in_zips_provider_factoriess get_importers ImpLoaders EggMetadatas working_setsregister_namespace_handlersEGG_DISTsCOMMAsget_supported_platforms get_entry_mapsLINE_ENDs ZipProvidersget_distributionsrequiressyss_get_mros parse_versionsiter_entry_pointssunlinks DEVELOP_DISTsEGG_NAMEsget_default_caches safe_versions _macosx_verss_managersVersionConflicts_parse_version_partss component_resIMetadataProvidersVERSIONs EntryPointstimesentrysPY_MAJOR((s+build/bdist.linux-i686/egg/pkg_resources.pys?s"?   Ï)    3     ))ÿ ¤ )  \  ‹)      #            - ){ÿ& # = 9<               PK¢ˆ45p‡}“E“Epkg_resources.py"""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. """ import sys, os, zipimport, time, re, imp, new from sets import ImmutableSet from os import utime, rename, unlink # capture these to bypass sandboxing from os import open as os_open def get_supported_platform(): """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. """ plat = get_build_platform(); m = macosVersionString.match(plat) if m is not None and sys.platform == "darwin": try: plat = 'macosx-%s-%s' % ('.'.join(_macosx_vers()[:2]), m.group(3)) except ValueError: pass # not Mac OS X return plat __all__ = [ # Basic resource access and distribution/entry point discovery 'require', 'run_script', 'get_provider', 'get_distribution', 'load_entry_point', 'get_entry_map', 'get_entry_info', 'iter_entry_points', 'resource_string', 'resource_stream', 'resource_filename', 'resource_listdir', 'resource_exists', 'resource_isdir', # Environmental control 'declare_namespace', 'working_set', 'add_activation_listener', 'find_distributions', 'set_extraction_path', 'cleanup_resources', 'get_default_cache', # Primary implementation classes 'Environment', 'WorkingSet', 'ResourceManager', 'Distribution', 'Requirement', 'EntryPoint', # Exceptions 'ResolutionError','VersionConflict','DistributionNotFound','UnknownExtra', 'ExtractionError', # Parsing functions and string utilities 'parse_requirements', 'parse_version', 'safe_name', 'safe_version', 'get_platform', 'compatible_platforms', 'yield_lines', 'split_sections', 'safe_extra', 'to_filename', # filesystem utilities 'ensure_directory', 'normalize_path', # Distribution "precedence" constants 'EGG_DIST', 'BINARY_DIST', 'SOURCE_DIST', 'CHECKOUT_DIST', 'DEVELOP_DIST', # "Provider" interfaces, implementations, and registration/lookup APIs 'IMetadataProvider', 'IResourceProvider', 'FileMetadata', 'PathMetadata', 'EggMetadata', 'EmptyProvider', 'empty_provider', 'NullProvider', 'EggProvider', 'DefaultProvider', 'ZipProvider', 'register_finder', 'register_namespace_handler', 'register_loader_type', 'fixup_namespace_packages', 'get_importer', # Deprecated/backward compatibility only 'run_main', 'AvailableDistributions', ] class ResolutionError(Exception): """Abstract base for dependency resolution errors""" def __repr__(self): return self.__class__.__name__+repr(self.args) class VersionConflict(ResolutionError): """An already-installed version conflicts with the requested version""" class DistributionNotFound(ResolutionError): """A requested distribution was not found""" class UnknownExtra(ResolutionError): """Distribution doesn't have an "extra feature" of the given name""" _provider_factories = {} PY_MAJOR = sys.version[:3] EGG_DIST = 3 BINARY_DIST = 2 SOURCE_DIST = 1 CHECKOUT_DIST = 0 DEVELOP_DIST = -1 def register_loader_type(loader_type, provider_factory): """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. """ _provider_factories[loader_type] = provider_factory def get_provider(moduleOrReq): """Return an IResourceProvider for the named module or requirement""" if isinstance(moduleOrReq,Requirement): return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0] try: module = sys.modules[moduleOrReq] except KeyError: __import__(moduleOrReq) module = sys.modules[moduleOrReq] loader = getattr(module, '__loader__', None) return _find_adapter(_provider_factories, loader)(module) def _macosx_vers(_cache=[]): if not _cache: info = os.popen('/usr/bin/sw_vers').read().splitlines() for line in info: key, value = line.split(None, 1) if key == 'ProductVersion:': _cache.append(value.strip().split(".")) break else: raise ValueError, "What?!" return _cache[0] def _macosx_arch(machine): return {'PowerPC':'ppc', 'Power_Macintosh':'ppc'}.get(machine,machine) def get_build_platform(): """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. """ from distutils.util import get_platform plat = get_platform() if sys.platform == "darwin" and not plat.startswith('macosx-'): try: version = _macosx_vers() machine = os.uname()[4].replace(" ", "_") return "macosx-%d.%d-%s" % (int(version[0]), int(version[1]), _macosx_arch(machine)) except ValueError: # if someone is running a non-Mac darwin system, this will fall # through to the default implementation pass return plat macosVersionString = re.compile(r"macosx-(\d+)\.(\d+)-(.*)") darwinVersionString = re.compile(r"darwin-(\d+)\.(\d+)\.(\d+)-(.*)") get_platform = get_build_platform # XXX backward compat def compatible_platforms(provided,required): """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. """ if provided is None or required is None or provided==required: return True # easy case # Mac OS X special cases reqMac = macosVersionString.match(required) if reqMac: provMac = macosVersionString.match(provided) # is this a Mac package? if not provMac: # this is backwards compatibility for packages built before # setuptools 0.6. All packages built after this point will # use the new macosx designation. provDarwin = darwinVersionString.match(provided) if provDarwin: dversion = int(provDarwin.group(1)) macosversion = "%s.%s" % (reqMac.group(1), reqMac.group(2)) if dversion == 7 and macosversion >= "10.3" or \ dversion == 8 and macosversion >= "10.4": #import warnings #warnings.warn("Mac eggs should be rebuilt to " # "use the macosx designation instead of darwin.", # category=DeprecationWarning) return True return False # egg isn't macosx or legacy darwin # are they the same major version and machine type? if provMac.group(1) != reqMac.group(1) or \ provMac.group(3) != reqMac.group(3): return False # is the required OS major update >= the provided one? if int(provMac.group(2)) > int(reqMac.group(2)): return False return True # XXX Linux and other platforms' special cases should go here return False def run_script(dist_spec, script_name): """Locate distribution `dist_spec` and run its `script_name` script""" ns = sys._getframe(1).f_globals name = ns['__name__'] ns.clear() ns['__name__'] = name require(dist_spec)[0].run_script(script_name, ns) run_main = run_script # backward compatibility def get_distribution(dist): """Return a current distribution object for a Requirement or string""" if isinstance(dist,basestring): dist = Requirement.parse(dist) if isinstance(dist,Requirement): dist = get_provider(dist) if not isinstance(dist,Distribution): raise TypeError("Expected string, Requirement, or Distribution", dist) return dist def load_entry_point(dist, group, name): """Return `name` entry point of `group` for `dist` or raise ImportError""" return get_distribution(dist).load_entry_point(group, name) def get_entry_map(dist, group=None): """Return the entry point map for `group`, or the full entry map""" return get_distribution(dist).get_entry_map(group) def get_entry_info(dist, group, name): """Return the EntryPoint object for `group`+`name`, or ``None``""" return get_distribution(dist).get_entry_info(group, name) class IMetadataProvider: def has_metadata(name): """Does the package's distribution contain the named metadata?""" def get_metadata(name): """The named metadata resource as a string""" def get_metadata_lines(name): """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.""" def metadata_isdir(name): """Is the named metadata a directory? (like ``os.path.isdir()``)""" def metadata_listdir(name): """List of metadata names in the directory (like ``os.listdir()``)""" def run_script(script_name, namespace): """Execute the named script in the supplied namespace dictionary""" class IResourceProvider(IMetadataProvider): """An object that provides access to package resources""" def get_resource_filename(manager, resource_name): """Return a true filesystem path for `resource_name` `manager` must be an ``IResourceManager``""" def get_resource_stream(manager, resource_name): """Return a readable file-like object for `resource_name` `manager` must be an ``IResourceManager``""" def get_resource_string(manager, resource_name): """Return a string containing the contents of `resource_name` `manager` must be an ``IResourceManager``""" def has_resource(resource_name): """Does the package contain the named resource?""" def resource_isdir(resource_name): """Is the named resource a directory? (like ``os.path.isdir()``)""" def resource_listdir(resource_name): """List of resource names in the directory (like ``os.listdir()``)""" class WorkingSet(object): """A collection of active distributions on sys.path (or a similar list)""" def __init__(self, entries=None): """Create working set from list of path entries (default=sys.path)""" self.entries = [] self.entry_keys = {} self.by_key = {} self.callbacks = [] if entries is None: entries = sys.path for entry in entries: self.add_entry(entry) def add_entry(self, entry): """Add a path item to ``.entries``, finding any distributions on it ``find_distributions(entry,False)`` 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``.) """ self.entry_keys.setdefault(entry, []) self.entries.append(entry) for dist in find_distributions(entry, True): self.add(dist, entry, False) def __contains__(self,dist): """True if `dist` is the active distribution for its project""" return self.by_key.get(dist.key) == dist def find(self, req): """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. """ dist = self.by_key.get(req.key) if dist is not None and dist not in req: raise VersionConflict(dist,req) # XXX add more info else: return dist def iter_entry_points(self, group, name=None): """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). """ for dist in self: entries = dist.get_entry_map(group) if name is None: for ep in entries.values(): yield ep elif name in entries: yield entries[name] def run_script(self, requires, script_name): """Locate distribution for `requires` and run `script_name` script""" ns = sys._getframe(1).f_globals name = ns['__name__'] ns.clear() ns['__name__'] = name self.require(requires)[0].run_script(script_name, ns) def __iter__(self): """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. """ seen = {} for item in self.entries: for key in self.entry_keys[item]: if key not in seen: seen[key]=1 yield self.by_key[key] def add(self, dist, entry=None, insert=True): """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. """ if insert: dist.insert_on(self.entries, entry) if entry is None: entry = dist.location keys = self.entry_keys.setdefault(entry,[]) keys2 = self.entry_keys.setdefault(dist.location,[]) if dist.key in self.by_key: return # ignore hidden distros self.by_key[dist.key] = dist if dist.key not in keys: keys.append(dist.key) if dist.key not in keys2: keys2.append(dist.key) self._added_new(dist) def resolve(self, requirements, env=None, installer=None): """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``. """ requirements = list(requirements)[::-1] # set up the stack processed = {} # set of processed requirements best = {} # key -> dist to_activate = [] while requirements: req = requirements.pop(0) # process dependencies breadth-first if req in processed: # Ignore cyclic or redundant dependencies continue dist = best.get(req.key) if dist is None: # Find the best distribution and add it to the map dist = self.by_key.get(req.key) if dist is None: if env is None: env = Environment(self.entries) dist = best[req.key] = env.best_match(req, self, installer) if dist is None: raise DistributionNotFound(req) # XXX put more info here to_activate.append(dist) if dist not in req: # Oops, the "best" so far conflicts with a dependency raise VersionConflict(dist,req) # XXX put more info here requirements.extend(dist.requires(req.extras)[::-1]) processed[req] = True return to_activate # return list of distros to activate def find_plugins(self, plugin_env, full_env=None, installer=None, fallback=True ): """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 "Couldn't 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