#!/bin/sh if [ `basename $0` = "setuptools-0.6c7-py2.3.egg" ] then exec python2.3 -c "import sys, os; sys.path.insert(0, os.path.abspath('$0')); from setuptools.command.easy_install import bootstrap; sys.exit(bootstrap())" "$@" else echo $0 is not the correct name for this egg file. echo Please rename it back to setuptools-0.6c7-py2.3.egg and try again. exec false fi PKC80site.pyc; Ec@s(dZedjoe[ndS(cCsdk}dk}dk}dk}|iid}|tjp|idjo| o g}n|i |i }t |dh}|i t|} |i it} x| D]}|| jp| oqn|i|} | tj o2| id}|tj o|idPqqy"|id|g\}}}Wntj o qnX|tjoqnz|id|||Wd|iXPqWtdtgi}|i D] }|t|ddfq~}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.darwin-8.0.1-x86/egg/site.pys__bootsd$%     "   @  ssiteN(s__boots__name__(s__boot((s(build/bdist.darwin-8.0.1-x86/egg/site.pys?s G PKC8.pkg_resources.pyo; FcC@sdZdkZdkZdkZdkZdkZdkZdkZyeWn e j odk l ZnXdkl Z l Z lZdklZdZdddd 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!efdIYZd"efdJYZd#efdKYZd$efdLYZhZeidM ZdMZdNZdOZdPZdQZdRZ dSZ!gdTZ"dUZ#dVZ$ei%dWZ&ei%dXZ'e$Z(dYZ)dZZ*e*Z+d[Z,d\Z-e.d]Z/d^Z0d7fd_YZ1d8e1fd`YZ2de3fdaYZ4de3fdbYZ5e5Z6d%e7fdcYZ8dfddYZ9deZ:dfZ;dgZ<dhZ=diZ>d>fdjYZ?e e3e?d?e?fdkYZ@d@e@fdlYZAe eBe.eAd<e?fdmYZCeCZDdAe@fdnYZEe eiFeEd9eCfdoYZGd:eAfdpYZHd;eEfdqYZIdrfdsYZJdtfduYZKdvZLydwkMlLZLlNZNWneOj onXeNZJ[K[NhZPdxZQeRdyZSeRdzZTeQeiFeTd{aUeRd|ZVeQe3eVeRd}ZWeQeJeWhZXhZYd~ZZdZ[dZ\e.dZ]dZ^eZeJe^eZeiFe^dZ_eZe3e_dZ`hdZadZbdZcei%didZeei%didZfei%didZgei%didZhei%didZiei%didZjei%didZkei%didZlei%deimeinBidZoei%deimZphdd<dd<dd<dd<ddDistribution doesn't have an "extra feature" of the given name(s__name__s __module__s__doc__(((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys UnknownExtras iiiiicCs|t|+cCsNtidi}|d}|i||dtZdZdZdZdZdZdZRS(NcCsdS(s;Does the package's distribution contain the named metadata?N((sname((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys has_metadata"scCsdS(s'The named metadata resource as a stringN((sname((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys get_metadata%scCsdS(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((sname((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysget_metadata_lines(scCsdS(s>Is the named metadata a directory? (like ``os.path.isdir()``)N((sname((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysmetadata_isdir.scCsdS(s?List of metadata names in the directory (like ``os.listdir()``)N((sname((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysmetadata_listdir1scCsdS(s=Execute the named script in the supplied namespace dictionaryN((s script_names namespace((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys run_script4s(s__name__s __module__s has_metadatas get_metadatasget_metadata_linessmetadata_isdirsmetadata_listdirs run_script(((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysIMetadataProvider s      cBsDtZdZdZdZdZdZdZdZRS(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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysget_resource_filenameLscCsdS(siReturn a readable file-like object for `resource_name` `manager` must be an ``IResourceManager``N((smanagers resource_name((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysget_resource_streamQscCsdS(smReturn a string containing the contents of `resource_name` `manager` must be an ``IResourceManager``N((smanagers resource_name((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysget_resource_stringVscCsdS(s,Does the package contain the named resource?N((s resource_name((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys has_resource[scCsdS(s>Is the named resource a directory? (like ``os.path.isdir()``)N((s resource_name((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysresource_isdir^scCsdS(s?List of resource names in the directory (like ``os.listdir()``)N((s resource_name((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysresource_listdiras( s__name__s __module__s__doc__sget_resource_filenamesget_resource_streamsget_resource_strings has_resourcesresource_isdirsresource_listdir(((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysIResourceProviderIs      cBstZdZedZdZdZdZedZdZ dZ ee dZ 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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__init__us      cCsT|ii|g|ii|x*t|tD]}|i ||t q3WdS(sAdd 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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys add_entrys cCs|ii|i|jSdS(s9True if `dist` is the active distribution for its projectN(sselfsby_keysgetsdistskey(sselfsdist((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys __contains__scCsJ|ii|i}|tj o ||jot||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(sselfsby_keysgetsreqskeysdistsNonesVersionConflict(sselfsreqsdist((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysfinds ccsixb|D]Z}|i|}|tjox5|iD] }|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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysiter_entry_pointss    cCsQtidi}|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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys run_scripts    ccs\h}xO|iD]D}x;|i|D],}||jod||<|i|Vq$q$WqWdS(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(sseensselfsentriessitems entry_keysskeysby_key(sselfsseenskeysitem((s1build/bdist.darwin-8.0.1-x86/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(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(sinsertsdists insert_onsselfsentriessentrysNoneslocations entry_keyss setdefaultskeysskeys2skeysby_keysappends _added_new(sselfsdistsentrysinsertskeysskeys2((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysadds   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|qn|i|n||jot||n|i|i|idddt||scCsdS(Ns((sselfspath((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysscCsgS(N((sselfspath((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysscCsdS(N((sself((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__init__s( s__name__s __module__s__doc__s_isdirs_hass_gets_listdirsNones module_paths__init__(((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys EmptyProviders    cBstZdZeZdZdZdZdZdZ dZ dZ dZ 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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__init__scCsE|i|io|t|iSntd||ifdS(Ns%s is not a subpath of %s(sfspaths startswithsselfszip_preslensAssertionError(sselfsfspath((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys _zipinfo_namescCsi|i|}|i|itio%|t|idi tiSnt d||ifdS(Nis%s is not a subpath of %s( sselfszip_preszip_pathsfspaths startswithsegg_rootsosssepslenssplitsAssertionError(sselfszip_pathsfspath((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys_parts s %cCs|i otdn|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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysget_resource_filenames  !c Cs||ijoPx9|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%| |Wnti&j otii|ojti|}|i| jo |i|jo|Sqqtidjot'|t%| ||SqqnnXWn ti&j o|i(nX|SdS(Niiii iiiii i?iiis .$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((s1build/bdist.darwin-8.0.1-x86/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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys_get_eager_resourcesYs  cCsy |iSWntj oh}x|iD]w}|iti}x\|oTtii |d }||jo||i |dPqG|i g||PEP 302 Importer that wraps Python's "normal" import algorithmcCs ||_dS(N(spathsself(sselfspath((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__init__scCs|idd}||jo |itjotSn|itjo t}n |ig}yti||\}}}Wnt j o tSnXt |||SdS(Ns.i( sfullnamessplitssubnamesselfspathsNonesimps find_modulesfilesfilenamesetcs ImportErrors ImpLoader(sselfsfullnamespathsfilenamesetcssubnamesfile((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys find_modules   (s__name__s __module__s__doc__sNones__init__s find_module(((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys ImpWrappers  s ImpLoadercBs tZdZdZdZRS(s<PEP 302 Loader that wraps Python's "normal" import algorithmcCs||_||_||_dS(N(sfilesselfsfilenamesetc(sselfsfilesfilenamesetc((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__init__s  cCsLz%ti||i|i|i}Wd|io|iinX|SdS(N( simps load_modulesfullnamesselfsfilesfilenamesetcsmodsclose(sselfsfullnamesmod((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys load_module s % (s__name__s __module__s__doc__s__init__s load_module(((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys ImpLoaders  cCsyti|}WnTtj oHxCtiD]-}y||}Wntj oq,XPq,Wt}nXtii |||tjo*yt |}Wqtj oqXn|SdS(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( ssysspath_importer_caches path_itemsimportersKeyErrors path_hooksshooks ImportErrorsNones setdefaults ImpWrapper(s path_itemshooksimporter((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys get_importers&    (s get_importers ImpImportercCs|t|y ||SWn+tj ot|||<}|SnXdS(N(s_cachesfilenamesKeyErrorsnormalize_pathsresult(sfilenames_cachesresult((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys_normalize_cacheds  cCsW|id}|i}|o1di|}tti ||ti |ndS(Ns.( s packageNamessplitspartsspopsnamesjoinsparentssetattrssyssmodules(s packageNamesparentsnamesparts((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys_set_parent_nss  ccst|toGxp|iD]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((s1build/bdist.darwin-8.0.1-x86/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-srcsdevs@ccswxlti|D][}t||}| p |djoqn|d djo|idVqd|VqWdVdS(Ns.is 0123456789is*s*final(s component_ressplitssspartsreplaceszfill(ssspart((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys_parse_version_parts*s cCsg}xt|iD]}|idoi|djo.x+|o|ddjo|iq?Wnx+|o|ddjo|iqmWn|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*finalis*final-s00000000N( spartss_parse_version_partsssslowersparts startswithspopsappendstuple(ssspartsspart((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys parse_version6s cBstZdZffedZdZdZeeedZeedZ edZ e e Z edZ e e Z edZ 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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__init__bs  "cCsnd|i|if}|io|ddi|i7}n|io|ddi|i7}n|SdS(Ns%s = %ss:s.s [%s]s,(sselfsnames module_namesssattrssjoinsextras(sselfss((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__str__ks   cCsdt|SdS(NsEntryPoint.parse(%r)(sstrsself(sself((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__repr__sscCs|o|i||nt|ittdg}xP|iD]E}yt ||}WqFt j ot d||fqFXqFW|SdS(Ns__name__s%r has no %r attribute( srequiresselfsenvs installers __import__s module_namesglobalssentrysattrssattrsgetattrsAttributeErrors ImportError(sselfsrequiresenvs installersattrsentry((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysloadvs! cCsZ|io|i otd|nttiti|ii|i||dS(Ns&Can't require() without a distribution( sselfsextrassdists UnknownExtrasmaps working_setsaddsresolvesrequiressenvs installer(sselfsenvs installer((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysrequires cCs&yf}}|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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysparses&       cCst| otd|nh}x\t|D]N}|i||}|i |jotd||i n|||i scCst|i|SdS(N(scmpsselfshashcmpsother(sselfsother((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__cmp__scCst|iSdS(N(shashsselfshashcmp(sself((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__hash__scCs?y |iSWn-tj o!|ii|_}|SnXdS(N(sselfs_keysAttributeErrors project_nameslowerskey(sselfskey((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pyskeys  cCs?y |iSWn-tj o!t|i|_}|SnXdS(N(sselfs_parsed_versionsAttributeErrors parse_versionsversionspv(sselfspv((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysparsed_versions  cCsy |iSWntj ovxq|idD]L}|iido0t|idddi |_|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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysversions %cCsy |iSWntj ohtg<}|_xpddfD]b}xYt|i|D]B\}}|ot |}n|i |gi t |q[Wq?W|SnXdS(Ns requires.txts depends.txt(sselfs_Distribution__dep_mapsAttributeErrorsNonesdmsnamessplit_sectionss _get_metadatasextrasreqss safe_extras setdefaultsextendsparse_requirements(sselfsdmsnamesextrasreqs((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys_dep_map-s   'cCs|i}g}|i|itfxU|D]M}y|i|t |Wq/t j ot d||fq/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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysrequires9s ccs6|i|o"x|i|D] }|Vq WndS(N(sselfs has_metadatasnamesget_metadata_linessline(sselfsnamesline((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys _get_metadataGscCsb|tjo ti}n|i||tijo't|itt|i dndS(s>Ensure distribution is importable on `path` (default=sys.path)snamespace_packages.txtN( spathsNonessyssselfs insert_onsfixup_namespace_packagesslocationsmapsdeclare_namespaces _get_metadata(sselfspath((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysactivateLs   cCsVdt|it|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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysegg_nameUs / cCs-|iod||ifSn t|SdS(Ns%s (%s)(sselfslocationsstr(sself((s1build/bdist.darwin-8.0.1-x86/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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__str__fs   cCs1|ido t|nt|i|SdS(sADelegate all unrecognized public attributes to .metadata providers_N(sattrs startswithsAttributeErrorsgetattrsselfs _provider(sselfsattr((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys __getattr__ls cKs,|it|tii|||SdS(N( sclss from_locations_normalize_cachedsfilenamesosspathsbasenamesmetadataskw(sclssfilenamesmetadataskw((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys from_filenamesscCs!tid|i|ifSdS(s?Return a ``Requirement`` that matches this distribution exactlys%s==%sN(s Requirementsparsesselfs project_namesversion(sself((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysas_requirementzscCsJ|i||}|tjotd||ffn|iSdS(s=Return the `name` entry point of `group` or raise ImportErrorsEntry point %r not foundN(sselfsget_entry_infosgroupsnamesepsNones ImportErrorsload(sselfsgroupsnamesep((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysload_entry_point~s  cCsny |i}Wn5tj o)ti|id|}|_nX|tj o|i |hSn|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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys get_entry_maps ' cCs|i|i|SdS(s<Return the EntryPoint object for `group`+`name`, or ``None``N(sselfs get_entry_mapsgroupsgetsname(sselfsgroupsname((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysget_entry_infosc CsO|p|i}| odSn|tijo|int|}tii |} t t|}t }xt|D]`\}}||joPq~|| jo |itjo%|i|||i||Pq~q~W|i|dSxQnoIy|i||d}Wntj oPqX||=||=|}qWdSdS(s@Insert self.location in path before its nearest parent directoryNi(slocsselfslocationspathssysscheck_version_conflicts_normalize_cachedsnlocsossdirnamesbdirsmapsnpathsNonesbps enumeratespsitems precedencesEGG_DISTsinsertsappendsindexsnps ValueError( sselfspathslocsnlocsnpathspsbpsitemsnpsbdir((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys insert_ons:      cCs|idjodSnti|id}t|i}x|idD]}|t i jp||jp |t joqOnt t i |dt}|ot|i|oqOntd|||ifqOWdS(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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pyscheck_version_conflicts*cCsAy |iWn+tj otdt|tSnXtSdS(NsUnbuilt egg for (sselfsversions ValueErrors issue_warningsreprsFalsesTrue(sself((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys has_versions   cKscx<ddddddfD]"}|i|t||tqW|id|i|i|SdS( s@Copy this distribution, substituting in any changed keyword argss project_namesversions py_versionsplatformslocations precedencesmetadataN(sattrskws setdefaultsgetattrsselfsNones _providers __class__(sselfskwsattr((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysclones  cCs7gi}|iD]}|o||qq~SdS(N(sappends_[1]sselfs_dep_mapsdep(sselfs_[1]sdep((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysextrass("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(((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys DistributionsD                     )    cOs|d}t}y/x(ti|i|jo|d7}qWWntj onXdkl}|d|d||dS(Ni(swarns stacklevel( slevelsglobalssgssyss _getframes f_globalss ValueErrorswarningsswarnsargsskw(sargsskwswarnsgslevel((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys issue_warnings  c #s;tt|d}xD]}t|}| otd|n|i d}|i } g} t|| }|o7|i } |tt|| dfd\}} } n|tt|| ddfd\}} }gi}|D]"\} }|| t|fq~}t||| Vq%WdS(sYield ``Requirement`` objects for each specification in `strs` `strs` must be an instance of ``basestring``, or a (possibly-nested) iterable thereof. csTg}x||| ot||o<yi}d}Wqftj otdqfXn|||}| 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(s1build/bdist.darwin-8.0.1-x86/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((sliness1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysparse_requirements" s$    +*9cCsxgi}|D]}||i|fq~}|igi}|D]\}}||qH~|dddDO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()!N(s project_names safe_namesselfs unsafe_nameslowerskeysappends_[1]sspecssopsvs parse_versions state_machinesindexssortsparsedstranssverstuplesmaps safe_extrasextrass frozensetshashCmpshashs_Requirement__hash( sselfs project_namesspecssextrassindexsversparseds_[1]svstranssop((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__init__u 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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__str__ s <cCs$t|to|i|ijSdS(N(s isinstancesothers RequirementsselfshashCmp(sselfsother((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__eq__ scCs#t|to6|i|ijotSn|io |i}qfn!t|tot |}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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys __contains__ s,      cCs |iSdS(N(sselfs_Requirement__hash(sself((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__hash__ scCsdt|SdS(NsRequirement.parse(%r)(sstrsself(sself((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__repr__ scCs^tt|}|o2t|djo |dSntd|ntd|dS(NiisExpected only one requirementsNo requirements found(slistsparse_requirementssssreqsslens ValueError(sssreqs((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysparse s  ( s__name__s __module__s__init__s__str__s__eq__s __contains__s__hash__s__repr__sparses staticmethod(((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys Requirementt s       ssF+Fs>=sT+Fs==sT..s!=sF++cCsDt|t o(d|tfdY}|idSn|iSdS(s&Get an mro for a type or classic classsclscBstZRS(N(s__name__s __module__(((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pyscls siN(s isinstancesclsstypesobjects__mro__(scls((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys_get_mro s cCsFx?tt|dt|D]}||jo ||SqqWdS(s2Return an adapter factory for `ob` from `registry`s __class__N(s_get_mrosgetattrsobstypestsregistry(sregistrysobst((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys _find_adapter s  cCs;tii|}tii| oti|ndS(s1Ensure that the parent directory of `path` existsN(sosspathsdirnamesisdirsmakedirs(spathsdirname((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysensure_directory sccst}g}xt|D]}|ido\|ido9|p|o||fVn|dd!i}g}qt 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]iisInvalid section headingN( sNonessectionscontents yield_linesssslines startswithsendswithsstrips ValueErrorsappend(ssssectionscontentsline((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pyssplit_sections s  cOsAdkl}ti}ztt_|||SWd|t_XdS(N(smkstemp(stempfilesmkstempsossopensold_opensos_opensargsskw(sargsskwsold_opensmkstemp((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys_mkstemp s   cCsCx<ttD].}|id ott||| s(s__doc__ssyssoss zipimportstimesresimpsnews frozensets NameErrorssetss 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 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 frozensets Distributions _handle_nssAvailableDistributionss _macosx_archsrun_mains __requires__sCBRACKETsensure_directorys find_nothingsCONTINUEsoss PathMetadatas safe_namesreplaces EnvironmentsIResourceProvidersregister_loader_typesimpsfind_distributionss WorkingSetsdeclare_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_factoriessfile_ns_handlers 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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys?s(?  ))    3     ))  )  \  )      #            6 ){& # = 9<               PKC8.pkg_resources.pyc; FcC@sdZdkZdkZdkZdkZdkZdkZdkZyeWn e j odk l ZnXdkl Z l Z lZdklZdZdddd 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!efdIYZd"efdJYZd#efdKYZd$efdLYZhZeidM ZdMZdNZdOZdPZdQZdRZ dSZ!gdTZ"dUZ#dVZ$ei%dWZ&ei%dXZ'e$Z(dYZ)dZZ*e*Z+d[Z,d\Z-e.d]Z/d^Z0d7fd_YZ1d8e1fd`YZ2de3fdaYZ4de3fdbYZ5e5Z6d%e7fdcYZ8dfddYZ9deZ:dfZ;dgZ<dhZ=diZ>d>fdjYZ?e e3e?d?e?fdkYZ@d@e@fdlYZAe eBe.eAd<e?fdmYZCeCZDdAe@fdnYZEe eiFeEd9eCfdoYZGd:eAfdpYZHd;eEfdqYZIdrfdsYZJdtfduYZKdvZLydwkMlLZLlNZNWneOj onXeNZJ[K[NhZPdxZQeRdyZSeRdzZTeQeiFeTd{aUeRd|ZVeQe3eVeRd}ZWeQeJeWhZXhZYd~ZZdZ[dZ\e.dZ]dZ^eZeJe^eZeiFe^dZ_eZe3e_dZ`hdZadZbdZcei%didZeei%didZfei%didZgei%didZhei%didZiei%didZjei%didZkei%didZlei%deimeinBidZoei%deimZphdd<dd<dd<dd<ddDistribution doesn't have an "extra feature" of the given name(s__name__s __module__s__doc__(((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys UnknownExtras iiiiicCs|t|+cCsNtidi}|d}|i||dtZdZdZdZdZdZdZRS(NcCsdS(s;Does the package's distribution contain the named metadata?N((sname((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys has_metadata"scCsdS(s'The named metadata resource as a stringN((sname((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys get_metadata%scCsdS(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((sname((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysget_metadata_lines(scCsdS(s>Is the named metadata a directory? (like ``os.path.isdir()``)N((sname((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysmetadata_isdir.scCsdS(s?List of metadata names in the directory (like ``os.listdir()``)N((sname((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysmetadata_listdir1scCsdS(s=Execute the named script in the supplied namespace dictionaryN((s script_names namespace((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys run_script4s(s__name__s __module__s has_metadatas get_metadatasget_metadata_linessmetadata_isdirsmetadata_listdirs run_script(((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysIMetadataProvider s      cBsDtZdZdZdZdZdZdZdZRS(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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysget_resource_filenameLscCsdS(siReturn a readable file-like object for `resource_name` `manager` must be an ``IResourceManager``N((smanagers resource_name((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysget_resource_streamQscCsdS(smReturn a string containing the contents of `resource_name` `manager` must be an ``IResourceManager``N((smanagers resource_name((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysget_resource_stringVscCsdS(s,Does the package contain the named resource?N((s resource_name((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys has_resource[scCsdS(s>Is the named resource a directory? (like ``os.path.isdir()``)N((s resource_name((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysresource_isdir^scCsdS(s?List of resource names in the directory (like ``os.listdir()``)N((s resource_name((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysresource_listdiras( s__name__s __module__s__doc__sget_resource_filenamesget_resource_streamsget_resource_strings has_resourcesresource_isdirsresource_listdir(((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysIResourceProviderIs      cBstZdZedZdZdZdZedZdZ dZ ee dZ 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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__init__us      cCsT|ii|g|ii|x*t|tD]}|i ||t q3WdS(sAdd 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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys add_entrys cCs|ii|i|jSdS(s9True if `dist` is the active distribution for its projectN(sselfsby_keysgetsdistskey(sselfsdist((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys __contains__scCsJ|ii|i}|tj o ||jot||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(sselfsby_keysgetsreqskeysdistsNonesVersionConflict(sselfsreqsdist((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysfinds ccsixb|D]Z}|i|}|tjox5|iD] }|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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysiter_entry_pointss    cCsQtidi}|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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys run_scripts    ccs\h}xO|iD]D}x;|i|D],}||jod||<|i|Vq$q$WqWdS(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(sseensselfsentriessitems entry_keysskeysby_key(sselfsseenskeysitem((s1build/bdist.darwin-8.0.1-x86/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(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(sinsertsdists insert_onsselfsentriessentrysNoneslocations entry_keyss setdefaultskeysskeys2skeysby_keysappends _added_new(sselfsdistsentrysinsertskeysskeys2((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysadds   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|qn|i|n||jot||n|i|i|idddt||scCsdS(Ns((sselfspath((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysscCsgS(N((sselfspath((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysscCsdS(N((sself((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__init__s( s__name__s __module__s__doc__s_isdirs_hass_gets_listdirsNones module_paths__init__(((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys EmptyProviders    cBstZdZeZdZdZdZdZdZ dZ dZ dZ 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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__init__scCsE|i|io|t|iSntd||ifdS(Ns%s is not a subpath of %s(sfspaths startswithsselfszip_preslensAssertionError(sselfsfspath((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys _zipinfo_namescCsi|i|}|i|itio%|t|idi tiSnt d||ifdS(Nis%s is not a subpath of %s( sselfszip_preszip_pathsfspaths startswithsegg_rootsosssepslenssplitsAssertionError(sselfszip_pathsfspath((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys_parts s %cCs|i otdn|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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysget_resource_filenames  !c Cs||ijoPx9|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%| |Wnti&j otii|ojti|}|i| jo |i|jo|Sqqtidjot'|t%| ||SqqnnXWn ti&j o|i(nX|SdS(Niiii iiiii i?iiis .$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((s1build/bdist.darwin-8.0.1-x86/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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys_get_eager_resourcesYs  cCsy |iSWntj oh}x|iD]w}|iti}x\|oTtii |d }||jo||i |dPqG|i g||PEP 302 Importer that wraps Python's "normal" import algorithmcCs ||_dS(N(spathsself(sselfspath((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__init__scCs|idd}||jo |itjotSn|itjo t}n |ig}yti||\}}}Wnt j o tSnXt |||SdS(Ns.i( sfullnamessplitssubnamesselfspathsNonesimps find_modulesfilesfilenamesetcs ImportErrors ImpLoader(sselfsfullnamespathsfilenamesetcssubnamesfile((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys find_modules   (s__name__s __module__s__doc__sNones__init__s find_module(((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys ImpWrappers  s ImpLoadercBs tZdZdZdZRS(s<PEP 302 Loader that wraps Python's "normal" import algorithmcCs||_||_||_dS(N(sfilesselfsfilenamesetc(sselfsfilesfilenamesetc((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__init__s  cCsLz%ti||i|i|i}Wd|io|iinX|SdS(N( simps load_modulesfullnamesselfsfilesfilenamesetcsmodsclose(sselfsfullnamesmod((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys load_module s % (s__name__s __module__s__doc__s__init__s load_module(((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys ImpLoaders  cCsyti|}WnTtj oHxCtiD]-}y||}Wntj oq,XPq,Wt}nXtii |||tjo*yt |}Wqtj oqXn|SdS(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( ssysspath_importer_caches path_itemsimportersKeyErrors path_hooksshooks ImportErrorsNones setdefaults ImpWrapper(s path_itemshooksimporter((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys get_importers&    (s get_importers ImpImportercCs|t|y ||SWn+tj ot|||<}|SnXdS(N(s_cachesfilenamesKeyErrorsnormalize_pathsresult(sfilenames_cachesresult((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys_normalize_cacheds  cCsW|id}|i}|o1di|}tti ||ti |ndS(Ns.( s packageNamessplitspartsspopsnamesjoinsparentssetattrssyssmodules(s packageNamesparentsnamesparts((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys_set_parent_nss  ccst|toGxp|iD]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((s1build/bdist.darwin-8.0.1-x86/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-srcsdevs@ccswxlti|D][}t||}| p |djoqn|d djo|idVqd|VqWdVdS(Ns.is 0123456789is*s*final(s component_ressplitssspartsreplaceszfill(ssspart((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys_parse_version_parts*s cCsg}xt|iD]}|idoi|djo.x+|o|ddjo|iq?Wnx+|o|ddjo|iqmWn|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*finalis*final-s00000000N( spartss_parse_version_partsssslowersparts startswithspopsappendstuple(ssspartsspart((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys parse_version6s cBstZdZffedZdZdZeeedZeedZ edZ e e Z edZ e e Z edZ 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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__init__bs  "cCsnd|i|if}|io|ddi|i7}n|io|ddi|i7}n|SdS(Ns%s = %ss:s.s [%s]s,(sselfsnames module_namesssattrssjoinsextras(sselfss((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__str__ks   cCsdt|SdS(NsEntryPoint.parse(%r)(sstrsself(sself((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__repr__sscCs|o|i||nt|ittdg}xP|iD]E}yt ||}WqFt j ot d||fqFXqFW|SdS(Ns__name__s%r has no %r attribute( srequiresselfsenvs installers __import__s module_namesglobalssentrysattrssattrsgetattrsAttributeErrors ImportError(sselfsrequiresenvs installersattrsentry((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysloadvs! cCsZ|io|i otd|nttiti|ii|i||dS(Ns&Can't require() without a distribution( sselfsextrassdists UnknownExtrasmaps working_setsaddsresolvesrequiressenvs installer(sselfsenvs installer((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysrequires cCs&yf}}|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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysparses&       cCst| otd|nh}x\t|D]N}|i||}|i |jotd||i n|||i scCst|i|SdS(N(scmpsselfshashcmpsother(sselfsother((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__cmp__scCst|iSdS(N(shashsselfshashcmp(sself((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__hash__scCs?y |iSWn-tj o!|ii|_}|SnXdS(N(sselfs_keysAttributeErrors project_nameslowerskey(sselfskey((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pyskeys  cCs?y |iSWn-tj o!t|i|_}|SnXdS(N(sselfs_parsed_versionsAttributeErrors parse_versionsversionspv(sselfspv((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysparsed_versions  cCsy |iSWntj ovxq|idD]L}|iido0t|idddi |_|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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysversions %cCsy |iSWntj ohtg<}|_xpddfD]b}xYt|i|D]B\}}|ot |}n|i |gi t |q[Wq?W|SnXdS(Ns requires.txts depends.txt(sselfs_Distribution__dep_mapsAttributeErrorsNonesdmsnamessplit_sectionss _get_metadatasextrasreqss safe_extras setdefaultsextendsparse_requirements(sselfsdmsnamesextrasreqs((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys_dep_map-s   'cCs|i}g}|i|itfxU|D]M}y|i|t |Wq/t j ot d||fq/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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysrequires9s ccs6|i|o"x|i|D] }|Vq WndS(N(sselfs has_metadatasnamesget_metadata_linessline(sselfsnamesline((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys _get_metadataGscCsb|tjo ti}n|i||tijo't|itt|i dndS(s>Ensure distribution is importable on `path` (default=sys.path)snamespace_packages.txtN( spathsNonessyssselfs insert_onsfixup_namespace_packagesslocationsmapsdeclare_namespaces _get_metadata(sselfspath((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysactivateLs   cCsVdt|it|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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysegg_nameUs / cCs-|iod||ifSn t|SdS(Ns%s (%s)(sselfslocationsstr(sself((s1build/bdist.darwin-8.0.1-x86/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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__str__fs   cCs1|ido t|nt|i|SdS(sADelegate all unrecognized public attributes to .metadata providers_N(sattrs startswithsAttributeErrorsgetattrsselfs _provider(sselfsattr((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys __getattr__ls cKs,|it|tii|||SdS(N( sclss from_locations_normalize_cachedsfilenamesosspathsbasenamesmetadataskw(sclssfilenamesmetadataskw((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys from_filenamesscCs!tid|i|ifSdS(s?Return a ``Requirement`` that matches this distribution exactlys%s==%sN(s Requirementsparsesselfs project_namesversion(sself((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysas_requirementzscCsJ|i||}|tjotd||ffn|iSdS(s=Return the `name` entry point of `group` or raise ImportErrorsEntry point %r not foundN(sselfsget_entry_infosgroupsnamesepsNones ImportErrorsload(sselfsgroupsnamesep((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysload_entry_point~s  cCsny |i}Wn5tj o)ti|id|}|_nX|tj o|i |hSn|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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys get_entry_maps ' cCs|i|i|SdS(s<Return the EntryPoint object for `group`+`name`, or ``None``N(sselfs get_entry_mapsgroupsgetsname(sselfsgroupsname((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysget_entry_infosc CsO|p|i}| odSn|tijo|int|}tii |} t t|}t }xt|D]`\}}||joPq~|| jo |itjo%|i|||i||Pq~q~W|i|dSxQnoIy|i||d}Wntj oPqX||=||=|}qWdSdS(s@Insert self.location in path before its nearest parent directoryNi(slocsselfslocationspathssysscheck_version_conflicts_normalize_cachedsnlocsossdirnamesbdirsmapsnpathsNonesbps enumeratespsitems precedencesEGG_DISTsinsertsappendsindexsnps ValueError( sselfspathslocsnlocsnpathspsbpsitemsnpsbdir((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys insert_ons:      cCs|idjodSnti|id}t|i}x|idD]}|t i jp||jp |t joqOnt t i |dt}|ot|i|oqOntd|||ifqOWdS(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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pyscheck_version_conflicts*cCsAy |iWn+tj otdt|tSnXtSdS(NsUnbuilt egg for (sselfsversions ValueErrors issue_warningsreprsFalsesTrue(sself((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys has_versions   cKscx<ddddddfD]"}|i|t||tqW|id|i|i|SdS( s@Copy this distribution, substituting in any changed keyword argss project_namesversions py_versionsplatformslocations precedencesmetadataN(sattrskws setdefaultsgetattrsselfsNones _providers __class__(sselfskwsattr((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysclones  cCs7gi}|iD]}|o||qq~SdS(N(sappends_[1]sselfs_dep_mapsdep(sselfs_[1]sdep((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysextrass("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(((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys DistributionsD                     )    cOs|d}t}y/x(ti|i|jo|d7}qWWntj onXdkl}|d|d||dS(Ni(swarns stacklevel( slevelsglobalssgssyss _getframes f_globalss ValueErrorswarningsswarnsargsskw(sargsskwswarnsgslevel((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys issue_warnings  c #s;tt|d}xD]}t|}| otd|n|i d}|i } g} t|| }|o7|i } |tt|| dfd\}} } n|tt|| ddfd\}} }gi}|D]"\} }|| t|fq~}t||| Vq%WdS(sYield ``Requirement`` objects for each specification in `strs` `strs` must be an instance of ``basestring``, or a (possibly-nested) iterable thereof. csTg}x||| ot||o<yi}d}Wqftj otdqfXn|||}| 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(s1build/bdist.darwin-8.0.1-x86/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((sliness1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysparse_requirements" s$    +*9cCsxgi}|D]}||i|fq~}|igi}|D]\}}||qH~|dddDO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()!N(s project_names safe_namesselfs unsafe_nameslowerskeysappends_[1]sspecssopsvs parse_versions state_machinesindexssortsparsedstranssverstuplesmaps safe_extrasextrass frozensetshashCmpshashs_Requirement__hash( sselfs project_namesspecssextrassindexsversparseds_[1]svstranssop((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__init__u 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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__str__ s <cCs$t|to|i|ijSdS(N(s isinstancesothers RequirementsselfshashCmp(sselfsother((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__eq__ scCs#t|to6|i|ijotSn|io |i}qfn!t|tot |}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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys __contains__ s,      cCs |iSdS(N(sselfs_Requirement__hash(sself((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__hash__ scCsdt|SdS(NsRequirement.parse(%r)(sstrsself(sself((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys__repr__ scCs^tt|}|o2t|djo |dSntd|ntd|dS(NiisExpected only one requirementsNo requirements found(slistsparse_requirementssssreqsslens ValueError(sssreqs((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysparse s  ( s__name__s __module__s__init__s__str__s__eq__s __contains__s__hash__s__repr__sparses staticmethod(((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys Requirementt s       ssF+Fs>=sT+Fs==sT..s!=sF++cCsDt|t o(d|tfdY}|idSn|iSdS(s&Get an mro for a type or classic classsclscBstZRS(N(s__name__s __module__(((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pyscls siN(s isinstancesclsstypesobjects__mro__(scls((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys_get_mro s cCsFx?tt|dt|D]}||jo ||SqqWdS(s2Return an adapter factory for `ob` from `registry`s __class__N(s_get_mrosgetattrsobstypestsregistry(sregistrysobst((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys _find_adapter s  cCs;tii|}tii| oti|ndS(s1Ensure that the parent directory of `path` existsN(sosspathsdirnamesisdirsmakedirs(spathsdirname((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pysensure_directory sccst}g}xt|D]}|ido\|ido9|p|o||fVn|dd!i}g}qt 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]iisInvalid section headingN( sNonessectionscontents yield_linesssslines startswithsendswithsstrips ValueErrorsappend(ssssectionscontentsline((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pyssplit_sections s  cOsAdkl}ti}ztt_|||SWd|t_XdS(N(smkstemp(stempfilesmkstempsossopensold_opensos_opensargsskw(sargsskwsold_opensmkstemp((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys_mkstemp s   cCsCx<ttD].}|id ott||| s(s__doc__ssyssoss zipimportstimesresimpsnews frozensets NameErrorssetss 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 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 frozensets Distributions _handle_nssAvailableDistributionss _macosx_archsrun_mains __requires__sCBRACKETsensure_directorys find_nothingsCONTINUEsoss PathMetadatas safe_namesreplaces EnvironmentsIResourceProvidersregister_loader_typesimpsfind_distributionss WorkingSetsdeclare_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_factoriessfile_ns_handlers 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((s1build/bdist.darwin-8.0.1-x86/egg/pkg_resources.pys?s(?  ))    3     ))  )  \  )      #            6 ){& # = 9<               PKC8~=;;easy_install.pyo; Ec@s/dZedjodklZendS(sRun the EasyInstall commands__main__(smainN(s__doc__s__name__ssetuptools.command.easy_installsmain(smain((s0build/bdist.darwin-8.0.1-x86/egg/easy_install.pys?s  PK45\OE~~easy_install.py"""Run the EasyInstall command""" if __name__ == '__main__': from setuptools.command.easy_install import main main() PKC80site.pyo; Ec@s(dZedjoe[ndS(cCsdk}dk}dk}dk}|iid}|tjp|idjo| o g}n|i |i }t |dh}|i t|} |i it} x| D]}|| jp| oqn|i|} | tj o2| id}|tj o|idPqqy"|id|g\}}}Wntj o qnX|tjoqnz|id|||Wd|iXPqWtdtgi}|i D] }|t|ddfq~}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.darwin-8.0.1-x86/egg/site.pys__bootsd$%     "   @  ssiteN(s__boots__name__(s__boot((s(build/bdist.darwin-8.0.1-x86/egg/site.pys?s G PKd$7~aGaGpkg_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 try: frozenset except NameError: from sets import ImmutableSet as frozenset 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 versions of a plugin if the newest version cannot be resolved. This method returns a 2-tuple: (`distributions`, `error_info`), where `distributions` is a list of the distributions found in `plugin_env` that were loadable, along with any other distributions that are needed to resolve their dependencies. `error_info` is a dictionary mapping unloadable plugin distributions to an exception instance describing the error that occurred. Usually this will be a ``DistributionNotFound`` or ``VersionConflict`` instance. """ plugin_projects = list(plugin_env) plugin_projects.sort() # scan project names in alphabetic order error_info = {} distributions = {} if full_env is None: env = Environment(self.entries) env += plugin_env else: env = full_env + plugin_env shadow_set = self.__class__([]) map(shadow_set.add, self) # put all our entries in shadow_set for project_name in plugin_projects: for dist in plugin_env[project_name]: req = [dist.as_requirement()] try: resolvees = shadow_set.resolve(req, env, installer) except ResolutionError,v: error_info[dist] = v # save error info if fallback: continue # try the next older version of project else: break # give up on this project, keep going else: map(shadow_set.add, resolvees) distributions.update(dict.fromkeys(resolvees)) # success, no need to try any more versions of this project break distributions = list(distributions) distributions.sort() return distributions, error_info def require(self, *requirements): """Ensure that distributions matching `requirements` are activated `requirements` must be a string or a (possibly-nested) sequence thereof, specifying the distributions and versions required. The return value is a sequence of the distributions that needed to be activated to fulfill the requirements; all relevant distributions are included, even if they were already activated in this working set. """ needed = self.resolve(parse_requirements(requirements)) for dist in needed: self.add(dist) return needed def subscribe(self, callback): """Invoke `callback` for all distributions (including existing ones)""" if callback in self.callbacks: return self.callbacks.append(callback) for dist in self: callback(dist) def _added_new(self, dist): for callback in self.callbacks: callback(dist) class Environment(object): """Searchable snapshot of distributions on a search path""" def __init__(self, search_path=None, platform=get_supported_platform(), python=PY_MAJOR): """Snapshot distributions available on a search path Any distributions found on `search_path` are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. `platform` is an optional string specifying the name of the platform that platform-specific distributions must be compatible with. If unspecified, it defaults to the current platform. `python` is an optional string naming the desired version of Python (e.g. ``'2.4'``); it defaults to the current version. You may explicitly set `platform` (and/or `python`) to ``None`` if you wish to map *all* distributions, not just those compatible with the running platform or Python version. """ self._distmap = {} self._cache = {} self.platform = platform self.python = python self.scan(search_path) def can_add(self, dist): """Is distribution `dist` acceptable for this environment? The distribution must match the platform and python version requirements specified when this environment was created, or False is returned. """ return (self.python is None or dist.py_version is None or dist.py_version==self.python) \ and compatible_platforms(dist.platform,self.platform) def remove(self, dist): """Remove `dist` from the environment""" self._distmap[dist.key].remove(dist) def scan(self, search_path=None): """Scan `search_path` for distributions usable in this environment Any distributions found are added to the environment. `search_path` should be a sequence of ``sys.path`` items. If not supplied, ``sys.path`` is used. Only distributions conforming to the platform/python version defined at initialization are added. """ if search_path is None: search_path = sys.path for item in search_path: for dist in find_distributions(item): self.add(dist) def __getitem__(self,project_name): """Return a newest-to-oldest list of distributions for `project_name` """ try: return self._cache[project_name] except KeyError: project_name = project_name.lower() if project_name not in self._distmap: return [] if project_name not in self._cache: dists = self._cache[project_name] = self._distmap[project_name] _sort_dists(dists) return self._cache[project_name] def add(self,dist): """Add `dist` if we ``can_add()`` it and it isn't already added""" if self.can_add(dist) and dist.has_version(): dists = self._distmap.setdefault(dist.key,[]) if dist not in dists: dists.append(dist) if dist.key in self._cache: _sort_dists(self._cache[dist.key]) def best_match(self, req, working_set, installer=None): """Find distribution best matching `req` and usable on `working_set` This calls the ``find(req)`` method of the `working_set` to see if a suitable distribution is already active. (This may raise ``VersionConflict`` if an unsuitable version of the project is already active in the specified `working_set`.) If a suitable distribution isn't active, this method returns the newest distribution in the environment that meets the ``Requirement`` in `req`. If no suitable distribution is found, and `installer` is supplied, then the result of calling the environment's ``obtain(req, installer)`` method will be returned. """ dist = working_set.find(req) if dist is not None: return dist for dist in self[req.key]: if dist in req: return dist return self.obtain(req, installer) # try and download/install def obtain(self, requirement, installer=None): """Obtain a distribution matching `requirement` (e.g. via download) Obtain a distro that matches requirement (e.g. via download). In the base ``Environment`` class, this routine just returns ``installer(requirement)``, unless `installer` is None, in which case None is returned instead. This method is a hook that allows subclasses to attempt other ways of obtaining a distribution before falling back to the `installer` argument.""" if installer is not None: return installer(requirement) def __iter__(self): """Yield the unique project names of the available distributions""" for key in self._distmap.keys(): if self[key]: yield key def __iadd__(self, other): """In-place addition of a distribution or environment""" if isinstance(other,Distribution): self.add(other) elif isinstance(other,Environment): for project in other: for dist in other[project]: self.add(dist) else: raise TypeError("Can't add %r to environment" % (other,)) return self def __add__(self, other): """Add an environment or distribution to an environment""" new = self.__class__([], platform=None, python=None) for env in self, other: new += env return new AvailableDistributions = Environment # XXX backward compatibility class ExtractionError(RuntimeError): """An error occurred extracting a resource The following attributes are available from instances of this exception: manager The resource manager that raised this exception cache_path The base directory for resource extraction original_error The exception instance that caused extraction to fail """ class ResourceManager: """Manage resource extraction and packages""" extraction_path = None def __init__(self): self.cached_files = {} def resource_exists(self, package_or_requirement, resource_name): """Does the named resource exist?""" return get_provider(package_or_requirement).has_resource(resource_name) def resource_isdir(self, package_or_requirement, resource_name): """Is the named resource an existing directory?""" return get_provider(package_or_requirement).resource_isdir( resource_name ) def resource_filename(self, package_or_requirement, resource_name): """Return a true filesystem path for specified resource""" return get_provider(package_or_requirement).get_resource_filename( self, resource_name ) def resource_stream(self, package_or_requirement, resource_name): """Return a readable file-like object for specified resource""" return get_provider(package_or_requirement).get_resource_stream( self, resource_name ) def resource_string(self, package_or_requirement, resource_name): """Return specified resource as a string""" return get_provider(package_or_requirement).get_resource_string( self, resource_name ) def resource_listdir(self, package_or_requirement, resource_name): """List the contents of the named resource directory""" return get_provider(package_or_requirement).resource_listdir( resource_name ) def extraction_error(self): """Give an error message for problems extracting file(s)""" old_exc = sys.exc_info()[1] cache_path = self.extraction_path or get_default_cache() err = ExtractionError("""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. """ % (old_exc, cache_path) ) err.manager = self err.cache_path = cache_path err.original_error = old_exc raise err def get_cache_path(self, archive_name, names=()): """Return absolute location in cache for `archive_name` and `names` The parent directory of the resulting path will be created if it does not already exist. `archive_name` should be the base filename of the enclosing egg (which may not be the name of the enclosing zipfile!), including its ".egg" extension. `names`, if provided, should be a sequence of path name parts "under" the egg's extraction location. This method should only be called by resource providers that need to obtain an extraction location, and only for names they intend to extract, as it tracks the generated names for possible cleanup later. """ extract_path = self.extraction_path or get_default_cache() target_path = os.path.join(extract_path, archive_name+'-tmp', *names) try: ensure_directory(target_path) except: self.extraction_error() self.cached_files[target_path] = 1 return target_path def postprocess(self, tempname, filename): """Perform any platform-specific postprocessing of `tempname` This is where Mac header rewrites should be done; other platforms don't have anything special they should do. Resource providers should call this method ONLY after successfully extracting a compressed resource. They must NOT call it on resources that are already in the filesystem. `tempname` is the current (temporary) name of the file, and `filename` is the name it will be renamed to by the caller after this routine returns. """ if os.name == 'posix': # Make the resource executable mode = ((os.stat(tempname).st_mode) | 0555) & 07777 os.chmod(tempname, mode) def set_extraction_path(self, path): """Set the base path where resources will be extracted to, if needed. If you do not call this routine before any extractions take place, the path defaults to the return value of ``get_default_cache()``. (Which is based on the ``PYTHON_EGG_CACHE`` environment variable, with various platform-specific fallbacks. See that routine's documentation for more details.) Resources are extracted to subdirectories of this path based upon information given by the ``IResourceProvider``. You may set this to a temporary directory, but then you must call ``cleanup_resources()`` to delete the extracted files when done. There is no guarantee that ``cleanup_resources()`` will be able to remove all extracted files. (Note: you may not change the extraction path for a given resource manager once resources have been extracted, unless you first call ``cleanup_resources()``.) """ if self.cached_files: raise ValueError( "Can't change extraction path, files already extracted" ) self.extraction_path = path def cleanup_resources(self, force=False): """ 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. """ # XXX def get_default_cache(): """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". """ try: return os.environ['PYTHON_EGG_CACHE'] except KeyError: pass if os.name!='nt': return os.path.expanduser('~/.python-eggs') app_data = 'Application Data' # XXX this may be locale-specific! app_homes = [ (('APPDATA',), None), # best option, should be locale-safe (('USERPROFILE',), app_data), (('HOMEDRIVE','HOMEPATH'), app_data), (('HOMEPATH',), app_data), (('HOME',), None), (('WINDIR',), app_data), # 95/98/ME ] for keys, subdir in app_homes: dirname = '' for key in keys: if key in os.environ: dirname = os.path.join(dirname, os.environ[key]) else: break else: if subdir: dirname = os.path.join(dirname,subdir) return os.path.join(dirname, 'Python-Eggs') else: raise RuntimeError( "Please set the PYTHON_EGG_CACHE enviroment variable" ) def safe_name(name): """Convert an arbitrary string to a standard distribution name Any runs of non-alphanumeric/. characters are replaced with a single '-'. """ return re.sub('[^A-Za-z0-9.]+', '-', name) def safe_version(version): """Convert an arbitrary string to a standard version string Spaces become dots, and all other non-alphanumeric characters become dashes, with runs of multiple dashes condensed to a single dash. """ version = version.replace(' ','.') return re.sub('[^A-Za-z0-9.]+', '-', version) def safe_extra(extra): """Convert an arbitrary string to a standard 'extra' name Any runs of non-alphanumeric characters are replaced with a single '_', and the result is always lowercased. """ return re.sub('[^A-Za-z0-9.]+', '_', extra).lower() def to_filename(name): """Convert a project or version name to its filename-escaped form Any '-' characters are currently replaced with '_'. """ return name.replace('-','_') class NullProvider: """Try to implement resources and metadata for arbitrary PEP 302 loaders""" egg_name = None egg_info = None loader = None def __init__(self, module): self.loader = getattr(module, '__loader__', None) self.module_path = os.path.dirname(getattr(module, '__file__', '')) def get_resource_filename(self, manager, resource_name): return self._fn(self.module_path, resource_name) def get_resource_stream(self, manager, resource_name): return StringIO(self.get_resource_string(manager, resource_name)) def get_resource_string(self, manager, resource_name): return self._get(self._fn(self.module_path, resource_name)) def has_resource(self, resource_name): return self._has(self._fn(self.module_path, resource_name)) def has_metadata(self, name): return self.egg_info and self._has(self._fn(self.egg_info,name)) def get_metadata(self, name): if not self.egg_info: return "" return self._get(self._fn(self.egg_info,name)) def get_metadata_lines(self, name): return yield_lines(self.get_metadata(name)) def resource_isdir(self,resource_name): return self._isdir(self._fn(self.module_path, resource_name)) def metadata_isdir(self,name): return self.egg_info and self._isdir(self._fn(self.egg_info,name)) def resource_listdir(self,resource_name): return self._listdir(self._fn(self.module_path,resource_name)) def metadata_listdir(self,name): if self.egg_info: return self._listdir(self._fn(self.egg_info,name)) return [] def run_script(self,script_name,namespace): script = 'scripts/'+script_name if not self.has_metadata(script): raise ResolutionError("No script named %r" % script_name) script_text = self.get_metadata(script).replace('\r\n','\n') script_text = script_text.replace('\r','\n') script_filename = self._fn(self.egg_info,script) namespace['__file__'] = script_filename if os.path.exists(script_filename): execfile(script_filename, namespace, namespace) else: from linecache import cache cache[script_filename] = ( len(script_text), 0, script_text.split('\n'), script_filename ) script_code = compile(script_text,script_filename,'exec') exec script_code in namespace, namespace def _has(self, path): raise NotImplementedError( "Can't perform this operation for unregistered loader type" ) def _isdir(self, path): raise NotImplementedError( "Can't perform this operation for unregistered loader type" ) def _listdir(self, path): raise NotImplementedError( "Can't perform this operation for unregistered loader type" ) def _fn(self, base, resource_name): return os.path.join(base, *resource_name.split('/')) def _get(self, path): if hasattr(self.loader, 'get_data'): return self.loader.get_data(path) raise NotImplementedError( "Can't perform this operation for loaders without 'get_data()'" ) register_loader_type(object, NullProvider) class EggProvider(NullProvider): """Provider based on a virtual filesystem""" def __init__(self,module): NullProvider.__init__(self,module) self._setup_prefix() def _setup_prefix(self): # we assume here that our metadata may be nested inside a "basket" # of multiple eggs; that's why we use module_path instead of .archive path = self.module_path old = None while path!=old: if path.lower().endswith('.egg'): self.egg_name = os.path.basename(path) self.egg_info = os.path.join(path, 'EGG-INFO') self.egg_root = path break old = path path, base = os.path.split(path) class DefaultProvider(EggProvider): """Provides access to package resources in the filesystem""" def _has(self, path): return os.path.exists(path) def _isdir(self,path): return os.path.isdir(path) def _listdir(self,path): return os.listdir(path) def get_resource_stream(self, manager, resource_name): return open(self._fn(self.module_path, resource_name), 'rb') def _get(self, path): stream = open(path, 'rb') try: return stream.read() finally: stream.close() register_loader_type(type(None), DefaultProvider) class EmptyProvider(NullProvider): """Provider that returns nothing for all requests""" _isdir = _has = lambda self,path: False _get = lambda self,path: '' _listdir = lambda self,path: [] module_path = None def __init__(self): pass empty_provider = EmptyProvider() class ZipProvider(EggProvider): """Resource support for zips and eggs""" eagers = None def __init__(self, module): EggProvider.__init__(self,module) self.zipinfo = zipimport._zip_directory_cache[self.loader.archive] self.zip_pre = self.loader.archive+os.sep def _zipinfo_name(self, fspath): # Convert a virtual filename (full path to file) into a zipfile subpath # usable with the zipimport directory cache for our target archive if fspath.startswith(self.zip_pre): return fspath[len(self.zip_pre):] raise AssertionError( "%s is not a subpath of %s" % (fspath,self.zip_pre) ) def _parts(self,zip_path): # Convert a zipfile subpath into an egg-relative path part list fspath = self.zip_pre+zip_path # pseudo-fs path if fspath.startswith(self.egg_root+os.sep): return fspath[len(self.egg_root)+1:].split(os.sep) raise AssertionError( "%s is not a subpath of %s" % (fspath,self.egg_root) ) def get_resource_filename(self, manager, resource_name): if not self.egg_name: raise NotImplementedError( "resource_filename() only supported for .egg, not .zip" ) # no need to lock for extraction, since we use temp names zip_path = self._resource_to_zip(resource_name) eagers = self._get_eager_resources() if '/'.join(self._parts(zip_path)) in eagers: for name in eagers: self._extract_resource(manager, self._eager_to_zip(name)) return self._extract_resource(manager, zip_path) def _extract_resource(self, manager, zip_path): if zip_path in self._index(): for name in self._index()[zip_path]: last = self._extract_resource( manager, os.path.join(zip_path, name) ) return os.path.dirname(last) # return the extracted directory name zip_stat = self.zipinfo[zip_path] t,d,size = zip_stat[5], zip_stat[6], zip_stat[3] date_time = ( (d>>9)+1980, (d>>5)&0xF, d&0x1F, # ymd (t&0xFFFF)>>11, (t>>5)&0x3F, (t&0x1F) * 2, 0, 0, -1 # hms, etc. ) timestamp = time.mktime(date_time) try: real_path = manager.get_cache_path( self.egg_name, self._parts(zip_path) ) if os.path.isfile(real_path): stat = os.stat(real_path) if stat.st_size==size and stat.st_mtime==timestamp: # size and stamp match, don't bother extracting return real_path outf, tmpnam = _mkstemp(".$extract", dir=os.path.dirname(real_path)) os.write(outf, self.loader.get_data(zip_path)) os.close(outf) utime(tmpnam, (timestamp,timestamp)) manager.postprocess(tmpnam, real_path) try: rename(tmpnam, real_path) except os.error: if os.path.isfile(real_path): stat = os.stat(real_path) if stat.st_size==size and stat.st_mtime==timestamp: # size and stamp match, somebody did it just ahead of # us, so we're done return real_path elif os.name=='nt': # Windows, del old file and retry unlink(real_path) rename(tmpnam, real_path) return real_path raise except os.error: manager.extraction_error() # report a user-friendly error return real_path def _get_eager_resources(self): if self.eagers is None: eagers = [] for name in ('native_libs.txt', 'eager_resources.txt'): if self.has_metadata(name): eagers.extend(self.get_metadata_lines(name)) self.eagers = eagers return self.eagers def _index(self): try: return self._dirindex except AttributeError: ind = {} for path in self.zipinfo: parts = path.split(os.sep) while parts: parent = os.sep.join(parts[:-1]) if parent in ind: ind[parent].append(parts[-1]) break else: ind[parent] = [parts.pop()] self._dirindex = ind return ind def _has(self, fspath): zip_path = self._zipinfo_name(fspath) return zip_path in self.zipinfo or zip_path in self._index() def _isdir(self,fspath): return self._zipinfo_name(fspath) in self._index() def _listdir(self,fspath): return list(self._index().get(self._zipinfo_name(fspath), ())) def _eager_to_zip(self,resource_name): return self._zipinfo_name(self._fn(self.egg_root,resource_name)) def _resource_to_zip(self,resource_name): return self._zipinfo_name(self._fn(self.module_path,resource_name)) register_loader_type(zipimport.zipimporter, ZipProvider) class FileMetadata(EmptyProvider): """Metadata handler for standalone PKG-INFO files Usage:: metadata = FileMetadata("/path/to/PKG-INFO") This provider rejects all data and metadata requests except for PKG-INFO, which is treated as existing, and will be the contents of the file at the provided location. """ def __init__(self,path): self.path = path def has_metadata(self,name): return name=='PKG-INFO' def get_metadata(self,name): if name=='PKG-INFO': return open(self.path,'rU').read() raise KeyError("No metadata except PKG-INFO is available") def get_metadata_lines(self,name): return yield_lines(self.get_metadata(name)) class PathMetadata(DefaultProvider): """Metadata provider for egg directories Usage:: # Development eggs: egg_info = "/path/to/PackageName.egg-info" base_dir = os.path.dirname(egg_info) metadata = PathMetadata(base_dir, egg_info) dist_name = os.path.splitext(os.path.basename(egg_info))[0] dist = Distribution(basedir,project_name=dist_name,metadata=metadata) # Unpacked egg directories: egg_path = "/path/to/PackageName-ver-pyver-etc.egg" metadata = PathMetadata(egg_path, os.path.join(egg_path,'EGG-INFO')) dist = Distribution.from_filename(egg_path, metadata=metadata) """ def __init__(self, path, egg_info): self.module_path = path self.egg_info = egg_info class EggMetadata(ZipProvider): """Metadata provider for .egg files""" def __init__(self, importer): """Create a metadata provider from a zipimporter""" self.zipinfo = zipimport._zip_directory_cache[importer.archive] self.zip_pre = importer.archive+os.sep self.loader = importer if importer.prefix: self.module_path = os.path.join(importer.archive, importer.prefix) else: self.module_path = importer.archive self._setup_prefix() class ImpWrapper: """PEP 302 Importer that wraps Python's "normal" import algorithm""" def __init__(self, path=None): self.path = path def find_module(self, fullname, path=None): subname = fullname.split(".")[-1] if subname != fullname and self.path is None: return None if self.path is None: path = None else: path = [self.path] try: file, filename, etc = imp.find_module(subname, path) except ImportError: return None return ImpLoader(file, filename, etc) class ImpLoader: """PEP 302 Loader that wraps Python's "normal" import algorithm""" def __init__(self, file, filename, etc): self.file = file self.filename = filename self.etc = etc def load_module(self, fullname): try: mod = imp.load_module(fullname, self.file, self.filename, self.etc) finally: if self.file: self.file.close() # Note: we don't set __loader__ because we want the module to look # normal; i.e. this is just a wrapper for standard import machinery return mod def get_importer(path_item): """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. """ try: importer = sys.path_importer_cache[path_item] except KeyError: for hook in sys.path_hooks: try: importer = hook(path_item) except ImportError: pass else: break else: importer = None sys.path_importer_cache.setdefault(path_item,importer) if importer is None: try: importer = ImpWrapper(path_item) except ImportError: pass return importer try: from pkgutil import get_importer, ImpImporter except ImportError: pass # Python 2.3 or 2.4, use our own implementation else: ImpWrapper = ImpImporter # Python 2.5, use pkgutil's implementation del ImpLoader, ImpImporter _distribution_finders = {} def register_finder(importer_type, distribution_finder): """Register `distribution_finder` to find distributions in sys.path items `importer_type` is the type or class of a PEP 302 "Importer" (sys.path item handler), and `distribution_finder` is a callable that, passed a path item and the importer instance, yields ``Distribution`` instances found on that path item. See ``pkg_resources.find_on_path`` for an example.""" _distribution_finders[importer_type] = distribution_finder def find_distributions(path_item, only=False): """Yield distributions accessible via `path_item`""" importer = get_importer(path_item) finder = _find_adapter(_distribution_finders, importer) return finder(importer, path_item, only) def find_in_zip(importer, path_item, only=False): metadata = EggMetadata(importer) if metadata.has_metadata('PKG-INFO'): yield Distribution.from_filename(path_item, metadata=metadata) if only: return # don't yield nested distros for subitem in metadata.resource_listdir('/'): if subitem.endswith('.egg'): subpath = os.path.join(path_item, subitem) for dist in find_in_zip(zipimport.zipimporter(subpath), subpath): yield dist register_finder(zipimport.zipimporter, find_in_zip) def StringIO(*args, **kw): """Thunk to load the real StringIO on demand""" global StringIO try: from cStringIO import StringIO except ImportError: from StringIO import StringIO return StringIO(*args,**kw) def find_nothing(importer, path_item, only=False): return () register_finder(object,find_nothing) def find_on_path(importer, path_item, only=False): """Yield distributions accessible on a sys.path directory""" path_item = _normalize_cached(path_item) if os.path.isdir(path_item): if path_item.lower().endswith('.egg'): # unpacked egg yield Distribution.from_filename( path_item, metadata=PathMetadata( path_item, os.path.join(path_item,'EGG-INFO') ) ) else: # scan for .egg and .egg-info in directory for entry in os.listdir(path_item): lower = entry.lower() if lower.endswith('.egg-info'): fullpath = os.path.join(path_item, entry) if os.path.isdir(fullpath): # egg-info directory, allow getting metadata metadata = PathMetadata(path_item, fullpath) else: metadata = FileMetadata(fullpath) yield Distribution.from_location( path_item,entry,metadata,precedence=DEVELOP_DIST ) elif not only and lower.endswith('.egg'): for dist in find_distributions(os.path.join(path_item, entry)): yield dist elif not only and lower.endswith('.egg-link'): for line in file(os.path.join(path_item, entry)): if not line.strip(): continue for item in find_distributions(os.path.join(path_item,line.rstrip())): yield item break register_finder(ImpWrapper,find_on_path) _namespace_handlers = {} _namespace_packages = {} def register_namespace_handler(importer_type, namespace_handler): """Register `namespace_handler` to declare namespace packages `importer_type` is the type or class of a PEP 302 "Importer" (sys.path item handler), and `namespace_handler` is a callable like this:: def namespace_handler(importer,path_entry,moduleName,module): # return a path_entry to use for child packages Namespace handlers are only called if the importer object has already agreed that it can handle the relevant path item, and they should only return a subpath if the module __path__ does not already contain an equivalent subpath. For an example namespace handler, see ``pkg_resources.file_ns_handler``. """ _namespace_handlers[importer_type] = namespace_handler def _handle_ns(packageName, path_item): """Ensure that named package includes a subpath of path_item (if needed)""" importer = get_importer(path_item) if importer is None: return None loader = importer.find_module(packageName) if loader is None: return None module = sys.modules.get(packageName) if module is None: module = sys.modules[packageName] = new.module(packageName) module.__path__ = []; _set_parent_ns(packageName) elif not hasattr(module,'__path__'): raise TypeError("Not a package:", packageName) handler = _find_adapter(_namespace_handlers, importer) subpath = handler(importer,path_item,packageName,module) if subpath is not None: path = module.__path__; path.append(subpath) loader.load_module(packageName); module.__path__ = path return subpath def declare_namespace(packageName): """Declare that package 'packageName' is a namespace package""" imp.acquire_lock() try: if packageName in _namespace_packages: return path, parent = sys.path, None if '.' in packageName: parent = '.'.join(packageName.split('.')[:-1]) declare_namespace(parent) __import__(parent) try: path = sys.modules[parent].__path__ except AttributeError: raise TypeError("Not a package:", parent) # Track what packages are namespaces, so when new path items are added, # they can be updated _namespace_packages.setdefault(parent,[]).append(packageName) _namespace_packages.setdefault(packageName,[]) for path_item in path: # Ensure all the parent's path items are reflected in the child, # if they apply _handle_ns(packageName, path_item) finally: imp.release_lock() def fixup_namespace_packages(path_item, parent=None): """Ensure that previously-declared namespace packages include path_item""" imp.acquire_lock() try: for package in _namespace_packages.get(parent,()): subpath = _handle_ns(package, path_item) if subpath: fixup_namespace_packages(subpath,package) finally: imp.release_lock() def file_ns_handler(importer, path_item, packageName, module): """Compute an ns-package subpath for a filesystem or zipfile importer""" subpath = os.path.join(path_item, packageName.split('.')[-1]) normalized = _normalize_cached(subpath) for item in module.__path__: if _normalize_cached(item)==normalized: break else: # Only return the path if it's not already there return subpath register_namespace_handler(ImpWrapper,file_ns_handler) register_namespace_handler(zipimport.zipimporter,file_ns_handler) def null_ns_handler(importer, path_item, packageName, module): return None register_namespace_handler(object,null_ns_handler) def normalize_path(filename): """Normalize a file/dir name for comparison purposes""" return os.path.normcase(os.path.realpath(filename)) def _normalize_cached(filename,_cache={}): try: return _cache[filename] except KeyError: _cache[filename] = result = normalize_path(filename) return result def _set_parent_ns(packageName): parts = packageName.split('.') name = parts.pop() if parts: parent = '.'.join(parts) setattr(sys.modules[parent], name, sys.modules[packageName]) def yield_lines(strs): """Yield non-empty/non-comment lines of a ``basestring`` or sequence""" if isinstance(strs,basestring): for s in strs.splitlines(): s = s.strip() if s and not s.startswith('#'): # skip blank lines/comments yield s else: for ss in strs: for s in yield_lines(ss): yield s LINE_END = re.compile(r"\s*(#.*)?$").match # whitespace and comment CONTINUE = re.compile(r"\s*\\\s*(#.*)?$").match # line continuation DISTRO = re.compile(r"\s*((\w|[-.])+)").match # Distribution or extra VERSION = re.compile(r"\s*(<=?|>=?|==|!=)\s*((\w|[-.])+)").match # ver. info COMMA = re.compile(r"\s*,").match # comma between items OBRACKET = re.compile(r"\s*\[").match CBRACKET = re.compile(r"\s*\]").match MODULE = re.compile(r"\w+(\.\w+)*$").match EGG_NAME = re.compile( r"(?P[^-]+)" r"( -(?P[^-]+) (-py(?P[^-]+) (-(?P.+))? )? )?", re.VERBOSE | re.IGNORECASE ).match component_re = re.compile(r'(\d+ | [a-z]+ | \.| -)', re.VERBOSE) replace = {'pre':'c', 'preview':'c','-':'final-','rc':'c','dev':'@'}.get def _parse_version_parts(s): for part in component_re.split(s): part = replace(part,part) if not part or part=='.': continue if part[:1] in '0123456789': yield part.zfill(8) # pad for numeric comparison else: yield '*'+part yield '*final' # ensure that alpha/beta/candidate are before final def parse_version(s): """Convert a version string to a chronologically-sortable key This is a rough cross between distutils' StrictVersion and LooseVersion; if you give it versions that would work with StrictVersion, then it behaves the same; otherwise it acts like a slightly-smarter LooseVersion. It is *possible* to create pathological version coding schemes that will fool this parser, but they should be very rare in practice. The returned value will be a tuple of strings. Numeric portions of the version are padded to 8 digits so they will compare numerically, but without relying on how numbers compare relative to strings. Dots are dropped, but dashes are retained. Trailing zeros between alpha segments or dashes are suppressed, so that e.g. "2.4.0" is considered the same as "2.4". Alphanumeric parts are lower-cased. The algorithm assumes that strings like "-" and any alpha string that alphabetically follows "final" represents a "patch level". So, "2.4-1" is assumed to be a branch or patch of "2.4", and therefore "2.4.1" is considered newer than "2.4-1", 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. """ parts = [] for part in _parse_version_parts(s.lower()): if part.startswith('*'): if part<'*final': # remove '-' before a prerelease tag while parts and parts[-1]=='*final-': parts.pop() # remove trailing zeros from each series of numeric parts while parts and parts[-1]=='00000000': parts.pop() parts.append(part) return tuple(parts) class EntryPoint(object): """Object representing an advertised importable object""" def __init__(self, name, module_name, attrs=(), extras=(), dist=None): if not MODULE(module_name): raise ValueError("Invalid module name", module_name) self.name = name self.module_name = module_name self.attrs = tuple(attrs) self.extras = Requirement.parse(("x[%s]" % ','.join(extras))).extras self.dist = dist def __str__(self): s = "%s = %s" % (self.name, self.module_name) if self.attrs: s += ':' + '.'.join(self.attrs) if self.extras: s += ' [%s]' % ','.join(self.extras) return s def __repr__(self): return "EntryPoint.parse(%r)" % str(self) def load(self, require=True, env=None, installer=None): if require: self.require(env, installer) entry = __import__(self.module_name, globals(),globals(), ['__name__']) for attr in self.attrs: try: entry = getattr(entry,attr) except AttributeError: raise ImportError("%r has no %r attribute" % (entry,attr)) return entry def require(self, env=None, installer=None): if self.extras and not self.dist: raise UnknownExtra("Can't require() without a distribution", self) map(working_set.add, working_set.resolve(self.dist.requires(self.extras),env,installer)) #@classmethod def parse(cls, src, dist=None): """Parse a single entry point from string `src` Entry point syntax follows the form:: name = some.module:some.attr [extra1,extra2] The entry name and module name are required, but the ``:attrs`` and ``[extras]`` parts are optional """ try: attrs = extras = () name,value = src.split('=',1) if '[' in value: value,extras = value.split('[',1) req = Requirement.parse("x["+extras) if req.specs: raise ValueError extras = req.extras if ':' in value: value,attrs = value.split(':',1) if not MODULE(attrs.rstrip()): raise ValueError attrs = attrs.rstrip().split('.') except ValueError: raise ValueError( "EntryPoint must be in 'name=module:attrs [extras]' format", src ) else: return cls(name.strip(), value.strip(), attrs, extras, dist) parse = classmethod(parse) #@classmethod def parse_group(cls, group, lines, dist=None): """Parse an entry point group""" if not MODULE(group): raise ValueError("Invalid group name", group) this = {} for line in yield_lines(lines): ep = cls.parse(line, dist) if ep.name in this: raise ValueError("Duplicate entry point", group, ep.name) this[ep.name]=ep return this parse_group = classmethod(parse_group) #@classmethod def parse_map(cls, data, dist=None): """Parse a map of entry point groups""" if isinstance(data,dict): data = data.items() else: data = split_sections(data) maps = {} for group, lines in data: if group is None: if not lines: continue raise ValueError("Entry points must be listed in groups") group = group.strip() if group in maps: raise ValueError("Duplicate group name", group) maps[group] = cls.parse_group(group, lines, dist) return maps parse_map = classmethod(parse_map) class Distribution(object): """Wrap an actual or potential sys.path entry w/metadata""" def __init__(self, location=None, metadata=None, project_name=None, version=None, py_version=PY_MAJOR, platform=None, precedence = EGG_DIST ): self.project_name = safe_name(project_name or 'Unknown') if version is not None: self._version = safe_version(version) self.py_version = py_version self.platform = platform self.location = location self.precedence = precedence self._provider = metadata or empty_provider #@classmethod def from_location(cls,location,basename,metadata=None,**kw): project_name, version, py_version, platform = [None]*4 basename, ext = os.path.splitext(basename) if ext.lower() in (".egg",".egg-info"): match = EGG_NAME(basename) if match: project_name, version, py_version, platform = match.group( 'name','ver','pyver','plat' ) return cls( location, metadata, project_name=project_name, version=version, py_version=py_version, platform=platform, **kw ) from_location = classmethod(from_location) hashcmp = property( lambda self: ( getattr(self,'parsed_version',()), self.precedence, self.key, -len(self.location or ''), self.location, self.py_version, self.platform ) ) def __cmp__(self, other): return cmp(self.hashcmp, other) def __hash__(self): return hash(self.hashcmp) # These properties have to be lazy so that we don't have to load any # metadata until/unless it's actually needed. (i.e., some distributions # may not know their name or version without loading PKG-INFO) #@property def key(self): try: return self._key except AttributeError: self._key = key = self.project_name.lower() return key key = property(key) #@property def parsed_version(self): try: return self._parsed_version except AttributeError: self._parsed_version = pv = parse_version(self.version) return pv parsed_version = property(parsed_version) #@property def version(self): try: return self._version except AttributeError: for line in self._get_metadata('PKG-INFO'): if line.lower().startswith('version:'): self._version = safe_version(line.split(':',1)[1].strip()) return self._version else: raise ValueError( "Missing 'Version:' header and/or PKG-INFO file", self ) version = property(version) #@property def _dep_map(self): try: return self.__dep_map except AttributeError: dm = self.__dep_map = {None: []} for name in 'requires.txt', 'depends.txt': for extra,reqs in split_sections(self._get_metadata(name)): if extra: extra = safe_extra(extra) dm.setdefault(extra,[]).extend(parse_requirements(reqs)) return dm _dep_map = property(_dep_map) def requires(self,extras=()): """List of Requirements needed for this distro if `extras` are used""" dm = self._dep_map deps = [] deps.extend(dm.get(None,())) for ext in extras: try: deps.extend(dm[safe_extra(ext)]) except KeyError: raise UnknownExtra( "%s has no such extra feature %r" % (self, ext) ) return deps def _get_metadata(self,name): if self.has_metadata(name): for line in self.get_metadata_lines(name): yield line def activate(self,path=None): """Ensure distribution is importable on `path` (default=sys.path)""" if path is None: path = sys.path self.insert_on(path) if path is sys.path: fixup_namespace_packages(self.location) map(declare_namespace, self._get_metadata('namespace_packages.txt')) def egg_name(self): """Return what this distribution's standard .egg filename should be""" filename = "%s-%s-py%s" % ( to_filename(self.project_name), to_filename(self.version), self.py_version or PY_MAJOR ) if self.platform: filename += '-'+self.platform return filename def __repr__(self): if self.location: return "%s (%s)" % (self,self.location) else: return str(self) def __str__(self): try: version = getattr(self,'version',None) except ValueError: version = None version = version or "[unknown version]" return "%s %s" % (self.project_name,version) def __getattr__(self,attr): """Delegate all unrecognized public attributes to .metadata provider""" if attr.startswith('_'): raise AttributeError,attr return getattr(self._provider, attr) #@classmethod def from_filename(cls,filename,metadata=None, **kw): return cls.from_location( _normalize_cached(filename), os.path.basename(filename), metadata, **kw ) from_filename = classmethod(from_filename) def as_requirement(self): """Return a ``Requirement`` that matches this distribution exactly""" return Requirement.parse('%s==%s' % (self.project_name, self.version)) def load_entry_point(self, group, name): """Return the `name` entry point of `group` or raise ImportError""" ep = self.get_entry_info(group,name) if ep is None: raise ImportError("Entry point %r not found" % ((group,name),)) return ep.load() def get_entry_map(self, group=None): """Return the entry point map for `group`, or the full entry map""" try: ep_map = self._ep_map except AttributeError: ep_map = self._ep_map = EntryPoint.parse_map( self._get_metadata('entry_points.txt'), self ) if group is not None: return ep_map.get(group,{}) return ep_map def get_entry_info(self, group, name): """Return the EntryPoint object for `group`+`name`, or ``None``""" return self.get_entry_map(group).get(name) def insert_on(self, path, loc = None): """Insert self.location in path before its nearest parent directory""" loc = loc or self.location if not loc: return if path is sys.path: self.check_version_conflict() nloc = _normalize_cached(loc) bdir = os.path.dirname(nloc) npath= map(_normalize_cached, path) bp = None for p, item in enumerate(npath): if item==nloc: break elif item==bdir and self.precedence==EGG_DIST: # if it's an .egg, give it precedence over its directory path.insert(p, loc) npath.insert(p, nloc) break else: path.append(loc) return # p is the spot where we found or inserted loc; now remove duplicates while 1: try: np = npath.index(nloc, p+1) except ValueError: break else: del npath[np], path[np] p = np # ha! return def check_version_conflict(self): if self.key=='setuptools': return # ignore the inevitable setuptools self-conflicts :( nsp = dict.fromkeys(self._get_metadata('namespace_packages.txt')) loc = normalize_path(self.location) for modname in self._get_metadata('top_level.txt'): if (modname not in sys.modules or modname in nsp or modname in _namespace_packages ): continue fn = getattr(sys.modules[modname], '__file__', None) if fn and normalize_path(fn).startswith(loc): continue issue_warning( "Module %s was already imported from %s, but %s is being added" " to sys.path" % (modname, fn, self.location), ) def has_version(self): try: self.version except ValueError: issue_warning("Unbuilt egg for "+repr(self)) return False return True def clone(self,**kw): """Copy this distribution, substituting in any changed keyword args""" for attr in ( 'project_name', 'version', 'py_version', 'platform', 'location', 'precedence' ): kw.setdefault(attr, getattr(self,attr,None)) kw.setdefault('metadata', self._provider) return self.__class__(**kw) #@property def extras(self): return [dep for dep in self._dep_map if dep] extras = property(extras) def issue_warning(*args,**kw): level = 1 g = globals() try: # find the first stack frame that is *not* code in # the pkg_resources module, to use for the warning while sys._getframe(level).f_globals is g: level += 1 except ValueError: pass from warnings import warn warn(stacklevel = level+1, *args, **kw) def parse_requirements(strs): """Yield ``Requirement`` objects for each specification in `strs` `strs` must be an instance of ``basestring``, or a (possibly-nested) iterable thereof. """ # create a steppable iterator, so we can handle \-continuations lines = iter(yield_lines(strs)) def scan_list(ITEM,TERMINATOR,line,p,groups,item_name): items = [] while not TERMINATOR(line,p): if CONTINUE(line,p): try: line = lines.next(); p = 0 except StopIteration: raise ValueError( "\\ must not appear on the last nonblank line" ) match = ITEM(line,p) if not match: raise ValueError("Expected "+item_name+" in",line,"at",line[p:]) items.append(match.group(*groups)) p = match.end() match = COMMA(line,p) if match: p = match.end() # skip the comma elif not TERMINATOR(line,p): raise ValueError( "Expected ',' or end-of-list in",line,"at",line[p:] ) match = TERMINATOR(line,p) if match: p = match.end() # skip the terminator, if any return line, p, items for line in lines: match = DISTRO(line) if not match: raise ValueError("Missing distribution spec", line) project_name = match.group(1) p = match.end() extras = [] match = OBRACKET(line,p) if match: p = match.end() line, p, extras = scan_list( DISTRO, CBRACKET, line, p, (1,), "'extra' name" ) line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec") specs = [(op,safe_version(val)) for op,val in specs] yield Requirement(project_name, specs, extras) def _sort_dists(dists): tmp = [(dist.hashcmp,dist) for dist in dists] tmp.sort() dists[::-1] = [d for hc,d in tmp] class Requirement: def __init__(self, project_name, specs, extras): """DO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()!""" self.unsafe_name, project_name = project_name, safe_name(project_name) self.project_name, self.key = project_name, project_name.lower() index = [(parse_version(v),state_machine[op],op,v) for op,v in specs] index.sort() self.specs = [(op,ver) for parsed,trans,op,ver in index] self.index, self.extras = index, tuple(map(safe_extra,extras)) self.hashCmp = ( self.key, tuple([(op,parsed) for parsed,trans,op,ver in index]), frozenset(self.extras) ) self.__hash = hash(self.hashCmp) def __str__(self): specs = ','.join([''.join(s) for s in self.specs]) extras = ','.join(self.extras) if extras: extras = '[%s]' % extras return '%s%s%s' % (self.project_name, extras, specs) def __eq__(self,other): return isinstance(other,Requirement) and self.hashCmp==other.hashCmp def __contains__(self,item): if isinstance(item,Distribution): if item.key <> self.key: return False if self.index: item = item.parsed_version # only get if we need it elif isinstance(item,basestring): item = parse_version(item) last = None for parsed,trans,op,ver in self.index: action = trans[cmp(item,parsed)] if action=='F': return False elif action=='T': return True elif action=='+': last = True elif action=='-' or last is None: last = False if last is None: last = True # no rules encountered return last def __hash__(self): return self.__hash def __repr__(self): return "Requirement.parse(%r)" % str(self) #@staticmethod def parse(s): reqs = list(parse_requirements(s)) if reqs: if len(reqs)==1: return reqs[0] raise ValueError("Expected only one requirement", s) raise ValueError("No requirements found", s) parse = staticmethod(parse) state_machine = { # =>< '<' : '--T', '<=': 'T-T', '>' : 'F+F', '>=': 'T+F', '==': 'T..', '!=': 'F++', } def _get_mro(cls): """Get an mro for a type or classic class""" if not isinstance(cls,type): class cls(cls,object): pass return cls.__mro__[1:] return cls.__mro__ def _find_adapter(registry, ob): """Return an adapter factory for `ob` from `registry`""" for t in _get_mro(getattr(ob, '__class__', type(ob))): if t in registry: return registry[t] def ensure_directory(path): """Ensure that the parent directory of `path` exists""" dirname = os.path.dirname(path) if not os.path.isdir(dirname): os.makedirs(dirname) def split_sections(s): """Split a string or iterable thereof into (section,content) pairs Each ``section`` is a stripped version of the section header ("[section]") and each ``content`` is a list of stripped lines excluding blank lines and comment-only lines. If there are any such lines before the first section header, they're returned in a first ``section`` of ``None``. """ section = None content = [] for line in yield_lines(s): if line.startswith("["): if line.endswith("]"): if section or content: yield section, content section = line[1:-1].strip() content = [] else: raise ValueError("Invalid section heading", line) else: content.append(line) # wrap up last segment yield section, content def _mkstemp(*args,**kw): from tempfile import mkstemp old_open = os.open try: os.open = os_open # temporarily bypass sandboxing return mkstemp(*args,**kw) finally: os.open = old_open # and then put it back # Set up global resource manager _manager = ResourceManager() def _initialize(g): for name in dir(_manager): if not name.startswith('_'): g[name] = getattr(_manager, name) _initialize(globals()) # Prepare the master working set and make the ``require()`` API available working_set = WorkingSet() try: # Does the main program list any requirements? from __main__ import __requires__ except ImportError: pass # No: just use the default working set based on sys.path else: # Yes: ensure the requirements are met, by prefixing sys.path if necessary try: working_set.require(__requires__) except VersionConflict: # try it without defaults already on sys.path working_set = WorkingSet([]) # by starting with an empty path for dist in working_set.resolve( parse_requirements(__requires__), Environment() ): working_set.add(dist) for entry in sys.path: # add any missing entries from sys.path if entry not in working_set.entries: working_set.add_entry(entry) sys.path[:] = working_set.entries # then copy back to sys.path require = working_set.require iter_entry_points = working_set.iter_entry_points add_activation_listener = working_set.subscribe run_script = working_set.run_script run_main = run_script # backward compatibility # Activate all distributions already on sys.path, and ensure that # all distributions added to the working set in the future (e.g. by # calling ``require()``) will get activated as well. add_activation_listener(lambda dist: dist.activate()) working_set.entries=[]; map(working_set.add_entry,sys.path) # match order PK45&: : site.pydef __boot(): import sys, imp, os, os.path PYTHONPATH = os.environ.get('PYTHONPATH') if PYTHONPATH is None or (sys.platform=='win32' and not PYTHONPATH): PYTHONPATH = [] else: PYTHONPATH = PYTHONPATH.split(os.pathsep) pic = getattr(sys,'path_importer_cache',{}) stdpath = sys.path[len(PYTHONPATH):] mydir = os.path.dirname(__file__) #print "searching",stdpath,sys.path for item in stdpath: if item==mydir or not item: continue # skip if current dir. on Windows, or my own directory importer = pic.get(item) if importer is not None: loader = importer.find_module('site') if loader is not None: # This should actually reload the current module loader.load_module('site') break else: try: stream, path, descr = imp.find_module('site',[item]) except ImportError: continue if stream is None: continue try: # This should actually reload the current module imp.load_module('site',stream,path,descr) finally: stream.close() break else: raise ImportError("Couldn't find the real 'site' module") #print "loaded", __file__ known_paths = dict([(makepath(item)[1],1) for item in sys.path]) # 2.2 comp oldpos = getattr(sys,'__egginsert',0) # save old insertion position sys.__egginsert = 0 # and reset the current one for item in PYTHONPATH: addsitedir(item) sys.__egginsert += oldpos # restore effective old position d,nd = makepath(stdpath[0]) insert_at = None new_path = [] for item in sys.path: p,np = makepath(item) if np==nd and insert_at is None: # We've hit the first 'system' path entry, so added entries go here insert_at = len(new_path) if np in known_paths or insert_at is None: new_path.append(item) else: # new path after the insert point, back-insert it new_path.insert(insert_at, item) insert_at += 1 sys.path[:] = new_path if __name__=='site': __boot() del __boot PKC8~=;;easy_install.pyc; Ec@s/dZedjodklZendS(sRun the EasyInstall commands__main__(smainN(s__doc__s__name__ssetuptools.command.easy_installsmain(smain((s0build/bdist.darwin-8.0.1-x86/egg/easy_install.pys?s  PKC8Dsetuptools/archive_util.pyo; Ec@sdZdddddddgZdkZdkZdkZdkZd klZd kl Z de fd YZ d Z e e d Z e dZe dZe dZeeefZdS(s/Utilities for extracting common archive formatssunpack_archivesunpack_zipfilesunpack_tarfilesdefault_filtersUnrecognizedFormatsextraction_driverssunpack_directoryN(sensure_directory(sDistutilsErrorcBstZdZRS(s#Couldn't recognize the archive type(s__name__s __module__s__doc__(((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/archive_util.pysUnrecognizedFormat s cCs|SdS(s@The default progress/filter callback; returns True for all filesN(sdst(ssrcsdst((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/archive_util.pysdefault_filterscCs]xV|ptD]7}y||||Wntj o qqXdSqWtd|dS(sUnpack `filename` to `extract_dir`, or raise ``UnrecognizedFormat`` `progress_filter` is a function taking two arguments: a source path internal to the archive ('/'-separated), and a filesystem path where it will be extracted. The callback must return the desired extract path (which may be the same as the one passed in), or else ``None`` to skip that file or directory. The callback can thus be used to report on the progress of the extraction, as well as to filter the items extracted or alter their extraction paths. `drivers`, if supplied, must be a non-empty sequence of functions with the same signature as this function (minus the `drivers` argument), that raise ``UnrecognizedFormat`` if they do not support extracting the designated archive type. The `drivers` are tried in sequence until one is found that does not raise an error, or until all are exhausted (in which case ``UnrecognizedFormat`` is raised). If you do not supply a sequence of drivers, the module's ``extraction_drivers`` constant will be used, which means that ``unpack_zipfile`` and ``unpack_tarfile`` will be tried, in that order. Ns!Not a recognized archive type: %s(sdriverssextraction_driverssdriversfilenames extract_dirsprogress_filtersUnrecognizedFormat(sfilenames extract_dirsprogress_filtersdriverssdriver((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/archive_util.pysunpack_archive*sc CsOtii| otd|fnh|d|f<}xti|D]\} }} || \}}xD|D]<}||dtii||f|tii| |ss/s..iN(starfilesopensfilenamestarobjsTarErrorsUnrecognizedFormatschownsmembersisfilesisdirsnames startswithsosspathsjoins extract_dirssplitsdstsprogress_filtersendswithsseps_extract_membersTruesclose(sfilenames extract_dirsprogress_filtersmembersnamesdststarobj((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/archive_util.pysunpack_tarfiles*   (s__doc__s__all__szipfilestarfilesossshutils pkg_resourcessensure_directorysdistutils.errorssDistutilsErrorsUnrecognizedFormatsdefault_filtersNonesunpack_archivesunpack_directorysunpack_zipfilesunpack_tarfilesextraction_drivers(s__all__sunpack_archiveszipfilesunpack_tarfilestarfilesensure_directorysunpack_zipfilesUnrecognizedFormatsunpack_directorysdefault_filtersshutilsossDistutilsErrorsextraction_drivers((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/archive_util.pys?s$   ) ) ) #PKVb$7+7klklsetuptools/package_index.py"""PyPI and direct package downloading""" import sys, os.path, re, urlparse, urllib2, shutil, random, socket, cStringIO from pkg_resources import * from distutils import log from distutils.errors import DistutilsError from md5 import md5 from fnmatch import translate EGG_FRAGMENT = re.compile(r'^egg=([-A-Za-z0-9_.]+)$') HREF = re.compile("""href\\s*=\\s*['"]?([^'"> ]+)""", re.I) # this is here to fix emacs' cruddy broken syntax highlighting PYPI_MD5 = re.compile( '([^<]+)\n\s+\\(md5\\)' ) URL_SCHEME = re.compile('([-+.a-z0-9]{2,}):',re.I).match EXTENSIONS = ".tar.gz .tar.bz2 .tar .zip .tgz".split() __all__ = [ 'PackageIndex', 'distros_for_url', 'parse_bdist_wininst', 'interpret_distro_name', ] def parse_bdist_wininst(name): """Return (base,pyversion) or (None,None) for possible .exe name""" lower = name.lower() base, py_ver = None, None if lower.endswith('.exe'): if lower.endswith('.win32.exe'): base = name[:-10] elif lower.startswith('.win32-py',-16): py_ver = name[-7:-4] base = name[:-16] return base,py_ver def egg_info_for_url(url): scheme, server, path, parameters, query, fragment = urlparse.urlparse(url) base = urllib2.unquote(path.split('/')[-1]) if '#' in base: base, fragment = base.split('#',1) return base,fragment def distros_for_url(url, metadata=None): """Yield egg or source distribution objects that might be found at a URL""" base, fragment = egg_info_for_url(url) for dist in distros_for_location(url, base, metadata): yield dist if fragment: match = EGG_FRAGMENT.match(fragment) if match: for dist in interpret_distro_name( url, match.group(1), metadata, precedence = CHECKOUT_DIST ): yield dist def distros_for_location(location, basename, metadata=None): """Yield egg or source distribution objects based on basename""" if basename.endswith('.egg.zip'): basename = basename[:-4] # strip the .zip if basename.endswith('.egg') and '-' in basename: # only one, unambiguous interpretation return [Distribution.from_location(location, basename, metadata)] if basename.endswith('.exe'): win_base, py_ver = parse_bdist_wininst(basename) if win_base is not None: return interpret_distro_name( location, win_base, metadata, py_ver, BINARY_DIST, "win32" ) # Try source distro extensions (.zip, .tgz, etc.) # for ext in EXTENSIONS: if basename.endswith(ext): basename = basename[:-len(ext)] return interpret_distro_name(location, basename, metadata) return [] # no extension matched def distros_for_filename(filename, metadata=None): """Yield possible egg or source distribution objects based on a filename""" return distros_for_location( normalize_path(filename), os.path.basename(filename), metadata ) def interpret_distro_name(location, basename, metadata, py_version=None, precedence=SOURCE_DIST, platform=None ): """Generate alternative interpretations of a source distro name Note: if `location` is a filesystem filename, you should call ``pkg_resources.normalize_path()`` on it before passing it to this routine! """ # Generate alternative interpretations of a source distro name # Because some packages are ambiguous as to name/versions split # e.g. "adns-python-1.1.0", "egenix-mx-commercial", etc. # So, we generate each possible interepretation (e.g. "adns, python-1.1.0" # "adns-python, 1.1.0", and "adns-python-1.1.0, no version"). In practice, # the spurious interpretations should be ignored, because in the event # there's also an "adns" package, the spurious "python-1.1.0" version will # compare lower than any numeric version number, and is therefore unlikely # to match a request for it. It's still a potential problem, though, and # in the long run PyPI and the distutils should go for "safe" names and # versions in distribution archive names (sdist and bdist). parts = basename.split('-') if not py_version: for i,p in enumerate(parts[2:]): if len(p)==5 and p.startswith('py2.'): return # It's a bdist_dumb, not an sdist -- bail out for p in range(1,len(parts)+1): yield Distribution( location, metadata, '-'.join(parts[:p]), '-'.join(parts[p:]), py_version=py_version, precedence = precedence, platform = platform ) REL = re.compile("""<([^>]*\srel\s*=\s*['"]?([^'">]+)[^>]*)>""", re.I) # this line is here to fix emacs' cruddy broken syntax highlighting def find_external_links(url, page): """Find rel="homepage" and rel="download" links in `page`, yielding URLs""" for match in REL.finditer(page): tag, rel = match.groups() rels = map(str.strip, rel.lower().split(',')) if 'homepage' in rels or 'download' in rels: for match in HREF.finditer(tag): yield urlparse.urljoin(url, htmldecode(match.group(1))) for tag in ("Home Page", "Download URL"): pos = page.find(tag) if pos!=-1: match = HREF.search(page,pos) if match: yield urlparse.urljoin(url, htmldecode(match.group(1))) user_agent = "Python-urllib/%s setuptools/%s" % ( urllib2.__version__, require('setuptools')[0].version ) class PackageIndex(Environment): """A distribution index that scans web pages for download URLs""" def __init__(self, index_url="http://pypi.python.org/simple", hosts=('*',), *args, **kw ): Environment.__init__(self,*args,**kw) self.index_url = index_url + "/"[:not index_url.endswith('/')] self.scanned_urls = {} self.fetched_urls = {} self.package_pages = {} self.allows = re.compile('|'.join(map(translate,hosts))).match self.to_scan = [] def process_url(self, url, retrieve=False): """Evaluate a URL as a possible download, and maybe retrieve it""" if url in self.scanned_urls and not retrieve: return self.scanned_urls[url] = True if not URL_SCHEME(url): self.process_filename(url) return else: dists = list(distros_for_url(url)) if dists: if not self.url_ok(url): return self.debug("Found link: %s", url) if dists or not retrieve or url in self.fetched_urls: map(self.add, dists) return # don't need the actual page if not self.url_ok(url): self.fetched_urls[url] = True return self.info("Reading %s", url) f = self.open_url(url, "Download error: %s -- Some packages may not be found!") if f is None: return self.fetched_urls[url] = self.fetched_urls[f.url] = True if 'html' not in f.headers.get('content-type', '').lower(): f.close() # not html, we can't process it return base = f.url # handle redirects page = f.read() f.close() if url.startswith(self.index_url) and getattr(f,'code',None)!=404: page = self.process_index(url, page) for match in HREF.finditer(page): link = urlparse.urljoin(base, htmldecode(match.group(1))) self.process_url(link) def process_filename(self, fn, nested=False): # process filenames or directories if not os.path.exists(fn): self.warn("Not found: %s", fn) return if os.path.isdir(fn) and not nested: path = os.path.realpath(fn) for item in os.listdir(path): self.process_filename(os.path.join(path,item), True) dists = distros_for_filename(fn) if dists: self.debug("Found: %s", fn) map(self.add, dists) def url_ok(self, url, fatal=False): if self.allows(urlparse.urlparse(url)[1]): return True msg = "\nLink to % s ***BLOCKED*** by --allow-hosts\n" if fatal: raise DistutilsError(msg % url) else: self.warn(msg, url) def scan_egg_links(self, search_path): for item in search_path: if os.path.isdir(item): for entry in os.listdir(item): if entry.endswith('.egg-link'): self.scan_egg_link(item, entry) def scan_egg_link(self, path, entry): lines = filter(None, map(str.strip, file(os.path.join(path, entry)))) if len(lines)==2: for dist in find_distributions(os.path.join(path, lines[0])): dist.location = os.path.join(path, *lines) dist.precedence = SOURCE_DIST self.add(dist) def process_index(self,url,page): """Process the contents of a PyPI page""" def scan(link): # Process a URL to see if it's for a package page if link.startswith(self.index_url): parts = map( urllib2.unquote, link[len(self.index_url):].split('/') ) if len(parts)==2 and '#' not in parts[1]: # it's a package page, sanitize and index it pkg = safe_name(parts[0]) ver = safe_version(parts[1]) self.package_pages.setdefault(pkg.lower(),{})[link] = True return to_filename(pkg), to_filename(ver) return None, None # process an index page into the package-page index for match in HREF.finditer(page): scan( urlparse.urljoin(url, htmldecode(match.group(1))) ) pkg, ver = scan(url) # ensure this page is in the page index if pkg: # process individual package page for new_url in find_external_links(url, page): # Process the found URL base, frag = egg_info_for_url(new_url) if base.endswith('.py') and not frag: if ver: new_url+='#egg=%s-%s' % (pkg,ver) else: self.need_version_info(url) self.scan_url(new_url) return PYPI_MD5.sub( lambda m: '%s' % m.group(1,3,2), page ) else: return "" # no sense double-scanning non-package pages def need_version_info(self, url): self.scan_all( "Page at %s links to .py file(s) without version info; an index " "scan is required.", url ) def scan_all(self, msg=None, *args): if self.index_url not in self.fetched_urls: if msg: self.warn(msg,*args) self.info( "Scanning index of all packages (this may take a while)" ) self.scan_url(self.index_url) def find_packages(self, requirement): self.scan_url(self.index_url + requirement.unsafe_name+'/') if not self.package_pages.get(requirement.key): # Fall back to safe version of the name self.scan_url(self.index_url + requirement.project_name+'/') if not self.package_pages.get(requirement.key): # We couldn't find the target package, so search the index page too self.not_found_in_index(requirement) for url in list(self.package_pages.get(requirement.key,())): # scan each page that might be related to the desired package self.scan_url(url) def obtain(self, requirement, installer=None): self.prescan(); self.find_packages(requirement) for dist in self[requirement.key]: if dist in requirement: return dist self.debug("%s does not match %s", requirement, dist) return super(PackageIndex, self).obtain(requirement,installer) def check_md5(self, cs, info, filename, tfp): if re.match('md5=[0-9a-f]{32}$', info): self.debug("Validating md5 checksum for %s", filename) if cs.hexdigest()<>info[4:]: tfp.close() os.unlink(filename) raise DistutilsError( "MD5 validation failed for "+os.path.basename(filename)+ "; possible download problem?" ) def add_find_links(self, urls): """Add `urls` to the list that will be prescanned for searches""" for url in urls: if ( self.to_scan is None # if we have already "gone online" or not URL_SCHEME(url) # or it's a local file/directory or url.startswith('file:') or list(distros_for_url(url)) # or a direct package link ): # then go ahead and process it now self.scan_url(url) else: # otherwise, defer retrieval till later self.to_scan.append(url) def prescan(self): """Scan urls scheduled for prescanning (e.g. --find-links)""" if self.to_scan: map(self.scan_url, self.to_scan) self.to_scan = None # from now on, go ahead and process immediately def not_found_in_index(self, requirement): if self[requirement.key]: # we've seen at least one distro meth, msg = self.info, "Couldn't retrieve index page for %r" else: # no distros seen for this name, might be misspelled meth, msg = (self.warn, "Couldn't find index page for %r (maybe misspelled?)") meth(msg, requirement.unsafe_name) self.scan_all() def download(self, spec, tmpdir): """Locate and/or download `spec` to `tmpdir`, returning a local path `spec` may be a ``Requirement`` object, or a string containing a URL, an existing local filename, or a project/version requirement spec (i.e. the string form of a ``Requirement`` object). If it is the URL of a .py file with an unambiguous ``#egg=name-version`` tag (i.e., one that escapes ``-`` as ``_`` throughout), a trivial ``setup.py`` is automatically created alongside the downloaded file. If `spec` is a ``Requirement`` object or a string containing a project/version requirement spec, this method returns the location of a matching distribution (possibly after downloading it to `tmpdir`). If `spec` is a locally existing file or directory name, it is simply returned unchanged. If `spec` is a URL, it is downloaded to a subpath of `tmpdir`, and the local filename is returned. Various errors may be raised if a problem occurs during downloading. """ if not isinstance(spec,Requirement): scheme = URL_SCHEME(spec) if scheme: # It's a url, download it to tmpdir found = self._download_url(scheme.group(1), spec, tmpdir) base, fragment = egg_info_for_url(spec) if base.endswith('.py'): found = self.gen_setup(found,fragment,tmpdir) return found elif os.path.exists(spec): # Existing file or directory, just return it return spec else: try: spec = Requirement.parse(spec) except ValueError: raise DistutilsError( "Not a URL, existing file, or requirement spec: %r" % (spec,) ) return getattr(self.fetch_distribution(spec, tmpdir),'location',None) def fetch_distribution(self, requirement, tmpdir, force_scan=False, source=False, develop_ok=False ): """Obtain a distribution suitable for fulfilling `requirement` `requirement` must be a ``pkg_resources.Requirement`` instance. If necessary, or if the `force_scan` flag is set, the requirement is searched for in the (online) package index as well as the locally installed packages. If a distribution matching `requirement` is found, the returned distribution's ``location`` is the value you would have gotten from calling the ``download()`` method with the matching distribution's URL or filename. If no matching distribution is found, ``None`` is returned. If the `source` flag is set, only source distributions and source checkout links will be considered. Unless the `develop_ok` flag is set, development and system eggs (i.e., those using the ``.egg-info`` format) will be ignored. """ # process a Requirement self.info("Searching for %s", requirement) skipped = {} def find(req): # Find a matching distribution; may be called more than once for dist in self[req.key]: if dist.precedence==DEVELOP_DIST and not develop_ok: if dist not in skipped: self.warn("Skipping development or system egg: %s",dist) skipped[dist] = 1 continue if dist in req and (dist.precedence<=SOURCE_DIST or not source): self.info("Best match: %s", dist) return dist.clone( location=self.download(dist.location, tmpdir) ) if force_scan: self.prescan() self.find_packages(requirement) dist = find(requirement) if dist is None and self.to_scan is not None: self.prescan() dist = find(requirement) if dist is None and not force_scan: self.find_packages(requirement) dist = find(requirement) if dist is None: self.warn( "No local packages or download links found for %s%s", (source and "a source distribution of " or ""), requirement, ) return dist def fetch(self, requirement, tmpdir, force_scan=False, source=False): """Obtain a file suitable for fulfilling `requirement` DEPRECATED; use the ``fetch_distribution()`` method now instead. For backward compatibility, this routine is identical but returns the ``location`` of the downloaded distribution instead of a distribution object. """ dist = self.fetch_distribution(requirement,tmpdir,force_scan,source) if dist is not None: return dist.location return None def gen_setup(self, filename, fragment, tmpdir): match = EGG_FRAGMENT.match(fragment) dists = match and [d for d in interpret_distro_name(filename, match.group(1), None) if d.version ] or [] if len(dists)==1: # unambiguous ``#egg`` fragment basename = os.path.basename(filename) # Make sure the file has been downloaded to the temp dir. if os.path.dirname(filename) != tmpdir: dst = os.path.join(tmpdir, basename) from setuptools.command.easy_install import samefile if not samefile(filename, dst): shutil.copy2(filename, dst) filename=dst file = open(os.path.join(tmpdir, 'setup.py'), 'w') file.write( "from setuptools import setup\n" "setup(name=%r, version=%r, py_modules=[%r])\n" % ( dists[0].project_name, dists[0].version, os.path.splitext(basename)[0] ) ) file.close() return filename elif match: raise DistutilsError( "Can't unambiguously interpret project/version identifier %r; " "any dashes in the name or version should be escaped using " "underscores. %r" % (fragment,dists) ) else: raise DistutilsError( "Can't process plain .py files without an '#egg=name-version'" " suffix to enable automatic setup script generation." ) dl_blocksize = 8192 def _download_to(self, url, filename): self.info("Downloading %s", url) # Download the file fp, tfp, info = None, None, None try: if '#' in url: url, info = url.split('#', 1) fp = self.open_url(url) if isinstance(fp, urllib2.HTTPError): raise DistutilsError( "Can't download %s: %s %s" % (url, fp.code,fp.msg) ) cs = md5() headers = fp.info() blocknum = 0 bs = self.dl_blocksize size = -1 if "content-length" in headers: size = int(headers["Content-Length"]) self.reporthook(url, filename, blocknum, bs, size) tfp = open(filename,'wb') while True: block = fp.read(bs) if block: cs.update(block) tfp.write(block) blocknum += 1 self.reporthook(url, filename, blocknum, bs, size) else: break if info: self.check_md5(cs, info, filename, tfp) return headers finally: if fp: fp.close() if tfp: tfp.close() def reporthook(self, url, filename, blocknum, blksize, size): pass # no-op def open_url(self, url, warning=None): if url.startswith('file:'): return local_open(url) try: return open_with_auth(url) except urllib2.HTTPError, v: return v except urllib2.URLError, v: if warning: self.warn(warning, v.reason) else: raise DistutilsError("Download error for %s: %s" % (url, v.reason)) def _download_url(self, scheme, url, tmpdir): # Determine download filename # name = filter(None,urlparse.urlparse(url)[2].split('/')) if name: name = name[-1] while '..' in name: name = name.replace('..','.').replace('\\','_') else: name = "__downloaded__" # default if URL has no path contents if name.endswith('.egg.zip'): name = name[:-4] # strip the extra .zip before download filename = os.path.join(tmpdir,name) # Download the file # if scheme=='svn' or scheme.startswith('svn+'): return self._download_svn(url, filename) elif scheme=='file': return urllib2.url2pathname(urlparse.urlparse(url)[2]) else: self.url_ok(url, True) # raises error if not allowed return self._attempt_download(url, filename) def scan_url(self, url): self.process_url(url, True) def _attempt_download(self, url, filename): headers = self._download_to(url, filename) if 'html' in headers.get('content-type','').lower(): return self._download_html(url, headers, filename) else: return filename def _download_html(self, url, headers, filename): file = open(filename) for line in file: if line.strip(): # Check for a subversion index page if re.search(r'Revision \d+:', line): # it's a subversion index page: file.close() os.unlink(filename) return self._download_svn(url, filename) break # not an index page file.close() os.unlink(filename) raise DistutilsError("Unexpected HTML page found at "+url) def _download_svn(self, url, filename): url = url.split('#',1)[0] # remove any fragment for svn's sake self.info("Doing subversion checkout from %s to %s", url, filename) os.system("svn checkout -q %s %s" % (url, filename)) return filename def debug(self, msg, *args): log.debug(msg, *args) def info(self, msg, *args): log.info(msg, *args) def warn(self, msg, *args): log.warn(msg, *args) # This pattern matches a character entity reference (a decimal numeric # references, a hexadecimal numeric reference, or a named reference). entity_sub = re.compile(r'&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?').sub def uchr(c): if not isinstance(c, int): return c if c>255: return unichr(c) return chr(c) def decode_entity(match): what = match.group(1) if what.startswith('#x'): what = int(what[2:], 16) elif what.startswith('#'): what = int(what[1:]) else: from htmlentitydefs import name2codepoint what = name2codepoint.get(what, match.group(0)) return uchr(what) def htmldecode(text): """Decode HTML entities in the given text.""" return entity_sub(decode_entity, text) def open_with_auth(url): """Open a urllib2 request, handling HTTP authentication""" scheme, netloc, path, params, query, frag = urlparse.urlparse(url) if scheme in ('http', 'https'): auth, host = urllib2.splituser(netloc) else: auth = None if auth: auth = "Basic " + urllib2.unquote(auth).encode('base64').strip() new_url = urlparse.urlunparse((scheme,host,path,params,query,frag)) request = urllib2.Request(new_url) request.add_header("Authorization", auth) else: request = urllib2.Request(url) request.add_header('User-Agent', user_agent) fp = urllib2.urlopen(request) if auth: # Put authentication info back into request URL if same host, # so that links found on the page will work s2, h2, path2, param2, query2, frag2 = urlparse.urlparse(fp.url) if s2==scheme and h2==host: fp.url = urlparse.urlunparse((s2,netloc,path2,param2,query2,frag2)) return fp def fix_sf_url(url): return url # backward compatibility def local_open(url): """Read a local path, with special support for directories""" scheme, server, path, param, query, frag = urlparse.urlparse(url) filename = urllib2.url2pathname(path) if os.path.isfile(filename): return urllib2.urlopen(url) elif path.endswith('/') and os.path.isdir(filename): files = [] for f in os.listdir(filename): if f=='index.html': body = open(os.path.join(filename,f),'rb').read() break elif os.path.isdir(os.path.join(filename,f)): f+='/' files.append("<a href=%r>%s</a>" % (f,f)) else: body = ("<html><head><title>%s" % url) + \ "%s" % '\n'.join(files) status, message = 200, "OK" else: status, message, body = 404, "Path not found", "Not found" return urllib2.HTTPError(url, status, message, {'content-type':'text/html'}, cStringIO.StringIO(body)) # this line is a kludge to keep the trailing blank lines for pje's editor PK$7!qh setuptools/__init__.py"""Extensions to the 'distutils' for large or complex distributions""" from setuptools.extension import Extension, Library from setuptools.dist import Distribution, Feature, _get_unpatched import distutils.core, setuptools.command from setuptools.depends import Require from distutils.core import Command as _Command from distutils.util import convert_path import os.path __version__ = '0.6c7' __all__ = [ 'setup', 'Distribution', 'Feature', 'Command', 'Extension', 'Require', 'find_packages' ] bootstrap_install_from = None def find_packages(where='.', exclude=()): """Return a list all Python packages found within directory 'where' 'where' should be supplied as a "cross-platform" (i.e. URL-style) path; it will be converted to the appropriate local path syntax. 'exclude' is a sequence of package names to exclude; '*' can be used as a wildcard in the names, such that 'foo.*' will exclude all subpackages of 'foo' (but not 'foo' itself). """ out = [] stack=[(convert_path(where), '')] while stack: where,prefix = stack.pop(0) for name in os.listdir(where): fn = os.path.join(where,name) if ('.' not in name and os.path.isdir(fn) and os.path.isfile(os.path.join(fn,'__init__.py')) ): out.append(prefix+name); stack.append((fn,prefix+name+'.')) for pat in list(exclude)+['ez_setup']: from fnmatch import fnmatchcase out = [item for item in out if not fnmatchcase(item,pat)] return out setup = distutils.core.setup _Command = _get_unpatched(_Command) class Command(_Command): __doc__ = _Command.__doc__ command_consumes_arguments = False def __init__(self, dist, **kw): # Add support for keyword arguments _Command.__init__(self,dist) for k,v in kw.items(): setattr(self,k,v) def reinitialize_command(self, command, reinit_subcommands=0, **kw): cmd = _Command.reinitialize_command(self, command, reinit_subcommands) for k,v in kw.items(): setattr(cmd,k,v) # update command with keywords return cmd import distutils.core distutils.core.Command = Command # we can't patch distutils.cmd, alas def findall(dir = os.curdir): """Find all files under 'dir' and return the list of full filenames (relative to 'dir'). """ all_files = [] for base, dirs, files in os.walk(dir): if base==os.curdir or base.startswith(os.curdir+os.sep): base = base[2:] if base: files = [os.path.join(base, f) for f in files] all_files.extend(filter(os.path.isfile, files)) return all_files import distutils.filelist distutils.filelist.findall = findall # fix findall bug in distutils. PKC8|G G setuptools/depends.pyc; Ec@sdklZdkZdkZdkZdklZlZlZlZdk l Z l Z ddddgZ dfdYZ d Zed Zd ed Zd d ZdS((s generatorsN(s PKG_DIRECTORYs PY_COMPILEDs PY_SOURCEs PY_FROZEN(s StrictVersions LooseVersionsRequires find_modulesget_module_constantsextract_constantcBsYtZdZdeedZdZdZeddZedZedZ RS( s7A prerequisite to building or installing a distributionscCsu|tjo |tj o t}n|tj o'||}|tjo d}qXn|iit|`dS(Ns __version__( sformatsNonesrequested_versions StrictVersions attributesselfs__dict__supdateslocals(sselfsnamesrequested_versionsmoduleshomepages attributesformat((s6build/bdist.darwin-8.0.1-x86/egg/setuptools/depends.pys__init__ s    cCs3|itj od|i|ifSn|iSdS(s0Return full package/distribution name, w/versions%s-%sN(sselfsrequested_versionsNonesname(sself((s6build/bdist.darwin-8.0.1-x86/egg/setuptools/depends.pys full_namescCsD|itjp0|itjp t|djo ||ijSdS(s%Is 'version' sufficiently up-to-date?sunknownN(sselfs attributesNonesformatsstrsversionsrequested_version(sselfsversion((s6build/bdist.darwin-8.0.1-x86/egg/setuptools/depends.pys version_ok$ssunknowncCs|itjoVy8t|i|\}}}|o|i n|SWqft j o tSqfXnt |i|i||}|tj o||j o |itj o|i|Sn|SdS(sGet version number of installed module, 'None', or 'default' Search 'paths' for module. If not found, return 'None'. If found, return the extracted version attribute, or 'default' if no version attribute was specified, or the value cannot be determined without importing the module. The version is formatted according to the requirement's version format (if any), unless it is 'None' or the supplied 'default'. N(sselfs attributesNones find_modulesmodulespathssfspsisclosesdefaults ImportErrorsget_module_constantsvsformat(sselfspathssdefaultsisfspsv((s6build/bdist.darwin-8.0.1-x86/egg/setuptools/depends.pys get_version*s  *cCs|i|tj SdS(s/Return true if dependency is present on 'paths'N(sselfs get_versionspathssNone(sselfspaths((s6build/bdist.darwin-8.0.1-x86/egg/setuptools/depends.pys is_presentFscCs5|i|}|tjotSn|i|SdS(s>Return true if dependency is present and up-to-date on 'paths'N(sselfs get_versionspathssversionsNonesFalses version_ok(sselfspathssversion((s6build/bdist.darwin-8.0.1-x86/egg/setuptools/depends.pys is_currentKs  ( s__name__s __module__s__doc__sNones__init__s full_names version_oks get_versions is_presents is_current(((s6build/bdist.darwin-8.0.1-x86/egg/setuptools/depends.pysRequire s    c csdkl}dkl}l}|d|i}t|i} d}d}x|| jo||}||joN||d||dd|}|d7}||jo|d }qPqnt }|d7}||fVqPWd S( s>Yield '(op,arg)' pair for each operation in code object 'code'(sarray(s HAVE_ARGUMENTs EXTENDED_ARGsbiiiiilN(sarraysdiss HAVE_ARGUMENTs EXTENDED_ARGscodesco_codesbytesslenseofsptrs extended_argsopsargsNone( scodes EXTENDED_ARGs HAVE_ARGUMENTsbytess extended_argsargsarraysopsptrseof((s6build/bdist.darwin-8.0.1-x86/egg/setuptools/depends.pys _iter_codeSs&    "     c Cs|id}x|o|id}ti||\}} \}}}}|tjo|pdg}| g}q|otd||fqqW|SdS(s7Just like 'imp.find_module()', but with package supports.is__init__sCan't find %r in %sN(smodulessplitspartsspopspartsimps find_modulespathssfspathssuffixsmodeskindsinfos PKG_DIRECTORYs ImportError( smodulespathssinfoskindssuffixsfspartsspartsmodespath((s6build/bdist.darwin-8.0.1-x86/egg/setuptools/depends.pys find_module|s(  ic Cs0y%t||\}}\}} }Wntj o t SnXz|t jo |i dt i |}n|tjoti|}nt|tjot|i |d}nK|tijo#ti||||| |fntti||t SWd|o|inXt|||SdS(sFind 'module' by searching 'paths', and extract 'symbol' Return 'None' if 'module' does not exist on 'paths', or it does not define 'symbol'. If the module defines 'symbol' as a constant, return the constant. Otherwise, return 'default'.isexecN(s find_modulesmodulespathssfspathssuffixsmodeskinds ImportErrorsNones PY_COMPILEDsreadsmarshalsloadscodes PY_FROZENsimpsget_frozen_objects PY_SOURCEscompilessyssmoduless load_modulesgetattrssymbolsclosesextract_constantsdefault( smodulessymbolsdefaultspathsscodessuffixspathskindsfsmode((s6build/bdist.darwin-8.0.1-x86/egg/setuptools/depends.pysget_module_constants(%     #c Cs||ijotSnt|ii|}d}d}d}|}xmt |D]_\} }| |jo|i|}qU||jo| |jp | |jo|SqU|}qUWdS(sExtract the constant value of 'symbol' from 'code' If the name 'symbol' is bound to a constant value by the Python code object 'code', return that value. If 'symbol' is bound to an expression, return 'default'. Otherwise, return 'None'. Return value is based on the first assignment to 'symbol'. 'symbol' must be a global, or at least a non-"fast" local in the code block. That is, only 'STORE_NAME' and 'STORE_GLOBAL' opcodes are checked, and 'symbol' must be present in 'code.co_names'. iZiaidN(ssymbolscodesco_namessNoneslistsindexsname_idxs STORE_NAMEs STORE_GLOBALs LOAD_CONSTsdefaultsconsts _iter_codesopsargs co_consts( scodessymbolsdefaultsconstsname_idxs STORE_GLOBALs LOAD_CONSTs STORE_NAMEsargsop((s6build/bdist.darwin-8.0.1-x86/egg/setuptools/depends.pysextract_constants   '(s __future__s generatorsssyssimpsmarshals PKG_DIRECTORYs PY_COMPILEDs PY_SOURCEs PY_FROZENsdistutils.versions StrictVersions LooseVersions__all__sRequires _iter_codesNones find_modulesget_module_constantsextract_constant(s StrictVersions__all__s PY_COMPILEDs find_modulesget_module_constantsRequires LooseVersions _iter_codessyssimps generatorss PKG_DIRECTORYs PY_SOURCEs PY_FROZENsmarshalsextract_constant((s6build/bdist.darwin-8.0.1-x86/egg/setuptools/depends.pys?s I ) ))PKC8|G G setuptools/depends.pyo; Ec@sdklZdkZdkZdkZdklZlZlZlZdk l Z l Z ddddgZ dfdYZ d Zed Zd ed Zd d ZdS((s generatorsN(s PKG_DIRECTORYs PY_COMPILEDs PY_SOURCEs PY_FROZEN(s StrictVersions LooseVersionsRequires find_modulesget_module_constantsextract_constantcBsYtZdZdeedZdZdZeddZedZedZ RS( s7A prerequisite to building or installing a distributionscCsu|tjo |tj o t}n|tj o'||}|tjo d}qXn|iit|`dS(Ns __version__( sformatsNonesrequested_versions StrictVersions attributesselfs__dict__supdateslocals(sselfsnamesrequested_versionsmoduleshomepages attributesformat((s6build/bdist.darwin-8.0.1-x86/egg/setuptools/depends.pys__init__ s    cCs3|itj od|i|ifSn|iSdS(s0Return full package/distribution name, w/versions%s-%sN(sselfsrequested_versionsNonesname(sself((s6build/bdist.darwin-8.0.1-x86/egg/setuptools/depends.pys full_namescCsD|itjp0|itjp t|djo ||ijSdS(s%Is 'version' sufficiently up-to-date?sunknownN(sselfs attributesNonesformatsstrsversionsrequested_version(sselfsversion((s6build/bdist.darwin-8.0.1-x86/egg/setuptools/depends.pys version_ok$ssunknowncCs|itjoVy8t|i|\}}}|o|i n|SWqft j o tSqfXnt |i|i||}|tj o||j o |itj o|i|Sn|SdS(sGet version number of installed module, 'None', or 'default' Search 'paths' for module. If not found, return 'None'. If found, return the extracted version attribute, or 'default' if no version attribute was specified, or the value cannot be determined without importing the module. The version is formatted according to the requirement's version format (if any), unless it is 'None' or the supplied 'default'. N(sselfs attributesNones find_modulesmodulespathssfspsisclosesdefaults ImportErrorsget_module_constantsvsformat(sselfspathssdefaultsisfspsv((s6build/bdist.darwin-8.0.1-x86/egg/setuptools/depends.pys get_version*s  *cCs|i|tj SdS(s/Return true if dependency is present on 'paths'N(sselfs get_versionspathssNone(sselfspaths((s6build/bdist.darwin-8.0.1-x86/egg/setuptools/depends.pys is_presentFscCs5|i|}|tjotSn|i|SdS(s>Return true if dependency is present and up-to-date on 'paths'N(sselfs get_versionspathssversionsNonesFalses version_ok(sselfspathssversion((s6build/bdist.darwin-8.0.1-x86/egg/setuptools/depends.pys is_currentKs  ( s__name__s __module__s__doc__sNones__init__s full_names version_oks get_versions is_presents is_current(((s6build/bdist.darwin-8.0.1-x86/egg/setuptools/depends.pysRequire s    c csdkl}dkl}l}|d|i}t|i} d}d}x|| jo||}||joN||d||dd|}|d7}||jo|d }qPqnt }|d7}||fVqPWd S( s>Yield '(op,arg)' pair for each operation in code object 'code'(sarray(s HAVE_ARGUMENTs EXTENDED_ARGsbiiiiilN(sarraysdiss HAVE_ARGUMENTs EXTENDED_ARGscodesco_codesbytesslenseofsptrs extended_argsopsargsNone( scodes EXTENDED_ARGs HAVE_ARGUMENTsbytess extended_argsargsarraysopsptrseof((s6build/bdist.darwin-8.0.1-x86/egg/setuptools/depends.pys _iter_codeSs&    "     c Cs|id}x|o|id}ti||\}} \}}}}|tjo|pdg}| g}q|otd||fqqW|SdS(s7Just like 'imp.find_module()', but with package supports.is__init__sCan't find %r in %sN(smodulessplitspartsspopspartsimps find_modulespathssfspathssuffixsmodeskindsinfos PKG_DIRECTORYs ImportError( smodulespathssinfoskindssuffixsfspartsspartsmodespath((s6build/bdist.darwin-8.0.1-x86/egg/setuptools/depends.pys find_module|s(  ic Cs0y%t||\}}\}} }Wntj o t SnXz|t jo |i dt i |}n|tjoti|}nt|tjot|i |d}nK|tijo#ti||||| |fntti||t SWd|o|inXt|||SdS(sFind 'module' by searching 'paths', and extract 'symbol' Return 'None' if 'module' does not exist on 'paths', or it does not define 'symbol'. If the module defines 'symbol' as a constant, return the constant. Otherwise, return 'default'.isexecN(s find_modulesmodulespathssfspathssuffixsmodeskinds ImportErrorsNones PY_COMPILEDsreadsmarshalsloadscodes PY_FROZENsimpsget_frozen_objects PY_SOURCEscompilessyssmoduless load_modulesgetattrssymbolsclosesextract_constantsdefault( smodulessymbolsdefaultspathsscodessuffixspathskindsfsmode((s6build/bdist.darwin-8.0.1-x86/egg/setuptools/depends.pysget_module_constants(%     #c Cs||ijotSnt|ii|}d}d}d}|}xmt |D]_\} }| |jo|i|}qU||jo| |jp | |jo|SqU|}qUWdS(sExtract the constant value of 'symbol' from 'code' If the name 'symbol' is bound to a constant value by the Python code object 'code', return that value. If 'symbol' is bound to an expression, return 'default'. Otherwise, return 'None'. Return value is based on the first assignment to 'symbol'. 'symbol' must be a global, or at least a non-"fast" local in the code block. That is, only 'STORE_NAME' and 'STORE_GLOBAL' opcodes are checked, and 'symbol' must be present in 'code.co_names'. iZiaidN(ssymbolscodesco_namessNoneslistsindexsname_idxs STORE_NAMEs STORE_GLOBALs LOAD_CONSTsdefaultsconsts _iter_codesopsargs co_consts( scodessymbolsdefaultsconstsname_idxs STORE_GLOBALs LOAD_CONSTs STORE_NAMEsargsop((s6build/bdist.darwin-8.0.1-x86/egg/setuptools/depends.pysextract_constants   '(s __future__s generatorsssyssimpsmarshals PKG_DIRECTORYs PY_COMPILEDs PY_SOURCEs PY_FROZENsdistutils.versions StrictVersions LooseVersions__all__sRequires _iter_codesNones find_modulesget_module_constantsextract_constant(s StrictVersions__all__s PY_COMPILEDs find_modulesget_module_constantsRequires LooseVersions _iter_codessyssimps generatorss PKG_DIRECTORYs PY_SOURCEs PY_FROZENsmarshalsextract_constant((s6build/bdist.darwin-8.0.1-x86/egg/setuptools/depends.pys?s I ) ))PKC8Vsetuptools/__init__.pyo; !Fc@sdZdklZlZdklZlZlZdkZ dk Z dk l Z dklZdklZdkZdZdd d d d d dgZeZdfdZe iiZeeZd efdYZdkZ ee i_eidZdkZ ee i_dS(s@Extensions to the 'distutils' for large or complex distributions(s ExtensionsLibrary(s DistributionsFeatures_get_unpatchedN(sRequire(sCommand(s convert_paths0.6c7ssetups DistributionsFeaturesCommands ExtensionsRequires find_packagess.c CsOg} t|dfg}x|o|id\}}xti|D]}ti i ||} d|jo2ti i | oti i ti i | do0| i|||i| ||dfqJqJWqWxdt|dgD]O}dkl}gi}| D]%}||| o||qq~} qW| SdS(sReturn a list all Python packages found within directory 'where' 'where' should be supplied as a "cross-platform" (i.e. URL-style) path; it will be converted to the appropriate local path syntax. 'exclude' is a sequence of package names to exclude; '*' can be used as a wildcard in the names, such that 'foo.*' will exclude all subpackages of 'foo' (but not 'foo' itself). sis.s __init__.pysez_setup(s fnmatchcaseN(souts convert_pathswheresstackspopsprefixsosslistdirsnamespathsjoinsfnsisdirsisfilesappendslistsexcludespatsfnmatchs fnmatchcases_[1]sitem( swheresexcludespatsnames fnmatchcases_[1]sitemsprefixsstacksfnsout((s7build/bdist.darwin-8.0.1-x86/egg/setuptools/__init__.pys find_packagess B9 @cBs,tZeiZeZdZddZRS(NcKsAti||x*|iD]\}}t|||qWdS(N( s_Commands__init__sselfsdistskwsitemssksvssetattr(sselfsdistskwsvsk((s7build/bdist.darwin-8.0.1-x86/egg/setuptools/__init__.pys__init__3s icKsJti|||}x*|iD]\}}t |||q"W|SdS(N( s_Commandsreinitialize_commandsselfscommandsreinit_subcommandsscmdskwsitemssksvssetattr(sselfscommandsreinit_subcommandsskwscmdsvsk((s7build/bdist.darwin-8.0.1-x86/egg/setuptools/__init__.pysreinitialize_command9s  (s__name__s __module__s_Commands__doc__sFalsescommand_consumes_argumentss__init__sreinitialize_command(((s7build/bdist.darwin-8.0.1-x86/egg/setuptools/__init__.pysCommand.s  cCsg}xti|D]\}}}|tijp|ititi o|d}n|o:gi }|D]}|ti i||qr~}n|itti i|qW|SdS(s^Find all files under 'dir' and return the list of full filenames (relative to 'dir'). iN(s all_filessosswalksdirsbasesdirssfilesscurdirs startswithssepsappends_[1]sfspathsjoinsextendsfiltersisfile(sdirsdirssfilessfs_[1]sbases all_files((s7build/bdist.darwin-8.0.1-x86/egg/setuptools/__init__.pysfindallBs*: (s__doc__ssetuptools.extensions ExtensionsLibraryssetuptools.dists DistributionsFeatures_get_unpatchedsdistutils.cores distutilsssetuptools.commands setuptoolsssetuptools.dependssRequiresCommands_Commandsdistutils.utils convert_pathsos.pathsoss __version__s__all__sNonesbootstrap_install_froms find_packagesscoressetupscurdirsfindallsdistutils.filelistsfilelist(s convert_paths Extensions distutilssossRequires_CommandsFeaturesLibrarysfindallsCommands setuptoolssbootstrap_install_fromssetups Distributions __version__s_get_unpatcheds find_packagess__all__((s7build/bdist.darwin-8.0.1-x86/egg/setuptools/__init__.pys?s&         PKC8}Â1212setuptools/sandbox.pyc; ӣEc @sdkZdkZdkZdkZdkZeieiZeZ dk l Z ddddgZ dZ dfdYZdefdYZeeigiZd iD]Zeeeed q[Zde fd YZdS( N(sDistutilsErrorsAbstractSandboxsDirectorySandboxsSandboxViolations run_setupc sKti}ti}ti}tiitii }tii |d}tii| oti|nti}z|t_ti|yGgt|ti(tiid|t|idWn4tj o(}|io |idoqnXWdti||ti(|ti(|t_XdS(s8Run a distutils setup script, sandboxed in its directorystempicstdhd<dd<S(Nssetup.pys__file__s__name__s__main__(sexecfiles setup_script((s setup_script(s6build/bdist.darwin-8.0.1-x86/egg/setuptools/sandbox.pyssN(sossgetcwdsold_dirssyssargvs save_argvspaths save_pathsabspathsdirnames setup_scripts setup_dirsjoinstemp_dirsisdirsmakedirsstempfilestempdirssave_tmpschdirslistsargssinsertsDirectorySandboxsruns SystemExitsv( s setup_scriptsargssold_dirstemp_dirs setup_dirsvs save_argvs save_pathssave_tmp((s setup_scripts6build/bdist.darwin-8.0.1-x86/egg/setuptools/sandbox.pys run_setup s0         cBstZdZeZdZdZdZdZx>dddgD]-Z e e e oee e e ss/s..iN(starfilesopensfilenamestarobjsTarErrorsUnrecognizedFormatschownsmembersisfilesisdirsnames startswithsosspathsjoins extract_dirssplitsdstsprogress_filtersendswithsseps_extract_membersTruesclose(sfilenames extract_dirsprogress_filtersmembersnamesdststarobj((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/archive_util.pysunpack_tarfiles*   (s__doc__s__all__szipfilestarfilesossshutils pkg_resourcessensure_directorysdistutils.errorssDistutilsErrorsUnrecognizedFormatsdefault_filtersNonesunpack_archivesunpack_directorysunpack_zipfilesunpack_tarfilesextraction_drivers(s__all__sunpack_archiveszipfilesunpack_tarfilestarfilesensure_directorysunpack_zipfilesUnrecognizedFormatsunpack_directorysdefault_filtersshutilsossDistutilsErrorsextraction_drivers((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/archive_util.pys?s$   ) ) ) #PKd)6:f+setuptools/sandbox.pyimport os, sys, __builtin__, tempfile, operator _os = sys.modules[os.name] _open = open from distutils.errors import DistutilsError __all__ = [ "AbstractSandbox", "DirectorySandbox", "SandboxViolation", "run_setup", ] def run_setup(setup_script, args): """Run a distutils setup script, sandboxed in its directory""" old_dir = os.getcwd() save_argv = sys.argv[:] save_path = sys.path[:] setup_dir = os.path.abspath(os.path.dirname(setup_script)) temp_dir = os.path.join(setup_dir,'temp') if not os.path.isdir(temp_dir): os.makedirs(temp_dir) save_tmp = tempfile.tempdir try: tempfile.tempdir = temp_dir os.chdir(setup_dir) try: sys.argv[:] = [setup_script]+list(args) sys.path.insert(0, setup_dir) DirectorySandbox(setup_dir).run( lambda: execfile( "setup.py", {'__file__':setup_script, '__name__':'__main__'} ) ) except SystemExit, v: if v.args and v.args[0]: raise # Normal exit, just return finally: os.chdir(old_dir) sys.path[:] = save_path sys.argv[:] = save_argv tempfile.tempdir = save_tmp class AbstractSandbox: """Wrap 'os' module and 'open()' builtin for virtualizing setup scripts""" _active = False def __init__(self): self._attrs = [ name for name in dir(_os) if not name.startswith('_') and hasattr(self,name) ] def _copy(self, source): for name in self._attrs: setattr(os, name, getattr(source,name)) def run(self, func): """Run 'func' under os sandboxing""" try: self._copy(self) __builtin__.open = __builtin__.file = self._open self._active = True return func() finally: self._active = False __builtin__.open = __builtin__.file = _open self._copy(_os) def _mk_dual_path_wrapper(name): original = getattr(_os,name) def wrap(self,src,dst,*args,**kw): if self._active: src,dst = self._remap_pair(name,src,dst,*args,**kw) return original(src,dst,*args,**kw) return wrap for name in ["rename", "link", "symlink"]: if hasattr(_os,name): locals()[name] = _mk_dual_path_wrapper(name) def _mk_single_path_wrapper(name, original=None): original = original or getattr(_os,name) def wrap(self,path,*args,**kw): if self._active: path = self._remap_input(name,path,*args,**kw) return original(path,*args,**kw) return wrap _open = _mk_single_path_wrapper('file', _open) for name in [ "stat", "listdir", "chdir", "open", "chmod", "chown", "mkdir", "remove", "unlink", "rmdir", "utime", "lchown", "chroot", "lstat", "startfile", "mkfifo", "mknod", "pathconf", "access" ]: if hasattr(_os,name): locals()[name] = _mk_single_path_wrapper(name) def _mk_single_with_return(name): original = getattr(_os,name) def wrap(self,path,*args,**kw): if self._active: path = self._remap_input(name,path,*args,**kw) return self._remap_output(name, original(path,*args,**kw)) return original(path,*args,**kw) return wrap for name in ['readlink', 'tempnam']: if hasattr(_os,name): locals()[name] = _mk_single_with_return(name) def _mk_query(name): original = getattr(_os,name) def wrap(self,*args,**kw): retval = original(*args,**kw) if self._active: return self._remap_output(name, retval) return retval return wrap for name in ['getcwd', 'tmpnam']: if hasattr(_os,name): locals()[name] = _mk_query(name) def _validate_path(self,path): """Called to remap or validate any path, whether input or output""" return path def _remap_input(self,operation,path,*args,**kw): """Called for path inputs""" return self._validate_path(path) def _remap_output(self,operation,path): """Called for path outputs""" return self._validate_path(path) def _remap_pair(self,operation,src,dst,*args,**kw): """Called for path pairs like rename, link, and symlink operations""" return ( self._remap_input(operation+'-from',src,*args,**kw), self._remap_input(operation+'-to',dst,*args,**kw) ) class DirectorySandbox(AbstractSandbox): """Restrict operations to a single subdirectory - pseudo-chroot""" write_ops = dict.fromkeys([ "open", "chmod", "chown", "mkdir", "remove", "unlink", "rmdir", "utime", "lchown", "chroot", "mkfifo", "mknod", "tempnam", ]) def __init__(self,sandbox): self._sandbox = os.path.normcase(os.path.realpath(sandbox)) self._prefix = os.path.join(self._sandbox,'') AbstractSandbox.__init__(self) def _violation(self, operation, *args, **kw): raise SandboxViolation(operation, args, kw) def _open(self, path, mode='r', *args, **kw): if mode not in ('r', 'rt', 'rb', 'rU', 'U') and not self._ok(path): self._violation("open", path, mode, *args, **kw) return _open(path,mode,*args,**kw) def tmpnam(self): self._violation("tmpnam") def _ok(self,path): active = self._active try: self._active = False realpath = os.path.normcase(os.path.realpath(path)) if realpath==self._sandbox or realpath.startswith(self._prefix): return True finally: self._active = active def _remap_input(self,operation,path,*args,**kw): """Called for path inputs""" if operation in self.write_ops and not self._ok(path): self._violation(operation, os.path.realpath(path), *args, **kw) return path def _remap_pair(self,operation,src,dst,*args,**kw): """Called for path pairs like rename, link, and symlink operations""" if not self._ok(src) or not self._ok(dst): self._violation(operation, src, dst, *args, **kw) return (src,dst) def open(self, file, flags, mode=0777): """Called for low-level os.open()""" if flags & WRITE_FLAGS and not self._ok(file): self._violation("os.open", file, flags, mode) return _os.open(file,flags,mode) WRITE_FLAGS = reduce( operator.or_, [getattr(_os, a, 0) for a in "O_WRONLY O_RDWR O_APPEND O_CREAT O_TRUNC O_TEMPORARY".split()] ) class SandboxViolation(DistutilsError): """A setup script attempted to modify the filesystem outside the sandbox""" def __str__(self): return """SandboxViolation: %s%r %s The package setup script has attempted to modify files on your system that are not within the EasyInstall build area, and has been aborted. This package cannot be safely installed by EasyInstall, and may not support alternate installation locations even if you run its setup script by hand. Please inform the package's author and the EasyInstall maintainers to find out if a fix or workaround is available.""" % self.args # PKC8qFosetuptools/package_index.pyo; eFc@sdZdkZdkZdkZdkZdkZdkZdkZdk Z dk Z dk Tdk l Z dklZdklZdklZeidZeideiZeid Zeid eiiZd iZd d ddgZdZdZedZ edZ!edZ"ee#edZ$eideiZ%dZ&dei'e(ddi)fZ*d e+fdYZ,eidi-Z.dZ/dZ0dZ1d Z2d!Z3d"Z4dS(#s#PyPI and direct package downloadingN(s*(slog(sDistutilsError(smd5(s translates^egg=([-A-Za-z0-9_.]+)$shref\s*=\s*['"]?([^'"> ]+)s([^<]+) \s+\(md5\)s([-+.a-z0-9]{2,}):s.tar.gz .tar.bz2 .tar .zip .tgzs PackageIndexsdistros_for_urlsparse_bdist_wininstsinterpret_distro_namecCs|i}ttf\}}|idoP|ido|d }q~|iddo|dd!}|d }q~n||fSdS( s=Return (base,pyversion) or (None,None) for possible .exe names.exes .win32.exeis .win32-pyiiiN(snameslowersNonesbasespy_versendswiths startswith(snameslowersbasespy_ver((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysparse_bdist_wininsts  cCstti|\}}}}}}ti |i dd}d|jo|i dd\}}n||fSdS(Ns/is#i( surlparsesurlsschemesserverspaths parameterssquerysfragmentsurllib2sunquotessplitsbase(surls parameterssserversfragmentsbasesqueryspathsscheme((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysegg_info_for_url*s ! ccst|\}}xt|||D] }|Vq%W|oNti|}|o4x1t ||i d|dt D] }|VqrWqndS(sEYield egg or source distribution objects that might be found at a URLis precedenceN( segg_info_for_urlsurlsbasesfragmentsdistros_for_locationsmetadatasdists EGG_FRAGMENTsmatchsinterpret_distro_namesgroups CHECKOUT_DIST(surlsmetadatasdistsfragmentsbasesmatch((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysdistros_for_url0s"cCs|ido|d }n|ido d|joti|||gSn|ido@t|\}}|t j ot ||||t dSqnxCt D];}|i|o%|t| }t |||SqqWgSdS(s:Yield egg or source distribution objects based on basenames.egg.zipis.eggs-s.exeswin32N(sbasenamesendswiths Distributions from_locationslocationsmetadatasparse_bdist_wininstswin_basespy_versNonesinterpret_distro_names BINARY_DISTs EXTENSIONSsextslen(slocationsbasenamesmetadatasextswin_basespy_ver((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysdistros_for_location<s !cCs&tt|tii||SdS(sEYield possible egg or source distribution objects based on a filenameN(sdistros_for_locationsnormalize_pathsfilenamesosspathsbasenamesmetadata(sfilenamesmetadata((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysdistros_for_filenameSsc cs|id}| oPxMt|dD]7\}}t|djo |idodSq(q(Wnx`t dt|dD]E}t ||di || di ||d|d|d |VqWdS( sGenerate alternative interpretations of a source distro name Note: if `location` is a filesystem filename, you should call ``pkg_resources.normalize_path()`` on it before passing it to this routine! s-iispy2.Nis py_versions precedencesplatform(sbasenamessplitspartss py_versions enumeratesispslens startswithsranges Distributionslocationsmetadatasjoins precedencesplatform( slocationsbasenamesmetadatas py_versions precedencesplatformspsisparts((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysinterpret_distro_nameZs  #) s(<([^>]*\srel\s*=\s*['"]?([^'">]+)[^>]*)>ccsxti|D]}|i\}}tti |i i d}d|jp d|jo=x:t i|D]%}ti|t|idVqsWqqWxpddfD]b}|i|}|djo@t i||}|o#ti|t|idVqqqWdS( sEFind rel="homepage" and rel="download" links in `page`, yielding URLss,shomepagesdownloadis Home PagesDownload URLiN(sRELsfinditerspagesmatchsgroupsstagsrelsmapsstrsstripslowerssplitsrelssHREFsurlparsesurljoinsurls htmldecodesgroupsfindsposssearch(surlspagesrelspossrelsstagsmatch((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysfind_external_linkss !+  sPython-urllib/%s setuptools/%ss setuptoolsicBsLtZdZddfdZedZedZedZdZdZ d Z d Z e d Z d Ze d ZdZdZdZdZdZeeedZeedZdZdZdZdZe dZdZdZdZdZdZ dZ!d Z"d!Z#RS("s;A distribution index that scans web pages for download URLsshttp://pypi.python.org/simples*cOs}ti||||d|id |_h|_h|_h|_ t i di t t|i|_g|_dS(Ns/s|(s Environments__init__sselfsargsskws index_urlsendswiths scanned_urlss fetched_urlss package_pagessrescompilesjoinsmaps translateshostssmatchsallowssto_scan(sselfs index_urlshostssargsskw((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pys__init__s   'c Cs&||ijo| odSnt|i|%siii(smsgroup(sm((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysssN(sscansHREFsfinditerspagesmatchsurlparsesurljoinsurls htmldecodesgroupspkgsversfind_external_linkssnew_urlsegg_info_for_urlsbasesfragsendswithsselfsneed_version_infosscan_urlsPYPI_MD5ssub( sselfsurlspagesfragsversscansnew_urlspkgsbasesmatch((sselfs<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pys process_indexs" )cCs|id|dS(NsPPage at %s links to .py file(s) without version info; an index scan is required.(sselfsscan_allsurl(sselfsurl((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysneed_version_info s cGsS|i|ijo,|o|i||n|idn|i|idS(Ns6Scanning index of all packages (this may take a while)(sselfs index_urls fetched_urlssmsgswarnsargssinfosscan_url(sselfsmsgsargs((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysscan_all&s cCs|i|i|id|ii|i o|i|i|idn|ii|i o|i |nx3t |ii|ifD]}|i|qWdS(Ns/( sselfsscan_urls index_urls requirements unsafe_names package_pagessgetskeys project_namesnot_found_in_indexslistsurl(sselfs requirementsurl((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pys find_packages.scCst|i|i|x=||iD].}||jo|Sn|id||q%Wtt|i ||SdS(Ns%s does not match %s( sselfsprescans find_packagess requirementskeysdistsdebugssupers PackageIndexsobtains installer(sselfs requirements installersdist((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysobtain=s cCs}tid|of|id||i|djo;|i t i |t dt i i|dqyndS(Nsmd5=[0-9a-f]{32}$sValidating md5 checksum for %sisMD5 validation failed for s; possible download problem?(sresmatchsinfosselfsdebugsfilenamescss hexdigeststfpsclosesossunlinksDistutilsErrorspathsbasename(sselfscssinfosfilenamestfp((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pys check_md5Is   cCswxp|D]h}|itjp.t| p |idptt|o|i |q|ii |qWdS(s;Add `urls` to the list that will be prescanned for searchessfile:N( surlssurlsselfsto_scansNones URL_SCHEMEs startswithslistsdistros_for_urlsscan_urlsappend(sselfsurlssurl((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysadd_find_linksTs AcCs.|iot|i|int|_dS(s7Scan urls scheduled for prescanning (e.g. --find-links)N(sselfsto_scansmapsscan_urlsNone(sself((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysprescancs cCsZ||io|idf\}}n|idf\}}|||i|idS(Ns#Couldn't retrieve index page for %rs3Couldn't find index page for %r (maybe misspelled?)( sselfs requirementskeysinfosmethsmsgswarns unsafe_namesscan_all(sselfs requirementsmsgsmeth((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysnot_found_in_indexis cCst|t ot|}|oa|i|id||}t |\}}|i do|i|||}n|Sqtii|o|Sqyti|}Wqtj otd|fqXnt|i||dtSdS(sLocate and/or download `spec` to `tmpdir`, returning a local path `spec` may be a ``Requirement`` object, or a string containing a URL, an existing local filename, or a project/version requirement spec (i.e. the string form of a ``Requirement`` object). If it is the URL of a .py file with an unambiguous ``#egg=name-version`` tag (i.e., one that escapes ``-`` as ``_`` throughout), a trivial ``setup.py`` is automatically created alongside the downloaded file. If `spec` is a ``Requirement`` object or a string containing a project/version requirement spec, this method returns the location of a matching distribution (possibly after downloading it to `tmpdir`). If `spec` is a locally existing file or directory name, it is simply returned unchanged. If `spec` is a URL, it is downloaded to a subpath of `tmpdir`, and the local filename is returned. Various errors may be raised if a problem occurs during downloading. is.pys1Not a URL, existing file, or requirement spec: %rslocationN(s isinstancesspecs Requirements URL_SCHEMEsschemesselfs _download_urlsgroupstmpdirsfoundsegg_info_for_urlsbasesfragmentsendswiths gen_setupsosspathsexistssparses ValueErrorsDistutilsErrorsgetattrsfetch_distributionsNone(sselfsspecstmpdirsfragmentsbasesfoundsscheme((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysdownloadrs  c sid|hd}|oii|n||}|t jo i t j oi||}n|t jo| oi|||}n|t jo%i dodpd|n|SdS(s|Obtain a distribution suitable for fulfilling `requirement` `requirement` must be a ``pkg_resources.Requirement`` instance. If necessary, or if the `force_scan` flag is set, the requirement is searched for in the (online) package index as well as the locally installed packages. If a distribution matching `requirement` is found, the returned distribution's ``location`` is the value you would have gotten from calling the ``download()`` method with the matching distribution's URL or filename. If no matching distribution is found, ``None`` is returned. If the `source` flag is set, only source distributions and source checkout links will be considered. Unless the `develop_ok` flag is set, development and system eggs (i.e., those using the ``.egg-info`` format) will be ignored. sSearching for %scsx|iD]}|itjo o2|joid|d|Revision \d+:sUnexpected HTML page found at (sopensfilenamesfileslinesstripsressearchsclosesossunlinksselfs _download_svnsurlsDistutilsError(sselfsurlsheaderssfilenamesfilesline((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pys_download_htmlss       cCsH|iddd}|id||tid||f|SdS(Ns#iis'Doing subversion checkout from %s to %sssvn checkout -q %s %s(surlssplitsselfsinfosfilenamesosssystem(sselfsurlsfilename((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pys _download_svnscGsti||dS(N(slogsdebugsmsgsargs(sselfsmsgsargs((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysdebugscGsti||dS(N(slogsinfosmsgsargs(sselfsmsgsargs((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysinfoscGsti||dS(N(slogswarnsmsgsargs(sselfsmsgsargs((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pyswarns($s__name__s __module__s__doc__s__init__sFalses process_urlsprocess_filenamesurl_oksscan_egg_linkss scan_egg_links process_indexsneed_version_infosNonesscan_alls find_packagessobtains check_md5sadd_find_linkssprescansnot_found_in_indexsdownloadsfetch_distributionsfetchs gen_setups dl_blocksizes _download_tos reporthooksopen_urls _download_urlsscan_urls_attempt_downloads_download_htmls _download_svnsdebugsinfoswarn(((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pys PackageIndexs@  )   )      )> ) $        s!&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?cCsBt|t o|Sn|djot|Snt|SdS(Ni(s isinstancescsintsunichrschr(sc((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysuchrs  cCs|id}|idot|dd}nM|idot|d}n)dkl}|i||id}t|SdS(Nis#xiis#(sname2codepointi( smatchsgroupswhats startswithsintshtmlentitydefssname2codepointsgetsuchr(smatchswhatsname2codepoint((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pys decode_entitys cCstt|SdS(s'Decode HTML entities in the given text.N(s entity_subs decode_entitystext(stext((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pys htmldecodescCsgti|\}} }}}} |ddfjoti | \} } nt } | ofdti | idi} ti|| |||| f}ti|}|id| nti|}|idtti|}| ojti|i\}}}}} }||jo || jo(ti|| ||| |f|_q_n|SdS(s4Open a urllib2 request, handling HTTP authenticationshttpshttpssBasic sbase64s Authorizations User-AgentN(surlparsesurlsschemesnetlocspathsparamssquerysfragsurllib2s splitusersauthshostsNonesunquotesencodesstrips urlunparsesnew_urlsRequestsrequests add_headers user_agentsurlopensfpss2sh2spath2sparam2squery2sfrag2(surlsfpsh2squeryss2snew_urlsparamssschemesparam2sfragsquery2snetlocsauthshostspathspath2srequestsfrag2((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysopen_with_auths$!"!$,cCs|SdS(N(surl(surl((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pys fix_sf_urlsc Csti|\} }} }} }ti | }t ii |oti |Sn | idot ii|og}xt i|D]}|djo)tt ii||di}Pn1t iit ii||o|d7}n|id||fqWd|ddi|}dd f\}} nd d d f\}} }ti||| hd d%ss%ss%ss isOKisPath not founds Not founds content-types text/htmlN(surlparsesurlsschemesserverspathsparamsquerysfragsurllib2s url2pathnamesfilenamesossisfilesurlopensendswithsisdirsfilesslistdirsfsopensjoinsreadsbodysappendsstatussmessages HTTPErrors cStringIOsStringIO( surlsfragsfilessfsbodysfilenamesparamsserversstatussqueryspathsmessagesscheme((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pys local_opens(!# $"(5s__doc__ssyssos.pathsossresurlparsesurllib2sshutilsrandomssockets cStringIOs pkg_resourcess distutilsslogsdistutils.errorssDistutilsErrorsmd5sfnmatchs translatescompiles EGG_FRAGMENTsIsHREFsPYPI_MD5smatchs URL_SCHEMEssplits EXTENSIONSs__all__sparse_bdist_wininstsegg_info_for_urlsNonesdistros_for_urlsdistros_for_locationsdistros_for_filenames SOURCE_DISTsinterpret_distro_namesRELsfind_external_linkss __version__srequiresversions user_agents Environments PackageIndexssubs entity_subsuchrs decode_entitys htmldecodesopen_with_auths fix_sf_urls local_open($s cStringIOsrandomsHREFsRELsPYPI_MD5sshutilsfind_external_linkssdistros_for_urls EGG_FRAGMENTsuchrslogs__all__sparse_bdist_wininstsegg_info_for_urls decode_entitys entity_subsres EXTENSIONSs translatesdistros_for_locations local_opens PackageIndexs fix_sf_urlsurllib2ssyssdistros_for_filenamesDistutilsErrorsmd5sinterpret_distro_namessockets URL_SCHEMEsurlparses user_agentsopen_with_authsoss htmldecode((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pys?s<Q         "     ) PKC8}Â1212setuptools/sandbox.pyo; ӣEc @sdkZdkZdkZdkZdkZeieiZeZ dk l Z ddddgZ dZ dfdYZdefdYZeeigiZd iD]Zeeeed q[Zde fd YZdS( N(sDistutilsErrorsAbstractSandboxsDirectorySandboxsSandboxViolations run_setupc sKti}ti}ti}tiitii }tii |d}tii| oti|nti}z|t_ti|yGgt|ti(tiid|t|idWn4tj o(}|io |idoqnXWdti||ti(|ti(|t_XdS(s8Run a distutils setup script, sandboxed in its directorystempicstdhd<dd<S(Nssetup.pys__file__s__name__s__main__(sexecfiles setup_script((s setup_script(s6build/bdist.darwin-8.0.1-x86/egg/setuptools/sandbox.pyssN(sossgetcwdsold_dirssyssargvs save_argvspaths save_pathsabspathsdirnames setup_scripts setup_dirsjoinstemp_dirsisdirsmakedirsstempfilestempdirssave_tmpschdirslistsargssinsertsDirectorySandboxsruns SystemExitsv( s setup_scriptsargssold_dirstemp_dirs setup_dirsvs save_argvs save_pathssave_tmp((s setup_scripts6build/bdist.darwin-8.0.1-x86/egg/setuptools/sandbox.pys run_setup s0         cBstZdZeZdZdZdZdZx>dddgD]-Z e e e oee e e s cCs1t||jotd||fndS(s)Verify that value is True, False, 0, or 1s#%r must be a boolean value (got %r)N(sboolsvaluesDistutilsSetupErrorsattr(sdistsattrsvalue((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pys assert_boolJscCsJytti|Wn,ttfj otd|fnXdS(s9Verify that install_requires is a valid requirements lists^%r must be a string or list of strings containing valid project/version requirement specifiersN(slists pkg_resourcessparse_requirementssvalues TypeErrors ValueErrorsDistutilsSetupErrorsattr(sdistsattrsvalue((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pyscheck_requirementsSs cCs<ytii|Wn!tj o}t|nXdS(s)Verify that entry_points map is parseableN(s pkg_resourcess EntryPoints parse_mapsvalues ValueErrorsesDistutilsSetupError(sdistsattrsvaluese((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pyscheck_entry_points]s cCs%t|t otdndS(Nstest_suite must be a string(s isinstancesvalues basestringsDistutilsSetupError(sdistsattrsvalue((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pyscheck_test_suiteescCst|to`x]|iD]G\}}t|t oPnyt|Wqtj oPqXqWdSnt |ddS(s@Verify that value is a dictionary of package names to glob listsNsI must be a dictionary mapping package names to lists of wildcard patterns( s isinstancesvaluesdictsitemssksvsstrsiters TypeErrorsDistutilsSetupErrorsattr(sdistsattrsvaluesksv((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pyscheck_package_datajs  cBstZdZeZdZedZdZdZdZ dZ dZ dZ d Z d Zd Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZRS(sxDistribution with support for features, tests, and package data This is an enhanced version of 'distutils.dist.Distribution' that effectively adds the following new optional keyword arguments to 'setup()': 'install_requires' -- a string or sequence of strings specifying project versions that the distribution requires when installed, in the format used by 'pkg_resources.require()'. They will be installed automatically when the package is installed. If you wish to use packages that are not available in PyPI, or want to give your users an alternate download location, you can add a 'find_links' option to the '[easy_install]' section of your project's 'setup.cfg' file, and then setuptools will scan the listed web pages for links that satisfy the requirements. 'extras_require' -- a dictionary mapping names of optional "extras" to the additional requirement(s) that using those extras incurs. For example, this:: extras_require = dict(reST = ["docutils>=0.3", "reSTedit"]) indicates that the distribution can optionally provide an extra capability called "reST", but it can only be used if docutils and reSTedit are installed. If the user installs your package using EasyInstall and requests one of your extras, the corresponding additional requirements will be installed if needed. 'features' -- a dictionary mapping option names to 'setuptools.Feature' objects. Features are a portion of the distribution that can be included or excluded based on user options, inter-feature dependencies, and availability on the current system. Excluded features are omitted from all setup commands, including source and binary distributions, so you can create multiple distributions from the same source tree. Feature names should be valid Python identifiers, except that they may contain the '-' (minus) sign. Features can be included or excluded via the command line options '--with-X' and '--without-X', where 'X' is the name of the feature. Whether a feature is included by default, and whether you are allowed to control this from the command line, is determined by the Feature object. See the 'Feature' class for more information. 'test_suite' -- the name of a test suite to run for the 'test' command. If the user runs 'python setup.py test', the package will be installed, and the named test suite will be run. The format is the same as would be used on a 'unittest.py' command line. That is, it is the dotted name of an object to import and call to generate a test suite. 'package_data' -- a dictionary mapping package names to lists of filenames or globs to use to find data files contained in the named packages. If the dictionary has filenames or globs listed under '""' (the empty string), those names will be searched for in every package, in addition to any names for the specific package. Data files found using these names/globs will be installed along with the package, in the same location as the package. Note that globs are allowed to reference the contents of non-package subdirectories, as long as you use '/' as a path separator. (Globs are automatically converted to platform-specific paths at runtime.) In addition to these new keywords, this class also has several new methods for manipulating the distribution's contents. For example, the 'include()' and 'exclude()' methods can be thought of as in-place add and subtract commands that add or remove packages, modules, extensions, and so on from the distribution. They are used by the feature subsystem to configure the distribution for the included and excluded features. cCs| pd|jp d|jodSntit|di}tiii|}|t j o|i d o)ti t|d|_ ||_ndS(NsnamesversionsPKG-INFO(sattrss pkg_resourcess safe_namesstrslowerskeys working_setsby_keysgetsdistsNones has_metadatas safe_versions_versionsselfs _patched_dist(sselfsattrssdistskey((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pyspatch_missing_pkg_infos"cCsGt|d}| o h|_ng|_h|_g|_|i||t j o,|i dg|_ t |d|i n|o d|jo|i |i dnxBtidD]1}t||i ot||it qqWti||t|iitttfot|ii|i_ndS(Ns package_datasdependency_linksssetup_requiressdistutils.setup_keywords(shasattrsselfshave_package_datas package_datasrequire_featuressfeaturess dist_filesspatch_missing_pkg_infosattrssNonespopsdependency_linkssassert_string_listsfetch_build_eggss pkg_resourcessiter_entry_pointssepsnamessetattrs _Distributions__init__s isinstancesmetadatasversionsintslongsfloatsstr(sselfsattrsshave_package_datasep((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pys__init__s&      cCs/ti|}|io|in|SdS(s3Process features after parsing command line optionsN(s _Distributionsparse_command_linesselfsresultsfeaturess_finalize_features(sselfsresult((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pysparse_command_lines  cCsd|iddSdS(s;Convert feature name to corresponding option attribute nameswith_s-s_N(snamesreplace(sselfsname((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pys_feature_attrnamescCsMdkl}l}x3|i||d|iD]}|i|q2WdS(sResolve pre-setup requirements(s working_setsparse_requirementss installerN( s pkg_resourcess working_setsparse_requirementssresolvesrequiressselfsfetch_build_eggsdistsadd(sselfsrequiressdistsparse_requirementss working_set((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pysfetch_build_eggss cCsti||io|inxitidD]X}t||i t }|t j o0|i d|i |i||i |q5q5WdS(Nsdistutils.setup_keywordss installer(s _Distributionsfinalize_optionssselfsfeaturess_set_global_opts_from_featuress pkg_resourcessiter_entry_pointssepsgetattrsnamesNonesvaluesrequiresfetch_build_eggsload(sselfsvaluesep((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pysfinalize_optionss   c Cshy |i}WnGtj o;dkl}|ihddg<}|i|i d}ddddddf}x,|i D]}||jo ||=qqW|ioG|i}d|jo|dd i|}nd |f|d\}}|i| o!|i ||i |dqqWdS(s9Add/remove features and resolve dependencies between themiiN( sselfsfeaturessitemssnamesfeaturesfeature_is_includedsenabledsNonesinclude_by_defaults include_ins _set_features exclude_from(sselfsenabledsnamesfeature((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pys_finalize_featuresIs !   cCs~||ijo|i|SnxXtid|D]4}|id|i|i|i|<}|Sq2Wt i ||SdS(s(Pluggable version of get_command_class()sdistutils.commandss installerN( scommandsselfscmdclasss pkg_resourcessiter_entry_pointssepsrequiresfetch_build_eggsloads _Distributionsget_command_class(sselfscommandscmdclasssep((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pysget_command_class[scCsaxMtidD]<}|i|ijo#|it}||i|i<   cCs|io|iSdS(s+Should this feature be included by default?N(sselfs availablesstandard(sself((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pysinclude_by_defaultscCsW|i ot|idn|i|ix|iD]}|i |q<WdS(sEnsure feature and its requirements are included in distribution You may override this in a subclass to perform additional operations on the distribution. Note that this method may be called more than once per feature, and so should be idempotent. s2 is required,but is not available on this platformN( sselfs availablesDistutilsPlatformErrors descriptionsdistsincludesextrassrequire_featuressfsinclude_feature(sselfsdistsf((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pys include_ins  cCsC|i|i|io%x"|iD]}|i|q$WndS(s2Ensure feature is excluded from distribution You may override this in a subclass to perform additional operations on the distribution. This method will be called at most once per feature, and only after all included features have been asked to include themselves. N(sdistsexcludesselfsextrassremovesitemsexclude_package(sselfsdistsitem((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pys exclude_froms   cCsIxB|iD]7}|i| o td|i||fq q WdS(sVerify that feature makes sense in context of distribution This method is called by the distribution just before it parses its command line. It checks to ensure that the 'remove' attribute, if any, contains only valid package/module names that are present in the base distribution when 'setup()' is called. You may override it in a subclass to perform any other required validation of the feature against a target distribution. sg%s wants to be able to remove %s, but the distribution doesn't contain any packages or modules under %sN(sselfsremovesitemsdistshas_contents_forsDistutilsSetupErrors description(sselfsdistsitem((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pysvalidate s  ( s__name__s __module__s__doc__sFalsesTrues__init__sinclude_by_defaults include_ins exclude_fromsvalidate(((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pysFeatures 1   ((s__all__sdistutils.cores Distributions _Distributionssetuptools.dependssRequiressetuptools.command.installsinstallssetuptools.command.sdistssdistssetuptools.command.install_libs install_libsdistutils.errorssDistutilsOptionErrorsDistutilsPlatformErrorsDistutilsSetupErrors setuptoolss pkg_resourcess distutilssdistutils.dists distutils.cmdsoss_get_unpatchedstupleslistssequencescheck_importablesassert_string_lists check_nsps check_extrass assert_boolscheck_requirementsscheck_entry_pointsscheck_test_suitescheck_package_datasdistscorescmdsmodulesFeature(sDistutilsPlatformErrorscheck_importables distutilsssequencessdistsFeaturesmodulesassert_string_lists assert_bools__all__sDistutilsSetupErrorscheck_test_suites check_nspscheck_requirementssinstallsRequirescheck_package_datas DistributionsDistutilsOptionErrors_get_unpatcheds check_extrass _Distributions pkg_resourcess setuptoolss install_libscheck_entry_pointssos((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pys?s8       -        PKC8setuptools/dist.pyc; Ec@skdgZdklZdklZdklZdkl Z dk l Z dk l Z lZdk lZdkZdkZdkZdkZdkZdkZd ZeeZeefZd Zd Zd Zd ZdZdZdZ dZ!dZ"defdYZx)ei#ei$ei%fD]Z&ee&_qAWdfdYZ'dS(s Distribution(s Distribution(sRequire(sinstall(ssdist(s install_lib(sDistutilsOptionErrorsDistutilsPlatformError(sDistutilsSetupErrorNcCsWx$|iido|i\}qW|iid otd|n|SdS(sProtect against re-patching the distutils if reloaded Also ensures that no other distutils extension monkeypatched the distutils first. s setuptoolss distutilss(distutils has already been patched by %rN(sclss __module__s startswiths __bases__sAssertionError(scls((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pys_get_unpatched scCshy,tiid|}|i ptWn5ttt tfj ot d||fnXdS(Nsx=s4%r must be importable 'module:attrs' string (got %r)( s pkg_resourcess EntryPointsparsesvaluesepsextrassAssertionErrors TypeErrors ValueErrorsAttributeErrorsDistutilsSetupErrorsattr(sdistsattrsvaluesep((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pyscheck_importables cCs]y!di||jptWn5ttttfj otd||fnXdS(s*Verify that value is a string list or Noness%%r must be a list of strings (got %r)N(sjoinsvaluesAssertionErrors TypeErrors ValueErrorsAttributeErrorsDistutilsSetupErrorsattr(sdistsattrsvalue((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pysassert_string_list*s !cCsNt|||x7|D]/}|i| otdd|qqWdS(s(Verify that namespace packages are valids1Distribution contains no modules or packages for snamespace package %rN(sassert_string_listsdistsattrsvaluesnspshas_contents_forsDistutilsSetupError(sdistsattrsvaluesnsp((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pys check_nsp3s cCscy4x-|iD]\}}tti|qWWn(ttt fj ot dnXdS(s+Verify that extras_require mapping is valids'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers.N( svaluesitemssksvslists pkg_resourcessparse_requirementss TypeErrors ValueErrorsAttributeErrorsDistutilsSetupError(sdistsattrsvaluesksv((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pys check_extras>s cCs1t||jotd||fndS(s)Verify that value is True, False, 0, or 1s#%r must be a boolean value (got %r)N(sboolsvaluesDistutilsSetupErrorsattr(sdistsattrsvalue((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pys assert_boolJscCsJytti|Wn,ttfj otd|fnXdS(s9Verify that install_requires is a valid requirements lists^%r must be a string or list of strings containing valid project/version requirement specifiersN(slists pkg_resourcessparse_requirementssvalues TypeErrors ValueErrorsDistutilsSetupErrorsattr(sdistsattrsvalue((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pyscheck_requirementsSs cCs<ytii|Wn!tj o}t|nXdS(s)Verify that entry_points map is parseableN(s pkg_resourcess EntryPoints parse_mapsvalues ValueErrorsesDistutilsSetupError(sdistsattrsvaluese((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pyscheck_entry_points]s cCs%t|t otdndS(Nstest_suite must be a string(s isinstancesvalues basestringsDistutilsSetupError(sdistsattrsvalue((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pyscheck_test_suiteescCst|to`x]|iD]G\}}t|t oPnyt|Wqtj oPqXqWdSnt |ddS(s@Verify that value is a dictionary of package names to glob listsNsI must be a dictionary mapping package names to lists of wildcard patterns( s isinstancesvaluesdictsitemssksvsstrsiters TypeErrorsDistutilsSetupErrorsattr(sdistsattrsvaluesksv((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pyscheck_package_datajs  cBstZdZeZdZedZdZdZdZ dZ dZ dZ d Z d Zd Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZRS(sxDistribution with support for features, tests, and package data This is an enhanced version of 'distutils.dist.Distribution' that effectively adds the following new optional keyword arguments to 'setup()': 'install_requires' -- a string or sequence of strings specifying project versions that the distribution requires when installed, in the format used by 'pkg_resources.require()'. They will be installed automatically when the package is installed. If you wish to use packages that are not available in PyPI, or want to give your users an alternate download location, you can add a 'find_links' option to the '[easy_install]' section of your project's 'setup.cfg' file, and then setuptools will scan the listed web pages for links that satisfy the requirements. 'extras_require' -- a dictionary mapping names of optional "extras" to the additional requirement(s) that using those extras incurs. For example, this:: extras_require = dict(reST = ["docutils>=0.3", "reSTedit"]) indicates that the distribution can optionally provide an extra capability called "reST", but it can only be used if docutils and reSTedit are installed. If the user installs your package using EasyInstall and requests one of your extras, the corresponding additional requirements will be installed if needed. 'features' -- a dictionary mapping option names to 'setuptools.Feature' objects. Features are a portion of the distribution that can be included or excluded based on user options, inter-feature dependencies, and availability on the current system. Excluded features are omitted from all setup commands, including source and binary distributions, so you can create multiple distributions from the same source tree. Feature names should be valid Python identifiers, except that they may contain the '-' (minus) sign. Features can be included or excluded via the command line options '--with-X' and '--without-X', where 'X' is the name of the feature. Whether a feature is included by default, and whether you are allowed to control this from the command line, is determined by the Feature object. See the 'Feature' class for more information. 'test_suite' -- the name of a test suite to run for the 'test' command. If the user runs 'python setup.py test', the package will be installed, and the named test suite will be run. The format is the same as would be used on a 'unittest.py' command line. That is, it is the dotted name of an object to import and call to generate a test suite. 'package_data' -- a dictionary mapping package names to lists of filenames or globs to use to find data files contained in the named packages. If the dictionary has filenames or globs listed under '""' (the empty string), those names will be searched for in every package, in addition to any names for the specific package. Data files found using these names/globs will be installed along with the package, in the same location as the package. Note that globs are allowed to reference the contents of non-package subdirectories, as long as you use '/' as a path separator. (Globs are automatically converted to platform-specific paths at runtime.) In addition to these new keywords, this class also has several new methods for manipulating the distribution's contents. For example, the 'include()' and 'exclude()' methods can be thought of as in-place add and subtract commands that add or remove packages, modules, extensions, and so on from the distribution. They are used by the feature subsystem to configure the distribution for the included and excluded features. cCs| pd|jp d|jodSntit|di}tiii|}|t j o|i d o)ti t|d|_ ||_ndS(NsnamesversionsPKG-INFO(sattrss pkg_resourcess safe_namesstrslowerskeys working_setsby_keysgetsdistsNones has_metadatas safe_versions_versionsselfs _patched_dist(sselfsattrssdistskey((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pyspatch_missing_pkg_infos"cCsGt|d}| o h|_ng|_h|_g|_|i||t j o,|i dg|_ t |d|i n|o d|jo|i |i dnxBtidD]1}t||i ot||it qqWti||t|iitttfot|ii|i_ndS(Ns package_datasdependency_linksssetup_requiressdistutils.setup_keywords(shasattrsselfshave_package_datas package_datasrequire_featuressfeaturess dist_filesspatch_missing_pkg_infosattrssNonespopsdependency_linkssassert_string_listsfetch_build_eggss pkg_resourcessiter_entry_pointssepsnamessetattrs _Distributions__init__s isinstancesmetadatasversionsintslongsfloatsstr(sselfsattrsshave_package_datasep((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pys__init__s&      cCs/ti|}|io|in|SdS(s3Process features after parsing command line optionsN(s _Distributionsparse_command_linesselfsresultsfeaturess_finalize_features(sselfsresult((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pysparse_command_lines  cCsd|iddSdS(s;Convert feature name to corresponding option attribute nameswith_s-s_N(snamesreplace(sselfsname((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pys_feature_attrnamescCsMdkl}l}x3|i||d|iD]}|i|q2WdS(sResolve pre-setup requirements(s working_setsparse_requirementss installerN( s pkg_resourcess working_setsparse_requirementssresolvesrequiressselfsfetch_build_eggsdistsadd(sselfsrequiressdistsparse_requirementss working_set((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pysfetch_build_eggss cCsti||io|inxitidD]X}t||i t }|t j o0|i d|i |i||i |q5q5WdS(Nsdistutils.setup_keywordss installer(s _Distributionsfinalize_optionssselfsfeaturess_set_global_opts_from_featuress pkg_resourcessiter_entry_pointssepsgetattrsnamesNonesvaluesrequiresfetch_build_eggsload(sselfsvaluesep((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pysfinalize_optionss   c Cshy |i}WnGtj o;dkl}|ihddg<}|i|i d}ddddddf}x,|i D]}||jo ||=qqW|ioG|i}d|jo|dd i|}nd |f|d\}}|i| o!|i ||i |dqqWdS(s9Add/remove features and resolve dependencies between themiiN( sselfsfeaturessitemssnamesfeaturesfeature_is_includedsenabledsNonesinclude_by_defaults include_ins _set_features exclude_from(sselfsenabledsnamesfeature((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pys_finalize_featuresIs !   cCs~||ijo|i|SnxXtid|D]4}|id|i|i|i|<}|Sq2Wt i ||SdS(s(Pluggable version of get_command_class()sdistutils.commandss installerN( scommandsselfscmdclasss pkg_resourcessiter_entry_pointssepsrequiresfetch_build_eggsloads _Distributionsget_command_class(sselfscommandscmdclasssep((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pysget_command_class[scCsaxMtidD]<}|i|ijo#|it}||i|i<   cCs|io|iSdS(s+Should this feature be included by default?N(sselfs availablesstandard(sself((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pysinclude_by_defaultscCsW|i ot|idn|i|ix|iD]}|i |q<WdS(sEnsure feature and its requirements are included in distribution You may override this in a subclass to perform additional operations on the distribution. Note that this method may be called more than once per feature, and so should be idempotent. s2 is required,but is not available on this platformN( sselfs availablesDistutilsPlatformErrors descriptionsdistsincludesextrassrequire_featuressfsinclude_feature(sselfsdistsf((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pys include_ins  cCsC|i|i|io%x"|iD]}|i|q$WndS(s2Ensure feature is excluded from distribution You may override this in a subclass to perform additional operations on the distribution. This method will be called at most once per feature, and only after all included features have been asked to include themselves. N(sdistsexcludesselfsextrassremovesitemsexclude_package(sselfsdistsitem((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pys exclude_froms   cCsIxB|iD]7}|i| o td|i||fq q WdS(sVerify that feature makes sense in context of distribution This method is called by the distribution just before it parses its command line. It checks to ensure that the 'remove' attribute, if any, contains only valid package/module names that are present in the base distribution when 'setup()' is called. You may override it in a subclass to perform any other required validation of the feature against a target distribution. sg%s wants to be able to remove %s, but the distribution doesn't contain any packages or modules under %sN(sselfsremovesitemsdistshas_contents_forsDistutilsSetupErrors description(sselfsdistsitem((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pysvalidate s  ( s__name__s __module__s__doc__sFalsesTrues__init__sinclude_by_defaults include_ins exclude_fromsvalidate(((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pysFeatures 1   ((s__all__sdistutils.cores Distributions _Distributionssetuptools.dependssRequiressetuptools.command.installsinstallssetuptools.command.sdistssdistssetuptools.command.install_libs install_libsdistutils.errorssDistutilsOptionErrorsDistutilsPlatformErrorsDistutilsSetupErrors setuptoolss pkg_resourcess distutilssdistutils.dists distutils.cmdsoss_get_unpatchedstupleslistssequencescheck_importablesassert_string_lists check_nsps check_extrass assert_boolscheck_requirementsscheck_entry_pointsscheck_test_suitescheck_package_datasdistscorescmdsmodulesFeature(sDistutilsPlatformErrorscheck_importables distutilsssequencessdistsFeaturesmodulesassert_string_lists assert_bools__all__sDistutilsSetupErrorscheck_test_suites check_nspscheck_requirementssinstallsRequirescheck_package_datas DistributionsDistutilsOptionErrors_get_unpatcheds check_extrass _Distributions pkg_resourcess setuptoolss install_libscheck_entry_pointssos((s3build/bdist.darwin-8.0.1-x86/egg/setuptools/dist.pys?s8       -        PK45M>88setuptools/depends.pyfrom __future__ import generators import sys, imp, marshal from imp import PKG_DIRECTORY, PY_COMPILED, PY_SOURCE, PY_FROZEN from distutils.version import StrictVersion, LooseVersion __all__ = [ 'Require', 'find_module', 'get_module_constant', 'extract_constant' ] class Require: """A prerequisite to building or installing a distribution""" def __init__(self,name,requested_version,module,homepage='', attribute=None,format=None ): if format is None and requested_version is not None: format = StrictVersion if format is not None: requested_version = format(requested_version) if attribute is None: attribute = '__version__' self.__dict__.update(locals()) del self.self def full_name(self): """Return full package/distribution name, w/version""" if self.requested_version is not None: return '%s-%s' % (self.name,self.requested_version) return self.name def version_ok(self,version): """Is 'version' sufficiently up-to-date?""" return self.attribute is None or self.format is None or \ str(version)<>"unknown" and version >= self.requested_version def get_version(self, paths=None, default="unknown"): """Get version number of installed module, 'None', or 'default' Search 'paths' for module. If not found, return 'None'. If found, return the extracted version attribute, or 'default' if no version attribute was specified, or the value cannot be determined without importing the module. The version is formatted according to the requirement's version format (if any), unless it is 'None' or the supplied 'default'. """ if self.attribute is None: try: f,p,i = find_module(self.module,paths) if f: f.close() return default except ImportError: return None v = get_module_constant(self.module,self.attribute,default,paths) if v is not None and v is not default and self.format is not None: return self.format(v) return v def is_present(self,paths=None): """Return true if dependency is present on 'paths'""" return self.get_version(paths) is not None def is_current(self,paths=None): """Return true if dependency is present and up-to-date on 'paths'""" version = self.get_version(paths) if version is None: return False return self.version_ok(version) def _iter_code(code): """Yield '(op,arg)' pair for each operation in code object 'code'""" from array import array from dis import HAVE_ARGUMENT, EXTENDED_ARG bytes = array('b',code.co_code) eof = len(code.co_code) ptr = 0 extended_arg = 0 while ptr=HAVE_ARGUMENT: arg = bytes[ptr+1] + bytes[ptr+2]*256 + extended_arg ptr += 3 if op==EXTENDED_ARG: extended_arg = arg * 65536L continue else: arg = None ptr += 1 yield op,arg def find_module(module, paths=None): """Just like 'imp.find_module()', but with package support""" parts = module.split('.') while parts: part = parts.pop(0) f, path, (suffix,mode,kind) = info = imp.find_module(part, paths) if kind==PKG_DIRECTORY: parts = parts or ['__init__'] paths = [path] elif parts: raise ImportError("Can't find %r in %s" % (parts,module)) return info def get_module_constant(module, symbol, default=-1, paths=None): """Find 'module' by searching 'paths', and extract 'symbol' Return 'None' if 'module' does not exist on 'paths', or it does not define 'symbol'. If the module defines 'symbol' as a constant, return the constant. Otherwise, return 'default'.""" try: f, path, (suffix,mode,kind) = find_module(module,paths) except ImportError: # Module doesn't exist return None try: if kind==PY_COMPILED: f.read(8) # skip magic & date code = marshal.load(f) elif kind==PY_FROZEN: code = imp.get_frozen_object(module) elif kind==PY_SOURCE: code = compile(f.read(), path, 'exec') else: # Not something we can parse; we'll have to import it. :( if module not in sys.modules: imp.load_module(module,f,path,(suffix,mode,kind)) return getattr(sys.modules[module],symbol,None) finally: if f: f.close() return extract_constant(code,symbol,default) def extract_constant(code,symbol,default=-1): """Extract the constant value of 'symbol' from 'code' If the name 'symbol' is bound to a constant value by the Python code object 'code', return that value. If 'symbol' is bound to an expression, return 'default'. Otherwise, return 'None'. Return value is based on the first assignment to 'symbol'. 'symbol' must be a global, or at least a non-"fast" local in the code block. That is, only 'STORE_NAME' and 'STORE_GLOBAL' opcodes are checked, and 'symbol' must be present in 'code.co_names'. """ if symbol not in code.co_names: # name's not there, can't possibly be an assigment return None name_idx = list(code.co_names).index(symbol) STORE_NAME = 90 STORE_GLOBAL = 97 LOAD_CONST = 100 const = default for op, arg in _iter_code(code): if op==LOAD_CONST: const = code.co_consts[arg] elif arg==name_idx and (op==STORE_NAME or op==STORE_GLOBAL): return const else: const = default PKC8qFosetuptools/package_index.pyc; eFc@sdZdkZdkZdkZdkZdkZdkZdkZdk Z dk Z dk Tdk l Z dklZdklZdklZeidZeideiZeid Zeid eiiZd iZd d ddgZdZdZedZ edZ!edZ"ee#edZ$eideiZ%dZ&dei'e(ddi)fZ*d e+fdYZ,eidi-Z.dZ/dZ0dZ1d Z2d!Z3d"Z4dS(#s#PyPI and direct package downloadingN(s*(slog(sDistutilsError(smd5(s translates^egg=([-A-Za-z0-9_.]+)$shref\s*=\s*['"]?([^'"> ]+)s([^<]+) \s+\(md5\)s([-+.a-z0-9]{2,}):s.tar.gz .tar.bz2 .tar .zip .tgzs PackageIndexsdistros_for_urlsparse_bdist_wininstsinterpret_distro_namecCs|i}ttf\}}|idoP|ido|d }q~|iddo|dd!}|d }q~n||fSdS( s=Return (base,pyversion) or (None,None) for possible .exe names.exes .win32.exeis .win32-pyiiiN(snameslowersNonesbasespy_versendswiths startswith(snameslowersbasespy_ver((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysparse_bdist_wininsts  cCstti|\}}}}}}ti |i dd}d|jo|i dd\}}n||fSdS(Ns/is#i( surlparsesurlsschemesserverspaths parameterssquerysfragmentsurllib2sunquotessplitsbase(surls parameterssserversfragmentsbasesqueryspathsscheme((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysegg_info_for_url*s ! ccst|\}}xt|||D] }|Vq%W|oNti|}|o4x1t ||i d|dt D] }|VqrWqndS(sEYield egg or source distribution objects that might be found at a URLis precedenceN( segg_info_for_urlsurlsbasesfragmentsdistros_for_locationsmetadatasdists EGG_FRAGMENTsmatchsinterpret_distro_namesgroups CHECKOUT_DIST(surlsmetadatasdistsfragmentsbasesmatch((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysdistros_for_url0s"cCs|ido|d }n|ido d|joti|||gSn|ido@t|\}}|t j ot ||||t dSqnxCt D];}|i|o%|t| }t |||SqqWgSdS(s:Yield egg or source distribution objects based on basenames.egg.zipis.eggs-s.exeswin32N(sbasenamesendswiths Distributions from_locationslocationsmetadatasparse_bdist_wininstswin_basespy_versNonesinterpret_distro_names BINARY_DISTs EXTENSIONSsextslen(slocationsbasenamesmetadatasextswin_basespy_ver((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysdistros_for_location<s !cCs&tt|tii||SdS(sEYield possible egg or source distribution objects based on a filenameN(sdistros_for_locationsnormalize_pathsfilenamesosspathsbasenamesmetadata(sfilenamesmetadata((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysdistros_for_filenameSsc cs|id}| oPxMt|dD]7\}}t|djo |idodSq(q(Wnx`t dt|dD]E}t ||di || di ||d|d|d |VqWdS( sGenerate alternative interpretations of a source distro name Note: if `location` is a filesystem filename, you should call ``pkg_resources.normalize_path()`` on it before passing it to this routine! s-iispy2.Nis py_versions precedencesplatform(sbasenamessplitspartss py_versions enumeratesispslens startswithsranges Distributionslocationsmetadatasjoins precedencesplatform( slocationsbasenamesmetadatas py_versions precedencesplatformspsisparts((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysinterpret_distro_nameZs  #) s(<([^>]*\srel\s*=\s*['"]?([^'">]+)[^>]*)>ccsxti|D]}|i\}}tti |i i d}d|jp d|jo=x:t i|D]%}ti|t|idVqsWqqWxpddfD]b}|i|}|djo@t i||}|o#ti|t|idVqqqWdS( sEFind rel="homepage" and rel="download" links in `page`, yielding URLss,shomepagesdownloadis Home PagesDownload URLiN(sRELsfinditerspagesmatchsgroupsstagsrelsmapsstrsstripslowerssplitsrelssHREFsurlparsesurljoinsurls htmldecodesgroupsfindsposssearch(surlspagesrelspossrelsstagsmatch((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysfind_external_linkss !+  sPython-urllib/%s setuptools/%ss setuptoolsicBsLtZdZddfdZedZedZedZdZdZ d Z d Z e d Z d Ze d ZdZdZdZdZdZeeedZeedZdZdZdZdZe dZdZdZdZdZdZ dZ!d Z"d!Z#RS("s;A distribution index that scans web pages for download URLsshttp://pypi.python.org/simples*cOs}ti||||d|id |_h|_h|_h|_ t i di t t|i|_g|_dS(Ns/s|(s Environments__init__sselfsargsskws index_urlsendswiths scanned_urlss fetched_urlss package_pagessrescompilesjoinsmaps translateshostssmatchsallowssto_scan(sselfs index_urlshostssargsskw((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pys__init__s   'c Cs&||ijo| odSnt|i|%siii(smsgroup(sm((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysssN(sscansHREFsfinditerspagesmatchsurlparsesurljoinsurls htmldecodesgroupspkgsversfind_external_linkssnew_urlsegg_info_for_urlsbasesfragsendswithsselfsneed_version_infosscan_urlsPYPI_MD5ssub( sselfsurlspagesfragsversscansnew_urlspkgsbasesmatch((sselfs<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pys process_indexs" )cCs|id|dS(NsPPage at %s links to .py file(s) without version info; an index scan is required.(sselfsscan_allsurl(sselfsurl((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysneed_version_info s cGsS|i|ijo,|o|i||n|idn|i|idS(Ns6Scanning index of all packages (this may take a while)(sselfs index_urls fetched_urlssmsgswarnsargssinfosscan_url(sselfsmsgsargs((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysscan_all&s cCs|i|i|id|ii|i o|i|i|idn|ii|i o|i |nx3t |ii|ifD]}|i|qWdS(Ns/( sselfsscan_urls index_urls requirements unsafe_names package_pagessgetskeys project_namesnot_found_in_indexslistsurl(sselfs requirementsurl((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pys find_packages.scCst|i|i|x=||iD].}||jo|Sn|id||q%Wtt|i ||SdS(Ns%s does not match %s( sselfsprescans find_packagess requirementskeysdistsdebugssupers PackageIndexsobtains installer(sselfs requirements installersdist((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysobtain=s cCs}tid|of|id||i|djo;|i t i |t dt i i|dqyndS(Nsmd5=[0-9a-f]{32}$sValidating md5 checksum for %sisMD5 validation failed for s; possible download problem?(sresmatchsinfosselfsdebugsfilenamescss hexdigeststfpsclosesossunlinksDistutilsErrorspathsbasename(sselfscssinfosfilenamestfp((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pys check_md5Is   cCswxp|D]h}|itjp.t| p |idptt|o|i |q|ii |qWdS(s;Add `urls` to the list that will be prescanned for searchessfile:N( surlssurlsselfsto_scansNones URL_SCHEMEs startswithslistsdistros_for_urlsscan_urlsappend(sselfsurlssurl((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysadd_find_linksTs AcCs.|iot|i|int|_dS(s7Scan urls scheduled for prescanning (e.g. --find-links)N(sselfsto_scansmapsscan_urlsNone(sself((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysprescancs cCsZ||io|idf\}}n|idf\}}|||i|idS(Ns#Couldn't retrieve index page for %rs3Couldn't find index page for %r (maybe misspelled?)( sselfs requirementskeysinfosmethsmsgswarns unsafe_namesscan_all(sselfs requirementsmsgsmeth((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysnot_found_in_indexis cCst|t ot|}|oa|i|id||}t |\}}|i do|i|||}n|Sqtii|o|Sqyti|}Wqtj otd|fqXnt|i||dtSdS(sLocate and/or download `spec` to `tmpdir`, returning a local path `spec` may be a ``Requirement`` object, or a string containing a URL, an existing local filename, or a project/version requirement spec (i.e. the string form of a ``Requirement`` object). If it is the URL of a .py file with an unambiguous ``#egg=name-version`` tag (i.e., one that escapes ``-`` as ``_`` throughout), a trivial ``setup.py`` is automatically created alongside the downloaded file. If `spec` is a ``Requirement`` object or a string containing a project/version requirement spec, this method returns the location of a matching distribution (possibly after downloading it to `tmpdir`). If `spec` is a locally existing file or directory name, it is simply returned unchanged. If `spec` is a URL, it is downloaded to a subpath of `tmpdir`, and the local filename is returned. Various errors may be raised if a problem occurs during downloading. is.pys1Not a URL, existing file, or requirement spec: %rslocationN(s isinstancesspecs Requirements URL_SCHEMEsschemesselfs _download_urlsgroupstmpdirsfoundsegg_info_for_urlsbasesfragmentsendswiths gen_setupsosspathsexistssparses ValueErrorsDistutilsErrorsgetattrsfetch_distributionsNone(sselfsspecstmpdirsfragmentsbasesfoundsscheme((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysdownloadrs  c sid|hd}|oii|n||}|t jo i t j oi||}n|t jo| oi|||}n|t jo%i dodpd|n|SdS(s|Obtain a distribution suitable for fulfilling `requirement` `requirement` must be a ``pkg_resources.Requirement`` instance. If necessary, or if the `force_scan` flag is set, the requirement is searched for in the (online) package index as well as the locally installed packages. If a distribution matching `requirement` is found, the returned distribution's ``location`` is the value you would have gotten from calling the ``download()`` method with the matching distribution's URL or filename. If no matching distribution is found, ``None`` is returned. If the `source` flag is set, only source distributions and source checkout links will be considered. Unless the `develop_ok` flag is set, development and system eggs (i.e., those using the ``.egg-info`` format) will be ignored. sSearching for %scsx|iD]}|itjo o2|joid|d|Revision \d+:sUnexpected HTML page found at (sopensfilenamesfileslinesstripsressearchsclosesossunlinksselfs _download_svnsurlsDistutilsError(sselfsurlsheaderssfilenamesfilesline((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pys_download_htmlss       cCsH|iddd}|id||tid||f|SdS(Ns#iis'Doing subversion checkout from %s to %sssvn checkout -q %s %s(surlssplitsselfsinfosfilenamesosssystem(sselfsurlsfilename((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pys _download_svnscGsti||dS(N(slogsdebugsmsgsargs(sselfsmsgsargs((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysdebugscGsti||dS(N(slogsinfosmsgsargs(sselfsmsgsargs((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysinfoscGsti||dS(N(slogswarnsmsgsargs(sselfsmsgsargs((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pyswarns($s__name__s __module__s__doc__s__init__sFalses process_urlsprocess_filenamesurl_oksscan_egg_linkss scan_egg_links process_indexsneed_version_infosNonesscan_alls find_packagessobtains check_md5sadd_find_linkssprescansnot_found_in_indexsdownloadsfetch_distributionsfetchs gen_setups dl_blocksizes _download_tos reporthooksopen_urls _download_urlsscan_urls_attempt_downloads_download_htmls _download_svnsdebugsinfoswarn(((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pys PackageIndexs@  )   )      )> ) $        s!&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?cCsBt|t o|Sn|djot|Snt|SdS(Ni(s isinstancescsintsunichrschr(sc((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysuchrs  cCs|id}|idot|dd}nM|idot|d}n)dkl}|i||id}t|SdS(Nis#xiis#(sname2codepointi( smatchsgroupswhats startswithsintshtmlentitydefssname2codepointsgetsuchr(smatchswhatsname2codepoint((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pys decode_entitys cCstt|SdS(s'Decode HTML entities in the given text.N(s entity_subs decode_entitystext(stext((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pys htmldecodescCsgti|\}} }}}} |ddfjoti | \} } nt } | ofdti | idi} ti|| |||| f}ti|}|id| nti|}|idtti|}| ojti|i\}}}}} }||jo || jo(ti|| ||| |f|_q_n|SdS(s4Open a urllib2 request, handling HTTP authenticationshttpshttpssBasic sbase64s Authorizations User-AgentN(surlparsesurlsschemesnetlocspathsparamssquerysfragsurllib2s splitusersauthshostsNonesunquotesencodesstrips urlunparsesnew_urlsRequestsrequests add_headers user_agentsurlopensfpss2sh2spath2sparam2squery2sfrag2(surlsfpsh2squeryss2snew_urlsparamssschemesparam2sfragsquery2snetlocsauthshostspathspath2srequestsfrag2((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pysopen_with_auths$!"!$,cCs|SdS(N(surl(surl((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pys fix_sf_urlsc Csti|\} }} }} }ti | }t ii |oti |Sn | idot ii|og}xt i|D]}|djo)tt ii||di}Pn1t iit ii||o|d7}n|id||fqWd|ddi|}dd f\}} nd d d f\}} }ti||| hd d%ss%ss%ss isOKisPath not founds Not founds content-types text/htmlN(surlparsesurlsschemesserverspathsparamsquerysfragsurllib2s url2pathnamesfilenamesossisfilesurlopensendswithsisdirsfilesslistdirsfsopensjoinsreadsbodysappendsstatussmessages HTTPErrors cStringIOsStringIO( surlsfragsfilessfsbodysfilenamesparamsserversstatussqueryspathsmessagesscheme((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pys local_opens(!# $"(5s__doc__ssyssos.pathsossresurlparsesurllib2sshutilsrandomssockets cStringIOs pkg_resourcess distutilsslogsdistutils.errorssDistutilsErrorsmd5sfnmatchs translatescompiles EGG_FRAGMENTsIsHREFsPYPI_MD5smatchs URL_SCHEMEssplits EXTENSIONSs__all__sparse_bdist_wininstsegg_info_for_urlsNonesdistros_for_urlsdistros_for_locationsdistros_for_filenames SOURCE_DISTsinterpret_distro_namesRELsfind_external_linkss __version__srequiresversions user_agents Environments PackageIndexssubs entity_subsuchrs decode_entitys htmldecodesopen_with_auths fix_sf_urls local_open($s cStringIOsrandomsHREFsRELsPYPI_MD5sshutilsfind_external_linkssdistros_for_urls EGG_FRAGMENTsuchrslogs__all__sparse_bdist_wininstsegg_info_for_urls decode_entitys entity_subsres EXTENSIONSs translatesdistros_for_locations local_opens PackageIndexs fix_sf_urlsurllib2ssyssdistros_for_filenamesDistutilsErrorsmd5sinterpret_distro_namessockets URL_SCHEMEsurlparses user_agentsopen_with_authsoss htmldecode((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/package_index.pys?s<Q         "     ) PK45+E:srsrsetuptools/dist.py__all__ = ['Distribution'] from distutils.core import Distribution as _Distribution from setuptools.depends import Require from setuptools.command.install import install from setuptools.command.sdist import sdist from setuptools.command.install_lib import install_lib from distutils.errors import DistutilsOptionError, DistutilsPlatformError from distutils.errors import DistutilsSetupError import setuptools, pkg_resources, distutils.core, distutils.dist, distutils.cmd import os def _get_unpatched(cls): """Protect against re-patching the distutils if reloaded Also ensures that no other distutils extension monkeypatched the distutils first. """ while cls.__module__.startswith('setuptools'): cls, = cls.__bases__ if not cls.__module__.startswith('distutils'): raise AssertionError( "distutils has already been patched by %r" % cls ) return cls _Distribution = _get_unpatched(_Distribution) sequence = tuple, list def check_importable(dist, attr, value): try: ep = pkg_resources.EntryPoint.parse('x='+value) assert not ep.extras except (TypeError,ValueError,AttributeError,AssertionError): raise DistutilsSetupError( "%r must be importable 'module:attrs' string (got %r)" % (attr,value) ) def assert_string_list(dist, attr, value): """Verify that value is a string list or None""" try: assert ''.join(value)!=value except (TypeError,ValueError,AttributeError,AssertionError): raise DistutilsSetupError( "%r must be a list of strings (got %r)" % (attr,value) ) def check_nsp(dist, attr, value): """Verify that namespace packages are valid""" assert_string_list(dist,attr,value) for nsp in value: if not dist.has_contents_for(nsp): raise DistutilsSetupError( "Distribution contains no modules or packages for " + "namespace package %r" % nsp ) def check_extras(dist, attr, value): """Verify that extras_require mapping is valid""" try: for k,v in value.items(): list(pkg_resources.parse_requirements(v)) except (TypeError,ValueError,AttributeError): raise DistutilsSetupError( "'extras_require' must be a dictionary whose values are " "strings or lists of strings containing valid project/version " "requirement specifiers." ) def assert_bool(dist, attr, value): """Verify that value is True, False, 0, or 1""" if bool(value) != value: raise DistutilsSetupError( "%r must be a boolean value (got %r)" % (attr,value) ) def check_requirements(dist, attr, value): """Verify that install_requires is a valid requirements list""" try: list(pkg_resources.parse_requirements(value)) except (TypeError,ValueError): raise DistutilsSetupError( "%r must be a string or list of strings " "containing valid project/version requirement specifiers" % (attr,) ) def check_entry_points(dist, attr, value): """Verify that entry_points map is parseable""" try: pkg_resources.EntryPoint.parse_map(value) except ValueError, e: raise DistutilsSetupError(e) def check_test_suite(dist, attr, value): if not isinstance(value,basestring): raise DistutilsSetupError("test_suite must be a string") def check_package_data(dist, attr, value): """Verify that value is a dictionary of package names to glob lists""" if isinstance(value,dict): for k,v in value.items(): if not isinstance(k,str): break try: iter(v) except TypeError: break else: return raise DistutilsSetupError( attr+" must be a dictionary mapping package names to lists of " "wildcard patterns" ) class Distribution(_Distribution): """Distribution with support for features, tests, and package data This is an enhanced version of 'distutils.dist.Distribution' that effectively adds the following new optional keyword arguments to 'setup()': 'install_requires' -- a string or sequence of strings specifying project versions that the distribution requires when installed, in the format used by 'pkg_resources.require()'. They will be installed automatically when the package is installed. If you wish to use packages that are not available in PyPI, or want to give your users an alternate download location, you can add a 'find_links' option to the '[easy_install]' section of your project's 'setup.cfg' file, and then setuptools will scan the listed web pages for links that satisfy the requirements. 'extras_require' -- a dictionary mapping names of optional "extras" to the additional requirement(s) that using those extras incurs. For example, this:: extras_require = dict(reST = ["docutils>=0.3", "reSTedit"]) indicates that the distribution can optionally provide an extra capability called "reST", but it can only be used if docutils and reSTedit are installed. If the user installs your package using EasyInstall and requests one of your extras, the corresponding additional requirements will be installed if needed. 'features' -- a dictionary mapping option names to 'setuptools.Feature' objects. Features are a portion of the distribution that can be included or excluded based on user options, inter-feature dependencies, and availability on the current system. Excluded features are omitted from all setup commands, including source and binary distributions, so you can create multiple distributions from the same source tree. Feature names should be valid Python identifiers, except that they may contain the '-' (minus) sign. Features can be included or excluded via the command line options '--with-X' and '--without-X', where 'X' is the name of the feature. Whether a feature is included by default, and whether you are allowed to control this from the command line, is determined by the Feature object. See the 'Feature' class for more information. 'test_suite' -- the name of a test suite to run for the 'test' command. If the user runs 'python setup.py test', the package will be installed, and the named test suite will be run. The format is the same as would be used on a 'unittest.py' command line. That is, it is the dotted name of an object to import and call to generate a test suite. 'package_data' -- a dictionary mapping package names to lists of filenames or globs to use to find data files contained in the named packages. If the dictionary has filenames or globs listed under '""' (the empty string), those names will be searched for in every package, in addition to any names for the specific package. Data files found using these names/globs will be installed along with the package, in the same location as the package. Note that globs are allowed to reference the contents of non-package subdirectories, as long as you use '/' as a path separator. (Globs are automatically converted to platform-specific paths at runtime.) In addition to these new keywords, this class also has several new methods for manipulating the distribution's contents. For example, the 'include()' and 'exclude()' methods can be thought of as in-place add and subtract commands that add or remove packages, modules, extensions, and so on from the distribution. They are used by the feature subsystem to configure the distribution for the included and excluded features. """ _patched_dist = None def patch_missing_pkg_info(self, attrs): # Fake up a replacement for the data that would normally come from # PKG-INFO, but which might not yet be built if this is a fresh # checkout. # if not attrs or 'name' not in attrs or 'version' not in attrs: return key = pkg_resources.safe_name(str(attrs['name'])).lower() dist = pkg_resources.working_set.by_key.get(key) if dist is not None and not dist.has_metadata('PKG-INFO'): dist._version = pkg_resources.safe_version(str(attrs['version'])) self._patched_dist = dist def __init__ (self, attrs=None): have_package_data = hasattr(self, "package_data") if not have_package_data: self.package_data = {} self.require_features = [] self.features = {} self.dist_files = [] self.patch_missing_pkg_info(attrs) # Make sure we have any eggs needed to interpret 'attrs' if attrs is not None: self.dependency_links = attrs.pop('dependency_links', []) assert_string_list(self,'dependency_links',self.dependency_links) if attrs and 'setup_requires' in attrs: self.fetch_build_eggs(attrs.pop('setup_requires')) for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'): if not hasattr(self,ep.name): setattr(self,ep.name,None) _Distribution.__init__(self,attrs) if isinstance(self.metadata.version, (int,long,float)): # Some people apparently take "version number" too literally :) self.metadata.version = str(self.metadata.version) def parse_command_line(self): """Process features after parsing command line options""" result = _Distribution.parse_command_line(self) if self.features: self._finalize_features() return result def _feature_attrname(self,name): """Convert feature name to corresponding option attribute name""" return 'with_'+name.replace('-','_') def fetch_build_eggs(self, requires): """Resolve pre-setup requirements""" from pkg_resources import working_set, parse_requirements for dist in working_set.resolve( parse_requirements(requires), installer=self.fetch_build_egg ): working_set.add(dist) def finalize_options(self): _Distribution.finalize_options(self) if self.features: self._set_global_opts_from_features() for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'): value = getattr(self,ep.name,None) if value is not None: ep.require(installer=self.fetch_build_egg) ep.load()(self, ep.name, value) def fetch_build_egg(self, req): """Fetch an egg needed for building""" try: cmd = self._egg_fetcher except AttributeError: from setuptools.command.easy_install import easy_install dist = self.__class__({'script_args':['easy_install']}) dist.parse_config_files() opts = dist.get_option_dict('easy_install') keep = ( 'find_links', 'site_dirs', 'index_url', 'optimize', 'site_dirs', 'allow_hosts' ) for key in opts.keys(): if key not in keep: del opts[key] # don't use any other settings if self.dependency_links: links = self.dependency_links[:] if 'find_links' in opts: links = opts['find_links'][1].split() + links opts['find_links'] = ('setup', links) cmd = easy_install( dist, args=["x"], install_dir=os.curdir, exclude_scripts=True, always_copy=False, build_directory=None, editable=False, upgrade=False, multi_version=True, no_report = True ) cmd.ensure_finalized() self._egg_fetcher = cmd return cmd.easy_install(req) def _set_global_opts_from_features(self): """Add --with-X/--without-X options based on optional features""" go = [] no = self.negative_opt.copy() for name,feature in self.features.items(): self._set_feature(name,None) feature.validate(self) if feature.optional: descr = feature.description incdef = ' (default)' excdef='' if not feature.include_by_default(): excdef, incdef = incdef, excdef go.append(('with-'+name, None, 'include '+descr+incdef)) go.append(('without-'+name, None, 'exclude '+descr+excdef)) no['without-'+name] = 'with-'+name self.global_options = self.feature_options = go + self.global_options self.negative_opt = self.feature_negopt = no def _finalize_features(self): """Add/remove features and resolve dependencies between them""" # First, flag all the enabled items (and thus their dependencies) for name,feature in self.features.items(): enabled = self.feature_is_included(name) if enabled or (enabled is None and feature.include_by_default()): feature.include_in(self) self._set_feature(name,1) # Then disable the rest, so that off-by-default features don't # get flagged as errors when they're required by an enabled feature for name,feature in self.features.items(): if not self.feature_is_included(name): feature.exclude_from(self) self._set_feature(name,0) def get_command_class(self, command): """Pluggable version of get_command_class()""" if command in self.cmdclass: return self.cmdclass[command] for ep in pkg_resources.iter_entry_points('distutils.commands',command): ep.require(installer=self.fetch_build_egg) self.cmdclass[command] = cmdclass = ep.load() return cmdclass else: return _Distribution.get_command_class(self, command) def print_commands(self): for ep in pkg_resources.iter_entry_points('distutils.commands'): if ep.name not in self.cmdclass: cmdclass = ep.load(False) # don't require extras, we're not running self.cmdclass[ep.name] = cmdclass return _Distribution.print_commands(self) def _set_feature(self,name,status): """Set feature's inclusion status""" setattr(self,self._feature_attrname(name),status) def feature_is_included(self,name): """Return 1 if feature is included, 0 if excluded, 'None' if unknown""" return getattr(self,self._feature_attrname(name)) def include_feature(self,name): """Request inclusion of feature named 'name'""" if self.feature_is_included(name)==0: descr = self.features[name].description raise DistutilsOptionError( descr + " is required, but was excluded or is not available" ) self.features[name].include_in(self) self._set_feature(name,1) def include(self,**attrs): """Add items to distribution that are named in keyword arguments For example, 'dist.exclude(py_modules=["x"])' would add 'x' to the distribution's 'py_modules' attribute, if it was not already there. Currently, this method only supports inclusion for attributes that are lists or tuples. If you need to add support for adding to other attributes in this or a subclass, you can add an '_include_X' method, where 'X' is the name of the attribute. The method will be called with the value passed to 'include()'. So, 'dist.include(foo={"bar":"baz"})' will try to call 'dist._include_foo({"bar":"baz"})', which can then handle whatever special inclusion logic is needed. """ for k,v in attrs.items(): include = getattr(self, '_include_'+k, None) if include: include(v) else: self._include_misc(k,v) def exclude_package(self,package): """Remove packages, modules, and extensions in named package""" pfx = package+'.' if self.packages: self.packages = [ p for p in self.packages if p<>package and not p.startswith(pfx) ] if self.py_modules: self.py_modules = [ p for p in self.py_modules if p<>package and not p.startswith(pfx) ] if self.ext_modules: self.ext_modules = [ p for p in self.ext_modules if p.name<>package and not p.name.startswith(pfx) ] def has_contents_for(self,package): """Return true if 'exclude_package(package)' would do something""" pfx = package+'.' for p in self.iter_distribution_names(): if p==package or p.startswith(pfx): return True def _exclude_misc(self,name,value): """Handle 'exclude()' for list/tuple attrs without a special handler""" if not isinstance(value,sequence): raise DistutilsSetupError( "%s: setting must be a list or tuple (%r)" % (name, value) ) try: old = getattr(self,name) except AttributeError: raise DistutilsSetupError( "%s: No such distribution setting" % name ) if old is not None and not isinstance(old,sequence): raise DistutilsSetupError( name+": this setting cannot be changed via include/exclude" ) elif old: setattr(self,name,[item for item in old if item not in value]) def _include_misc(self,name,value): """Handle 'include()' for list/tuple attrs without a special handler""" if not isinstance(value,sequence): raise DistutilsSetupError( "%s: setting must be a list (%r)" % (name, value) ) try: old = getattr(self,name) except AttributeError: raise DistutilsSetupError( "%s: No such distribution setting" % name ) if old is None: setattr(self,name,value) elif not isinstance(old,sequence): raise DistutilsSetupError( name+": this setting cannot be changed via include/exclude" ) else: setattr(self,name,old+[item for item in value if item not in old]) def exclude(self,**attrs): """Remove items from distribution that are named in keyword arguments For example, 'dist.exclude(py_modules=["x"])' would remove 'x' from the distribution's 'py_modules' attribute. Excluding packages uses the 'exclude_package()' method, so all of the package's contained packages, modules, and extensions are also excluded. Currently, this method only supports exclusion from attributes that are lists or tuples. If you need to add support for excluding from other attributes in this or a subclass, you can add an '_exclude_X' method, where 'X' is the name of the attribute. The method will be called with the value passed to 'exclude()'. So, 'dist.exclude(foo={"bar":"baz"})' will try to call 'dist._exclude_foo({"bar":"baz"})', which can then handle whatever special exclusion logic is needed. """ for k,v in attrs.items(): exclude = getattr(self, '_exclude_'+k, None) if exclude: exclude(v) else: self._exclude_misc(k,v) def _exclude_packages(self,packages): if not isinstance(packages,sequence): raise DistutilsSetupError( "packages: setting must be a list or tuple (%r)" % (packages,) ) map(self.exclude_package, packages) def _parse_command_opts(self, parser, args): # Remove --with-X/--without-X options when processing command args self.global_options = self.__class__.global_options self.negative_opt = self.__class__.negative_opt # First, expand any aliases command = args[0] aliases = self.get_option_dict('aliases') while command in aliases: src,alias = aliases[command] del aliases[command] # ensure each alias can expand only once! import shlex args[:1] = shlex.split(alias,True) command = args[0] nargs = _Distribution._parse_command_opts(self, parser, args) # Handle commands that want to consume all remaining arguments cmd_class = self.get_command_class(command) if getattr(cmd_class,'command_consumes_arguments',None): self.get_option_dict(command)['args'] = ("command line", nargs) if nargs is not None: return [] return nargs def get_cmdline_options(self): """Return a '{cmd: {opt:val}}' map of all command-line options Option names are all long, but do not include the leading '--', and contain dashes rather than underscores. If the option doesn't take an argument (e.g. '--quiet'), the 'val' is 'None'. Note that options provided by config files are intentionally excluded. """ d = {} for cmd,opts in self.command_options.items(): for opt,(src,val) in opts.items(): if src != "command line": continue opt = opt.replace('_','-') if val==0: cmdobj = self.get_command_obj(cmd) neg_opt = self.negative_opt.copy() neg_opt.update(getattr(cmdobj,'negative_opt',{})) for neg,pos in neg_opt.items(): if pos==opt: opt=neg val=None break else: raise AssertionError("Shouldn't be able to get here") elif val==1: val = None d.setdefault(cmd,{})[opt] = val return d def iter_distribution_names(self): """Yield all packages, modules, and extension names in distribution""" for pkg in self.packages or (): yield pkg for module in self.py_modules or (): yield module for ext in self.ext_modules or (): if isinstance(ext,tuple): name, buildinfo = ext else: name = ext.name if name.endswith('module'): name = name[:-6] yield name # Install it throughout the distutils for module in distutils.dist, distutils.core, distutils.cmd: module.Distribution = Distribution class Feature: """A subset of the distribution that can be excluded if unneeded/wanted Features are created using these keyword arguments: 'description' -- a short, human readable description of the feature, to be used in error messages, and option help messages. 'standard' -- if true, the feature is included by default if it is available on the current system. Otherwise, the feature is only included if requested via a command line '--with-X' option, or if another included feature requires it. The default setting is 'False'. 'available' -- if true, the feature is available for installation on the current system. The default setting is 'True'. 'optional' -- if true, the feature's inclusion can be controlled from the command line, using the '--with-X' or '--without-X' options. If false, the feature's inclusion status is determined automatically, based on 'availabile', 'standard', and whether any other feature requires it. The default setting is 'True'. 'require_features' -- a string or sequence of strings naming features that should also be included if this feature is included. Defaults to empty list. May also contain 'Require' objects that should be added/removed from the distribution. 'remove' -- a string or list of strings naming packages to be removed from the distribution if this feature is *not* included. If the feature *is* included, this argument is ignored. This argument exists to support removing features that "crosscut" a distribution, such as defining a 'tests' feature that removes all the 'tests' subpackages provided by other features. The default for this argument is an empty list. (Note: the named package(s) or modules must exist in the base distribution when the 'setup()' function is initially called.) other keywords -- any other keyword arguments are saved, and passed to the distribution's 'include()' and 'exclude()' methods when the feature is included or excluded, respectively. So, for example, you could pass 'packages=["a","b"]' to cause packages 'a' and 'b' to be added or removed from the distribution as appropriate. A feature must include at least one 'requires', 'remove', or other keyword argument. Otherwise, it can't affect the distribution in any way. Note also that you can subclass 'Feature' to create your own specialized feature types that modify the distribution in other ways when included or excluded. See the docstrings for the various methods here for more detail. Aside from the methods, the only feature attributes that distributions look at are 'description' and 'optional'. """ def __init__(self, description, standard=False, available=True, optional=True, require_features=(), remove=(), **extras ): self.description = description self.standard = standard self.available = available self.optional = optional if isinstance(require_features,(str,Require)): require_features = require_features, self.require_features = [ r for r in require_features if isinstance(r,str) ] er = [r for r in require_features if not isinstance(r,str)] if er: extras['require_features'] = er if isinstance(remove,str): remove = remove, self.remove = remove self.extras = extras if not remove and not require_features and not extras: raise DistutilsSetupError( "Feature %s: must define 'require_features', 'remove', or at least one" " of 'packages', 'py_modules', etc." ) def include_by_default(self): """Should this feature be included by default?""" return self.available and self.standard def include_in(self,dist): """Ensure feature and its requirements are included in distribution You may override this in a subclass to perform additional operations on the distribution. Note that this method may be called more than once per feature, and so should be idempotent. """ if not self.available: raise DistutilsPlatformError( self.description+" is required," "but is not available on this platform" ) dist.include(**self.extras) for f in self.require_features: dist.include_feature(f) def exclude_from(self,dist): """Ensure feature is excluded from distribution You may override this in a subclass to perform additional operations on the distribution. This method will be called at most once per feature, and only after all included features have been asked to include themselves. """ dist.exclude(**self.extras) if self.remove: for item in self.remove: dist.exclude_package(item) def validate(self,dist): """Verify that feature makes sense in context of distribution This method is called by the distribution just before it parses its command line. It checks to ensure that the 'remove' attribute, if any, contains only valid package/module names that are present in the base distribution when 'setup()' is called. You may override it in a subclass to perform any other required validation of the feature against a target distribution. """ for item in self.remove: if not dist.has_contents_for(item): raise DistutilsSetupError( "%s wants to be able to remove %s, but the distribution" " doesn't contain any packages or modules under %s" % (self.description, item, item) ) PKC8n66setuptools/extension.pyo; Ec@sdklZdklZeeZydklZWnej o eZ nXe Z defdYZdefdYZ dk Z dkZ dkZ ee i_ee i_de ijoee id_ndS( (s Extension(s_get_unpatched(s build_exts ExtensioncBs#tZdZe o dZnRS(s7Extension that uses '.c' files in place of '.pyx' filescOspti|||g}xG|iD]<}|ido|i|d dq#|i|q#W||_dS(Ns.pyxisc( s _Extensions__init__sselfsargsskwssourcessssendswithsappend(sselfsargsskwssourcesss((s8build/bdist.darwin-8.0.1-x86/egg/setuptools/extension.pys__init__s (s__name__s __module__s__doc__s have_pyrexs__init__(((s8build/bdist.darwin-8.0.1-x86/egg/setuptools/extension.pys Extension s sLibrarycBstZdZRS(s=Just like a regular Extension, but built as a library instead(s__name__s __module__s__doc__(((s8build/bdist.darwin-8.0.1-x86/egg/setuptools/extension.pysLibrarys Nsdistutils.command.build_ext(sdistutils.cores Extensions _Extensionsdists_get_unpatchedsPyrex.Distutils.build_exts build_exts ImportErrorsFalses have_pyrexsTruesLibraryssyss distutilssdistutils.extensionscores extensionsmodules(s distutilss Extensions _ExtensionsLibraryssyss have_pyrexs_get_unpatcheds build_ext((s8build/bdist.darwin-8.0.1-x86/egg/setuptools/extension.pys?s      PKC8Vsetuptools/__init__.pyc; !Fc@sdZdklZlZdklZlZlZdkZ dk Z dk l Z dklZdklZdkZdZdd d d d d dgZeZdfdZe iiZeeZd efdYZdkZ ee i_eidZdkZ ee i_dS(s@Extensions to the 'distutils' for large or complex distributions(s ExtensionsLibrary(s DistributionsFeatures_get_unpatchedN(sRequire(sCommand(s convert_paths0.6c7ssetups DistributionsFeaturesCommands ExtensionsRequires find_packagess.c CsOg} t|dfg}x|o|id\}}xti|D]}ti i ||} d|jo2ti i | oti i ti i | do0| i|||i| ||dfqJqJWqWxdt|dgD]O}dkl}gi}| D]%}||| o||qq~} qW| SdS(sReturn a list all Python packages found within directory 'where' 'where' should be supplied as a "cross-platform" (i.e. URL-style) path; it will be converted to the appropriate local path syntax. 'exclude' is a sequence of package names to exclude; '*' can be used as a wildcard in the names, such that 'foo.*' will exclude all subpackages of 'foo' (but not 'foo' itself). sis.s __init__.pysez_setup(s fnmatchcaseN(souts convert_pathswheresstackspopsprefixsosslistdirsnamespathsjoinsfnsisdirsisfilesappendslistsexcludespatsfnmatchs fnmatchcases_[1]sitem( swheresexcludespatsnames fnmatchcases_[1]sitemsprefixsstacksfnsout((s7build/bdist.darwin-8.0.1-x86/egg/setuptools/__init__.pys find_packagess B9 @cBs,tZeiZeZdZddZRS(NcKsAti||x*|iD]\}}t|||qWdS(N( s_Commands__init__sselfsdistskwsitemssksvssetattr(sselfsdistskwsvsk((s7build/bdist.darwin-8.0.1-x86/egg/setuptools/__init__.pys__init__3s icKsJti|||}x*|iD]\}}t |||q"W|SdS(N( s_Commandsreinitialize_commandsselfscommandsreinit_subcommandsscmdskwsitemssksvssetattr(sselfscommandsreinit_subcommandsskwscmdsvsk((s7build/bdist.darwin-8.0.1-x86/egg/setuptools/__init__.pysreinitialize_command9s  (s__name__s __module__s_Commands__doc__sFalsescommand_consumes_argumentss__init__sreinitialize_command(((s7build/bdist.darwin-8.0.1-x86/egg/setuptools/__init__.pysCommand.s  cCsg}xti|D]\}}}|tijp|ititi o|d}n|o:gi }|D]}|ti i||qr~}n|itti i|qW|SdS(s^Find all files under 'dir' and return the list of full filenames (relative to 'dir'). iN(s all_filessosswalksdirsbasesdirssfilesscurdirs startswithssepsappends_[1]sfspathsjoinsextendsfiltersisfile(sdirsdirssfilessfs_[1]sbases all_files((s7build/bdist.darwin-8.0.1-x86/egg/setuptools/__init__.pysfindallBs*: (s__doc__ssetuptools.extensions ExtensionsLibraryssetuptools.dists DistributionsFeatures_get_unpatchedsdistutils.cores distutilsssetuptools.commands setuptoolsssetuptools.dependssRequiresCommands_Commandsdistutils.utils convert_pathsos.pathsoss __version__s__all__sNonesbootstrap_install_froms find_packagesscoressetupscurdirsfindallsdistutils.filelistsfilelist(s convert_paths Extensions distutilssossRequires_CommandsFeaturesLibrarysfindallsCommands setuptoolssbootstrap_install_fromssetups Distributions __version__s_get_unpatcheds find_packagess__all__((s7build/bdist.darwin-8.0.1-x86/egg/setuptools/__init__.pys?s&         PK45QjAAsetuptools/extension.pyfrom distutils.core import Extension as _Extension from dist import _get_unpatched _Extension = _get_unpatched(_Extension) try: from Pyrex.Distutils.build_ext import build_ext except ImportError: have_pyrex = False else: have_pyrex = True class Extension(_Extension): """Extension that uses '.c' files in place of '.pyx' files""" if not have_pyrex: # convert .pyx extensions to .c def __init__(self,*args,**kw): _Extension.__init__(self,*args,**kw) sources = [] for s in self.sources: if s.endswith('.pyx'): sources.append(s[:-3]+'c') else: sources.append(s) self.sources = sources class Library(Extension): """Just like a regular Extension, but built as a library instead""" import sys, distutils.core, distutils.extension distutils.core.Extension = Extension distutils.extension.Extension = Extension if 'distutils.command.build_ext' in sys.modules: sys.modules['distutils.command.build_ext'].Extension = Extension PKvk6ôsetuptools/cli.exeMZ@ !L!This program cannot be run in DOS mode. $PELIǷE 8p @`l P.text  `.data0 @.rdataP0@@.bss`@.idataP@U]E1ۉu1=wC=r[$1҉T$t tzt$л؋u]]=twJ=t؋u]]=t[=u$1t$ tjt$=$D$ vc l$ 1D$ t0R$ ?$L$ %$ D$r 'US$$@ EED$ @$@@D$ ED$@@D$B @@tY @Q@t@@D$Q@@0$ Q@t@@D$Q@@P$ t&  @ D$@@D$@@$S $+ D$Q@@$w Q@VU$Q@&U$Q@&U 0Q@]t&U $Q@]ᐐUE D$ED$Q@@$\ UWVS uэyD$D?$ E"B9}3<\uA<"u~ \BI\BBC9|ͅ~ \BI"BE [^_]UVSD$D$E$ Ƹt>D$$fÅtD$D$4$ 4$؍e[^]UWVSLu^t/uC\C„u퍅D$D$ D$E؉D$4$}u \u 4$D$D$ \$E؉D$E $э\;\uK;\t9w K;\t9vD$t$ D$E؉D$$$|L[^_]UWVS]ID$ $E޿EE UC$uCEt$ztG}uAt\FOuFU @U4}ueC$=u;uEK}\uG떀}"uu}EEt\FOu}`EFT[^_]UWVS,D$\$$2 эt9s>.tN9s>.uI-scrDipt.fDpyD D$4$Ãut$$0@D$t$$\Ɖ$BG9s?t ? t? u0@8t%Dž#!pyDžthonDž.exeƅD$$D$$fDžuD$$0@ D$E@$^<$ Ӄ;}$F;|ፅ$;u}U $F;u|}t*D$$\$$60@=T$|$$e[^_]US-6D$T$$R[]USdÍE$uC   Шu"t> 1Ҁ …tLt__p__fmodeP__set_app_typey_cexit_iob_makepath^_onexit_setmode_splitpathatexit!calloc9fprintfZisspacesignalExitProcessFreeLibraryGetCommandLineAMGetModuleFileNameAOGetModuleHandleAGetStartupInfoA LoadLibraryExASetUnhandledExceptionFilterPPPPPmsvcrt.dllPPPPPPPPPPPPPPPPPmsvcrt.dll(P(P(P(P(P(P(P(PKERNEL32.dllPK45osetuptools/archive_util.py"""Utilities for extracting common archive formats""" __all__ = [ "unpack_archive", "unpack_zipfile", "unpack_tarfile", "default_filter", "UnrecognizedFormat", "extraction_drivers", "unpack_directory", ] import zipfile, tarfile, os, shutil from pkg_resources import ensure_directory from distutils.errors import DistutilsError class UnrecognizedFormat(DistutilsError): """Couldn't recognize the archive type""" def default_filter(src,dst): """The default progress/filter callback; returns True for all files""" return dst def unpack_archive(filename, extract_dir, progress_filter=default_filter, drivers=None ): """Unpack `filename` to `extract_dir`, or raise ``UnrecognizedFormat`` `progress_filter` is a function taking two arguments: a source path internal to the archive ('/'-separated), and a filesystem path where it will be extracted. The callback must return the desired extract path (which may be the same as the one passed in), or else ``None`` to skip that file or directory. The callback can thus be used to report on the progress of the extraction, as well as to filter the items extracted or alter their extraction paths. `drivers`, if supplied, must be a non-empty sequence of functions with the same signature as this function (minus the `drivers` argument), that raise ``UnrecognizedFormat`` if they do not support extracting the designated archive type. The `drivers` are tried in sequence until one is found that does not raise an error, or until all are exhausted (in which case ``UnrecognizedFormat`` is raised). If you do not supply a sequence of drivers, the module's ``extraction_drivers`` constant will be used, which means that ``unpack_zipfile`` and ``unpack_tarfile`` will be tried, in that order. """ for driver in drivers or extraction_drivers: try: driver(filename, extract_dir, progress_filter) except UnrecognizedFormat: continue else: return else: raise UnrecognizedFormat( "Not a recognized archive type: %s" % filename ) def unpack_directory(filename, extract_dir, progress_filter=default_filter): """"Unpack" a directory, using the same interface as for archives Raises ``UnrecognizedFormat`` if `filename` is not a directory """ if not os.path.isdir(filename): raise UnrecognizedFormat("%s is not a directory" % (filename,)) paths = {filename:('',extract_dir)} for base, dirs, files in os.walk(filename): src,dst = paths[base] for d in dirs: paths[os.path.join(base,d)] = src+d+'/', os.path.join(dst,d) for f in files: name = src+f target = os.path.join(dst,f) target = progress_filter(src+f, target) if not target: continue # skip non-files ensure_directory(target) f = os.path.join(base,f) shutil.copyfile(f, target) shutil.copystat(f, target) def unpack_zipfile(filename, extract_dir, progress_filter=default_filter): """Unpack zip `filename` to `extract_dir` Raises ``UnrecognizedFormat`` if `filename` is not a zipfile (as determined by ``zipfile.is_zipfile()``). See ``unpack_archive()`` for an explanation of the `progress_filter` argument. """ if not zipfile.is_zipfile(filename): raise UnrecognizedFormat("%s is not a zip file" % (filename,)) z = zipfile.ZipFile(filename) try: for info in z.infolist(): name = info.filename # don't extract absolute paths or ones with .. in them if name.startswith('/') or '..' in name: continue target = os.path.join(extract_dir, *name.split('/')) target = progress_filter(name, target) if not target: continue if name.endswith('/'): # directory ensure_directory(target) else: # file ensure_directory(target) data = z.read(info.filename) f = open(target,'wb') try: f.write(data) finally: f.close() del data finally: z.close() def unpack_tarfile(filename, extract_dir, progress_filter=default_filter): """Unpack tar/tar.gz/tar.bz2 `filename` to `extract_dir` Raises ``UnrecognizedFormat`` if `filename` is not a tarfile (as determined by ``tarfile.open()``). See ``unpack_archive()`` for an explanation of the `progress_filter` argument. """ try: tarobj = tarfile.open(filename) except tarfile.TarError: raise UnrecognizedFormat( "%s is not a compressed or uncompressed tar file" % (filename,) ) try: tarobj.chown = lambda *args: None # don't do any chowning! for member in tarobj: if member.isfile() or member.isdir(): name = member.name # don't extract absolute paths or ones with .. in them if not name.startswith('/') and '..' not in name: dst = os.path.join(extract_dir, *name.split('/')) dst = progress_filter(name, dst) if dst: if dst.endswith(os.sep): dst = dst[:-1] tarobj._extract_member(member,dst) # XXX Ugh return True finally: tarobj.close() extraction_drivers = unpack_directory, unpack_zipfile, unpack_tarfile PKvk6{ setuptools/gui.exeMZ@ !L!This program cannot be run in DOS mode. $PELOǷE 8p @`tb P.text  `.data0 @.rdataP0@@.bss`@.idataP@U]E1ۉu1=wC=r[$1҉T$t tzt$л؋u]]=twJ=t؋u]]=t[=u$1t$ tjt$=$D$ vc l$ 1D$ t0R$ ?$L$ %$ D$r 'US$$@ EED$ @$@@D$ ED$@@D$B @@tY @Q@t@@D$Q@@0$ Q@t@@D$Q@@P$ t&  @ D$@@D$@@$S $+ D$Q@@$w Q@VU$Q@&U$Q@&U 0Q@]t&U $Q@]ᐐUE D$ED$Q@@$\ UWVS uэyD$D?$ E"B9}3<\uA<"u~ \BI\BBC9|ͅ~ \BI"BE [^_]UVSD$D$E$ Ƹt>D$$fÅtD$D$4$ 4$؍e[^]UWVSLu^t/uC\C„u퍅D$D$ D$E؉D$4$}u \u 4$D$D$ \$E؉D$E $э\;\uK;\t9w K;\t9vD$t$ D$E؉D$$$|L[^_]UWVS]ID$ $E޿EE UC$uCEt$ztG}uAt\FOuFU @U4}ueC$=u;uEK}\uG떀}"uu}EEt\FOu}`EFT[^_]UWVS,D$\$$2 эt9s>.tN9s>.uI-scrDipt.DpywD$4$Ãut$$0@D$t$$`Ɖ$FG9s?t ? t? u0@8t%Dž#!pyDžthonDž.exeƅD$$D$$jDžuD$$0@D$E@$b<$Ӄ;}$F;|ፅ$;u}U $F;u|}t*D$$\$$60@AT$|$$e[^_]US1:D$T$$V[]USdÍE$uC   Шu"t> 1Ҁ …tLt__p__fmodeP__set_app_typey_cexit_iob_makepath^_onexit_setmode_splitpathatexit!calloc9fprintfZisspacesignalExitProcessFreeLibraryGetCommandLineAMGetModuleFileNameAOGetModuleHandleAGetStartupInfoA LoadLibraryExASetUnhandledExceptionFilterPPPPPmsvcrt.dllPPPPPPPPPPPPPPPPPmsvcrt.dll(P(P(P(P(P(P(P(PKERNEL32.dllPKC8'a:L:Lsetuptools/command/egg_info.pyo; Fc@sBdZdkZdkZdklZdkTdklZdkl Z dkl Z dk l Z dk lZd klZlZlZlZlZlZlZlZd k lZd efd YZd efdYZde fdYZdZdZdZdZdZe dZ!dZ"dZ#dS(sUsetuptools.command.egg_info Create a distribution's .egg-info directory and contentsN(sCommand(s*(slog(ssdist(s file_util(s convert_path(sFileList(sparse_requirementss safe_names parse_versions safe_versions yield_liness EntryPointsiter_entry_pointss to_filename(s walk_revctrlsegg_infocBstZdZdddfdddfdd d fd d d fdddfdddfgZddgZhdd<dd|ii D],}||jp|i |doPqrqrW|St |d}d|ijo!dkl}|id|n|i|SdS(s8Check namespace packages' __init__ for declare_namespaces.srUsdeclare_namespace(slogsWARNING: %s is a namespace package, but its __init__.py does not declare_namespace(); setuptools 0.7 will REQUIRE this! (See the setuptools manual under "Namespace Packages" for details.) N(sselfspackages_checkedspackagesKeyErrors _build_pys check_packages package_dirsinit_pys distributionsnamespace_packagesspkgs startswithsopensfsreads distutilsslogswarnsclose(sselfspackages package_dirsfslogsinit_pyspkg((s?build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_py.pys check_package|s*  !     cCsh|_ti|dS(N(sselfspackages_checkeds _build_pysinitialize_options(sself((s?build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_py.pysinitialize_optionss c Cs|iidg|ii|g} g}x<| D]4}|iti |t i i |t|q5Wti|}h}gi}|D]A}||jo||jo|i|do||qq~SdS(s6Filter filenames for package's data files in 'src_dir'siN(sselfsexclude_package_datasgetspackagesglobssbadspatternsextendsfnmatchsfiltersfilessosspathsjoinssrc_dirs convert_pathsdictsfromkeyssseensappends_[1]sfs setdefault( sselfspackagessrc_dirsfilesspatternsfs_[1]sbadsseensglobs((s?build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_py.pysexclude_data_filess(2(s__name__s __module__s__doc__sfinalize_optionssruns __getattr__s_get_data_filessfind_data_filessbuild_package_datasanalyze_manifestsget_data_filesssyssversions get_outputss check_packagesinitialize_optionssexclude_data_files(((s?build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_py.pysbuild_pys         cCs=tii| o|Sndkl}|d|dS(N(sDistutilsSetupErrorsError: setup script specifies an absolute path: %s setup() arguments must *always* be /-separated paths relative to the setup.py directory, *never* absolute paths. (sosspathsisabssdistutils.errorssDistutilsSetupError(spathsDistutilsSetupError((s?build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_py.pysassert_relatives ( sos.pathsosssyssfnmatchsdistutils.command.build_pysbuild_pys _build_pysdistutils.utils convert_pathsglobsassert_relative(s convert_pathsassert_relativesbuild_pysglobssyss _build_pysfnmatchsos((s?build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_py.pys?s    PK45Gh,h,setuptools/command/build_ext.pyfrom distutils.command.build_ext import build_ext as _du_build_ext try: # Attempt to use Pyrex for building extensions, if available from Pyrex.Distutils.build_ext import build_ext as _build_ext except ImportError: _build_ext = _du_build_ext import os, sys from distutils.file_util import copy_file from setuptools.extension import Library from distutils.ccompiler import new_compiler from distutils.sysconfig import customize_compiler, get_config_var get_config_var("LDSHARED") # make sure _config_vars is initialized from distutils.sysconfig import _config_vars from distutils import log from distutils.errors import * have_rtld = False use_stubs = False libtype = 'shared' if sys.platform == "darwin": use_stubs = True elif os.name != 'nt': try: from dl import RTLD_NOW have_rtld = True use_stubs = True except ImportError: pass def if_dl(s): if have_rtld: return s return '' class build_ext(_build_ext): def run(self): """Build extensions in build directory, then copy if --inplace""" old_inplace, self.inplace = self.inplace, 0 _build_ext.run(self) self.inplace = old_inplace if old_inplace: self.copy_extensions_to_source() def copy_extensions_to_source(self): build_py = self.get_finalized_command('build_py') for ext in self.extensions: fullname = self.get_ext_fullname(ext.name) filename = self.get_ext_filename(fullname) modpath = fullname.split('.') package = '.'.join(modpath[:-1]) package_dir = build_py.get_package_dir(package) dest_filename = os.path.join(package_dir,os.path.basename(filename)) src_filename = os.path.join(self.build_lib,filename) # Always copy, even if source is older than destination, to ensure # that the right extensions for the current Python/platform are # used. copy_file( src_filename, dest_filename, verbose=self.verbose, dry_run=self.dry_run ) if ext._needs_stub: self.write_stub(package_dir or os.curdir, ext, True) if _build_ext is not _du_build_ext: # Workaround for problems using some Pyrex versions w/SWIG and/or 2.4 def swig_sources(self, sources, *otherargs): # first do any Pyrex processing sources = _build_ext.swig_sources(self, sources) or sources # Then do any actual SWIG stuff on the remainder return _du_build_ext.swig_sources(self, sources, *otherargs) def get_ext_filename(self, fullname): filename = _build_ext.get_ext_filename(self,fullname) ext = self.ext_map[fullname] if isinstance(ext,Library): fn, ext = os.path.splitext(filename) return self.shlib_compiler.library_filename(fn,libtype) elif use_stubs and ext._links_to_dynamic: d,fn = os.path.split(filename) return os.path.join(d,'dl-'+fn) else: return filename def initialize_options(self): _build_ext.initialize_options(self) self.shlib_compiler = None self.shlibs = [] self.ext_map = {} def finalize_options(self): _build_ext.finalize_options(self) self.extensions = self.extensions or [] self.check_extensions_list(self.extensions) self.shlibs = [ext for ext in self.extensions if isinstance(ext,Library)] if self.shlibs: self.setup_shlib_compiler() for ext in self.extensions: fullname = ext._full_name = self.get_ext_fullname(ext.name) self.ext_map[fullname] = ext ltd = ext._links_to_dynamic = \ self.shlibs and self.links_to_dynamic(ext) or False ext._needs_stub = ltd and use_stubs and not isinstance(ext,Library) filename = ext._file_name = self.get_ext_filename(fullname) libdir = os.path.dirname(os.path.join(self.build_lib,filename)) if ltd and libdir not in ext.library_dirs: ext.library_dirs.append(libdir) if ltd and use_stubs and os.curdir not in ext.runtime_library_dirs: ext.runtime_library_dirs.append(os.curdir) def setup_shlib_compiler(self): compiler = self.shlib_compiler = new_compiler( compiler=self.compiler, dry_run=self.dry_run, force=self.force ) if sys.platform == "darwin": tmp = _config_vars.copy() try: # XXX Help! I don't have any idea whether these are right... _config_vars['LDSHARED'] = "gcc -Wl,-x -dynamiclib -undefined dynamic_lookup" _config_vars['CCSHARED'] = " -dynamiclib" _config_vars['SO'] = ".dylib" customize_compiler(compiler) finally: _config_vars.clear() _config_vars.update(tmp) else: customize_compiler(compiler) if self.include_dirs is not None: compiler.set_include_dirs(self.include_dirs) if self.define is not None: # 'define' option is a list of (name,value) tuples for (name,value) in self.define: compiler.define_macro(name, value) if self.undef is not None: for macro in self.undef: compiler.undefine_macro(macro) if self.libraries is not None: compiler.set_libraries(self.libraries) if self.library_dirs is not None: compiler.set_library_dirs(self.library_dirs) if self.rpath is not None: compiler.set_runtime_library_dirs(self.rpath) if self.link_objects is not None: compiler.set_link_objects(self.link_objects) # hack so distutils' build_extension() builds a library instead compiler.link_shared_object = link_shared_object.__get__(compiler) def get_export_symbols(self, ext): if isinstance(ext,Library): return ext.export_symbols return _build_ext.get_export_symbols(self,ext) def build_extension(self, ext): _compiler = self.compiler try: if isinstance(ext,Library): self.compiler = self.shlib_compiler _build_ext.build_extension(self,ext) if ext._needs_stub: self.write_stub( self.get_finalized_command('build_py').build_lib, ext ) finally: self.compiler = _compiler def links_to_dynamic(self, ext): """Return true if 'ext' links to a dynamic lib in the same package""" # XXX this should check to ensure the lib is actually being built # XXX as dynamic, and not just using a locally-found version or a # XXX static-compiled version libnames = dict.fromkeys([lib._full_name for lib in self.shlibs]) pkg = '.'.join(ext._full_name.split('.')[:-1]+['']) for libname in ext.libraries: if pkg+libname in libnames: return True return False def get_outputs(self): outputs = _build_ext.get_outputs(self) optimize = self.get_finalized_command('build_py').optimize for ext in self.extensions: if ext._needs_stub: base = os.path.join(self.build_lib, *ext._full_name.split('.')) outputs.append(base+'.py') outputs.append(base+'.pyc') if optimize: outputs.append(base+'.pyo') return outputs def write_stub(self, output_dir, ext, compile=False): log.info("writing stub loader for %s to %s",ext._full_name, output_dir) stub_file = os.path.join(output_dir, *ext._full_name.split('.'))+'.py' if compile and os.path.exists(stub_file): raise DistutilsError(stub_file+" already exists! Please delete.") if not self.dry_run: f = open(stub_file,'w') f.write('\n'.join([ "def __bootstrap__():", " global __bootstrap__, __file__, __loader__", " import sys, os, pkg_resources, imp"+if_dl(", dl"), " __file__ = pkg_resources.resource_filename(__name__,%r)" % os.path.basename(ext._file_name), " del __bootstrap__", " if '__loader__' in globals():", " del __loader__", if_dl(" old_flags = sys.getdlopenflags()"), " old_dir = os.getcwd()", " try:", " os.chdir(os.path.dirname(__file__))", if_dl(" sys.setdlopenflags(dl.RTLD_NOW)"), " imp.load_dynamic(__name__,__file__)", " finally:", if_dl(" sys.setdlopenflags(old_flags)"), " os.chdir(old_dir)", "__bootstrap__()", "" # terminal \n ])) f.close() if compile: from distutils.util import byte_compile byte_compile([stub_file], optimize=0, force=True, dry_run=self.dry_run) optimize = self.get_finalized_command('install_lib').optimize if optimize > 0: byte_compile([stub_file], optimize=optimize, force=True, dry_run=self.dry_run) if os.path.exists(stub_file) and not self.dry_run: os.unlink(stub_file) if use_stubs or os.name=='nt': # Build shared libraries # def link_shared_object(self, objects, output_libname, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None, target_lang=None ): self.link( self.SHARED_LIBRARY, objects, output_libname, output_dir, libraries, library_dirs, runtime_library_dirs, export_symbols, debug, extra_preargs, extra_postargs, build_temp, target_lang ) else: # Build static libraries everywhere else libtype = 'static' def link_shared_object(self, objects, output_libname, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None, target_lang=None ): # XXX we need to either disallow these attrs on Library instances, # or warn/abort here if set, or something... #libraries=None, library_dirs=None, runtime_library_dirs=None, #export_symbols=None, extra_preargs=None, extra_postargs=None, #build_temp=None assert output_dir is None # distutils build_ext doesn't pass this output_dir,filename = os.path.split(output_libname) basename, ext = os.path.splitext(filename) if self.library_filename("x").startswith('lib'): # strip 'lib' prefix; this is kludgy if some platform uses # a different prefix basename = basename[3:] self.create_static_lib( objects, basename, output_dir, debug, target_lang ) PKC8؈~3~3 setuptools/command/build_ext.pyc; Ec @sdklZydklZWnej o eZnXdkZdkZdkl Z dk l Z dk l Z dklZlZeddklZdklZd kTeZeZd Zeid jo eZnHeid jo7yd klZeZeZWq$ej oq$XndZdefdYZep eid jo+eeeeedeeeed Z n.dZeeeeedeeeed Z dS((s build_extN(s copy_file(sLibrary(s new_compiler(scustomize_compilersget_config_varsLDSHARED(s _config_vars(slog(s*ssharedsdarwinsnt(sRTLD_NOWcCsto|SndSdS(Ns(s have_rtldss(ss((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pysif_dl ss build_extcBstZdZdZeej o dZndZdZdZ dZ dZ d Z d Z d Zed ZRS( NcCsG|idf\}|_ti|||_|o|indS(s;Build extensions in build directory, then copy if --inplaceiN(sselfsinplaces old_inplaces _build_extsrunscopy_extensions_to_source(sselfs old_inplace((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pysrun+s   c Cs|id}x|iD]}|i|i}|i|}|i d}di |d }|i|} tii | tii|}tii |i|}t||d|id|i|io!|i| pti|tqqWdS(Nsbuild_pys.isverbosesdry_run(sselfsget_finalized_commandsbuild_pys extensionssextsget_ext_fullnamesnamesfullnamesget_ext_filenamesfilenamessplitsmodpathsjoinspackagesget_package_dirs package_dirsosspathsbasenames dest_filenames build_libs src_filenames copy_filesverbosesdry_runs _needs_stubs write_stubscurdirsTrue( sselfsbuild_pyspackages src_filenamesfilenames dest_filenamesextsmodpathsfullnames package_dir((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pyscopy_extensions_to_source3s !  cGs0ti||p|}ti|||SdS(N(s _build_exts swig_sourcessselfssourcess _du_build_exts otherargs(sselfssourcess otherargs((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pys swig_sourcesKscCsti||}|i|}t|to/t i i |\}}|i i|tSnIto|io3t i i|\}}t i i|d|Sn|SdS(Nsdl-(s _build_extsget_ext_filenamesselfsfullnamesfilenamesext_mapsexts isinstancesLibrarysosspathssplitextsfnsshlib_compilerslibrary_filenameslibtypes use_stubss_links_to_dynamicssplitsdsjoin(sselfsfullnamesdsfilenamesextsfn((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pysget_ext_filenameSs cCs,ti|t|_g|_h|_dS(N(s _build_extsinitialize_optionssselfsNonesshlib_compilersshlibssext_map(sself((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pysinitialize_options_s   cCsti||ipg|_|i|igi}|iD]$}t|t o||qAqA~|_ |i o|i nx|iD]}|i |i }|_||i|<|i o |i|pt}|_|otot|t  |_|i|}|_tiitii|i|}|o ||i jo|i i|n|ototi!|i"jo|i"iti!qqWdS(N(#s _build_extsfinalize_optionssselfs extensionsscheck_extensions_listsappends_[1]sexts isinstancesLibrarysshlibsssetup_shlib_compilersget_ext_fullnamesnamesfullnames _full_namesext_mapslinks_to_dynamicsFalsesltds_links_to_dynamics use_stubss _needs_stubsget_ext_filenamesfilenames _file_namesosspathsdirnamesjoins build_libslibdirs library_dirsscurdirsruntime_library_dirs(sselfslibdirsfilenames_[1]sextsltdsfullname((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pysfinalize_optionses$ A   '!$!cCstd|id|id|i}|_tidjoWti }z,dtd+        cCs/t|to |iSnti||SdS(N(s isinstancesextsLibrarysexport_symbolss _build_extsget_export_symbolssself(sselfsext((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pysget_export_symbolss cCsx|i}z^t|to|i|_nti|||i o |i |i di |nWd||_XdS(Nsbuild_py( sselfscompilers _compilers isinstancesextsLibrarysshlib_compilers _build_extsbuild_extensions _needs_stubs write_stubsget_finalized_commands build_lib(sselfsexts _compiler((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pysbuild_extensions  $cCstigi}|iD]}||iq~}di |ii dd dg}x*|i D]}|||jotSqfqfWtSdS(s?Return true if 'ext' links to a dynamic lib in the same packages.isN(sdictsfromkeyssappends_[1]sselfsshlibsslibs _full_nameslibnamessjoinsextssplitspkgs librariesslibnamesTruesFalse(sselfsextslibnameslibs_[1]spkgslibnames((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pyslinks_to_dynamics6&  cCsti|}|idi}x|iD]v}|ioft i i |i |i id}|i|d|i|d|o|i|dqq+q+W|SdS(Nsbuild_pys.s.pys.pycs.pyo(s _build_exts get_outputssselfsoutputssget_finalized_commandsoptimizes extensionssexts _needs_stubsosspathsjoins build_libs _full_namessplitsbasesappend(sselfsoutputssextsbasesoptimize((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pys get_outputss  $cCstid|i|tii||iidd}|otii |ot |dn|i ot|d}|ididdd td d tii|id d dtddddtdddtddddg|in|odkl}||gdddtd|i|idi}|djo&||gd|dtd|intii |o|i oti|qndS( Ns writing stub loader for %s to %ss.s.pys already exists! Please delete.sws sdef __bootstrap__():s- global __bootstrap__, __file__, __loader__s% import sys, os, pkg_resources, imps, dls: __file__ = pkg_resources.resource_filename(__name__,%r)s del __bootstrap__s if '__loader__' in globals():s del __loader__s# old_flags = sys.getdlopenflags()s old_dir = os.getcwd()s try:s( os.chdir(os.path.dirname(__file__))s$ sys.setdlopenflags(dl.RTLD_NOW)s( imp.load_dynamic(__name__,__file__)s finally:s" sys.setdlopenflags(old_flags)s os.chdir(old_dir)s__bootstrap__()s(s byte_compilesoptimizeisforcesdry_runs install_lib(slogsinfosexts _full_names output_dirsosspathsjoinssplits stub_filescompilesexistssDistutilsErrorsselfsdry_runsopensfswritesif_dlsbasenames _file_namesclosesdistutils.utils byte_compilesTruesget_finalized_commandsoptimizesunlink(sselfs output_dirsextscompiles byte_compilesoptimizesfs stub_file((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pys write_stubs$% {  (s__name__s __module__srunscopy_extensions_to_sources _build_exts _du_build_exts swig_sourcessget_ext_filenamesinitialize_optionssfinalize_optionsssetup_shlib_compilersget_export_symbolssbuild_extensionslinks_to_dynamics get_outputssFalses write_stub(((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pys build_ext*s       )  ic Cs8|i|i||||||||| | | | dS(N(sselfslinksSHARED_LIBRARYsobjectssoutput_libnames output_dirs librariess library_dirssruntime_library_dirssexport_symbolssdebugs extra_preargssextra_postargss build_temps target_lang( sselfsobjectssoutput_libnames output_dirs librariess library_dirssruntime_library_dirssexport_symbolssdebugs extra_preargssextra_postargss build_temps target_lang((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pyslink_shared_objects  sstaticc Cs|tjpttii|\}}tii|\}} |i di do|d}n|i||||| dS(Nsxslibi(s output_dirsNonesAssertionErrorsosspathssplitsoutput_libnamesfilenamessplitextsbasenamesextsselfslibrary_filenames startswithscreate_static_libsobjectssdebugs target_lang(sselfsobjectssoutput_libnames output_dirs librariess library_dirssruntime_library_dirssexport_symbolssdebugs extra_preargssextra_postargss build_temps target_langsextsfilenamesbasename((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pyslink_shared_objects (!sdistutils.command.build_exts build_exts _du_build_extsPyrex.Distutils.build_exts _build_exts ImportErrorsosssyssdistutils.file_utils copy_filessetuptools.extensionsLibrarysdistutils.ccompilers new_compilersdistutils.sysconfigscustomize_compilersget_config_vars _config_varss distutilsslogsdistutils.errorssFalses have_rtlds use_stubsslibtypesplatformsTruesnamesdlsRTLD_NOWsif_dlsNoneslink_shared_object(sget_config_vars _du_build_extsRTLD_NOWs build_exts new_compilerscustomize_compilerslogs _build_extslink_shared_objects copy_files have_rtldssyss use_stubssif_dls _config_varssLibraryslibtypesos((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pys?s>             + PK5Trrsetuptools/command/__init__.py__all__ = [ 'alias', 'bdist_egg', 'bdist_rpm', 'build_ext', 'build_py', 'develop', 'easy_install', 'egg_info', 'install', 'install_lib', 'rotate', 'saveopts', 'sdist', 'setopt', 'test', 'upload', 'install_egg_info', 'install_scripts', 'register', 'bdist_wininst', ] import sys if sys.version>='2.5': # In Python 2.5 and above, distutils includes its own upload command __all__.remove('upload') from distutils.command.bdist import bdist if 'egg' not in bdist.format_commands: bdist.format_command['egg'] = ('bdist_egg', "Python .egg file") bdist.format_commands.append('egg') del bdist, sys PKC8?setuptools/command/upload.pyc; eFc@sdZdkTdklZdklZdklZdklZdk Z dk Z dk Z dk Z dk Z dkZdkZdkZdefdYZdS( s`distutils.command.upload Implements the Distutils 'upload' subcommand (upload package to PyPI).(s*(sCommand(sspawn(slog(smd5NsuploadcBs~tZdZdZdddefdedfdd d fd d d fgZddgZdZdZdZ dZ RS(Nsupload binary package to PyPIshttp://pypi.python.org/pypis repository=srsurl of repository [default: %s]s show-responses&display full response text from serverssignssssign files to upload using gpgs identity=sisGPG identity used to sign filescCs:d|_d|_d|_d|_t|_t|_dS(Nsi( sselfsusernamespasswords repositorys show_responsesFalsessignsNonesidentity(sself((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/upload.pysinitialize_options$s      cCsB|io|i otdntiidotiitidd}tii |o|i d|t i hdd<dd<dd<}|i||i o|id d|_n|i o|id d|_n|i o|id d|_qq#n|i o|i|_ndS( Ns.Must use --sign for --identity to have meaningsHOMEs.pypircsUsing PyPI login from %ssusernamesspasswords repositorys server-login(sselfsidentityssignsDistutilsOptionErrorsossenvironshas_keyspathsjoinsrcsexistssannounces ConfigParsersconfigsreads repositorysgetsusernamespasswordsDEFAULT_REPOSITORY(sselfsrcsconfig((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/upload.pysfinalize_options,s *    ! cCsU|ii otdnx0|iiD]"\}}}|i|||q+WdS(Ns'No dist file created in earlier command(sselfs distributions dist_filessDistutilsOptionErrorscommands pyversionsfilenames upload_file(sselfscommands pyversionsfilename((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/upload.pysrunCs  cCsR|ioMddd|g} |iod|ig| dd+nt| d|int|di} t i i |}d}|d jo |iiod tid d }nhd d<dd<d|ii<d|ii<d|| f<d|<d|<dt| i<}|djo4ti\}} } |od|| f}qn(|djodtid d }n||d<|io4t i i |dt|dif|d|}nt:d-|d}t1i2}yu|i@|iAd.||iBd/d0||iBd1t,tC||iBd2||iD|iE|Wn5tFiGj o&}|i/t,|t1iIdSnX|iJ}|iLd3jo'|i/d4|iL|iMft1i2n$|i/d5|iL|iMft1iI|iNod6d7G|iGd6d7GHndS(8Nsgpgs --detach-signs-as --local-userisdry_runsrbss bdist_eggs built on %ssterseis:actions file_uploadsprotcol_versions1snamesversionscontentsfiletypes pyversions md5_digests bdist_rpmsbuilt for %s %ss bdist_dumbs built for %sscomments.ascs gpg_signaturesBasic s:s3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254s --s--s;filename="%s"is* Content-Disposition: form-data; name="%s"s is s sSubmitting %s to %sshttpshttpssunsupported schema sPOSTs Content-types multipart/form-data; boundary=%ssContent-lengths AuthorizationisServer response (%s): %ssUpload failed (%s): %ss-iK(Osselfssignsfilenamesgpg_argssidentitysspawnsdry_runsopensreadscontentsosspathsbasenamescommentscommands distributionshas_ext_modulessplatformsget_names get_versions pyversionsmd5s hexdigestsdatasdistsversionsidsbase64s encodestringsusernamespasswordsstripsauthsboundarys sep_boundarys end_boundarysStringIOsbodysitemsskeysvaluestypestuplesfnsstrswritesgetvaluesannounces repositoryslogsINFOsurlparsesschemasnetlocsurlsparamssquerys fragmentssAssertionErrorshttplibsHTTPConnectionshttpsHTTPSConnectionsloglevelsconnects putrequests putheaderslens endheadersssendssocketserrorsesERRORs getresponsesrsstatussreasons show_response(sselfscommands pyversionsfilenamescommentsdistsbasenamesvaluesquerysids end_boundarysgpg_argsscontentsversionsparamss sep_boundarysboundarysschemasbodyshttpsnetlocsauthskeysdatas fragmentssfnsesurlsloglevelsr((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/upload.pys upload_fileIs  r    4'              $            ( s__name__s __module__s descriptionsDEFAULT_REPOSITORYsNones user_optionssboolean_optionssinitialize_optionssfinalize_optionssruns upload_file(((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/upload.pysuploads:    (s__doc__sdistutils.errorssdistutils.coresCommandsdistutils.spawnsspawns distutilsslogsmd5sosssocketsplatforms ConfigParsershttplibsbase64surlparses cStringIOsStringIOsupload( sspawnshttplibssocketsStringIOsbase64suploadsurlparsesplatformsCommands ConfigParsersmd5sosslog((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/upload.pys?s            PKvk6@setuptools/command/install.pyimport setuptools, sys from distutils.command.install import install as _install from distutils.errors import DistutilsArgError class install(_install): """Use easy_install to install the package, w/dependencies""" user_options = _install.user_options + [ ('old-and-unmanageable', None, "Try not to use this!"), ('single-version-externally-managed', None, "used by system package builders to create 'flat' eggs"), ] boolean_options = _install.boolean_options + [ 'old-and-unmanageable', 'single-version-externally-managed', ] new_commands = [ ('install_egg_info', lambda self: True), ('install_scripts', lambda self: True), ] _nc = dict(new_commands) sub_commands = [ cmd for cmd in _install.sub_commands if cmd[0] not in _nc ] + new_commands def initialize_options(self): _install.initialize_options(self) self.old_and_unmanageable = None self.single_version_externally_managed = None self.no_compile = None # make DISTUTILS_DEBUG work right! def finalize_options(self): _install.finalize_options(self) if self.root: self.single_version_externally_managed = True elif self.single_version_externally_managed: if not self.root and not self.record: raise DistutilsArgError( "You must specify --record or --root when building system" " packages" ) def handle_extra_path(self): if self.root or self.single_version_externally_managed: # explicit backward-compatibility mode, allow extra_path to work return _install.handle_extra_path(self) # Ignore extra_path when installing an egg (or being run by another # command without --root or --single-version-externally-managed self.path_file = None self.extra_dirs = '' def run(self): # Explicit request for old-style install? Just do it if self.old_and_unmanageable or self.single_version_externally_managed: return _install.run(self) # Attempt to detect whether we were called from setup() or by another # command. If we were called by setup(), our caller will be the # 'run_command' method in 'distutils.dist', and *its* caller will be # the 'run_commands' method. If we were called any other way, our # immediate caller *might* be 'run_command', but it won't have been # called by 'run_commands'. This is slightly kludgy, but seems to # work. # caller = sys._getframe(2) caller_module = caller.f_globals.get('__name__','') caller_name = caller.f_code.co_name if caller_module != 'distutils.dist' or caller_name!='run_commands': # We weren't called from the command line or setup(), so we # should run in backward-compatibility mode to support bdist_* # commands. _install.run(self) else: self.do_egg_install() def do_egg_install(self): easy_install = self.distribution.get_command_class('easy_install') cmd = easy_install( self.distribution, args="x", root=self.root, record=self.record, ) cmd.ensure_finalized() # finalize before bdist_egg munges install cmd self.run_command('bdist_egg') args = [self.distribution.get_command_obj('bdist_egg').egg_output] if setuptools.bootstrap_install_from: # Bootstrap self-installation of setuptools args.insert(0, setuptools.bootstrap_install_from) cmd.args = args cmd.run() setuptools.bootstrap_install_from = None # PKC8setuptools/command/setopt.pyo; Ec@sdkZdkZdklZdklZdklZdkTddddgZd d Z e d Z defd YZ de fd YZ dS(N(sCommand(s convert_path(slog(s*s config_files edit_configs option_basessetoptslocalcCs|djodSn|djo&tiitiitidSn|djo;tidjodpd}tii t d |Snt d |d S( sGet the filename of the distutils, local, global, or per-user config `kind` must be one of "local", "global", or "user" slocals setup.cfgsglobals distutils.cfgsusersposixs.ss~/%spydistutils.cfgs7config_file() type must be 'local', 'global', or 'user'N( skindsosspathsjoinsdirnames distutilss__file__snamesdots expandusers convert_paths ValueError(skindsdot((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/setopt.pys config_file s  & c Csdkl}tid||}|i|gx5|iD]'\}}|t jo$ti d|||i |qC|i| o$tid|||i|nx|iD]\} }|t jo_tid|| ||i|| |i | o$ti d|||i |qfqtid|| |||i|| |qWqCWti d|| o*t|d }|i||ind S( sYEdit a configuration file to include `settings` `settings` is a dictionary of dictionaries or ``None`` values, keyed by command/section name. A ``None`` value means to delete the entire section, while a dictionary lists settings to be changed or deleted in that section. A setting of ``None`` means to delete that setting. (sRawConfigParsersReading configuration from %ssDeleting section [%s] from %ssAdding new section [%s] to %ssDeleting %s.%s from %ss#Deleting empty [%s] section from %ssSetting %s.%s to %r in %ss Writing %sswN(s ConfigParsersRawConfigParserslogsdebugsfilenamesoptssreadssettingssitemsssectionsoptionssNonesinfosremove_sections has_sections add_sectionsoptionsvalues remove_optionssetsdry_runsopensfswritesclose( sfilenamessettingssdry_runssectionsfsvaluesRawConfigParsersoptionssoptssoption((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/setopt.pys edit_config*s:           cBsVtZdZdddfdddfddd fgZddgZd Zd ZRS( s<Abstract base class for commands that mess with config filess global-configsgs0save options to the site-wide distutils.cfg files user-configsus7save options to the current user's pydistutils.cfg files filename=sfs-configuration file to use (default=setup.cfg)cCst|_t|_t|_dS(N(sNonesselfs global_configs user_configsfilename(sself((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/setopt.pysinitialize_optionscs  cCsg}|io|itdn|io|itdn|itj o|i|in| o|itdnt|djot d|n|\|_dS(Nsglobalsuserslocalis/Must specify only one configuration file option( s filenamessselfs global_configsappends config_files user_configsfilenamesNoneslensDistutilsOptionError(sselfs filenames((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/setopt.pysfinalize_optionshs   (s__name__s __module__s__doc__s user_optionssboolean_optionssinitialize_optionssfinalize_options(((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/setopt.pys option_baseSs *  cBs|tZdZdZdddfdddfdd d fd d d fgeiZeid gZdZdZdZ RS(s#Save command-line options to a files1set an option in setup.cfg or another config filescommand=scscommand to set an option forsoption=sos option to sets set-value=sssvalue of the optionsremovesrsremove (unset) the valuecCs5ti|t|_t|_t|_t|_dS(N(s option_basesinitialize_optionssselfsNonescommandsoptions set_valuesremove(sself((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/setopt.pysinitialize_optionss     cCslti||itjp |itjotdn|itjo|i otdndS(Ns%Must specify --command *and* --options$Must specify --set-value or --remove( s option_basesfinalize_optionssselfscommandsNonesoptionsDistutilsOptionErrors set_valuesremove(sself((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/setopt.pysfinalize_optionss   c CsAt|ih|ih|iidd|i<<|idS(Ns-s_(s edit_configsselfsfilenamescommandsoptionsreplaces set_valuesdry_run(sself((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/setopt.pysruns3( s__name__s __module__s__doc__s descriptions option_bases user_optionssboolean_optionssinitialize_optionssfinalize_optionssrun(((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/setopt.pyssetopt|s =  (s distutilssoss setuptoolssCommandsdistutils.utils convert_pathslogsdistutils.errorss__all__s config_filesFalses edit_configs option_basessetopt( s convert_paths config_fileslogs__all__s distutilssCommands edit_configsoss option_basessetopt((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/setopt.pys?s    ))PKC8!N N &setuptools/command/install_scripts.pyc; wREc@sidklZdklZlZdklZlZl Z dk Z dk l Z defdYZdS((sinstall_scripts(sget_script_argsssys_executable(s Distributions PathMetadatasensure_directoryN(slogsinstall_scriptscBs,tZdZdZdZddZRS(s;Do normal script install, plus any egg_info wrapper scriptscCsti|t|_dS(N(s_install_scriptssinitialize_optionssselfsFalsesno_ep(sself((sFbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_scripts.pysinitialize_options s cCs|id|iioti|n g|_|iodSn|id}t |i t |i |i |i|i}|id}t|dt}t|iddt}x't|||D]}|i|qWdS(Nsegg_infos build_scriptss executables bdist_wininsts _is_running(sselfs run_commands distributionsscriptss_install_scriptssrunsoutfilessno_epsget_finalized_commandsei_cmds Distributionsegg_bases PathMetadatasegg_infosegg_names egg_versionsdistsbs_cmdsgetattrssys_executables executablesFalses is_wininstsget_script_argssargss write_script(sselfsei_cmdsdistsargss executablesbs_cmds is_wininst((sFbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_scripts.pysruns    stcGstid||itii|i|}|i i ||i okt |t |d|}|i||iyti|dWqttifj oqXndS(s1Write an executable file to the scripts directorysInstalling %s script to %sswiN(slogsinfos script_namesselfs install_dirsosspathsjoinstargetsoutfilessappendsdry_runsensure_directorysopensmodesfswritescontentsscloseschmodsAttributeErrorserror(sselfs script_namescontentssmodesignoredsfstarget((sFbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_scripts.pys write_script*s    (s__name__s __module__s__doc__sinitialize_optionssruns write_script(((sFbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_scripts.pysinstall_scriptss   ( s!distutils.command.install_scriptssinstall_scriptss_install_scriptss easy_installsget_script_argsssys_executables pkg_resourcess Distributions PathMetadatasensure_directorysoss distutilsslog( s PathMetadatasinstall_scriptssget_script_argss_install_scriptssensure_directoryssys_executables Distributionsosslog((sFbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_scripts.pys?s   PKC8Innsetuptools/command/upload.pyo; eFc@sdZdkTdklZdklZdklZdklZdk Z dk Z dk Z dk Z dk Z dkZdkZdkZdefdYZdS( s`distutils.command.upload Implements the Distutils 'upload' subcommand (upload package to PyPI).(s*(sCommand(sspawn(slog(smd5NsuploadcBs~tZdZdZdddefdedfdd d fd d d fgZddgZdZdZdZ dZ RS(Nsupload binary package to PyPIshttp://pypi.python.org/pypis repository=srsurl of repository [default: %s]s show-responses&display full response text from serverssignssssign files to upload using gpgs identity=sisGPG identity used to sign filescCs:d|_d|_d|_d|_t|_t|_dS(Nsi( sselfsusernamespasswords repositorys show_responsesFalsessignsNonesidentity(sself((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/upload.pysinitialize_options$s      cCsB|io|i otdntiidotiitidd}tii |o|i d|t i hdd<dd<dd<}|i||i o|id d|_n|i o|id d|_n|i o|id d|_qq#n|i o|i|_ndS( Ns.Must use --sign for --identity to have meaningsHOMEs.pypircsUsing PyPI login from %ssusernamesspasswords repositorys server-login(sselfsidentityssignsDistutilsOptionErrorsossenvironshas_keyspathsjoinsrcsexistssannounces ConfigParsersconfigsreads repositorysgetsusernamespasswordsDEFAULT_REPOSITORY(sselfsrcsconfig((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/upload.pysfinalize_options,s *    ! cCsU|ii otdnx0|iiD]"\}}}|i|||q+WdS(Ns'No dist file created in earlier command(sselfs distributions dist_filessDistutilsOptionErrorscommands pyversionsfilenames upload_file(sselfscommands pyversionsfilename((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/upload.pysrunCs  cCs3|ioMddd|g} |iod|ig| dd+nt| d|int|di} t i i |}d}|d jo |iiod tid d }nhd d<dd<d|ii<d|ii<d|| f<d|<d|<dt| i<}|djo4ti\}} } |od|| f}qn(|djodtid d }n||d<|io4t i i |dt|dif|dd-|d}t1i2}yu|i@|iAd.||iBd/d0||iBd1t,tC||iBd2||iD|iE|Wn5tFiGj o&}|i/t,|t1iIdSnX|iJ}|iLd3jo'|i/d4|iL|iMft1i2n$|i/d5|iL|iMft1iI|iNod6d7G|iGd6d7GHndS(8Nsgpgs --detach-signs-as --local-userisdry_runsrbss bdist_eggs built on %ssterseis:actions file_uploadsprotcol_versions1snamesversionscontentsfiletypes pyversions md5_digests bdist_rpmsbuilt for %s %ss bdist_dumbs built for %sscomments.ascs gpg_signaturesBasic s:s3--------------GHSKFJDLGDS7543FJKLFHRE75642756743254s --s--s;filename="%s"is* Content-Disposition: form-data; name="%s"s is s sSubmitting %s to %sshttpshttpssunsupported schema sPOSTs Content-types multipart/form-data; boundary=%ssContent-lengths AuthorizationisServer response (%s): %ssUpload failed (%s): %ss-iK(Osselfssignsfilenamesgpg_argssidentitysspawnsdry_runsopensreadscontentsosspathsbasenamescommentscommands distributionshas_ext_modulessplatformsget_names get_versions pyversionsmd5s hexdigestsdatasdistsversionsidsbase64s encodestringsusernamespasswordsstripsauthsboundarys sep_boundarys end_boundarysStringIOsbodysitemsskeysvaluestypestuplesfnsstrswritesgetvaluesannounces repositoryslogsINFOsurlparsesschemasnetlocsurlsparamssquerys fragmentsshttplibsHTTPConnectionshttpsHTTPSConnectionsAssertionErrorsloglevelsconnects putrequests putheaderslens endheadersssendssocketserrorsesERRORs getresponsesrsstatussreasons show_response(sselfscommands pyversionsfilenamescommentsdistsbasenamesvaluesquerysids end_boundarysgpg_argsscontentsversionsparamss sep_boundarysboundarysschemasbodyshttpsnetlocsauthskeysdatas fragmentssfnsesurlsloglevelsr((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/upload.pys upload_fileIs  r    4'              $            ( s__name__s __module__s descriptionsDEFAULT_REPOSITORYsNones user_optionssboolean_optionssinitialize_optionssfinalize_optionssruns upload_file(((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/upload.pysuploads:    (s__doc__sdistutils.errorssdistutils.coresCommandsdistutils.spawnsspawns distutilsslogsmd5sosssocketsplatforms ConfigParsershttplibsbase64surlparses cStringIOsStringIOsupload( sspawnshttplibssocketsStringIOsbase64suploadsurlparsesplatformsCommands ConfigParsersmd5sosslog((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/upload.pys?s            PKC8o'setuptools/command/install_egg_info.pyc; Fc@sbdklZdklZdklZlZdkZdkZdk Z defdYZ dS((sCommand(sunpack_archive(slogsdir_utilNsinstall_egg_infocBsetZdZdZdddfgZdZdZdZdZdZ d Z d Z RS( s.Install an .egg-info directory for the packages install-dir=sdsdirectory to install tocCs t|_dS(N(sNonesselfs install_dir(sself((sGbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_egg_info.pysinitialize_optionsscCs|idddf|id}titt|i|iid}|i |_ t i i|i||_|ig|_dS(Ns install_libs install_dirsegg_infos .egg-info(sselfsset_undefined_optionssget_finalized_commandsei_cmds pkg_resourcess DistributionsNonesegg_names egg_versionsbasenamesegg_infossourcesosspathsjoins install_dirstargetsoutputs(sselfsei_cmdsbasename((sGbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_egg_info.pysfinalize_optionss ( cCs|id|i}tii|iotii|i oti|id|i n>tii |io'|i ti |ifd|in|i ot i|in|i |ifd|i|if|idS(Nsegg_infosdry_runs Removing sCopying %s to %s(sselfs run_commandstargetsosspathsisdirsislinksdir_utils remove_treesdry_runsexistssexecutesunlinks pkg_resourcessensure_directoryscopytreessourcesinstall_namespaces(sselfstarget((sGbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_egg_info.pysruns  -' cCs |iSdS(N(sselfsoutputs(sself((sGbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_egg_info.pys get_outputs*scs&d}tii|dS(Ncskx=ddfD]/}|i|pd||jotSq q Wii|ti d|||SdS(Ns.svn/sCVS/s/sCopying %s to %s( sskipssrcs startswithsNonesselfsoutputssappendsdstslogsdebug(ssrcsdstsskip(sself(sGbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_egg_info.pysskimmer/s ! (sskimmersunpack_archivesselfssourcestarget(sselfsskimmer((sselfsGbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_egg_info.pyscopytree-s cCs|i}| odSntii|i\}}|d7}|i i |t i d||i ot|d}xo|D]g}t|id}d}d|jo%ddi|d |df}n|idtqW|indS( Ns -nspkg.pths Installing %sswbs.s s(; m and setattr(sys.modules[%r], %r, m) is/import sys,new,os; p = os.path.join(sys._getframe(1).f_locals['sitedir'], *%(pth)r); ie = os.path.exists(os.path.join(p,'__init__.py')); m = not ie and sys.modules.setdefault(%(pkg)r,new.module(%(pkg)r)); mp = (m or []) and m.__dict__.setdefault('__path__',[]); (p not in mp) and mp.append(p)%(trailer)s(sselfs_get_all_ns_packagessnspsosspathssplitextstargetsfilenamesextsoutputssappendslogsinfosdry_runsopensfspkgstuplessplitspthstrailersjoinswriteslocalssclose(sselfsfspthsfilenamesextspkgsnspstrailer((sGbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_egg_info.pysinstall_namespacesSs    % cCs}h}xV|iipgD]A}|id}x)|o!d|di|<|iq2WqWt|}|i |SdS(Ns.i( snspsselfs distributionsnamespace_packagesspkgssplitsjoinspopslistssort(sselfsnspspkg((sGbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_egg_info.pys_get_all_ns_packagesps  ( s__name__s __module__s__doc__s descriptions user_optionssinitialize_optionssfinalize_optionssruns get_outputsscopytreesinstall_namespacess_get_all_ns_packages(((sGbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_egg_info.pysinstall_egg_infos     & ( s setuptoolssCommandssetuptools.archive_utilsunpack_archives distutilsslogsdir_utilsossshutils pkg_resourcessinstall_egg_info(slogsunpack_archives pkg_resourcessdir_utilsinstall_egg_infosCommandsshutilsos((sGbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_egg_info.pys?s  PKC8e8setuptools/command/install.pyo; _Fc@sFdkZdkZdklZdklZdefdYZdS(N(sinstall(sDistutilsArgErrorsinstallcBstZdZeidedfdedfgZeiddgZddfddfgZeeZ gi Z ei D]%Z e de joe e qq[ eZ d Zd Zd Zd Zd ZRS(s7Use easy_install to install the package, w/dependenciessold-and-unmanageablesTry not to use this!s!single-version-externally-manageds5used by system package builders to create 'flat' eggssinstall_egg_infocCstS(N(sTrue(sself((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/install.pysssinstall_scriptsicCs,ti|t|_t|_t|_dS(N(s_installsinitialize_optionssselfsNonesold_and_unmanageables!single_version_externally_manageds no_compile(sself((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/install.pysinitialize_optionss   cCs\ti||io t|_n5|io*|i o|i otdqXndS(NsAYou must specify --record or --root when building system packages(s_installsfinalize_optionssselfsrootsTrues!single_version_externally_managedsrecordsDistutilsArgError(sself((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/install.pysfinalize_optionss     cCs;|ip|ioti|Snt|_d|_dS(Ns(sselfsroots!single_version_externally_manageds_installshandle_extra_pathsNones path_files extra_dirs(sself((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/install.pyshandle_extra_path*s cCs|ip|ioti|Sntid}|ii dd}|i i }|djp |djoti|n |idS(Nis__name__ssdistutils.dists run_commands(sselfsold_and_unmanageables!single_version_externally_manageds_installsrunssyss _getframescallers f_globalssgets caller_modulesf_codesco_names caller_namesdo_egg_install(sselfscallers caller_names caller_module((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/install.pysrun5s  cCs|iid}||iddd|id|i}|i|id|ii di g}t i o|idt i n||_ |itt _ dS(Ns easy_installsargssxsrootsrecords bdist_eggi(sselfs distributionsget_command_classs easy_installsrootsrecordscmdsensure_finalizeds run_commandsget_command_objs egg_outputsargss setuptoolssbootstrap_install_fromsinsertsrunsNone(sselfsargsscmds easy_install((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/install.pysdo_egg_installSs'     (s__name__s __module__s__doc__s_installs user_optionssNonesboolean_optionss new_commandssdicts_ncsappends_[1]s sub_commandsscmdsinitialize_optionssfinalize_optionsshandle_extra_pathsrunsdo_egg_install(((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/install.pysinstalls % C  (s setuptoolsssyssdistutils.command.installsinstalls_installsdistutils.errorssDistutilsArgError(ssyss_installsDistutilsArgErrorsinstalls setuptools((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/install.pys?s  PKC8qksSS setuptools/command/bdist_egg.pyo; _Fc@sadZdkZdkZdkZdklZdklZlZdk l Z l Z dk l Z dklZdklZlZlZdklZd klZd klZd Zd Zd ZdefdYZeidiZ dZ!dZ"dZ#he$d<e%d|i? ot@|id|intA|i%dgidtB|i<fdS(Nsegg_infosinstalling library code to %ssinstalls install_libswarn_diris.pyscreating stub loader for %ss/sEGG-INFOsscriptssinstalling scripts to %ssinstall_scriptss install_dirsno_episnative_libs.txts writing %sswts s removing %ss depends.txtsxWARNING: 'depends.txt' will not be used by setuptools 0.6! Use the install_requires/extras_require setup() args instead.sverbosesdry_runsmodes dist_filess bdist_egg(Csselfs run_commandslogsinfos bdist_dirsget_finalized_commandsinstcmdsrootsold_rootsNones call_commandscmdsget_ext_outputss all_outputss ext_outputssstubss to_compiles enumeratespsext_namesosspathssplitextsfilenamesextsjoins strip_modulespyfilesappendsdry_runs write_stubsbasenamesreplacessepsextendsmake_init_filess byte_compiles distributions data_filessdo_install_datas archive_rootsegg_infosmkpathsscriptss script_dirs native_libssopens libs_fileswritesclosesisfilesunlinkscopy_metadata_toswrite_safety_flagszip_safesexistsswarnsexclude_source_filess zap_pyfiless make_zipfiles egg_outputsverboses gen_headers keep_temps remove_treesgetattrsget_python_version(sselfs ext_outputss native_libssext_names libs_filesfilenames all_outputss script_dirs to_compilesinstcmdspyfilesegg_infoscmdspsextsold_roots archive_root((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_egg.pysrunsl    "          "%  cCstidxwt|iD]f\}}}xT|D]L}|i do6t i i ||}ti d|t i|q3q3WqWdS(Ns+Removing .py files from temporary directorys.pys Deleting %s(slogsinfoswalk_eggsselfs bdist_dirsbasesdirssfilessnamesendswithsosspathsjoinsdebugsunlink(sselfsdirssfilessbasespathsname((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_egg.pys zap_pyfiless cCsNt|idt}|tj o|Sntidt|i|i SdS(Nszip_safes4zip_safe flag not set; analyzing archive contents...( sgetattrsselfs distributionsNonessafeslogswarns analyze_eggs bdist_dirsstubs(sselfssafe((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_egg.pyszip_safes   c Cs*g}xt|iD]\}}}||ijoqnx|D]}|idod|jo|t |idi t i d}|ii|oktid|t ii|d}|i o*t|d}|it|in|i|qnPqCqCWg|(qW|SdS(s%Create missing package __init__ filess.pys __init__.pyis.s#Creating missing __init__.py for %sswN(s init_filesswalk_eggsselfs bdist_dirsbasesdirssfilessnamesendswithslensreplacesosssepspkgs distributionshas_contents_forslogswarnspathsjoinsfilenamesdry_runsopensfswrites NS_PKG_STUBsclosesappend( sselfsdirssfilessnamesfsfilenames init_filessbasespkg((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_egg.pysmake_init_filess* &   c Cs1ti|iipd}|idhid} | tjodSn| i p| i ot d| fnt i d }| i}di| i }| i d}tii|i}d t}|i oOttii|id |it|id}|i||i nd SdS( Nsssetuptools.installations eggsecutableswsGeggsecutable entry point (%r) cannot have 'extras' or refer to a moduleis.isH#!/bin/sh if [ `basename $0` = "%(basename)s" ] then exec python%(pyver)s -c "import sys, os; sys.path.insert(0, os.path.abspath('$0')); from %(pkg)s import %(base)s; sys.exit(%(full)s())" "$@" else echo $0 is not the correct name for this egg file. echo Please rename it back to %(basename)s and try again. exec false fi sdry_runsa(!s EntryPoints parse_mapsselfs distributions entry_pointssepmsgetsepsNonesattrssextrassDistutilsSetupErrorssyssversionspyvers module_namespkgsjoinsfullsbasesosspathsbasenames egg_outputslocalssheadersdry_runsmkpathsdirnamesopensfswritesclose( sselfsfullsfsheaderspyversepmspkgsbasesbasenamesep((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_egg.pys gen_header s$      " cCstii|id}xd|iiiD]S}|i |o=tii||t |}t ||i||q(q(WdS(Ns(sosspathsjoinsselfsegg_infosprefixsei_cmdsfilelistsfiless startswiths target_dirslenstargetsensure_directorys copy_file(sselfs target_dirstargetsprefixspath((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_egg.pyscopy_metadata_toIs c Csg}g}h|id<}xti|iD]\}}} xJ| D]B}ti i |di tjo|i|||qGqGWx3|D]+}|||d|ti i||dd gD]0} | |jotid || t} qqWd |jo`x]d d dddddddddg D]0} | |jotid|| t} qCqCWnd|jod|jo d|jo2ti d djotid|t} qn| SdS(s;Check whether module possibly uses unsafe-for-zipfile stuffiis.sisrbis__file__s__path__s%s: module references %ssinspects getsources getabsfiles getsourcefilesgetfilegetsourceliness findsources getcommentss getframeinfosgetinnerframessgetouterframessstackstraces"%s: module MAY be using inspect.%ss__name__s__main__is2.4s.%s: top-level module may be 'python -m' scriptN(!sosspathsjoinsbasesnamesfilenamesstubssTrueslensegg_dirsreplacessepspkgssplitextsmodulesopensfsreadsmarshalsloadscodesclosessafesdictsfromkeyss iter_symbolsssymbolssbadslogswarnsFalsessyssversion( segg_dirsbasesnamesstubsscodesmodulessymbolsspkgsfilenamessafesfsbad((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_egg.pys scan_modules4#,   ( 'ccswx|iD] }|Vq WxX|iD]M}t|to|Vq"t|toxt|D] }|Vq]Wq"q"WdS(sBYield names and strings used by `code` and its nested code objectsN( scodesco_namessnames co_constssconsts isinstances basestringsCodeTypes iter_symbols(scodesconstsname((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_egg.pys iter_symbolss   s install_libs install_dirs install_datas install_baseiswc sdk}ttii|dtid|d} |t jot idj}n|i|igt|} o<|i||d|}tii| ||intii| t |SdS(sqCreate a zip file from all the files under 'base_dir'. The output zip file will be named 'base_dir' + ".zip". Uses either the "zipfile" Python module (if available) or the InfoZIP "zip" utility (if installed and found on the default search path). If neither tool is available, raises DistutilsExecError. Returns the name of the output zip file. Nsdry_runs#creating '%s' and adding '%s' to itcsx|D]}tiitii||}tii|oE|td} o|i ||ntid|qqWdS(Nis adding '%s'(snamessnamesosspathsnormpathsjoinsdirnamesisfileslensbase_dirspsdry_runszswriteslogsdebug(szsdirnamesnamessnamespspath(sdry_runsbase_dir(s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_egg.pysvisits!s2.4s compression(szipfilesmkpathsosspathsdirnames zip_filenamesdry_runslogsinfosbase_dirsvisitscompresssNonessyssversions ZIP_STOREDs ZIP_DEFLATEDsbools compressionsZipFilesmodeszswalksclose( s zip_filenamesbase_dirsverbosesdry_runscompresssmodeszszipfiles compressionsvisit((sbase_dirsdry_runs@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_egg.pys make_zipfiles  (,s__doc__ssyssossmarshals setuptoolssCommandsdistutils.dir_utils remove_treesmkpathsdistutils.sysconfigsget_python_versionsget_python_libs distutilsslogsdistutils.errorssDistutilsSetupErrors pkg_resourcessget_build_platforms Distributionsensure_directorys EntryPointstypessCodeTypessetuptools.extensionsLibrarys strip_modules write_stubs NS_PKG_STUBs bdist_eggsdictsfromkeysssplitsNATIVE_EXTENSIONSswalk_eggs analyze_eggswrite_safety_flagsTruesFalses safety_flagss scan_modules iter_symbolssINSTALL_DIRECTORY_ATTRSsNones make_zipfile(s strip_modules make_zipfilesLibrarysCodeTypes iter_symbolss safety_flagss NS_PKG_STUBsNATIVE_EXTENSIONSslogsINSTALL_DIRECTORY_ATTRSsget_python_versionsDistutilsSetupErrors write_stubswalk_eggs remove_trees analyze_eggssyssget_build_platformsCommands Distributionswrite_safety_flagsmkpathsensure_directorys scan_modules EntryPoints bdist_eggsossmarshalsget_python_lib((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_egg.pys?s0        D    PKC8xi))setuptools/command/develop.pyo; _Fc@s|dklZdklZdklZlZlZdkl Z dk Tdk Z dk Z dk Z defdYZdS((s easy_install(s convert_path(s Distributions PathMetadatasnormalize_path(slog(s*NsdevelopcBstZdZdZeidddfdedfgZeidgZeZ dZ dZ d Z d Z d Zd ZRS( sSet up package for developments%install package in 'development mode's uninstallsusUninstall this source packages egg-path=s-Set the path to be used in the .egg-link filecCs9|iot|_|in |i|idS(N(sselfs uninstallsTrues multi_versionsuninstall_linksinstall_for_developmentswarn_deprecated_options(sself((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/develop.pysruns    cCs,t|_t|_ti|t|_dS(N(sNonesselfs uninstallsegg_paths easy_installsinitialize_optionss setup_path(sself((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/develop.pysinitialize_optionss   cCs|id}|io td|i|ifn|ig|_ti |t i i |i |id|_|i|_|itjot i i|i|_nt|i}tt i i |i |i|jotd|nt|t|t i i|id|i|_|iit id}|t ijod|idd}n||_tt i i |i |i|}|tt ijotd |tt indS( Nsegg_infos-Please rename %r to %r before using 'develop's .egg-linksA--egg-path must be a relative path from the install directory to s project_names/s../isGCan't get a consistent path to setup script from installation directory(sselfsget_finalized_commandseisbroken_egg_infosDistutilsErrorsegg_infosegg_namesargss easy_installsfinalize_optionssosspathsjoins install_dirsegg_linksegg_basesegg_pathsNonesabspathsnormalize_pathstargetsDistutilsOptionErrors Distributions PathMetadatasdistsreplacessepspscurdirscounts setup_path(sselfseistargetsp((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/develop.pysfinalize_options*s.   " ( $cCs|id|iddd|id|itio|ititt_nti d|i |i |i o;t |i d}|i|id|i|in|it|i|i dS(Nsegg_infos build_extsinplaceisCreating %s (link to %s)sws (sselfs run_commandsreinitialize_commandsinstall_site_pys setuptoolssbootstrap_install_froms easy_installsNoneslogsinfosegg_linksegg_basesdry_runsopensfswritesegg_paths setup_pathsclosesprocess_distributionsdistsno_deps(sselfsf((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/develop.pysinstall_for_developmentSs      cCstii|iotid|i|igi}t |iD]}||i qF~}||ig|i|igfjotid|dSn|i oti|iqn|i o|i|in|iiotidndS(NsRemoving %s (link to %s)s$Link points to %s: uninstall aborteds5Note: you must uninstall or replace scripts manually!(sosspathsexistssselfsegg_linkslogsinfosegg_basesappends_[1]sfileslinesrstripscontentssegg_paths setup_pathswarnsdry_runsunlinks update_pthsdists distributionsscripts(sselfs_[1]slinescontents((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/develop.pysuninstall_linkis6%   cCs||ij oti||Sn|i|x|iipgD]k}ti i t |}ti i |}t|d}|i}|i|i||||qEWdS(NsrU(sdistsselfs easy_installsinstall_egg_scriptssinstall_wrapper_scriptss distributionsscriptss script_namesosspathsabspaths convert_paths script_pathsbasenamesopensfsreads script_textsclosesinstall_script(sselfsdistsfs script_names script_paths script_text((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/develop.pysinstall_egg_scripts|s   (s__name__s __module__s__doc__s descriptions easy_installs user_optionssNonesboolean_optionssFalsescommand_consumes_argumentssrunsinitialize_optionssfinalize_optionssinstall_for_developmentsuninstall_linksinstall_egg_scripts(((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/develop.pysdevelops %  )  (ssetuptools.command.easy_installs easy_installsdistutils.utils convert_paths pkg_resourcess Distributions PathMetadatasnormalize_paths distutilsslogsdistutils.errorsssyssoss setuptoolssdevelop( s convert_paths PathMetadatasdevelopslogsnormalize_pathssyss easy_installs setuptoolss Distributionsos((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/develop.pys?s   PKC8RYD  "setuptools/command/install_lib.pyo; Ec@s0dklZdkZdefdYZdS((s install_libNs install_libcBsGtZdZdZdZdZdddddZdZRS(s9Don't add compiled flags to filenames of non-Python filescCs{g}xj|D]b}|id oq n|io|i|dn|idjo|i|dq q W|SdS(Ns.pysciso(sbytecode_filess py_filenamesspy_filesendswithsselfscompilesappendsoptimize(sselfs py_filenamesspy_filesbytecode_files((sBbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_lib.pys_bytecode_filenamess cCs8|i|i}|tj o|i|ndS(N(sselfsbuildsinstallsoutfilessNones byte_compile(sselfsoutfiles((sBbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_lib.pysruns   cCsh}|ii}|o|idiox|D]y}|id}xa|oYt i i |i |}x0dddfD]}d|t i i || %s( sdstsexcludeslogswarnsFalsesinfossrcsosspathsdirnamesoutfilessappend(ssrcsdst(slogsoutfilessexclude(sBbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_lib.pyspf;s   ( sselfsget_exclusionssexcludes _install_libs copy_treesinfilesoutfilessetuptools.archive_utilsunpack_directorys distutilsslogsoutfilesspf( sselfsinfilesoutfiles preserve_modespreserve_timesspreserve_symlinksslevelsunpack_directoryspfsoutfilessexcludeslog((soutfilessexcludeslogsBbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_lib.pys copy_tree*s    cCsdti|}|i}|o:gi}|D]!}||jo||q0q0~Sn|SdS(N( s _install_libs get_outputssselfsoutputssget_exclusionssexcludesappends_[1]sf(sselfsfsoutputss_[1]sexclude((sBbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_lib.pys get_outputsGs  :(s__name__s __module__s__doc__s_bytecode_filenamessrunsget_exclusionss copy_trees get_outputs(((sBbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_lib.pys install_libs   (sdistutils.command.install_libs install_libs _install_libsos(s _install_libs install_libsos((sBbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_lib.pys?s  PKC83Usetuptools/command/register.pyo; Ec@s'dklZdefdYZdS((sregistersregistercBstZeiZdZRS(NcCs|idti|dS(Nsegg_info(sselfs run_commands _registersrun(sself((s?build/bdist.darwin-8.0.1-x86/egg/setuptools/command/register.pysruns (s__name__s __module__s _registers__doc__srun(((s?build/bdist.darwin-8.0.1-x86/egg/setuptools/command/register.pysregisters N(sdistutils.command.registersregisters _register(s _registersregister((s?build/bdist.darwin-8.0.1-x86/egg/setuptools/command/register.pys?s PKC8 %s( sdstsexcludeslogswarnsFalsesinfossrcsosspathsdirnamesoutfilessappend(ssrcsdst(slogsoutfilessexclude(sBbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_lib.pyspf;s   (s preserve_modespreserve_timesspreserve_symlinkssAssertionErrorsselfsget_exclusionssexcludes _install_libs copy_treesinfilesoutfilessetuptools.archive_utilsunpack_directorys distutilsslogsoutfilesspf( sselfsinfilesoutfiles preserve_modespreserve_timesspreserve_symlinksslevelsunpack_directoryspfsoutfilessexcludeslog((soutfilessexcludeslogsBbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_lib.pys copy_tree*s    cCsdti|}|i}|o:gi}|D]!}||jo||q0q0~Sn|SdS(N( s _install_libs get_outputssselfsoutputssget_exclusionssexcludesappends_[1]sf(sselfsfsoutputss_[1]sexclude((sBbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_lib.pys get_outputsGs  :(s__name__s __module__s__doc__s_bytecode_filenamessrunsget_exclusionss copy_trees get_outputs(((sBbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_lib.pys install_libs   (sdistutils.command.install_libs install_libs _install_libsos(s _install_libs install_libsos((sBbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_lib.pys?s  PKC8_ setuptools/command/rotate.pyc; Ec@sZdkZdkZdklZdklZdklZdkTdefdYZdS(N(sCommand(s convert_path(slog(s*srotatecBs_tZdZdZdddfdddfdd d fgZgZd Zd Zd ZRS(sDelete older distributionss2delete older distributions, keeping N newest filessmatch=smspatterns to match (required)s dist-dir=sds%directory where the distributions areskeep=sks(number of matching distributions to keepcCst|_t|_t|_dS(N(sNonesselfsmatchsdist_dirskeep(sself((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/rotate.pysinitialize_optionss  cCs|itjotdn|itjotdnyt|i|_Wntj otdnXt|itoFgi }|ii dD]}|t |iq~|_n|idddfdS(NsQMust specify one or more (comma-separated) match patterns (e.g. '.zip' or '.egg')s$Must specify number of files to keeps--keep must be an integers,sbdistsdist_dir(sselfsmatchsNonesDistutilsOptionErrorskeepsints ValueErrors isinstances basestringsappends_[1]ssplitsps convert_pathsstripsset_undefined_options(sselfs_[1]sp((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/rotate.pysfinalize_optionssFcCs|iddkl}x|iD]}|iid|}|tii |i |}gi }|D]"}|tii||fqm~}|i|itidt||||i}x@|D]8\}}tid||i oti|qqWq$WdS(Nsegg_info(sglobs*s%d file(s) matching %ss Deleting %s(sselfs run_commandsglobsmatchspatterns distributionsget_namesosspathsjoinsdist_dirsfilessappends_[1]sfsgetmtimessortsreverseslogsinfoslenskeepstsdry_runsunlink(sselfsfilessfspatterns_[1]stsglob((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/rotate.pysrun*s    9     ( s__name__s __module__s__doc__s descriptions user_optionssboolean_optionssinitialize_optionssfinalize_optionssrun(((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/rotate.pysrotates *  ( s distutilssoss setuptoolssCommandsdistutils.utils convert_pathslogsdistutils.errorssrotate(s convert_pathsrotateslogs distutilssCommandsos((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/rotate.pys?s    PKC8X(??setuptools/command/test.pyo; _Fc@smdklZdklZdkZdkTdklZlZdefdYZ defdYZ dS( (sCommand(sDistutilsOptionErrorN(s*(s TestLoadersmainsScanningLoadercBstZdZRS(NcCs6g}|idjo|iti||nt|do|i|int|doxt |idD]}|i do |djo|id|d }n0t |i|d o|id|}nq}|i|i|q}Wnt|d jo|i|Sn |d Sd S( sReturn a suite of all tests cases contained in the given module If the module is a package, load tests from all the modules in it. If the module has an ``additional_tests`` function, call it and add the return value to the tests. ssetuptools.tests.doctestsadditional_testss__path__ss.pys __init__.pys.is /__init__.pyiiN(stestssmodules__name__sappends TestLoadersloadTestsFromModulesselfshasattrsadditional_testssresource_listdirsfilesendswiths submodulesresource_existssloadTestsFromNameslens suiteClass(sselfsmodulestestss submodulesfile((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/command/test.pysloadTestsFromModule s$(s__name__s __module__sloadTestsFromModule(((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/command/test.pysScanningLoadersstestcBs_tZdZdZdddfdddfgZdZd Zd Zd Zd Z RS( s.Command to run unit tests after in-place builds#run unit tests after in-place builds test-module=sms$Run 'test_suite' in specified modules test-suite=sss1Test suite to run (e.g. 'some_module.test_suite')cCst|_t|_t|_dS(N(sNonesselfs test_suites test_modules test_loader(sself((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/command/test.pysinitialize_options6s  cCs|itjo7|itjo|ii|_qa|id|_n|iotdn|ig|_|io|iiddn|i tjot |idt|_ n|i tjo d|_ ndS(Ns .test_suites1You may specify a module or a suite, but not bothis --verboses test_loaders&setuptools.command.test:ScanningLoader( sselfs test_suitesNones test_modules distributionsDistutilsOptionErrors test_argssverbosesinserts test_loadersgetattr(sself((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/command/test.pysfinalize_options<s  cCs|id|iddd|id|id}ti}tii }zXtii dt |i titdtd|i|if|Wd|ti(tiitii|tiXdS(Nsegg_infos build_extsinplaceiicCs |iS(N(sdistsactivate(sdist((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/command/test.pyscss%s==%s(sselfs run_commandsreinitialize_commandsget_finalized_commandsei_cmdssysspathsold_pathsmodulesscopys old_modulessinsertsnormalize_pathsegg_bases working_sets__init__sadd_activation_listenersrequiresegg_names egg_versionsfuncsclearsupdate(sselfsfuncsei_cmds old_modulessold_path((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/command/test.pyswith_project_on_sys_pathSs"        cCs|iio|ii|iin|ioVdi|i}|io|i d|q|i d||i |i ndS(Ns s skipping "unittest %s" (dry run)srunning "unittest %s"( sselfs distributions tests_requiresfetch_build_eggss test_suitesjoins test_argsscmdsdry_runsannounceswith_project_on_sys_paths run_tests(sselfscmd((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/command/test.pysrunms   cCs^dk}tid|i}|idt}|i t t |i g|i d|dS(Nsx=srequires testLoader( sunittests EntryPointsparsesselfs test_loaders loader_epsloadsFalses loader_classsmainsNones__file__s test_args(sselfs loader_classs loader_epsunittest((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/command/test.pys run_tests|s  ( s__name__s __module__s__doc__s descriptions user_optionssinitialize_optionssfinalize_optionsswith_project_on_sys_pathsruns run_tests(((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/command/test.pystest*s     ( s setuptoolssCommandsdistutils.errorssDistutilsOptionErrorssyss pkg_resourcessunittests TestLoadersmainsScanningLoaderstest(ssyssCommandsScanningLoaderstestsDistutilsOptionErrorsmains TestLoader((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/command/test.pys?s   #PKvk6tpsetuptools/command/test.pyfrom setuptools import Command from distutils.errors import DistutilsOptionError import sys from pkg_resources import * from unittest import TestLoader, main class ScanningLoader(TestLoader): def loadTestsFromModule(self, module): """Return a suite of all tests cases contained in the given module If the module is a package, load tests from all the modules in it. If the module has an ``additional_tests`` function, call it and add the return value to the tests. """ tests = [] if module.__name__!='setuptools.tests.doctest': # ugh tests.append(TestLoader.loadTestsFromModule(self,module)) if hasattr(module, "additional_tests"): tests.append(module.additional_tests()) if hasattr(module, '__path__'): for file in resource_listdir(module.__name__, ''): if file.endswith('.py') and file!='__init__.py': submodule = module.__name__+'.'+file[:-3] else: if resource_exists( module.__name__, file+'/__init__.py' ): submodule = module.__name__+'.'+file else: continue tests.append(self.loadTestsFromName(submodule)) if len(tests)!=1: return self.suiteClass(tests) else: return tests[0] # don't create a nested suite for only one return class test(Command): """Command to run unit tests after in-place build""" description = "run unit tests after in-place build" user_options = [ ('test-module=','m', "Run 'test_suite' in specified module"), ('test-suite=','s', "Test suite to run (e.g. 'some_module.test_suite')"), ] def initialize_options(self): self.test_suite = None self.test_module = None self.test_loader = None def finalize_options(self): if self.test_suite is None: if self.test_module is None: self.test_suite = self.distribution.test_suite else: self.test_suite = self.test_module+".test_suite" elif self.test_module: raise DistutilsOptionError( "You may specify a module or a suite, but not both" ) self.test_args = [self.test_suite] if self.verbose: self.test_args.insert(0,'--verbose') if self.test_loader is None: self.test_loader = getattr(self.distribution,'test_loader',None) if self.test_loader is None: self.test_loader = "setuptools.command.test:ScanningLoader" def with_project_on_sys_path(self, func): # Ensure metadata is up-to-date self.run_command('egg_info') # Build extensions in-place self.reinitialize_command('build_ext', inplace=1) self.run_command('build_ext') ei_cmd = self.get_finalized_command("egg_info") old_path = sys.path[:] old_modules = sys.modules.copy() try: sys.path.insert(0, normalize_path(ei_cmd.egg_base)) working_set.__init__() add_activation_listener(lambda dist: dist.activate()) require('%s==%s' % (ei_cmd.egg_name, ei_cmd.egg_version)) func() finally: sys.path[:] = old_path sys.modules.clear() sys.modules.update(old_modules) working_set.__init__() def run(self): if self.distribution.tests_require: self.distribution.fetch_build_eggs(self.distribution.tests_require) if self.test_suite: cmd = ' '.join(self.test_args) if self.dry_run: self.announce('skipping "unittest %s" (dry run)' % cmd) else: self.announce('running "unittest %s"' % cmd) self.with_project_on_sys_path(self.run_tests) def run_tests(self): import unittest loader_ep = EntryPoint.parse("x="+self.test_loader) loader_class = loader_ep.load(require=False) unittest.main( None, None, [unittest.__file__]+self.test_args, testLoader = loader_class() ) PKC8E::setuptools/command/__init__.pyo; fEc@sdddddddddd d d d d ddddddgZdkZeidjoeidndklZdeijo'ddfeid|ii D],}||jp|i |doPqrqrW|St |d}d|ijo!dkl}|id|n|i|SdS(s8Check namespace packages' __init__ for declare_namespaces.srUsdeclare_namespace(slogsWARNING: %s is a namespace package, but its __init__.py does not declare_namespace(); setuptools 0.7 will REQUIRE this! (See the setuptools manual under "Namespace Packages" for details.) N(sselfspackages_checkedspackagesKeyErrors _build_pys check_packages package_dirsinit_pys distributionsnamespace_packagesspkgs startswithsopensfsreads distutilsslogswarnsclose(sselfspackages package_dirsfslogsinit_pyspkg((s?build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_py.pys check_package|s*  !     cCsh|_ti|dS(N(sselfspackages_checkeds _build_pysinitialize_options(sself((s?build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_py.pysinitialize_optionss c Cs|iidg|ii|g} g}x<| D]4}|iti |t i i |t|q5Wti|}h}gi}|D]A}||jo||jo|i|do||qq~SdS(s6Filter filenames for package's data files in 'src_dir'siN(sselfsexclude_package_datasgetspackagesglobssbadspatternsextendsfnmatchsfiltersfilessosspathsjoinssrc_dirs convert_pathsdictsfromkeyssseensappends_[1]sfs setdefault( sselfspackagessrc_dirsfilesspatternsfs_[1]sbadsseensglobs((s?build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_py.pysexclude_data_filess(2(s__name__s __module__s__doc__sfinalize_optionssruns __getattr__s_get_data_filessfind_data_filessbuild_package_datasanalyze_manifestsget_data_filesssyssversions get_outputss check_packagesinitialize_optionssexclude_data_files(((s?build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_py.pysbuild_pys         cCs=tii| o|Sndkl}|d|dS(N(sDistutilsSetupErrorsError: setup script specifies an absolute path: %s setup() arguments must *always* be /-separated paths relative to the setup.py directory, *never* absolute paths. (sosspathsisabssdistutils.errorssDistutilsSetupError(spathsDistutilsSetupError((s?build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_py.pysassert_relatives ( sos.pathsosssyssfnmatchsdistutils.command.build_pysbuild_pys _build_pysdistutils.utils convert_pathsglobsassert_relative(s convert_pathsassert_relativesbuild_pysglobssyss _build_pysfnmatchsos((s?build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_py.pys?s    PKC8?5N3N3 setuptools/command/build_ext.pyo; Ec @sdklZydklZWnej o eZnXdkZdkZdkl Z dk l Z dk l Z dklZlZeddklZdklZd kTeZeZd Zeid jo eZnHeid jo7yd klZeZeZWq$ej oq$XndZdefdYZep eid jo+eeeeedeeeed Z n.dZeeeeedeeeed Z dS((s build_extN(s copy_file(sLibrary(s new_compiler(scustomize_compilersget_config_varsLDSHARED(s _config_vars(slog(s*ssharedsdarwinsnt(sRTLD_NOWcCsto|SndSdS(Ns(s have_rtldss(ss((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pysif_dl ss build_extcBstZdZdZeej o dZndZdZdZ dZ dZ d Z d Z d Zed ZRS( NcCsG|idf\}|_ti|||_|o|indS(s;Build extensions in build directory, then copy if --inplaceiN(sselfsinplaces old_inplaces _build_extsrunscopy_extensions_to_source(sselfs old_inplace((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pysrun+s   c Cs|id}x|iD]}|i|i}|i|}|i d}di |d }|i|} tii | tii|}tii |i|}t||d|id|i|io!|i| pti|tqqWdS(Nsbuild_pys.isverbosesdry_run(sselfsget_finalized_commandsbuild_pys extensionssextsget_ext_fullnamesnamesfullnamesget_ext_filenamesfilenamessplitsmodpathsjoinspackagesget_package_dirs package_dirsosspathsbasenames dest_filenames build_libs src_filenames copy_filesverbosesdry_runs _needs_stubs write_stubscurdirsTrue( sselfsbuild_pyspackages src_filenamesfilenames dest_filenamesextsmodpathsfullnames package_dir((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pyscopy_extensions_to_source3s !  cGs0ti||p|}ti|||SdS(N(s _build_exts swig_sourcessselfssourcess _du_build_exts otherargs(sselfssourcess otherargs((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pys swig_sourcesKscCsti||}|i|}t|to/t i i |\}}|i i|tSnIto|io3t i i|\}}t i i|d|Sn|SdS(Nsdl-(s _build_extsget_ext_filenamesselfsfullnamesfilenamesext_mapsexts isinstancesLibrarysosspathssplitextsfnsshlib_compilerslibrary_filenameslibtypes use_stubss_links_to_dynamicssplitsdsjoin(sselfsfullnamesdsfilenamesextsfn((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pysget_ext_filenameSs cCs,ti|t|_g|_h|_dS(N(s _build_extsinitialize_optionssselfsNonesshlib_compilersshlibssext_map(sself((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pysinitialize_options_s   cCsti||ipg|_|i|igi}|iD]$}t|t o||qAqA~|_ |i o|i nx|iD]}|i |i }|_||i|<|i o |i|pt}|_|otot|t  |_|i|}|_tiitii|i|}|o ||i jo|i i|n|ototi!|i"jo|i"iti!qqWdS(N(#s _build_extsfinalize_optionssselfs extensionsscheck_extensions_listsappends_[1]sexts isinstancesLibrarysshlibsssetup_shlib_compilersget_ext_fullnamesnamesfullnames _full_namesext_mapslinks_to_dynamicsFalsesltds_links_to_dynamics use_stubss _needs_stubsget_ext_filenamesfilenames _file_namesosspathsdirnamesjoins build_libslibdirs library_dirsscurdirsruntime_library_dirs(sselfslibdirsfilenames_[1]sextsltdsfullname((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pysfinalize_optionses$ A   '!$!cCstd|id|id|i}|_tidjoWti }z,dtd+        cCs/t|to |iSnti||SdS(N(s isinstancesextsLibrarysexport_symbolss _build_extsget_export_symbolssself(sselfsext((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pysget_export_symbolss cCsx|i}z^t|to|i|_nti|||i o |i |i di |nWd||_XdS(Nsbuild_py( sselfscompilers _compilers isinstancesextsLibrarysshlib_compilers _build_extsbuild_extensions _needs_stubs write_stubsget_finalized_commands build_lib(sselfsexts _compiler((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pysbuild_extensions  $cCstigi}|iD]}||iq~}di |ii dd dg}x*|i D]}|||jotSqfqfWtSdS(s?Return true if 'ext' links to a dynamic lib in the same packages.isN(sdictsfromkeyssappends_[1]sselfsshlibsslibs _full_nameslibnamessjoinsextssplitspkgs librariesslibnamesTruesFalse(sselfsextslibnameslibs_[1]spkgslibnames((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pyslinks_to_dynamics6&  cCsti|}|idi}x|iD]v}|ioft i i |i |i id}|i|d|i|d|o|i|dqq+q+W|SdS(Nsbuild_pys.s.pys.pycs.pyo(s _build_exts get_outputssselfsoutputssget_finalized_commandsoptimizes extensionssexts _needs_stubsosspathsjoins build_libs _full_namessplitsbasesappend(sselfsoutputssextsbasesoptimize((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pys get_outputss  $cCstid|i|tii||iidd}|otii |ot |dn|i ot|d}|ididdd td d tii|id d dtddddtdddtddddg|in|odkl}||gdddtd|i|idi}|djo&||gd|dtd|intii |o|i oti|qndS( Ns writing stub loader for %s to %ss.s.pys already exists! Please delete.sws sdef __bootstrap__():s- global __bootstrap__, __file__, __loader__s% import sys, os, pkg_resources, imps, dls: __file__ = pkg_resources.resource_filename(__name__,%r)s del __bootstrap__s if '__loader__' in globals():s del __loader__s# old_flags = sys.getdlopenflags()s old_dir = os.getcwd()s try:s( os.chdir(os.path.dirname(__file__))s$ sys.setdlopenflags(dl.RTLD_NOW)s( imp.load_dynamic(__name__,__file__)s finally:s" sys.setdlopenflags(old_flags)s os.chdir(old_dir)s__bootstrap__()s(s byte_compilesoptimizeisforcesdry_runs install_lib(slogsinfosexts _full_names output_dirsosspathsjoinssplits stub_filescompilesexistssDistutilsErrorsselfsdry_runsopensfswritesif_dlsbasenames _file_namesclosesdistutils.utils byte_compilesTruesget_finalized_commandsoptimizesunlink(sselfs output_dirsextscompiles byte_compilesoptimizesfs stub_file((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pys write_stubs$% {  (s__name__s __module__srunscopy_extensions_to_sources _build_exts _du_build_exts swig_sourcessget_ext_filenamesinitialize_optionssfinalize_optionsssetup_shlib_compilersget_export_symbolssbuild_extensionslinks_to_dynamics get_outputssFalses write_stub(((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pys build_ext*s       )  ic Cs8|i|i||||||||| | | | dS(N(sselfslinksSHARED_LIBRARYsobjectssoutput_libnames output_dirs librariess library_dirssruntime_library_dirssexport_symbolssdebugs extra_preargssextra_postargss build_temps target_lang( sselfsobjectssoutput_libnames output_dirs librariess library_dirssruntime_library_dirssexport_symbolssdebugs extra_preargssextra_postargss build_temps target_lang((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pyslink_shared_objects  sstaticc Csttii|\}}tii|\}} |i di do|d}n|i ||||| dS(Nsxslibi(sosspathssplitsoutput_libnames output_dirsfilenamessplitextsbasenamesextsselfslibrary_filenames startswithscreate_static_libsobjectssdebugs target_lang(sselfsobjectssoutput_libnames output_dirs librariess library_dirssruntime_library_dirssexport_symbolssdebugs extra_preargssextra_postargss build_temps target_langsextsfilenamesbasename((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pyslink_shared_objects (!sdistutils.command.build_exts build_exts _du_build_extsPyrex.Distutils.build_exts _build_exts ImportErrorsosssyssdistutils.file_utils copy_filessetuptools.extensionsLibrarysdistutils.ccompilers new_compilersdistutils.sysconfigscustomize_compilersget_config_vars _config_varss distutilsslogsdistutils.errorssFalses have_rtlds use_stubsslibtypesplatformsTruesnamesdlsRTLD_NOWsif_dlsNoneslink_shared_object(sget_config_vars _du_build_extsRTLD_NOWs build_exts new_compilerscustomize_compilerslogs _build_extslink_shared_objects copy_files have_rtldssyss use_stubssif_dls _config_varssLibraryslibtypesos((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/build_ext.pys?s>             + PK6'Y6setuptools/command/bdist_rpm.py# This is just a kludge so that bdist_rpm doesn't guess wrong about the # distribution name and version, if the egg_info command is going to alter # them, another kludge to allow you to build old-style non-egg RPMs, and # finally, a kludge to track .rpm files for uploading when run on Python <2.5. from distutils.command.bdist_rpm import bdist_rpm as _bdist_rpm import sys, os class bdist_rpm(_bdist_rpm): def initialize_options(self): _bdist_rpm.initialize_options(self) self.no_egg = None if sys.version<"2.5": # Track for uploading any .rpm file(s) moved to self.dist_dir def move_file(self, src, dst, level=1): _bdist_rpm.move_file(self, src, dst, level) if dst==self.dist_dir and src.endswith('.rpm'): getattr(self.distribution,'dist_files',[]).append( ('bdist_rpm', src.endswith('.src.rpm') and 'any' or sys.version[:3], os.path.join(dst, os.path.basename(src))) ) def run(self): self.run_command('egg_info') # ensure distro name is up-to-date _bdist_rpm.run(self) def _make_spec_file(self): version = self.distribution.get_version() rpmversion = version.replace('-','_') spec = _bdist_rpm._make_spec_file(self) line23 = '%define version '+version line24 = '%define version '+rpmversion spec = [ line.replace( "Source0: %{name}-%{version}.tar", "Source0: %{name}-%{unmangled_version}.tar" ).replace( "setup.py install ", "setup.py install --single-version-externally-managed " ).replace( "%setup", "%setup -n %{name}-%{unmangled_version}" ).replace(line23,line24) for line in spec ] spec.insert(spec.index(line24)+1, "%define unmangled_version "+version) return spec PKC8ݍfPxx$setuptools/command/bdist_wininst.pyo; Ec@s9dklZdkZdkZdefdYZdS((s bdist_wininstNs bdist_wininstcBs)tZedZddZdZRS(NcCsti||||t|idg}|i o_t i i |i d||i f}|i }dd|f}||jo|i|qn#t i i |i d|}d}|id||fdS(Ns dist_filess%s.win32-py%s.exes bdist_wininstsanys %s.win32.exe(s_bdist_wininsts create_exesselfsarcnamesfullnamesbitmapsgetattrs distributions dist_filesstarget_versionsosspathsjoinsdist_dirsinstaller_names pyversionsbadsremovesappend(sselfsarcnamesfullnamesbitmaps dist_filessbads pyversionsinstaller_name((sDbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_wininst.pys create_exes    icCs=|ii||}|ddfjo t|_n|SdS(Nsinstalls install_lib(sselfs distributionsreinitialize_commandscommandsreinit_subcommandsscmdsNones install_lib(sselfscommandsreinit_subcommandsscmd((sDbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_wininst.pysreinitialize_commands cCs+t|_zti|Wdt|_XdS(N(sTruesselfs _is_runnings_bdist_wininstsrunsFalse(sself((sDbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_wininst.pysrun"s  (s__name__s __module__sNones create_exesreinitialize_commandsrun(((sDbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_wininst.pys bdist_wininsts  (sdistutils.command.bdist_wininsts bdist_wininsts_bdist_wininstsosssys(ssyss bdist_wininsts_bdist_wininstsos((sDbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_wininst.pys?s PKC8(11setuptools/command/alias.pyo; Ec@sdkZdkZdklZdklZdklZdkTdkl Z l Z l Z dZ de fdYZ d ZdS( N(sCommand(s convert_path(slog(s*(s edit_configs option_bases config_filecCsdx5ddddfD]!}||jot|SqqW|i|gjot|Sn|SdS(s4Quote an argument for later parsing by shlex.split()s"s's\s#N(scsargsreprssplit(sargsc((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/alias.pysshquotes saliascBs^tZdZdZeZdddfgeiZeidgZdZ dZ dZ RS(s3Define a shortcut that invokes one or more commandss0define a shortcut to invoke one or more commandssremovesrsremove (unset) the aliascCs#ti|t|_t|_dS(N(s option_basesinitialize_optionssselfsNonesargssremove(sself((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/alias.pysinitialize_optionss  cCsAti||iot|idjotdndS(NisFMust specify exactly one argument (the alias name) when using --remove(s option_basesfinalize_optionssselfsremoveslensargssDistutilsOptionError(sself((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/alias.pysfinalize_options"s  c Cs|iid}|i o5dGHdGHx |D]}dGt||GHq.WdSnt|idjoX|i\}|io t }q||jodGt||GHdSqd|GHdSn-|id}di t t |id}t|ihdh||<<|idS( NsaliasessCommand Aliasess---------------ssetup.py aliasis No alias definition found for %ris (sselfs distributionsget_option_dictsaliasessargssaliass format_aliasslensremovesNonescommandsjoinsmapsshquotes edit_configsfilenamesdry_run(sselfsaliasscommandsaliases((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/alias.pysrun*s(       ( s__name__s __module__s__doc__s descriptionsTruescommand_consumes_argumentss option_bases user_optionssboolean_optionssinitialize_optionssfinalize_optionssrun(((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/alias.pysaliass   cCs||\}}|tdjo d}nE|tdjo d}n(|tdjo d}n d|}||d|SdS( Nsglobals--global-config susers--user-config slocalss --filename=%rs (saliasessnamessourcescommands config_file(snamesaliasesssourcescommand((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/alias.pys format_aliasEs    (s distutilssoss setuptoolssCommandsdistutils.utils convert_pathslogsdistutils.errorsssetuptools.command.setopts edit_configs option_bases config_filesshquotesaliass format_alias( sshquotes convert_paths config_fileslogs distutilss format_aliassaliassCommands edit_configsoss option_base((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/alias.pys?s    4PKC8X(??setuptools/command/test.pyc; _Fc@smdklZdklZdkZdkTdklZlZdefdYZ defdYZ dS( (sCommand(sDistutilsOptionErrorN(s*(s TestLoadersmainsScanningLoadercBstZdZRS(NcCs6g}|idjo|iti||nt|do|i|int|doxt |idD]}|i do |djo|id|d }n0t |i|d o|id|}nq}|i|i|q}Wnt|d jo|i|Sn |d Sd S( sReturn a suite of all tests cases contained in the given module If the module is a package, load tests from all the modules in it. If the module has an ``additional_tests`` function, call it and add the return value to the tests. ssetuptools.tests.doctestsadditional_testss__path__ss.pys __init__.pys.is /__init__.pyiiN(stestssmodules__name__sappends TestLoadersloadTestsFromModulesselfshasattrsadditional_testssresource_listdirsfilesendswiths submodulesresource_existssloadTestsFromNameslens suiteClass(sselfsmodulestestss submodulesfile((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/command/test.pysloadTestsFromModule s$(s__name__s __module__sloadTestsFromModule(((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/command/test.pysScanningLoadersstestcBs_tZdZdZdddfdddfgZdZd Zd Zd Zd Z RS( s.Command to run unit tests after in-place builds#run unit tests after in-place builds test-module=sms$Run 'test_suite' in specified modules test-suite=sss1Test suite to run (e.g. 'some_module.test_suite')cCst|_t|_t|_dS(N(sNonesselfs test_suites test_modules test_loader(sself((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/command/test.pysinitialize_options6s  cCs|itjo7|itjo|ii|_qa|id|_n|iotdn|ig|_|io|iiddn|i tjot |idt|_ n|i tjo d|_ ndS(Ns .test_suites1You may specify a module or a suite, but not bothis --verboses test_loaders&setuptools.command.test:ScanningLoader( sselfs test_suitesNones test_modules distributionsDistutilsOptionErrors test_argssverbosesinserts test_loadersgetattr(sself((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/command/test.pysfinalize_options<s  cCs|id|iddd|id|id}ti}tii }zXtii dt |i titdtd|i|if|Wd|ti(tiitii|tiXdS(Nsegg_infos build_extsinplaceiicCs |iS(N(sdistsactivate(sdist((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/command/test.pyscss%s==%s(sselfs run_commandsreinitialize_commandsget_finalized_commandsei_cmdssysspathsold_pathsmodulesscopys old_modulessinsertsnormalize_pathsegg_bases working_sets__init__sadd_activation_listenersrequiresegg_names egg_versionsfuncsclearsupdate(sselfsfuncsei_cmds old_modulessold_path((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/command/test.pyswith_project_on_sys_pathSs"        cCs|iio|ii|iin|ioVdi|i}|io|i d|q|i d||i |i ndS(Ns s skipping "unittest %s" (dry run)srunning "unittest %s"( sselfs distributions tests_requiresfetch_build_eggss test_suitesjoins test_argsscmdsdry_runsannounceswith_project_on_sys_paths run_tests(sselfscmd((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/command/test.pysrunms   cCs^dk}tid|i}|idt}|i t t |i g|i d|dS(Nsx=srequires testLoader( sunittests EntryPointsparsesselfs test_loaders loader_epsloadsFalses loader_classsmainsNones__file__s test_args(sselfs loader_classs loader_epsunittest((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/command/test.pys run_tests|s  ( s__name__s __module__s__doc__s descriptions user_optionssinitialize_optionssfinalize_optionsswith_project_on_sys_pathsruns run_tests(((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/command/test.pystest*s     ( s setuptoolssCommandsdistutils.errorssDistutilsOptionErrorssyss pkg_resourcessunittests TestLoadersmainsScanningLoaderstest(ssyssCommandsScanningLoaderstestsDistutilsOptionErrorsmains TestLoader((s;build/bdist.darwin-8.0.1-x86/egg/setuptools/command/test.pys?s   #PKd$7N &setuptools/command/install_egg_info.pyfrom setuptools import Command from setuptools.archive_util import unpack_archive from distutils import log, dir_util import os, shutil, pkg_resources class install_egg_info(Command): """Install an .egg-info directory for the package""" description = "Install an .egg-info directory for the package" user_options = [ ('install-dir=', 'd', "directory to install to"), ] def initialize_options(self): self.install_dir = None def finalize_options(self): self.set_undefined_options('install_lib',('install_dir','install_dir')) ei_cmd = self.get_finalized_command("egg_info") basename = pkg_resources.Distribution( None, None, ei_cmd.egg_name, ei_cmd.egg_version ).egg_name()+'.egg-info' self.source = ei_cmd.egg_info self.target = os.path.join(self.install_dir, basename) self.outputs = [self.target] def run(self): self.run_command('egg_info') target = self.target if os.path.isdir(self.target) and not os.path.islink(self.target): dir_util.remove_tree(self.target, dry_run=self.dry_run) elif os.path.exists(self.target): self.execute(os.unlink,(self.target,),"Removing "+self.target) if not self.dry_run: pkg_resources.ensure_directory(self.target) self.execute(self.copytree, (), "Copying %s to %s" % (self.source, self.target) ) self.install_namespaces() def get_outputs(self): return self.outputs def copytree(self): # Copy the .egg-info tree to site-packages def skimmer(src,dst): # filter out source-control directories; note that 'src' is always # a '/'-separated path, regardless of platform. 'dst' is a # platform-specific path. for skip in '.svn/','CVS/': if src.startswith(skip) or '/'+skip in src: return None self.outputs.append(dst) log.debug("Copying %s to %s", src, dst) return dst unpack_archive(self.source, self.target, skimmer) def install_namespaces(self): nsp = self._get_all_ns_packages() if not nsp: return filename,ext = os.path.splitext(self.target) filename += '-nspkg.pth'; self.outputs.append(filename) log.info("Installing %s",filename) if not self.dry_run: f = open(filename,'wb') for pkg in nsp: pth = tuple(pkg.split('.')) trailer = '\n' if '.' in pkg: trailer = ( "; m and setattr(sys.modules[%r], %r, m)\n" % ('.'.join(pth[:-1]), pth[-1]) ) f.write( "import sys,new,os; " "p = os.path.join(sys._getframe(1).f_locals['sitedir'], " "*%(pth)r); " "ie = os.path.exists(os.path.join(p,'__init__.py')); " "m = not ie and " "sys.modules.setdefault(%(pkg)r,new.module(%(pkg)r)); " "mp = (m or []) and m.__dict__.setdefault('__path__',[]); " "(p not in mp) and mp.append(p)%(trailer)s" % locals() ) f.close() def _get_all_ns_packages(self): nsp = {} for pkg in self.distribution.namespace_packages or []: pkg = pkg.split('.') while pkg: nsp['.'.join(pkg)] = 1 pkg.pop() nsp=list(nsp) nsp.sort() # set up shorter names first return nsp PKd$744setuptools/command/egg_info.py"""setuptools.command.egg_info Create a distribution's .egg-info directory and contents""" # This module should be kept compatible with Python 2.3 import os, re from setuptools import Command from distutils.errors import * from distutils import log from setuptools.command.sdist import sdist from distutils import file_util from distutils.util import convert_path from distutils.filelist import FileList from pkg_resources import parse_requirements, safe_name, parse_version, \ safe_version, yield_lines, EntryPoint, iter_entry_points, to_filename from sdist import walk_revctrl class egg_info(Command): description = "create a distribution's .egg-info directory" user_options = [ ('egg-base=', 'e', "directory containing .egg-info directories" " (default: top of the source tree)"), ('tag-svn-revision', 'r', "Add subversion revision ID to version number"), ('tag-date', 'd', "Add date stamp (e.g. 20050528) to version number"), ('tag-build=', 'b', "Specify explicit tag to add to version number"), ('no-svn-revision', 'R', "Don't add subversion revision ID [default]"), ('no-date', 'D', "Don't include date stamp [default]"), ] boolean_options = ['tag-date', 'tag-svn-revision'] negative_opt = {'no-svn-revision': 'tag-svn-revision', 'no-date': 'tag-date'} def initialize_options(self): self.egg_name = None self.egg_version = None self.egg_base = None self.egg_info = None self.tag_build = None self.tag_svn_revision = 0 self.tag_date = 0 self.broken_egg_info = False self.vtags = None def save_version_info(self, filename): from setopt import edit_config edit_config( filename, {'egg_info': {'tag_svn_revision':0, 'tag_date': 0, 'tag_build': self.tags()} } ) def finalize_options (self): self.egg_name = safe_name(self.distribution.get_name()) self.vtags = self.tags() self.egg_version = self.tagged_version() try: list( parse_requirements('%s==%s' % (self.egg_name,self.egg_version)) ) except ValueError: raise DistutilsOptionError( "Invalid distribution name or version syntax: %s-%s" % (self.egg_name,self.egg_version) ) if self.egg_base is None: dirs = self.distribution.package_dir self.egg_base = (dirs or {}).get('',os.curdir) self.ensure_dirname('egg_base') self.egg_info = to_filename(self.egg_name)+'.egg-info' if self.egg_base != os.curdir: self.egg_info = os.path.join(self.egg_base, self.egg_info) if '-' in self.egg_name: self.check_broken_egg_info() # Set package version for the benefit of dumber commands # (e.g. sdist, bdist_wininst, etc.) # self.distribution.metadata.version = self.egg_version # If we bootstrapped around the lack of a PKG-INFO, as might be the # case in a fresh checkout, make sure that any special tags get added # to the version info # pd = self.distribution._patched_dist if pd is not None and pd.key==self.egg_name.lower(): pd._version = self.egg_version pd._parsed_version = parse_version(self.egg_version) self.distribution._patched_dist = None def write_or_delete_file(self, what, filename, data, force=False): """Write `data` to `filename` or delete if empty If `data` is non-empty, this routine is the same as ``write_file()``. If `data` is empty but not ``None``, this is the same as calling ``delete_file(filename)`. If `data` is ``None``, then this is a no-op unless `filename` exists, in which case a warning is issued about the orphaned file (if `force` is false), or deleted (if `force` is true). """ if data: self.write_file(what, filename, data) elif os.path.exists(filename): if data is None and not force: log.warn( "%s not set in setup(), but %s exists", what, filename ) return else: self.delete_file(filename) def write_file(self, what, filename, data): """Write `data` to `filename` (if not a dry run) after announcing it `what` is used in a log message to identify what is being written to the file. """ log.info("writing %s to %s", what, filename) if not self.dry_run: f = open(filename, 'wb') f.write(data) f.close() def delete_file(self, filename): """Delete `filename` (if not a dry run) after announcing it""" log.info("deleting %s", filename) if not self.dry_run: os.unlink(filename) def tagged_version(self): return safe_version(self.distribution.get_version() + self.vtags) def run(self): self.mkpath(self.egg_info) installer = self.distribution.fetch_build_egg for ep in iter_entry_points('egg_info.writers'): writer = ep.load(installer=installer) writer(self, ep.name, os.path.join(self.egg_info,ep.name)) self.find_sources() def tags(self): version = '' if self.tag_build: version+=self.tag_build if self.tag_svn_revision and ( os.path.exists('.svn') or os.path.exists('PKG-INFO') ): version += '-r%s' % self.get_svn_revision() if self.tag_date: import time; version += time.strftime("-%Y%m%d") return version def get_svn_revision(self): revision = 0 urlre = re.compile('url="([^"]+)"') revre = re.compile('committed-rev="(\d+)"') for base,dirs,files in os.walk(os.curdir): if '.svn' not in dirs: dirs[:] = [] continue # no sense walking uncontrolled subdirs dirs.remove('.svn') f = open(os.path.join(base,'.svn','entries')) data = f.read() f.close() if data.startswith('8'): data = map(str.splitlines,data.split('\n\x0c\n')) del data[0][0] # get rid of the '8' dirurl = data[0][3] localrev = max([int(d[9]) for d in data if len(d)>9 and d[9]]+[0]) elif data.startswith('[arg]: return repr(arg) return arg class alias(option_base): """Define a shortcut that invokes one or more commands""" description = "define a shortcut to invoke one or more commands" command_consumes_arguments = True user_options = [ ('remove', 'r', 'remove (unset) the alias'), ] + option_base.user_options boolean_options = option_base.boolean_options + ['remove'] def initialize_options(self): option_base.initialize_options(self) self.args = None self.remove = None def finalize_options(self): option_base.finalize_options(self) if self.remove and len(self.args)<>1: raise DistutilsOptionError( "Must specify exactly one argument (the alias name) when " "using --remove" ) def run(self): aliases = self.distribution.get_option_dict('aliases') if not self.args: print "Command Aliases" print "---------------" for alias in aliases: print "setup.py alias", format_alias(alias, aliases) return elif len(self.args)==1: alias, = self.args if self.remove: command = None elif alias in aliases: print "setup.py alias", format_alias(alias, aliases) return else: print "No alias definition found for %r" % alias return else: alias = self.args[0] command = ' '.join(map(shquote,self.args[1:])) edit_config(self.filename, {'aliases': {alias:command}}, self.dry_run) def format_alias(name, aliases): source, command = aliases[name] if source == config_file('global'): source = '--global-config ' elif source == config_file('user'): source = '--user-config ' elif source == config_file('local'): source = '' else: source = '--filename=%r' % source return source+name+' '+command PK45{setuptools/command/saveopts.pyimport distutils, os from setuptools import Command from setuptools.command.setopt import edit_config, option_base class saveopts(option_base): """Save command-line options to a file""" description = "save supplied options to setup.cfg or other config file" def run(self): dist = self.distribution commands = dist.command_options.keys() settings = {} for cmd in commands: if cmd=='saveopts': continue # don't save our own options! for opt,(src,val) in dist.get_option_dict(cmd).items(): if src=="command line": settings.setdefault(cmd,{})[opt] = val edit_config(self.filename, settings, self.dry_run) PK45Sƌ{setuptools/command/setopt.pyimport distutils, os from setuptools import Command from distutils.util import convert_path from distutils import log from distutils.errors import * __all__ = ['config_file', 'edit_config', 'option_base', 'setopt'] def config_file(kind="local"): """Get the filename of the distutils, local, global, or per-user config `kind` must be one of "local", "global", or "user" """ if kind=='local': return 'setup.cfg' if kind=='global': return os.path.join( os.path.dirname(distutils.__file__),'distutils.cfg' ) if kind=='user': dot = os.name=='posix' and '.' or '' return os.path.expanduser(convert_path("~/%spydistutils.cfg" % dot)) raise ValueError( "config_file() type must be 'local', 'global', or 'user'", kind ) def edit_config(filename, settings, dry_run=False): """Edit a configuration file to include `settings` `settings` is a dictionary of dictionaries or ``None`` values, keyed by command/section name. A ``None`` value means to delete the entire section, while a dictionary lists settings to be changed or deleted in that section. A setting of ``None`` means to delete that setting. """ from ConfigParser import RawConfigParser log.debug("Reading configuration from %s", filename) opts = RawConfigParser() opts.read([filename]) for section, options in settings.items(): if options is None: log.info("Deleting section [%s] from %s", section, filename) opts.remove_section(section) else: if not opts.has_section(section): log.debug("Adding new section [%s] to %s", section, filename) opts.add_section(section) for option,value in options.items(): if value is None: log.debug("Deleting %s.%s from %s", section, option, filename ) opts.remove_option(section,option) if not opts.options(section): log.info("Deleting empty [%s] section from %s", section, filename) opts.remove_section(section) else: log.debug( "Setting %s.%s to %r in %s", section, option, value, filename ) opts.set(section,option,value) log.info("Writing %s", filename) if not dry_run: f = open(filename,'w'); opts.write(f); f.close() class option_base(Command): """Abstract base class for commands that mess with config files""" user_options = [ ('global-config', 'g', "save options to the site-wide distutils.cfg file"), ('user-config', 'u', "save options to the current user's pydistutils.cfg file"), ('filename=', 'f', "configuration file to use (default=setup.cfg)"), ] boolean_options = [ 'global-config', 'user-config', ] def initialize_options(self): self.global_config = None self.user_config = None self.filename = None def finalize_options(self): filenames = [] if self.global_config: filenames.append(config_file('global')) if self.user_config: filenames.append(config_file('user')) if self.filename is not None: filenames.append(self.filename) if not filenames: filenames.append(config_file('local')) if len(filenames)>1: raise DistutilsOptionError( "Must specify only one configuration file option", filenames ) self.filename, = filenames class setopt(option_base): """Save command-line options to a file""" description = "set an option in setup.cfg or another config file" user_options = [ ('command=', 'c', 'command to set an option for'), ('option=', 'o', 'option to set'), ('set-value=', 's', 'value of the option'), ('remove', 'r', 'remove (unset) the value'), ] + option_base.user_options boolean_options = option_base.boolean_options + ['remove'] def initialize_options(self): option_base.initialize_options(self) self.command = None self.option = None self.set_value = None self.remove = None def finalize_options(self): option_base.finalize_options(self) if self.command is None or self.option is None: raise DistutilsOptionError("Must specify --command *and* --option") if self.set_value is None and not self.remove: raise DistutilsOptionError("Must specify --set-value or --remove") def run(self): edit_config( self.filename, { self.command: {self.option.replace('-','_'):self.set_value} }, self.dry_run ) PK45(wsetuptools/command/register.pyfrom distutils.command.register import register as _register class register(_register): __doc__ = _register.__doc__ def run(self): # Make sure that we are using valid current name/version info self.run_command('egg_info') _register.run(self) PKC8_ setuptools/command/rotate.pyo; Ec@sZdkZdkZdklZdklZdklZdkTdefdYZdS(N(sCommand(s convert_path(slog(s*srotatecBs_tZdZdZdddfdddfdd d fgZgZd Zd Zd ZRS(sDelete older distributionss2delete older distributions, keeping N newest filessmatch=smspatterns to match (required)s dist-dir=sds%directory where the distributions areskeep=sks(number of matching distributions to keepcCst|_t|_t|_dS(N(sNonesselfsmatchsdist_dirskeep(sself((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/rotate.pysinitialize_optionss  cCs|itjotdn|itjotdnyt|i|_Wntj otdnXt|itoFgi }|ii dD]}|t |iq~|_n|idddfdS(NsQMust specify one or more (comma-separated) match patterns (e.g. '.zip' or '.egg')s$Must specify number of files to keeps--keep must be an integers,sbdistsdist_dir(sselfsmatchsNonesDistutilsOptionErrorskeepsints ValueErrors isinstances basestringsappends_[1]ssplitsps convert_pathsstripsset_undefined_options(sselfs_[1]sp((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/rotate.pysfinalize_optionssFcCs|iddkl}x|iD]}|iid|}|tii |i |}gi }|D]"}|tii||fqm~}|i|itidt||||i}x@|D]8\}}tid||i oti|qqWq$WdS(Nsegg_info(sglobs*s%d file(s) matching %ss Deleting %s(sselfs run_commandsglobsmatchspatterns distributionsget_namesosspathsjoinsdist_dirsfilessappends_[1]sfsgetmtimessortsreverseslogsinfoslenskeepstsdry_runsunlink(sselfsfilessfspatterns_[1]stsglob((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/rotate.pysrun*s    9     ( s__name__s __module__s__doc__s descriptions user_optionssboolean_optionssinitialize_optionssfinalize_optionssrun(((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/rotate.pysrotates *  ( s distutilssoss setuptoolssCommandsdistutils.utils convert_pathslogsdistutils.errorssrotate(s convert_pathsrotateslogs distutilssCommandsos((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/rotate.pys?s    PKC8!N N &setuptools/command/install_scripts.pyo; wREc@sidklZdklZlZdklZlZl Z dk Z dk l Z defdYZdS((sinstall_scripts(sget_script_argsssys_executable(s Distributions PathMetadatasensure_directoryN(slogsinstall_scriptscBs,tZdZdZdZddZRS(s;Do normal script install, plus any egg_info wrapper scriptscCsti|t|_dS(N(s_install_scriptssinitialize_optionssselfsFalsesno_ep(sself((sFbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_scripts.pysinitialize_options s cCs|id|iioti|n g|_|iodSn|id}t |i t |i |i |i|i}|id}t|dt}t|iddt}x't|||D]}|i|qWdS(Nsegg_infos build_scriptss executables bdist_wininsts _is_running(sselfs run_commands distributionsscriptss_install_scriptssrunsoutfilessno_epsget_finalized_commandsei_cmds Distributionsegg_bases PathMetadatasegg_infosegg_names egg_versionsdistsbs_cmdsgetattrssys_executables executablesFalses is_wininstsget_script_argssargss write_script(sselfsei_cmdsdistsargss executablesbs_cmds is_wininst((sFbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_scripts.pysruns    stcGstid||itii|i|}|i i ||i okt |t |d|}|i||iyti|dWqttifj oqXndS(s1Write an executable file to the scripts directorysInstalling %s script to %sswiN(slogsinfos script_namesselfs install_dirsosspathsjoinstargetsoutfilessappendsdry_runsensure_directorysopensmodesfswritescontentsscloseschmodsAttributeErrorserror(sselfs script_namescontentssmodesignoredsfstarget((sFbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_scripts.pys write_script*s    (s__name__s __module__s__doc__sinitialize_optionssruns write_script(((sFbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_scripts.pysinstall_scriptss   ( s!distutils.command.install_scriptssinstall_scriptss_install_scriptss easy_installsget_script_argsssys_executables pkg_resourcess Distributions PathMetadatasensure_directorysoss distutilsslog( s PathMetadatasinstall_scriptssget_script_argss_install_scriptssensure_directoryssys_executables Distributionsosslog((sFbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_scripts.pys?s   PKC8As#setuptools/command/easy_install.pyo; eFc@s dZdkZdkZdkZdkZdkZdkZdkZdk Z dk Z dk l Z dk l Z dklZdklZlZdklZdklZlZlZdklZd klZlZd klZd kl Z l!Z!d k"Tei#i$ei%Z&d dddddgZ'dZ(de fdYZ)dZ*dZ+dZ,dZ-dZ.de/fdYZ0e&e1dZ2dZ3dZ4dZ5dd Z6d!Z7d"Z8e&e1d#Z9e1e3d$Z:d%Z;e<d&Z=dS('sEasy Install ------------ A tool for doing automatic download/extract/build of distutils-based Python packages. For detailed documentation, see the accompanying EasyInstall.txt file, or visit the `EasyInstall home page`__. __ http://peak.telecommunity.com/DevCenter/EasyInstall N(sglob(sCommand(s run_setup(slogsdir_util(sget_python_lib(sDistutilsArgErrorsDistutilsOptionErrorsDistutilsError(sunpack_archive(s PackageIndexsparse_bdist_wininst(s URL_SCHEME(s bdist_eggsegg_info(s*ssamefiles easy_installsPthDistributionssextract_wininst_cfgsmainsget_exe_prefixescCsttido#tii|otii|otii||Sntiitii|tiitii|jSdS(Nssamefile( shasattrsosspathsexistssp1sp2ssamefilesnormpathsnormcase(sp1sp2((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pyssamefile s9cBstZdZdZeZdedfdddfddd fd d d fd ddfdddfdddfdddfdddfdddfdd d!fd"ed!fd#d$d%fd&d'd(fd)ed*fd+d,d-fd.d/d0fd1d2d3fd4d5d6fd7d8d9fd:d;d<fgZdddd ddd"d1d4d:g Zhd+dZ d?Zd@ZdAZdBZdCZdDZdEZdFZdGZdHZdIZedJZedKZedLZdMZdNZdOZedPZ dQfdRZ!dSZ"dTZ#dUZ$dVZ%dWZ&dXZ'dYZ(dZd[Z)d\Z*d]Z+d^Z,d_Z-d`Z.daZ/dbZ0dcZ1ddZ2e3dee3dfdgdhdiZ4e3dfdjdhdkZ5dlZ6RS(ms'Manage a download/build/install processs Find/get/install Python packagessprefix=sinstallation prefixszip-okszsinstall package as a zipfiles multi-versionsms%make apps have to require() a versionsupgradesUs1force upgrade (searches PyPI for latest versions)s install-dir=sdsinstall package to DIRs script-dir=sssinstall scripts to DIRsexclude-scriptssxsDon't install scriptss always-copysas'Copy all needed packages to install dirs index-url=sis base URL of Python Package Indexs find-links=sfs(additional URL(s) to search for packagessdelete-conflictingsDs no longer needed; don't use thissignore-conflicts-at-my-risksbuild-directory=sbs/download/extract/build in DIR; keep the resultss optimize=sOslalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0]srecord=s3filename in which to record list of installed filess always-unzipsZs*don't install as a zipfile, no matter whats site-dirs=sSs)list of directories where .pth files workseditableses+Install specified packages in editable formsno-depssNsdon't install dependenciess allow-hosts=sHs$pattern(s) that hostnames must matchslocal-snapshots-oksls(allow building eggs from local checkoutscCst|_|_t|_|_|_t|_t|_t|_ t|_ t|_ |_ t|_ |_|_t|_|_|_t|_|_|_t|_t|_t|_t|_t|_h|_t|_t|_|ii |_ |ii!||ii"ddS(Ns easy_install(#sNonesselfszip_okslocal_snapshots_oks install_dirs script_dirsexclude_scriptss index_urls find_linkssbuild_directorysargssoptimizesrecordsupgrades always_copys multi_versionseditablesno_depss allow_hostssrootsprefixs no_reports package_indexspth_filesdelete_conflictingsignore_conflicts_at_my_risks site_dirssinstalled_projectssFalsessitepy_installeds_dry_runs distributionsverboses_set_command_optionssget_option_dict(sself((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysinitialize_optionsSs(            cCsx|D]}tii|ptii|oetid||i oFtii |otii| ot |qti |qqqWdS(Ns Deleting %s( sblockerssfilenamesosspathsexistssislinkslogsinfosselfsdry_runsisdirsrmtreesunlink(sselfsblockerssfilename((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysdelete_blockersrs& 'cCs|idddd|itjo|i|_n|idddf|idddf|idddfttti }t |_ |i tj ogi}|i id D]"}|ti i|iq~}xw|D]k}ti i| otid |qt||jot|d q|i it|qWn|i o|in|ipd |_|i |_xG|it|ifD]-}||ijo|iid |qqW|i tj o=gi}|i id D]}||iq~}n dg}|i"tjo(|i#|id|id||_"nt$|iti |_%|i&tj o-t'|i&t(o|i&i|_&qn g|_&|i)o|i"i*|iti n|i"i+|i&|idddft'|i,t- ohyBt-|i,|_,d |i,jo djn o t.nWqt.j otdqXn|i/o|i0otdn|io|i1 ot2dn|i3 ot2dng|_4dS(Ns install_dirs script_dirsbuild_directorys site_dirss install_libsinstall_scriptssinstallsrecords,s"%s (in --site-dirs) does not exists$ (in --site-dirs) is not on sys.pathshttp://pypi.python.org/simpleis*s search_pathshostssoptimizeis--optimize must be 0, 1, or 2sVCan't use both --delete-conflicting and --ignore-conflicts-at-my-risk at the same times9Must specify a build directory (-b) when using --editables:No urls, filenames, or requirements specified (see --help)(5sselfs_expands script_dirsNones install_dirsset_undefined_optionssmapsnormalize_pathssysspathsnormpaths get_site_dirss all_site_dirss site_dirssappends_[1]ssplitsssoss expandusersstripsdsisdirslogswarnsDistutilsOptionErrorseditablescheck_site_dirs index_urls shadow_paths path_itemsinserts allow_hostsshostss package_indexs create_indexs Environments local_indexs find_linkss isinstances basestringslocal_snapshots_oksscan_egg_linkssadd_find_linkssoptimizesints ValueErrorsdelete_conflictingsignore_conflicts_at_my_risksbuild_directorysDistutilsArgErrorsargssoutputs(sselfs path_itemsdsnormpaths_[1]ssshostss site_dirs((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysfinalize_options|sn     E  = (  " cCs|i|iijoti|inzx%|iD]}|i||i q7W|i o|i }|i oBt |i }x0tt |D]}|||||x;|idD]&}|i|||id|q+Wn|i|dS(s=Write all the scripts for `dist`, unless scripts are excludedsscriptssscripts/N( sselfsexclude_scriptssdistsmetadata_isdirsmetadata_listdirs script_namesinstall_scripts get_metadatasinstall_wrapper_scripts(sselfsdists script_name((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysinstall_egg_scriptsrs cCs~tii|oWxdti|D]?\}}}x-|D]%}|i i tii ||q9Wq#Wn|i i |dS(N( sosspathsisdirswalksbasesdirssfilessfilenamesselfsoutputssappendsjoin(sselfspathsdirssfilessfilenamesbase((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys add_output|s+cCs%|iotd|fndS(NsjInvalid argument %r: you can't use filenames or URLs with --editable (except via the --find-links option).(sselfseditablesDistutilsArgErrorsspec(sselfsspec((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys not_editables cCs_|i odSntiitii|i|io t d|i|ifndS(Ns2%r already exists in %s; can't do a checkout there( sselfseditablesosspathsexistssjoinsbuild_directorysspecskeysDistutilsArgError(sselfsspec((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pyscheck_editables (cCstidd}t}|i o|inzit|t  ot |o?|i ||i i||}|it|||tSqtii|o*|i ||it|||tSqt|}n|i||i i|||i|i|i }|tjo2d|}|io|d7}nt|nH|itjo|i|||d|Sn|i||i||SWdtii|ot |nXdS(Nsprefixs easy_install-s+Could not find suitable distribution for %rs2 (--always-copy skips system and development eggs)sUsing(!stempfilesmkdtempstmpdirsNonesdownloadsselfseditablesinstall_site_pys isinstancesspecs Requirements URL_SCHEMEs not_editables package_indexs install_itemsdepssTruesosspathsexistssparse_requirement_argscheck_editablesfetch_distributionsupgrades always_copysdistsmsgsDistutilsErrors precedences DEVELOP_DISTsprocess_distributionslocationsrmtree(sselfsspecsdepssdistsmsgsdownloadstmpdir((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys easy_installs8     (   cCs_|p|i}|ptii||j}|p|id }|o| o:x7|i |i D]}|i |joPqfqfWt}ntidtii||o=|i|||}xZ|D]}|i|||qWn6|i|i|g}|i||d|d|tj o*x'|D]}||jo|Sq8q8WndS(Ns.eggs Processing %sisUsing(sinstall_neededsselfs always_copysosspathsdirnamesdownloadstmpdirsendswithsspecs local_indexs project_namesdistslocationsTrueslogsinfosbasenames install_eggssdistssprocess_distributionsdepsscheck_conflictssegg_distributionsNone(sselfsspecsdownloadstmpdirsdepssinstall_neededsdistsdists((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys install_items,    cGs|i||ii||ii||i|||i|i=%(version)s") # this version or higher s Note also that the installation directory must be on sys.path at runtime for this to work. (e.g. by being the application's script directory, by being on PYTHONPATH, or by being added to sys.path by your code.) sN(smsgsselfs multi_versions no_reports install_dirsmapsnormalize_pathssysspathsdistslocationsegglocs project_namesnamesversionsextrasslocals( sselfsreqsdistswhatsnamesegglocsversionsmsgsextras((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysinstallation_report^s    cCs*tii|}ti}dtSdS(Ns" Extracted editable version of %(spec)s to %(dirname)s If it uses setuptools in its setup script, you can activate it in "development" mode by going to that directory and running:: %(python)s setup.py develop See the setuptools documentation for the "develop" command for more info. (sosspathsdirnames setup_scriptssyss executablespythonslocals(sselfsspecs setup_scriptspythonsdirname((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysreport_editablezs cCstiidttiidtt|}|idjo)d|id}|i dd|n%|idjo|i ddn|i o|i dd nt i d |t|dd i|yt||Wn/tj o#}td |idfnXdS( Nsdistutils.command.bdist_eggsdistutils.command.egg_infoisviis-s-qs-ns Running %s %ss sSetup script exited with %s(ssyssmoduless setdefaults bdist_eggsegg_infoslistsargssselfsverbosesvsinsertsdry_runslogsinfos setup_scriptslens setup_basesjoins run_setups SystemExitsDistutilsError(sselfs setup_scripts setup_basesargssv((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys run_setups  *c Csddg}tidddtii|}z|i||i |||t |g}g}x?|D]7}x.||D]"}|i|i|i|qWqoW| o|i otid|n|SWdt|ti|iXdS(Ns bdist_eggs --dist-dirsprefixs egg-dist-tmp-sdirs+No eggs found in %s (setup script problem?)(sargsstempfilesmkdtempsosspathsdirnames setup_scriptsdist_dirsappendsselfs run_setups setup_bases Environmentsall_eggsseggsskeysdists install_eggslocationsdry_runslogswarnsrmtrees set_verbositysverbose( sselfs setup_scripts setup_basesdistseggssargsskeysdist_dirsall_eggs((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysbuild_and_installs& $  $   cCs|itjodSnx|i|iD]q}|ip|i|ijoNti d||ii ||i|i jo|i i |iqq)q)W|i ox|i|ii joti d|q!ti d||ii ||i|i jo|i i|iq!n|i o|ii|idjoytii|id}tii|oti|nt|d}|i|ii|id|iqndS(Ns&Removing %s from easy-install.pth files4%s is already the active version in easy-install.pths"Adding %s to easy-install.pth files setuptoolsssetuptools.pthswts (sselfspth_filesNonesdistskeysds multi_versionslocationslogsinfosremoves shadow_pathspathssaddsappendsdry_runssavesosspathsjoins install_dirsfilenamesislinksunlinksopensfswrites make_relativesclose(sselfsdistsfsfilenamesd((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys update_pths4      cCstid|||SdS(NsUnpacking %s to %s(slogsdebugssrcsdst(sselfssrcsdst((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysunpack_progresssc sggd}t|||ii oft i t i B}xSD]G}t i |t idBd@}tid||t i||q]WndS(Ncsi|ido|id oi|ni||i|i o|pt SdS(Ns.pys EGG-INFO/( sdstsendswithssrcs startswiths to_compilesappendsselfsunpack_progresssto_chmodsdry_runsNone(ssrcsdst(s to_compilesto_chmodsself(sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pyspfs!imischanging mode of %s to %o(s to_compilesto_chmodspfsunpack_archivesegg_paths destinationsselfs byte_compilesdry_runsstatsS_IXGRPsflagssfsossST_MODEsmodeslogsdebugschmod( sselfsegg_paths destinations to_compilesfspfsmodesflagssto_chmod((sselfs to_compilesto_chmodsCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysunpack_and_compiles   cCsdkl}zgti|id||ddddd|i|io&||d|iddd|inWdti|iXdS(N(s byte_compileisoptimizeisforcesdry_run( sdistutils.utils byte_compileslogs set_verbositysselfsverboses to_compilesdry_runsoptimize(sselfs to_compiles byte_compile((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys byte_compiles  cCs$d|itiiddfSdS(Nsbad install directory or PYTHONPATH You are attempting to install a package to a directory that is not on PYTHONPATH and which Python does not read ".pth" files from. The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: %s and your PYTHONPATH environment variable currently contains: %r Here are some of your options for correcting the problem: * You can choose a different installation directory, i.e., one that is on PYTHONPATH or supports .pth files * You can add the installation directory to the PYTHONPATH environment variable. (It must then also be on PYTHONPATH whenever you run Python and want to use the package(s) you are installing.) * You can set up the installation directory to support ".pth" files by using one of the approaches described here: http://peak.telecommunity.com/EasyInstall.html#custom-installation-locations Please make the appropriate changes for your system and try again.s PYTHONPATHs(sselfs install_dirsossenvironsget(sself((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysno_default_version_msgscCs)|iodSntii|id}tti dd}d}tii |oQt id|it|di}|id otd|qn||joct id ||i o4t|t|d }|i||in|i|gnt|_dS( s8Make sure there's a site.py in the target dir, if neededNssite.pys setuptoolsssChecking existing site.py in %ssrbs def __boot():s;%s is not a setuptools-generated site.py; please remove it.s Creating %sswb(sselfssitepy_installedsosspathsjoins install_dirssitepysresource_strings Requirementsparsessourcescurrentsexistsslogsdebugsopensreads startswithsDistutilsErrorsinfosdry_runsensure_directorysfswritescloses byte_compilesTrue(sselfsfscurrentssourcessitepy((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysinstall_site_py+s(     sposixs install_dirs/$base/lib/python$py_version_short/site-packagess script_dirs $base/bins$base/Lib/site-packagess $base/ScriptscGs%|idi}|io|i}|i|d<|iiti|i }xK|i D]9\}}t||ttjot|||q]q]Wndkl}xs|D]k}t||}|tj oI|||}tidjotii|}nt|||qqWdS(Nsinstallsbase(s subst_varssposix(sselfsget_finalized_commands config_varssprefixscopysINSTALL_SCHEMESsgetsossnamesDEFAULT_SCHEMEsschemesitemssattrsvalsgetattrsNonessetattrsdistutils.utils subst_varssattrsspaths expanduser(sselfsattrssattrsvals subst_varss config_varssscheme((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys_expand`s$      (7s__name__s __module__s__doc__s descriptionsTruescommand_consumes_argumentssNones user_optionssboolean_optionss negative_opts PackageIndexs create_indexsinitialize_optionssdelete_blockerssfinalize_optionssrunspseudo_tempnameswarn_deprecated_optionsscheck_site_dirscant_write_to_targetscheck_pth_processingsinstall_egg_scriptss add_outputs not_editablescheck_editablesFalses easy_installs install_itemsprocess_distributions should_unzips maybe_movesinstall_wrapper_scriptssinstall_scripts write_scripts install_eggssegg_distributions install_eggs install_exes exe_to_eggscheck_conflictssfound_conflictssinstallation_reportsreport_editables run_setupsbuild_and_installs update_pthsunpack_progresssunpack_and_compiles byte_compilesno_default_version_msgsinstall_site_pysdictsINSTALL_SCHEMESsDEFAULT_SCHEMEs_expand(((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys easy_install*sf $  R   ) ) )    ) ) ,    )  " ) / # )    $    ) )  cCstttiidditi}ti g}ti ti jo|i ti nx>|D]6}|o)ti ddfjo#|i tii|ddntidjoI|itii|dd tid dtii|dd gn&|i|tii|ddgti d jo^d |joMtiid}|o0|i tii|ddtid dqqqqdqdWx>ddfD]0}t|}||jo|i |qqWtt|}|SdS(Ns PYTHONPATHssos2emxsriscossLibs site-packagess/slibspythonis site-pythonsdarwinsPython.frameworksHOMEsLibrarysPythonii(sfiltersNonesossenvironsgetssplitspathsepssitedirsssyssprefixsprefixess exec_prefixsappendsplatformspathsjoinssepsextendsversionshomes plat_specificsget_python_libssite_libsmapsnormalize_path(sprefixess plat_specificssitedirssprefixshomessite_lib((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys get_site_dirs}s>* #&%     ccsth}xg|D]_}t|}||joq nd||egg path translations for a given .exe filesPURELIB/ssPLATLIB/sSCRIPTS/sEGG-INFO/scripts/s/iisPKG-INFOis .egg-infois EGG-INFO/s.pths -nspkg.pthsPURELIBsPLATLIBs\simports%s/%s/N(sprefixesszipfilesZipFiles exe_filenameszsinfolistsinfosfilenamesnamessplitspartsslensendswithsinsertsjoins yield_linessreadspthsstripsreplaces startswithsappendsclosessortsreverse(s exe_filenamesinfosnamespthsprefixesspartssz((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysget_exe_prefixess4!  $# $5 cCs>yti|SWn&tj otd|fnXdS(Ns1Not a URL, existing file, or requirement spec: %r(s Requirementsparsesspecs ValueErrorsDistutilsError(sspec((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysparse_requirement_argscBsJtZdZeZdZdZdZdZdZ dZ RS(s)A .pth file with Distribution paths in itcCs~||_ttii|i|_|iti |gt t x0t |i D]}t |it|tqWWdS(N(sfilenamesselfsnormalize_pathsosspathsdirnamesbasedirs_loads Environments__init__sNones yield_linesspathssmapsaddsfind_distributionssTrue(sselfsfilenamespath((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys__init__&s   cCsxg|_t}h}tii|ioxt |idD]}|i do t }q>n|i }|ii||i p|ii doq>nttii|i|}|idnd||Wn|io| o t |_nx1|io|idi o|iiqCWdS(Nsrtsimports#ii(sselfspathssFalses saw_importsseensosspathsisfilesfilenamesopenslines startswithsTruesrstripsappendsstripsnormalize_pathsjoinsbasedirsexistsspopsdirty(sselfs saw_importspathsseensline((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys_load-s0  $)!   cCs|i odSndit|i|i}|ottid|i d|}t i i |i ot i |i nt|i d}|i||in>t i i|i o'tid|i t i |i nt|_dS(s$Write changed .pth file back to diskNs s Saving %ssimport sys; sys.__plen = len(sys.path) %s import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new) swbsDeleting empty %s(sselfsdirtysjoinsmaps make_relativespathssdataslogsdebugsfilenamesosspathsislinksunlinksopensfswritesclosesexistssFalse(sselfsfsdata((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pyssaveJs  cCsG|i|ijo |ii|it|_nti||dS(s"Add `dist` to the distribution mapN( sdistslocationsselfspathssappendsTruesdirtys Environmentsadd(sselfsdist((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysaddfs cCsKx4|i|ijo |ii|it|_qWti||dS(s'Remove `dist` from the distribution mapN(sdistslocationsselfspathssremovesTruesdirtys Environment(sselfsdist((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysremovels !cCstiit|\}}t|i}|g}ti djodpti }x|t||jod||ijo+|i ti|i|i|Sntii|\}}|i |qYW|SdS(Ns/(sosspathssplitsnormalize_pathsnpathslastslensselfsbasedirsbaselenspartssaltsepssepsappendscurdirsreversesjoin(sselfspathslastsnpathssepspartssbaselen((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys make_relativess   ( s__name__s __module__s__doc__sFalsesdirtys__init__s_loadssavesaddsremoves make_relative(((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysPthDistributions!s      cCsdkl}|did}|i|}d}|o/|idpd}|od|}qln|o d}n t |}dt }t |d d id |joP|o2|iid od |id}qnd }dt }n|Sd S(s;Create a #! line, getting options (if any) from script_text(s first_line_res isis s python.exes#!%(executable)s%(options)s sasciisignores-s -xN(sdistutils.command.build_scriptss first_line_res script_texts splitlinessfirstsmatchsoptionssgroupswininsts executables nt_quote_argslocalsshdrsunicodesencodesstrips startswith(s script_texts executableswininstshdrs first_line_resoptionssmatchsfirst((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysget_script_headers(    "cCs|tijo tidjo!ti|ti||Snti }|d|dd|ddd||ffdS(Nsntiis %s %s( sfuncsossremovesnameschmodsargsstatsS_IWRITEssyssexc_infosexc(sfuncsargsexc((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys auto_chmods   cCs.dkl}t||t|tidS(s?Ensure that the importer caches dont have stale info for `path`(s_zip_directory_cacheN(s zipimports_zip_directory_cacheszdcs_uncachespathssysspath_importer_cache(spathszdc((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysuncache_zipdirs  cCs[||jo ||=n@t|}x0|D](}t||jo||=dSq+q+WdS(N(spathscachesnormalize_pathsp(spathscachesp((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys_uncaches   scCs<yt||dWnttfj o tSnXtSdS(s%Is this string a valid Python script?sexecN(scompilestextsfilenames SyntaxErrors TypeErrorsFalsesTrue(stextsfilename((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys is_pythons  cCs$g}t}d}d|jp d|j}|o|idnx|D]}|djo|d7}qJ|djo#|id|ddd}qJ|o|id|d}n|i|qJW|o|id|n|o"|id||idnd i|Sd S( s@Quote a command line argument according to Windows parsing rulesis s s"s\iis\"sN(sresultsFalses needquotesnbsargsappendscsjoin(sargscs needquotesnbsresult((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys nt_quote_args0    cCsv|idp |idotSnt||otSn|idod|idijSntSdS(sMIs this text, as a whole, a Python script? (as opposed to shell/bat/etc. s.pys.pyws#!spythoniN( sfilenamesendswithsTrues is_pythons script_texts startswiths splitlinesslowersFalse(s script_textsfilename((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysis_python_scripts c cst|i}td||}xxddfD]j}xa|i |i D]J\} }dt }tidjp|o |djo4ddf\} } dg}tid d |}n7d d f\} } d ddg}tidd|}tii|dd!p tidjo |} n|} | | | |dgi} |D]}| | |qM~ fV| dtd| dfVqM| ||fVqMWq1WdS(sEYield write_script() argument tuples for a distribution's entrypointsssconsole_scriptss gui_scriptss# EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r __requires__ = %(spec)r import sys from pkg_resources import load_entry_point sys.exit( load_entry_point(%(spec)r, %(group)r, %(name)r)() ) swin32s -script.pywsgui.exes.pyws(?i)python.exes pythonw.exes -script.pyscli.exes.pys.pycs.pyos(?i)pythonw.exes python.exeiists.exes setuptoolssbN(sstrsdistsas_requirementsspecsget_script_headers executableswininstsheadersgroups get_entry_mapsitemssnamesepslocalss script_textssyssplatformsextslaunchersoldsressubs new_headersosspathsexistsshdrsappends_[1]sxsresource_string(sdists executableswininsts new_headersheadersoldsepsgroupsspecshdrsnameslaunchers_[1]sextsxs script_text((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysget_script_argss,     * =cCs|o d}n|tjo d}ng}yti|}Wn1tij o"}|ti|t i nXx|D]}tii ||}yti|i}Wntij o d}nXti|ot|||qyti|Wqtij o"}|ti|t i qXqWyti|Wn/tij o |ti|t i nXdS(sRecursively delete a directory tree. This code is taken from the Python 2.4 version of 'shutil', because the 2.3 version doesn't really work right. cGsdS(N((sargs((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysonerrorGscGsdS(N((sargs((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysonerrorJsiN(s ignore_errorssonerrorsNonesnamessosslistdirspathserrorserrssyssexc_infosnamesjoinsfullnameslstatsst_modesmodesstatsS_ISDIRsrmtreesremovesrmdir(spaths ignore_errorssonerrorsnameserrsnamessfullnamesmode((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysrmtree@s6    "cCsJdk}tii|id}|tids(s with_ei_usage(sselfsargsskw(s with_ei_usages Distribution(sselfsargsskwsCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys _show_helps(s__name__s __module__s _show_help((s Distributions with_ei_usage(sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysDistributionWithoutHelpCommandssics7ddddgdtidpddS(Ns script_argss-qs easy_installs-vs script_nameis distclass(ssetupsargvssyssDistributionWithoutHelpCommandsskw((ssetupskwsDistributionWithoutHelpCommandssargv(sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pyss( s setuptoolsssetupssetuptools.dists Distributionsdistutils.cores distutilssUSAGEs gen_usages with_ei_usagesDistributionWithoutHelpCommandssargvsNonessys( sargvskws gen_usages distutilsssetupsUSAGEs Distributions with_ei_usagesDistributionWithoutHelpCommands(( sargvskws gen_usages distutilsssetupsUSAGEs Distributions with_ei_usagesDistributionWithoutHelpCommandssCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysmainis     (>s__doc__ssyssos.pathsoss zipimportsshutilstempfileszipfilesresstatsrandomsglobs setuptoolssCommandssetuptools.sandboxs run_setups distutilsslogsdir_utilsdistutils.sysconfigsget_python_libsdistutils.errorssDistutilsArgErrorsDistutilsOptionErrorsDistutilsErrorssetuptools.archive_utilsunpack_archivessetuptools.package_indexs PackageIndexsparse_bdist_wininsts URL_SCHEMEssetuptools.commands bdist_eggsegg_infos pkg_resourcesspathsnormpaths executablessys_executables__all__ssamefiles easy_installs get_site_dirss expand_pathssextract_wininst_cfgsget_exe_prefixessparse_requirement_args EnvironmentsPthDistributionssFalsesget_script_headers auto_chmodsuncache_zipdirs_uncaches is_pythons nt_quote_argsis_python_scriptsget_script_argssrmtrees bootstrapsNonesmain(-srandoms get_site_dirssdir_utilsshutilsDistutilsArgErrorslogs__all__stempfilesis_python_scriptsparse_bdist_wininstsPthDistributionssres is_pythonsextract_wininst_cfgsmains nt_quote_argsget_script_headerssamefilesstats zipimportsunpack_archives PackageIndexs auto_chmodsglobszipfilesparse_requirement_argssyssuncache_zipdirsCommandsrmtreessys_executablesDistutilsOptionErrorsDistutilsErrorsget_script_argssget_exe_prefixess URL_SCHEMEsegg_infos bootstraps run_setups easy_installs bdist_eggs_uncaches expand_pathssossget_python_lib((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys? sJQ       W ) ) ) ! a    ) ))# PKC83Usetuptools/command/register.pyc; Ec@s'dklZdefdYZdS((sregistersregistercBstZeiZdZRS(NcCs|idti|dS(Nsegg_info(sselfs run_commands _registersrun(sself((s?build/bdist.darwin-8.0.1-x86/egg/setuptools/command/register.pysruns (s__name__s __module__s _registers__doc__srun(((s?build/bdist.darwin-8.0.1-x86/egg/setuptools/command/register.pysregisters N(sdistutils.command.registersregisters _register(s _registersregister((s?build/bdist.darwin-8.0.1-x86/egg/setuptools/command/register.pys?s PKC8ݍfPxx$setuptools/command/bdist_wininst.pyc; Ec@s9dklZdkZdkZdefdYZdS((s bdist_wininstNs bdist_wininstcBs)tZedZddZdZRS(NcCsti||||t|idg}|i o_t i i |i d||i f}|i }dd|f}||jo|i|qn#t i i |i d|}d}|id||fdS(Ns dist_filess%s.win32-py%s.exes bdist_wininstsanys %s.win32.exe(s_bdist_wininsts create_exesselfsarcnamesfullnamesbitmapsgetattrs distributions dist_filesstarget_versionsosspathsjoinsdist_dirsinstaller_names pyversionsbadsremovesappend(sselfsarcnamesfullnamesbitmaps dist_filessbads pyversionsinstaller_name((sDbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_wininst.pys create_exes    icCs=|ii||}|ddfjo t|_n|SdS(Nsinstalls install_lib(sselfs distributionsreinitialize_commandscommandsreinit_subcommandsscmdsNones install_lib(sselfscommandsreinit_subcommandsscmd((sDbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_wininst.pysreinitialize_commands cCs+t|_zti|Wdt|_XdS(N(sTruesselfs _is_runnings_bdist_wininstsrunsFalse(sself((sDbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_wininst.pysrun"s  (s__name__s __module__sNones create_exesreinitialize_commandsrun(((sDbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_wininst.pys bdist_wininsts  (sdistutils.command.bdist_wininsts bdist_wininsts_bdist_wininstsosssys(ssyss bdist_wininsts_bdist_wininstsos((sDbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_wininst.pys?s PKC8e8setuptools/command/install.pyc; _Fc@sFdkZdkZdklZdklZdefdYZdS(N(sinstall(sDistutilsArgErrorsinstallcBstZdZeidedfdedfgZeiddgZddfddfgZeeZ gi Z ei D]%Z e de joe e qq[ eZ d Zd Zd Zd Zd ZRS(s7Use easy_install to install the package, w/dependenciessold-and-unmanageablesTry not to use this!s!single-version-externally-manageds5used by system package builders to create 'flat' eggssinstall_egg_infocCstS(N(sTrue(sself((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/install.pysssinstall_scriptsicCs,ti|t|_t|_t|_dS(N(s_installsinitialize_optionssselfsNonesold_and_unmanageables!single_version_externally_manageds no_compile(sself((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/install.pysinitialize_optionss   cCs\ti||io t|_n5|io*|i o|i otdqXndS(NsAYou must specify --record or --root when building system packages(s_installsfinalize_optionssselfsrootsTrues!single_version_externally_managedsrecordsDistutilsArgError(sself((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/install.pysfinalize_optionss     cCs;|ip|ioti|Snt|_d|_dS(Ns(sselfsroots!single_version_externally_manageds_installshandle_extra_pathsNones path_files extra_dirs(sself((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/install.pyshandle_extra_path*s cCs|ip|ioti|Sntid}|ii dd}|i i }|djp |djoti|n |idS(Nis__name__ssdistutils.dists run_commands(sselfsold_and_unmanageables!single_version_externally_manageds_installsrunssyss _getframescallers f_globalssgets caller_modulesf_codesco_names caller_namesdo_egg_install(sselfscallers caller_names caller_module((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/install.pysrun5s  cCs|iid}||iddd|id|i}|i|id|ii di g}t i o|idt i n||_ |itt _ dS(Ns easy_installsargssxsrootsrecords bdist_eggi(sselfs distributionsget_command_classs easy_installsrootsrecordscmdsensure_finalizeds run_commandsget_command_objs egg_outputsargss setuptoolssbootstrap_install_fromsinsertsrunsNone(sselfsargsscmds easy_install((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/install.pysdo_egg_installSs'     (s__name__s __module__s__doc__s_installs user_optionssNonesboolean_optionss new_commandssdicts_ncsappends_[1]s sub_commandsscmdsinitialize_optionssfinalize_optionsshandle_extra_pathsrunsdo_egg_install(((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/install.pysinstalls % C  (s setuptoolsssyssdistutils.command.installsinstalls_installsdistutils.errorssDistutilsArgError(ssyss_installsDistutilsArgErrorsinstalls setuptools((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/install.pys?s  PKVb$7'h::"setuptools/command/easy_install.py#!python """\ Easy Install ------------ A tool for doing automatic download/extract/build of distutils-based Python packages. For detailed documentation, see the accompanying EasyInstall.txt file, or visit the `EasyInstall home page`__. __ http://peak.telecommunity.com/DevCenter/EasyInstall """ import sys, os.path, zipimport, shutil, tempfile, zipfile, re, stat, random from glob import glob from setuptools import Command from setuptools.sandbox import run_setup from distutils import log, dir_util from distutils.sysconfig import get_python_lib from distutils.errors import DistutilsArgError, DistutilsOptionError, \ DistutilsError from setuptools.archive_util import unpack_archive from setuptools.package_index import PackageIndex, parse_bdist_wininst from setuptools.package_index import URL_SCHEME from setuptools.command import bdist_egg, egg_info from pkg_resources import * sys_executable = os.path.normpath(sys.executable) __all__ = [ 'samefile', 'easy_install', 'PthDistributions', 'extract_wininst_cfg', 'main', 'get_exe_prefixes', ] def samefile(p1,p2): if hasattr(os.path,'samefile') and ( os.path.exists(p1) and os.path.exists(p2) ): return os.path.samefile(p1,p2) return ( os.path.normpath(os.path.normcase(p1)) == os.path.normpath(os.path.normcase(p2)) ) class easy_install(Command): """Manage a download/build/install process""" description = "Find/get/install Python packages" command_consumes_arguments = True user_options = [ ('prefix=', None, "installation prefix"), ("zip-ok", "z", "install package as a zipfile"), ("multi-version", "m", "make apps have to require() a version"), ("upgrade", "U", "force upgrade (searches PyPI for latest versions)"), ("install-dir=", "d", "install package to DIR"), ("script-dir=", "s", "install scripts to DIR"), ("exclude-scripts", "x", "Don't install scripts"), ("always-copy", "a", "Copy all needed packages to install dir"), ("index-url=", "i", "base URL of Python Package Index"), ("find-links=", "f", "additional URL(s) to search for packages"), ("delete-conflicting", "D", "no longer needed; don't use this"), ("ignore-conflicts-at-my-risk", None, "no longer needed; don't use this"), ("build-directory=", "b", "download/extract/build in DIR; keep the results"), ('optimize=', 'O', "also compile with optimization: -O1 for \"python -O\", " "-O2 for \"python -OO\", and -O0 to disable [default: -O0]"), ('record=', None, "filename in which to record list of installed files"), ('always-unzip', 'Z', "don't install as a zipfile, no matter what"), ('site-dirs=','S',"list of directories where .pth files work"), ('editable', 'e', "Install specified packages in editable form"), ('no-deps', 'N', "don't install dependencies"), ('allow-hosts=', 'H', "pattern(s) that hostnames must match"), ('local-snapshots-ok', 'l', "allow building eggs from local checkouts"), ] boolean_options = [ 'zip-ok', 'multi-version', 'exclude-scripts', 'upgrade', 'always-copy', 'delete-conflicting', 'ignore-conflicts-at-my-risk', 'editable', 'no-deps', 'local-snapshots-ok', ] negative_opt = {'always-unzip': 'zip-ok'} create_index = PackageIndex def initialize_options(self): self.zip_ok = self.local_snapshots_ok = None self.install_dir = self.script_dir = self.exclude_scripts = None self.index_url = None self.find_links = None self.build_directory = None self.args = None self.optimize = self.record = None self.upgrade = self.always_copy = self.multi_version = None self.editable = self.no_deps = self.allow_hosts = None self.root = self.prefix = self.no_report = None # Options not specifiable via command line self.package_index = None self.pth_file = None self.delete_conflicting = None self.ignore_conflicts_at_my_risk = None self.site_dirs = None self.installed_projects = {} self.sitepy_installed = False # Always read easy_install options, even if we are subclassed, or have # an independent instance created. This ensures that defaults will # always come from the standard configuration file(s)' "easy_install" # section, even if this is a "develop" or "install" command, or some # other embedding. self._dry_run = None self.verbose = self.distribution.verbose self.distribution._set_command_options( self, self.distribution.get_option_dict('easy_install') ) def delete_blockers(self, blockers): for filename in blockers: if os.path.exists(filename) or os.path.islink(filename): log.info("Deleting %s", filename) if not self.dry_run: if os.path.isdir(filename) and not os.path.islink(filename): rmtree(filename) else: os.unlink(filename) def finalize_options(self): self._expand('install_dir','script_dir','build_directory','site_dirs') # If a non-default installation directory was specified, default the # script directory to match it. if self.script_dir is None: self.script_dir = self.install_dir # Let install_dir get set by install_lib command, which in turn # gets its info from the install command, and takes into account # --prefix and --home and all that other crud. self.set_undefined_options('install_lib', ('install_dir','install_dir') ) # Likewise, set default script_dir from 'install_scripts.install_dir' self.set_undefined_options('install_scripts', ('install_dir', 'script_dir') ) # default --record from the install command self.set_undefined_options('install', ('record', 'record')) normpath = map(normalize_path, sys.path) self.all_site_dirs = get_site_dirs() if self.site_dirs is not None: site_dirs = [ os.path.expanduser(s.strip()) for s in self.site_dirs.split(',') ] for d in site_dirs: if not os.path.isdir(d): log.warn("%s (in --site-dirs) does not exist", d) elif normalize_path(d) not in normpath: raise DistutilsOptionError( d+" (in --site-dirs) is not on sys.path" ) else: self.all_site_dirs.append(normalize_path(d)) if not self.editable: self.check_site_dir() self.index_url = self.index_url or "http://pypi.python.org/simple" self.shadow_path = self.all_site_dirs[:] for path_item in self.install_dir, normalize_path(self.script_dir): if path_item not in self.shadow_path: self.shadow_path.insert(0, path_item) if self.allow_hosts is not None: hosts = [s.strip() for s in self.allow_hosts.split(',')] else: hosts = ['*'] if self.package_index is None: self.package_index = self.create_index( self.index_url, search_path = self.shadow_path, hosts=hosts, ) self.local_index = Environment(self.shadow_path+sys.path) if self.find_links is not None: if isinstance(self.find_links, basestring): self.find_links = self.find_links.split() else: self.find_links = [] if self.local_snapshots_ok: self.package_index.scan_egg_links(self.shadow_path+sys.path) self.package_index.add_find_links(self.find_links) self.set_undefined_options('install_lib', ('optimize','optimize')) if not isinstance(self.optimize,int): try: self.optimize = int(self.optimize) if not (0 <= self.optimize <= 2): raise ValueError except ValueError: raise DistutilsOptionError("--optimize must be 0, 1, or 2") if self.delete_conflicting and self.ignore_conflicts_at_my_risk: raise DistutilsOptionError( "Can't use both --delete-conflicting and " "--ignore-conflicts-at-my-risk at the same time" ) if self.editable and not self.build_directory: raise DistutilsArgError( "Must specify a build directory (-b) when using --editable" ) if not self.args: raise DistutilsArgError( "No urls, filenames, or requirements specified (see --help)") self.outputs = [] def run(self): if self.verbose<>self.distribution.verbose: log.set_verbosity(self.verbose) try: for spec in self.args: self.easy_install(spec, not self.no_deps) if self.record: outputs = self.outputs if self.root: # strip any package prefix root_len = len(self.root) for counter in xrange(len(outputs)): outputs[counter] = outputs[counter][root_len:] from distutils import file_util self.execute( file_util.write_file, (self.record, outputs), "writing list of installed files to '%s'" % self.record ) self.warn_deprecated_options() finally: log.set_verbosity(self.distribution.verbose) def pseudo_tempname(self): """Return a pseudo-tempname base in the install directory. This code is intentionally naive; if a malicious party can write to the target directory you're already in deep doodoo. """ try: pid = os.getpid() except: pid = random.randint(0,sys.maxint) return os.path.join(self.install_dir, "test-easy-install-%s" % pid) def warn_deprecated_options(self): if self.delete_conflicting or self.ignore_conflicts_at_my_risk: log.warn( "Note: The -D, --delete-conflicting and" " --ignore-conflicts-at-my-risk no longer have any purpose" " and should not be used." ) def check_site_dir(self): """Verify that self.install_dir is .pth-capable dir, if needed""" instdir = normalize_path(self.install_dir) pth_file = os.path.join(instdir,'easy-install.pth') # Is it a configured, PYTHONPATH, implicit, or explicit site dir? is_site_dir = instdir in self.all_site_dirs if not is_site_dir: # No? Then directly test whether it does .pth file processing is_site_dir = self.check_pth_processing() else: # make sure we can write to target dir testfile = self.pseudo_tempname()+'.write-test' test_exists = os.path.exists(testfile) try: if test_exists: os.unlink(testfile) open(testfile,'w').close() os.unlink(testfile) except (OSError,IOError): self.cant_write_to_target() if not is_site_dir and not self.multi_version: # Can't install non-multi to non-site dir raise DistutilsError(self.no_default_version_msg()) if is_site_dir: if self.pth_file is None: self.pth_file = PthDistributions(pth_file) else: self.pth_file = None PYTHONPATH = os.environ.get('PYTHONPATH','').split(os.pathsep) if instdir not in map(normalize_path, filter(None,PYTHONPATH)): # only PYTHONPATH dirs need a site.py, so pretend it's there self.sitepy_installed = True elif self.multi_version and not os.path.exists(pth_file): self.sitepy_installed = True # don't need site.py in this case self.pth_file = None # and don't create a .pth file self.install_dir = instdir def cant_write_to_target(self): msg = """can't create or remove files in install directory The following error occurred while trying to add or remove files in the installation directory: %s The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: %s """ % (sys.exc_info()[1], self.install_dir,) if not os.path.exists(self.install_dir): msg += """ This directory does not currently exist. Please create it and try again, or choose a different installation directory (using the -d or --install-dir option). """ else: msg += """ Perhaps your account does not have write access to this directory? If the installation directory is a system-owned directory, you may need to sign in as the administrator or "root" account. If you do not have administrative access to this machine, you may wish to choose a different installation directory, preferably one that is listed in your PYTHONPATH environment variable. For information on other options, you may wish to consult the documentation at: http://peak.telecommunity.com/EasyInstall.html Please make the appropriate changes for your system and try again. """ raise DistutilsError(msg) def check_pth_processing(self): """Empirically verify whether .pth files are supported in inst. dir""" instdir = self.install_dir log.info("Checking .pth file support in %s", instdir) pth_file = self.pseudo_tempname()+".pth" ok_file = pth_file+'.ok' ok_exists = os.path.exists(ok_file) try: if ok_exists: os.unlink(ok_file) f = open(pth_file,'w') except (OSError,IOError): self.cant_write_to_target() else: try: f.write("import os;open(%r,'w').write('OK')\n" % (ok_file,)) f.close(); f=None executable = sys.executable if os.name=='nt': dirname,basename = os.path.split(executable) alt = os.path.join(dirname,'pythonw.exe') if basename.lower()=='python.exe' and os.path.exists(alt): # use pythonw.exe to avoid opening a console window executable = alt from distutils.spawn import spawn spawn([executable,'-E','-c','pass'],0) if os.path.exists(ok_file): log.info( "TEST PASSED: %s appears to support .pth files", instdir ) return True finally: if f: f.close() if os.path.exists(ok_file): os.unlink(ok_file) if os.path.exists(pth_file): os.unlink(pth_file) if not self.multi_version: log.warn("TEST FAILED: %s does NOT support .pth files", instdir) return False def install_egg_scripts(self, dist): """Write all the scripts for `dist`, unless scripts are excluded""" if not self.exclude_scripts and dist.metadata_isdir('scripts'): for script_name in dist.metadata_listdir('scripts'): self.install_script( dist, script_name, dist.get_metadata('scripts/'+script_name) ) self.install_wrapper_scripts(dist) def add_output(self, path): if os.path.isdir(path): for base, dirs, files in os.walk(path): for filename in files: self.outputs.append(os.path.join(base,filename)) else: self.outputs.append(path) def not_editable(self, spec): if self.editable: raise DistutilsArgError( "Invalid argument %r: you can't use filenames or URLs " "with --editable (except via the --find-links option)." % (spec,) ) def check_editable(self,spec): if not self.editable: return if os.path.exists(os.path.join(self.build_directory, spec.key)): raise DistutilsArgError( "%r already exists in %s; can't do a checkout there" % (spec.key, self.build_directory) ) def easy_install(self, spec, deps=False): tmpdir = tempfile.mkdtemp(prefix="easy_install-") download = None if not self.editable: self.install_site_py() try: if not isinstance(spec,Requirement): if URL_SCHEME(spec): # It's a url, download it to tmpdir and process self.not_editable(spec) download = self.package_index.download(spec, tmpdir) return self.install_item(None, download, tmpdir, deps, True) elif os.path.exists(spec): # Existing file or directory, just process it directly self.not_editable(spec) return self.install_item(None, spec, tmpdir, deps, True) else: spec = parse_requirement_arg(spec) self.check_editable(spec) dist = self.package_index.fetch_distribution( spec, tmpdir, self.upgrade, self.editable, not self.always_copy ) if dist is None: msg = "Could not find suitable distribution for %r" % spec if self.always_copy: msg+=" (--always-copy skips system and development eggs)" raise DistutilsError(msg) elif dist.precedence==DEVELOP_DIST: # .egg-info dists don't need installing, just process deps self.process_distribution(spec, dist, deps, "Using") return dist else: return self.install_item(spec, dist.location, tmpdir, deps) finally: if os.path.exists(tmpdir): rmtree(tmpdir) def install_item(self, spec, download, tmpdir, deps, install_needed=False): # Installation is also needed if file in tmpdir or is not an egg install_needed = install_needed or self.always_copy install_needed = install_needed or os.path.dirname(download) == tmpdir install_needed = install_needed or not download.endswith('.egg') if spec and not install_needed: # at this point, we know it's a local .egg, we just don't know if # it's already installed. for dist in self.local_index[spec.project_name]: if dist.location==download: break else: install_needed = True # it's not in the local index log.info("Processing %s", os.path.basename(download)) if install_needed: dists = self.install_eggs(spec, download, tmpdir) for dist in dists: self.process_distribution(spec, dist, deps) else: dists = [self.check_conflicts(self.egg_distribution(download))] self.process_distribution(spec, dists[0], deps, "Using") if spec is not None: for dist in dists: if dist in spec: return dist def process_distribution(self, requirement, dist, deps=True, *info): self.update_pth(dist) self.package_index.add(dist) self.local_index.add(dist) self.install_egg_scripts(dist) self.installed_projects[dist.key] = dist log.info(self.installation_report(requirement, dist, *info)) if not deps and not self.always_copy: return elif requirement is not None and dist.key != requirement.key: log.warn("Skipping dependencies for %s", dist) return # XXX this is not the distribution we were looking for elif requirement is None or dist not in requirement: # if we wound up with a different version, resolve what we've got distreq = dist.as_requirement() requirement = requirement or distreq requirement = Requirement( distreq.project_name, distreq.specs, requirement.extras ) if dist.has_metadata('dependency_links.txt'): self.package_index.add_find_links( dist.get_metadata_lines('dependency_links.txt') ) log.info("Processing dependencies for %s", requirement) try: distros = WorkingSet([]).resolve( [requirement], self.local_index, self.easy_install ) except DistributionNotFound, e: raise DistutilsError( "Could not find required distribution %s" % e.args ) except VersionConflict, e: raise DistutilsError( "Installed distribution %s conflicts with requirement %s" % e.args ) if self.always_copy: # Force all the relevant distros to be copied or activated for dist in distros: if dist.key not in self.installed_projects: self.easy_install(dist.as_requirement()) log.info("Finished processing dependencies for %s", requirement) def should_unzip(self, dist): if self.zip_ok is not None: return not self.zip_ok if dist.has_metadata('not-zip-safe'): return True if not dist.has_metadata('zip-safe'): return True return False def maybe_move(self, spec, dist_filename, setup_base): dst = os.path.join(self.build_directory, spec.key) if os.path.exists(dst): log.warn( "%r already exists in %s; build directory %s will not be kept", spec.key, self.build_directory, setup_base ) return setup_base if os.path.isdir(dist_filename): setup_base = dist_filename else: if os.path.dirname(dist_filename)==setup_base: os.unlink(dist_filename) # get it out of the tmp dir contents = os.listdir(setup_base) if len(contents)==1: dist_filename = os.path.join(setup_base,contents[0]) if os.path.isdir(dist_filename): # if the only thing there is a directory, move it instead setup_base = dist_filename ensure_directory(dst); shutil.move(setup_base, dst) return dst def install_wrapper_scripts(self, dist): if not self.exclude_scripts: for args in get_script_args(dist): self.write_script(*args) def install_script(self, dist, script_name, script_text, dev_path=None): """Generate a legacy script wrapper and install it""" spec = str(dist.as_requirement()) is_script = is_python_script(script_text, script_name) if is_script and dev_path: script_text = get_script_header(script_text) + ( "# EASY-INSTALL-DEV-SCRIPT: %(spec)r,%(script_name)r\n" "__requires__ = %(spec)r\n" "from pkg_resources import require; require(%(spec)r)\n" "del require\n" "__file__ = %(dev_path)r\n" "execfile(__file__)\n" ) % locals() elif is_script: script_text = get_script_header(script_text) + ( "# EASY-INSTALL-SCRIPT: %(spec)r,%(script_name)r\n" "__requires__ = %(spec)r\n" "import pkg_resources\n" "pkg_resources.run_script(%(spec)r, %(script_name)r)\n" ) % locals() self.write_script(script_name, script_text, 'b') def write_script(self, script_name, contents, mode="t", blockers=()): """Write an executable file to the scripts directory""" self.delete_blockers( # clean up old .py/.pyw w/o a script [os.path.join(self.script_dir,x) for x in blockers]) log.info("Installing %s script to %s", script_name, self.script_dir) target = os.path.join(self.script_dir, script_name) self.add_output(target) if not self.dry_run: ensure_directory(target) f = open(target,"w"+mode) f.write(contents) f.close() try: os.chmod(target,0755) except (AttributeError, os.error): pass def install_eggs(self, spec, dist_filename, tmpdir): # .egg dirs or files are already built, so just return them if dist_filename.lower().endswith('.egg'): return [self.install_egg(dist_filename, tmpdir)] elif dist_filename.lower().endswith('.exe'): return [self.install_exe(dist_filename, tmpdir)] # Anything else, try to extract and build setup_base = tmpdir if os.path.isfile(dist_filename) and not dist_filename.endswith('.py'): unpack_archive(dist_filename, tmpdir, self.unpack_progress) elif os.path.isdir(dist_filename): setup_base = os.path.abspath(dist_filename) if (setup_base.startswith(tmpdir) # something we downloaded and self.build_directory and spec is not None ): setup_base = self.maybe_move(spec, dist_filename, setup_base) # Find the setup.py file setup_script = os.path.join(setup_base, 'setup.py') if not os.path.exists(setup_script): setups = glob(os.path.join(setup_base, '*', 'setup.py')) if not setups: raise DistutilsError( "Couldn't find a setup script in %s" % dist_filename ) if len(setups)>1: raise DistutilsError( "Multiple setup scripts in %s" % dist_filename ) setup_script = setups[0] # Now run it, and return the result if self.editable: log.info(self.report_editable(spec, setup_script)) return [] else: return self.build_and_install(setup_script, setup_base) def egg_distribution(self, egg_path): if os.path.isdir(egg_path): metadata = PathMetadata(egg_path,os.path.join(egg_path,'EGG-INFO')) else: metadata = EggMetadata(zipimport.zipimporter(egg_path)) return Distribution.from_filename(egg_path,metadata=metadata) def install_egg(self, egg_path, tmpdir): destination = os.path.join(self.install_dir,os.path.basename(egg_path)) destination = os.path.abspath(destination) if not self.dry_run: ensure_directory(destination) dist = self.egg_distribution(egg_path) self.check_conflicts(dist) if not samefile(egg_path, destination): if os.path.isdir(destination) and not os.path.islink(destination): dir_util.remove_tree(destination, dry_run=self.dry_run) elif os.path.exists(destination): self.execute(os.unlink,(destination,),"Removing "+destination) uncache_zipdir(destination) if os.path.isdir(egg_path): if egg_path.startswith(tmpdir): f,m = shutil.move, "Moving" else: f,m = shutil.copytree, "Copying" elif self.should_unzip(dist): self.mkpath(destination) f,m = self.unpack_and_compile, "Extracting" elif egg_path.startswith(tmpdir): f,m = shutil.move, "Moving" else: f,m = shutil.copy2, "Copying" self.execute(f, (egg_path, destination), (m+" %s to %s") % (os.path.basename(egg_path),os.path.dirname(destination))) self.add_output(destination) return self.egg_distribution(destination) def install_exe(self, dist_filename, tmpdir): # See if it's valid, get data cfg = extract_wininst_cfg(dist_filename) if cfg is None: raise DistutilsError( "%s is not a valid distutils Windows .exe" % dist_filename ) # Create a dummy distribution object until we build the real distro dist = Distribution(None, project_name=cfg.get('metadata','name'), version=cfg.get('metadata','version'), platform="win32" ) # Convert the .exe to an unpacked egg egg_path = dist.location = os.path.join(tmpdir, dist.egg_name()+'.egg') egg_tmp = egg_path+'.tmp' egg_info = os.path.join(egg_tmp, 'EGG-INFO') pkg_inf = os.path.join(egg_info, 'PKG-INFO') ensure_directory(pkg_inf) # make sure EGG-INFO dir exists dist._provider = PathMetadata(egg_tmp, egg_info) # XXX self.exe_to_egg(dist_filename, egg_tmp) # Write EGG-INFO/PKG-INFO if not os.path.exists(pkg_inf): f = open(pkg_inf,'w') f.write('Metadata-Version: 1.0\n') for k,v in cfg.items('metadata'): if k<>'target_version': f.write('%s: %s\n' % (k.replace('_','-').title(), v)) f.close() script_dir = os.path.join(egg_info,'scripts') self.delete_blockers( # delete entry-point scripts to avoid duping [os.path.join(script_dir,args[0]) for args in get_script_args(dist)] ) # Build .egg file from tmpdir bdist_egg.make_zipfile( egg_path, egg_tmp, verbose=self.verbose, dry_run=self.dry_run ) # install the .egg return self.install_egg(egg_path, tmpdir) def exe_to_egg(self, dist_filename, egg_tmp): """Extract a bdist_wininst to the directories an egg would use""" # Check for .pth file and set up prefix translations prefixes = get_exe_prefixes(dist_filename) to_compile = [] native_libs = [] top_level = {} def process(src,dst): for old,new in prefixes: if src.startswith(old): src = new+src[len(old):] parts = src.split('/') dst = os.path.join(egg_tmp, *parts) dl = dst.lower() if dl.endswith('.pyd') or dl.endswith('.dll'): parts[-1] = bdist_egg.strip_module(parts[-1]) top_level[os.path.splitext(parts[0])[0]] = 1 native_libs.append(src) elif dl.endswith('.py') and old!='SCRIPTS/': top_level[os.path.splitext(parts[0])[0]] = 1 to_compile.append(dst) return dst if not src.endswith('.pth'): log.warn("WARNING: can't process %s", src) return None # extract, tracking .pyd/.dll->native_libs and .py -> to_compile unpack_archive(dist_filename, egg_tmp, process) stubs = [] for res in native_libs: if res.lower().endswith('.pyd'): # create stubs for .pyd's parts = res.split('/') resource = parts[-1] parts[-1] = bdist_egg.strip_module(parts[-1])+'.py' pyfile = os.path.join(egg_tmp, *parts) to_compile.append(pyfile); stubs.append(pyfile) bdist_egg.write_stub(resource, pyfile) self.byte_compile(to_compile) # compile .py's bdist_egg.write_safety_flag(os.path.join(egg_tmp,'EGG-INFO'), bdist_egg.analyze_egg(egg_tmp, stubs)) # write zip-safety flag for name in 'top_level','native_libs': if locals()[name]: txt = os.path.join(egg_tmp, 'EGG-INFO', name+'.txt') if not os.path.exists(txt): open(txt,'w').write('\n'.join(locals()[name])+'\n') def check_conflicts(self, dist): """Verify that there are no conflicting "old-style" packages""" return dist # XXX temporarily disable until new strategy is stable from imp import find_module, get_suffixes from glob import glob blockers = [] names = dict.fromkeys(dist._get_metadata('top_level.txt')) # XXX private attr exts = {'.pyc':1, '.pyo':1} # get_suffixes() might leave one out for ext,mode,typ in get_suffixes(): exts[ext] = 1 for path,files in expand_paths([self.install_dir]+self.all_site_dirs): for filename in files: base,ext = os.path.splitext(filename) if base in names: if not ext: # no extension, check for package try: f, filename, descr = find_module(base, [path]) except ImportError: continue else: if f: f.close() if filename not in blockers: blockers.append(filename) elif ext in exts and base!='site': # XXX ugh blockers.append(os.path.join(path,filename)) if blockers: self.found_conflicts(dist, blockers) return dist def found_conflicts(self, dist, blockers): if self.delete_conflicting: log.warn("Attempting to delete conflicting packages:") return self.delete_blockers(blockers) msg = """\ ------------------------------------------------------------------------- CONFLICT WARNING: The following modules or packages have the same names as modules or packages being installed, and will be *before* the installed packages in Python's search path. You MUST remove all of the relevant files and directories before you will be able to use the package(s) you are installing: %s """ % '\n '.join(blockers) if self.ignore_conflicts_at_my_risk: msg += """\ (Note: you can run EasyInstall on '%s' with the --delete-conflicting option to attempt deletion of the above files and/or directories.) """ % dist.project_name else: msg += """\ Note: you can attempt this installation again with EasyInstall, and use either the --delete-conflicting (-D) option or the --ignore-conflicts-at-my-risk option, to either delete the above files and directories, or to ignore the conflicts, respectively. Note that if you ignore the conflicts, the installed package(s) may not work. """ msg += """\ ------------------------------------------------------------------------- """ sys.stderr.write(msg) sys.stderr.flush() if not self.ignore_conflicts_at_my_risk: raise DistutilsError("Installation aborted due to conflicts") def installation_report(self, req, dist, what="Installed"): """Helpful installation message for display to package users""" msg = "\n%(what)s %(eggloc)s%(extras)s" if self.multi_version and not self.no_report: msg += """ Because this distribution was installed --multi-version, before you can import modules from this package in an application, you will need to 'import pkg_resources' and then use a 'require()' call similar to one of these examples, in order to select the desired version: pkg_resources.require("%(name)s") # latest installed version pkg_resources.require("%(name)s==%(version)s") # this exact version pkg_resources.require("%(name)s>=%(version)s") # this version or higher """ if self.install_dir not in map(normalize_path,sys.path): msg += """ Note also that the installation directory must be on sys.path at runtime for this to work. (e.g. by being the application's script directory, by being on PYTHONPATH, or by being added to sys.path by your code.) """ eggloc = dist.location name = dist.project_name version = dist.version extras = '' # TODO: self.report_extras(req, dist) return msg % locals() def report_editable(self, spec, setup_script): dirname = os.path.dirname(setup_script) python = sys.executable return """\nExtracted editable version of %(spec)s to %(dirname)s If it uses setuptools in its setup script, you can activate it in "development" mode by going to that directory and running:: %(python)s setup.py develop See the setuptools documentation for the "develop" command for more info. """ % locals() def run_setup(self, setup_script, setup_base, args): sys.modules.setdefault('distutils.command.bdist_egg', bdist_egg) sys.modules.setdefault('distutils.command.egg_info', egg_info) args = list(args) if self.verbose>2: v = 'v' * (self.verbose - 1) args.insert(0,'-'+v) elif self.verbose<2: args.insert(0,'-q') if self.dry_run: args.insert(0,'-n') log.info( "Running %s %s", setup_script[len(setup_base)+1:], ' '.join(args) ) try: run_setup(setup_script, args) except SystemExit, v: raise DistutilsError("Setup script exited with %s" % (v.args[0],)) def build_and_install(self, setup_script, setup_base): args = ['bdist_egg', '--dist-dir'] dist_dir = tempfile.mkdtemp( prefix='egg-dist-tmp-', dir=os.path.dirname(setup_script) ) try: args.append(dist_dir) self.run_setup(setup_script, setup_base, args) all_eggs = Environment([dist_dir]) eggs = [] for key in all_eggs: for dist in all_eggs[key]: eggs.append(self.install_egg(dist.location, setup_base)) if not eggs and not self.dry_run: log.warn("No eggs found in %s (setup script problem?)", dist_dir) return eggs finally: rmtree(dist_dir) log.set_verbosity(self.verbose) # restore our log verbosity def update_pth(self,dist): if self.pth_file is None: return for d in self.pth_file[dist.key]: # drop old entries if self.multi_version or d.location != dist.location: log.info("Removing %s from easy-install.pth file", d) self.pth_file.remove(d) if d.location in self.shadow_path: self.shadow_path.remove(d.location) if not self.multi_version: if dist.location in self.pth_file.paths: log.info( "%s is already the active version in easy-install.pth", dist ) else: log.info("Adding %s to easy-install.pth file", dist) self.pth_file.add(dist) # add new entry if dist.location not in self.shadow_path: self.shadow_path.append(dist.location) if not self.dry_run: self.pth_file.save() if dist.key=='setuptools': # Ensure that setuptools itself never becomes unavailable! # XXX should this check for latest version? filename = os.path.join(self.install_dir,'setuptools.pth') if os.path.islink(filename): os.unlink(filename) f = open(filename, 'wt') f.write(self.pth_file.make_relative(dist.location)+'\n') f.close() def unpack_progress(self, src, dst): # Progress filter for unpacking log.debug("Unpacking %s to %s", src, dst) return dst # only unpack-and-compile skips files for dry run def unpack_and_compile(self, egg_path, destination): to_compile = []; to_chmod = [] def pf(src,dst): if dst.endswith('.py') and not src.startswith('EGG-INFO/'): to_compile.append(dst) self.unpack_progress(src,dst); to_chmod.append(dst) return not self.dry_run and dst or None unpack_archive(egg_path, destination, pf) self.byte_compile(to_compile) if not self.dry_run: flags = stat.S_IXGRP|stat.S_IXGRP for f in to_chmod: mode = ((os.stat(f)[stat.ST_MODE]) | 0555) & 07777 log.debug("changing mode of %s to %o", f, mode) os.chmod(f, mode) def byte_compile(self, to_compile): from distutils.util import byte_compile try: # try to make the byte compile messages quieter log.set_verbosity(self.verbose - 1) byte_compile(to_compile, optimize=0, force=1, dry_run=self.dry_run) if self.optimize: byte_compile( to_compile, optimize=self.optimize, force=1, dry_run=self.dry_run ) finally: log.set_verbosity(self.verbose) # restore original verbosity def no_default_version_msg(self): return """bad install directory or PYTHONPATH You are attempting to install a package to a directory that is not on PYTHONPATH and which Python does not read ".pth" files from. The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: %s and your PYTHONPATH environment variable currently contains: %r Here are some of your options for correcting the problem: * You can choose a different installation directory, i.e., one that is on PYTHONPATH or supports .pth files * You can add the installation directory to the PYTHONPATH environment variable. (It must then also be on PYTHONPATH whenever you run Python and want to use the package(s) you are installing.) * You can set up the installation directory to support ".pth" files by using one of the approaches described here: http://peak.telecommunity.com/EasyInstall.html#custom-installation-locations Please make the appropriate changes for your system and try again.""" % ( self.install_dir, os.environ.get('PYTHONPATH','') ) def install_site_py(self): """Make sure there's a site.py in the target dir, if needed""" if self.sitepy_installed: return # already did it, or don't need to sitepy = os.path.join(self.install_dir, "site.py") source = resource_string(Requirement.parse("setuptools"), "site.py") current = "" if os.path.exists(sitepy): log.debug("Checking existing site.py in %s", self.install_dir) current = open(sitepy,'rb').read() if not current.startswith('def __boot():'): raise DistutilsError( "%s is not a setuptools-generated site.py; please" " remove it." % sitepy ) if current != source: log.info("Creating %s", sitepy) if not self.dry_run: ensure_directory(sitepy) f = open(sitepy,'wb') f.write(source) f.close() self.byte_compile([sitepy]) self.sitepy_installed = True INSTALL_SCHEMES = dict( posix = dict( install_dir = '$base/lib/python$py_version_short/site-packages', script_dir = '$base/bin', ), ) DEFAULT_SCHEME = dict( install_dir = '$base/Lib/site-packages', script_dir = '$base/Scripts', ) def _expand(self, *attrs): config_vars = self.get_finalized_command('install').config_vars if self.prefix: # Set default install_dir/scripts from --prefix config_vars = config_vars.copy() config_vars['base'] = self.prefix scheme = self.INSTALL_SCHEMES.get(os.name,self.DEFAULT_SCHEME) for attr,val in scheme.items(): if getattr(self,attr,None) is None: setattr(self,attr,val) from distutils.util import subst_vars for attr in attrs: val = getattr(self, attr) if val is not None: val = subst_vars(val, config_vars) if os.name == 'posix': val = os.path.expanduser(val) setattr(self, attr, val) def get_site_dirs(): # return a list of 'site' dirs sitedirs = filter(None,os.environ.get('PYTHONPATH','').split(os.pathsep)) prefixes = [sys.prefix] if sys.exec_prefix != sys.prefix: prefixes.append(sys.exec_prefix) for prefix in prefixes: if prefix: if sys.platform in ('os2emx', 'riscos'): sitedirs.append(os.path.join(prefix, "Lib", "site-packages")) elif os.sep == '/': sitedirs.extend([os.path.join(prefix, "lib", "python" + sys.version[:3], "site-packages"), os.path.join(prefix, "lib", "site-python")]) else: sitedirs.extend( [prefix, os.path.join(prefix, "lib", "site-packages")] ) if sys.platform == 'darwin': # for framework builds *only* we add the standard Apple # locations. Currently only per-user, but /Library and # /Network/Library could be added too if 'Python.framework' in prefix: home = os.environ.get('HOME') if home: sitedirs.append( os.path.join(home, 'Library', 'Python', sys.version[:3], 'site-packages')) for plat_specific in (0,1): site_lib = get_python_lib(plat_specific) if site_lib not in sitedirs: sitedirs.append(site_lib) sitedirs = map(normalize_path, sitedirs) return sitedirs def expand_paths(inputs): """Yield sys.path directories that might contain "old-style" packages""" seen = {} for dirname in inputs: dirname = normalize_path(dirname) if dirname in seen: continue seen[dirname] = 1 if not os.path.isdir(dirname): continue files = os.listdir(dirname) yield dirname, files for name in files: if not name.endswith('.pth'): # We only care about the .pth files continue if name in ('easy-install.pth','setuptools.pth'): # Ignore .pth files that we control continue # Read the .pth file f = open(os.path.join(dirname,name)) lines = list(yield_lines(f)) f.close() # Yield existing non-dupe, non-import directory lines from it for line in lines: if not line.startswith("import"): line = normalize_path(line.rstrip()) if line not in seen: seen[line] = 1 if not os.path.isdir(line): continue yield line, os.listdir(line) def extract_wininst_cfg(dist_filename): """Extract configuration data from a bdist_wininst .exe Returns a ConfigParser.RawConfigParser, or None """ f = open(dist_filename,'rb') try: endrec = zipfile._EndRecData(f) if endrec is None: return None prepended = (endrec[9] - endrec[5]) - endrec[6] if prepended < 12: # no wininst data here return None f.seek(prepended-12) import struct, StringIO, ConfigParser tag, cfglen, bmlen = struct.unpack("egg path translations for a given .exe file""" prefixes = [ ('PURELIB/', ''), ('PLATLIB/', ''), ('SCRIPTS/', 'EGG-INFO/scripts/') ] z = zipfile.ZipFile(exe_filename) try: for info in z.infolist(): name = info.filename parts = name.split('/') if len(parts)==3 and parts[2]=='PKG-INFO': if parts[1].endswith('.egg-info'): prefixes.insert(0,('/'.join(parts[:2]), 'EGG-INFO/')) break if len(parts)<>2 or not name.endswith('.pth'): continue if name.endswith('-nspkg.pth'): continue if parts[0] in ('PURELIB','PLATLIB'): for pth in yield_lines(z.read(name)): pth = pth.strip().replace('\\','/') if not pth.startswith('import'): prefixes.append((('%s/%s/' % (parts[0],pth)), '')) finally: z.close() prefixes.sort(); prefixes.reverse() return prefixes def parse_requirement_arg(spec): try: return Requirement.parse(spec) except ValueError: raise DistutilsError( "Not a URL, existing file, or requirement spec: %r" % (spec,) ) class PthDistributions(Environment): """A .pth file with Distribution paths in it""" dirty = False def __init__(self, filename): self.filename = filename self.basedir = normalize_path(os.path.dirname(self.filename)) self._load(); Environment.__init__(self, [], None, None) for path in yield_lines(self.paths): map(self.add, find_distributions(path, True)) def _load(self): self.paths = [] saw_import = False seen = {} if os.path.isfile(self.filename): for line in open(self.filename,'rt'): if line.startswith('import'): saw_import = True continue path = line.rstrip() self.paths.append(path) if not path.strip() or path.strip().startswith('#'): continue # skip non-existent paths, in case somebody deleted a package # manually, and duplicate paths as well path = self.paths[-1] = normalize_path( os.path.join(self.basedir,path) ) if not os.path.exists(path) or path in seen: self.paths.pop() # skip it self.dirty = True # we cleaned up, so we're dirty now :) continue seen[path] = 1 if self.paths and not saw_import: self.dirty = True # ensure anything we touch has import wrappers while self.paths and not self.paths[-1].strip(): self.paths.pop() def save(self): """Write changed .pth file back to disk""" if not self.dirty: return data = '\n'.join(map(self.make_relative,self.paths)) if data: log.debug("Saving %s", self.filename) data = ( "import sys; sys.__plen = len(sys.path)\n" "%s\n" "import sys; new=sys.path[sys.__plen:];" " del sys.path[sys.__plen:];" " p=getattr(sys,'__egginsert',0); sys.path[p:p]=new;" " sys.__egginsert = p+len(new)\n" ) % data if os.path.islink(self.filename): os.unlink(self.filename) f = open(self.filename,'wb') f.write(data); f.close() elif os.path.exists(self.filename): log.debug("Deleting empty %s", self.filename) os.unlink(self.filename) self.dirty = False def add(self,dist): """Add `dist` to the distribution map""" if dist.location not in self.paths: self.paths.append(dist.location); self.dirty = True Environment.add(self,dist) def remove(self,dist): """Remove `dist` from the distribution map""" while dist.location in self.paths: self.paths.remove(dist.location); self.dirty = True Environment.remove(self,dist) def make_relative(self,path): npath, last = os.path.split(normalize_path(path)) baselen = len(self.basedir) parts = [last] sep = os.altsep=='/' and '/' or os.sep while len(npath)>=baselen: if npath==self.basedir: parts.append(os.curdir) parts.reverse() return sep.join(parts) npath, last = os.path.split(npath) parts.append(last) else: return path def get_script_header(script_text, executable=sys_executable, wininst=False): """Create a #! line, getting options (if any) from script_text""" from distutils.command.build_scripts import first_line_re first = (script_text+'\n').splitlines()[0] match = first_line_re.match(first) options = '' if match: options = match.group(1) or '' if options: options = ' '+options if wininst: executable = "python.exe" else: executable = nt_quote_arg(executable) hdr = "#!%(executable)s%(options)s\n" % locals() if unicode(hdr,'ascii','ignore').encode('ascii') != hdr: # Non-ascii path to sys.executable, use -x to prevent warnings if options: if options.strip().startswith('-'): options = ' -x'+options.strip()[1:] # else: punt, we can't do it, let the warning happen anyway else: options = ' -x' hdr = "#!%(executable)s%(options)s\n" % locals() return hdr def auto_chmod(func, arg, exc): if func is os.remove and os.name=='nt': os.chmod(arg, stat.S_IWRITE) return func(arg) exc = sys.exc_info() raise exc[0], (exc[1][0], exc[1][1] + (" %s %s" % (func,arg))) def uncache_zipdir(path): """Ensure that the importer caches dont have stale info for `path`""" from zipimport import _zip_directory_cache as zdc _uncache(path, zdc) _uncache(path, sys.path_importer_cache) def _uncache(path, cache): if path in cache: del cache[path] else: path = normalize_path(path) for p in cache: if normalize_path(p)==path: del cache[p] return def is_python(text, filename=''): "Is this string a valid Python script?" try: compile(text, filename, 'exec') except (SyntaxError, TypeError): return False else: return True def nt_quote_arg(arg): """Quote a command line argument according to Windows parsing rules""" result = [] needquote = False nb = 0 needquote = (" " in arg) or ("\t" in arg) if needquote: result.append('"') for c in arg: if c == '\\': nb += 1 elif c == '"': # double preceding backslashes, then add a \" result.append('\\' * (nb*2) + '\\"') nb = 0 else: if nb: result.append('\\' * nb) nb = 0 result.append(c) if nb: result.append('\\' * nb) if needquote: result.append('\\' * nb) # double the trailing backslashes result.append('"') return ''.join(result) def is_python_script(script_text, filename): """Is this text, as a whole, a Python script? (as opposed to shell/bat/etc. """ if filename.endswith('.py') or filename.endswith('.pyw'): return True # extension says it's Python if is_python(script_text, filename): return True # it's syntactically valid Python if script_text.startswith('#!'): # It begins with a '#!' line, so check if 'python' is in it somewhere return 'python' in script_text.splitlines()[0].lower() return False # Not any Python I can recognize def get_script_args(dist, executable=sys_executable, wininst=False): """Yield write_script() argument tuples for a distribution's entrypoints""" spec = str(dist.as_requirement()) header = get_script_header("", executable, wininst) for group in 'console_scripts', 'gui_scripts': for name,ep in dist.get_entry_map(group).items(): script_text = ( "# EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r\n" "__requires__ = %(spec)r\n" "import sys\n" "from pkg_resources import load_entry_point\n" "\n" "sys.exit(\n" " load_entry_point(%(spec)r, %(group)r, %(name)r)()\n" ")\n" ) % locals() if sys.platform=='win32' or wininst: # On Windows/wininst, add a .py extension and an .exe launcher if group=='gui_scripts': ext, launcher = '-script.pyw', 'gui.exe' old = ['.pyw'] new_header = re.sub('(?i)python.exe','pythonw.exe',header) else: ext, launcher = '-script.py', 'cli.exe' old = ['.py','.pyc','.pyo'] new_header = re.sub('(?i)pythonw.exe','python.exe',header) if os.path.exists(new_header[2:-1]) or sys.platform!='win32': hdr = new_header else: hdr = header yield (name+ext, hdr+script_text, 't', [name+x for x in old]) yield ( name+'.exe', resource_string('setuptools', launcher), 'b' # write in binary mode ) else: # On other platforms, we assume the right thing to do is to # just write the stub with no extension. yield (name, header+script_text) def rmtree(path, ignore_errors=False, onerror=auto_chmod): """Recursively delete a directory tree. This code is taken from the Python 2.4 version of 'shutil', because the 2.3 version doesn't really work right. """ if ignore_errors: def onerror(*args): pass elif onerror is None: def onerror(*args): raise names = [] try: names = os.listdir(path) except os.error, err: onerror(os.listdir, path, sys.exc_info()) for name in names: fullname = os.path.join(path, name) try: mode = os.lstat(fullname).st_mode except os.error: mode = 0 if stat.S_ISDIR(mode): rmtree(fullname, ignore_errors, onerror) else: try: os.remove(fullname) except os.error, err: onerror(os.remove, fullname, sys.exc_info()) try: os.rmdir(path) except os.error: onerror(os.rmdir, path, sys.exc_info()) def bootstrap(): # This function is called when setuptools*.egg is run using /bin/sh import setuptools; argv0 = os.path.dirname(setuptools.__path__[0]) sys.argv[0] = argv0; sys.argv.append(argv0); main() def main(argv=None, **kw): from setuptools import setup from setuptools.dist import Distribution import distutils.core USAGE = """\ usage: %(script)s [options] requirement_or_url ... or: %(script)s --help """ def gen_usage (script_name): script = os.path.basename(script_name) return USAGE % vars() def with_ei_usage(f): old_gen_usage = distutils.core.gen_usage try: distutils.core.gen_usage = gen_usage return f() finally: distutils.core.gen_usage = old_gen_usage class DistributionWithoutHelpCommands(Distribution): def _show_help(self,*args,**kw): with_ei_usage(lambda: Distribution._show_help(self,*args,**kw)) if argv is None: argv = sys.argv[1:] with_ei_usage(lambda: setup( script_args = ['-q','easy_install', '-v']+argv, script_name = sys.argv[0] or 'easy_install', distclass=DistributionWithoutHelpCommands, **kw ) ) PKC8xi))setuptools/command/develop.pyc; _Fc@s|dklZdklZdklZlZlZdkl Z dk Tdk Z dk Z dk Z defdYZdS((s easy_install(s convert_path(s Distributions PathMetadatasnormalize_path(slog(s*NsdevelopcBstZdZdZeidddfdedfgZeidgZeZ dZ dZ d Z d Z d Zd ZRS( sSet up package for developments%install package in 'development mode's uninstallsusUninstall this source packages egg-path=s-Set the path to be used in the .egg-link filecCs9|iot|_|in |i|idS(N(sselfs uninstallsTrues multi_versionsuninstall_linksinstall_for_developmentswarn_deprecated_options(sself((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/develop.pysruns    cCs,t|_t|_ti|t|_dS(N(sNonesselfs uninstallsegg_paths easy_installsinitialize_optionss setup_path(sself((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/develop.pysinitialize_optionss   cCs|id}|io td|i|ifn|ig|_ti |t i i |i |id|_|i|_|itjot i i|i|_nt|i}tt i i |i |i|jotd|nt|t|t i i|id|i|_|iit id}|t ijod|idd}n||_tt i i |i |i|}|tt ijotd |tt indS( Nsegg_infos-Please rename %r to %r before using 'develop's .egg-linksA--egg-path must be a relative path from the install directory to s project_names/s../isGCan't get a consistent path to setup script from installation directory(sselfsget_finalized_commandseisbroken_egg_infosDistutilsErrorsegg_infosegg_namesargss easy_installsfinalize_optionssosspathsjoins install_dirsegg_linksegg_basesegg_pathsNonesabspathsnormalize_pathstargetsDistutilsOptionErrors Distributions PathMetadatasdistsreplacessepspscurdirscounts setup_path(sselfseistargetsp((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/develop.pysfinalize_options*s.   " ( $cCs|id|iddd|id|itio|ititt_nti d|i |i |i o;t |i d}|i|id|i|in|it|i|i dS(Nsegg_infos build_extsinplaceisCreating %s (link to %s)sws (sselfs run_commandsreinitialize_commandsinstall_site_pys setuptoolssbootstrap_install_froms easy_installsNoneslogsinfosegg_linksegg_basesdry_runsopensfswritesegg_paths setup_pathsclosesprocess_distributionsdistsno_deps(sselfsf((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/develop.pysinstall_for_developmentSs      cCstii|iotid|i|igi}t |iD]}||i qF~}||ig|i|igfjotid|dSn|i oti|iqn|i o|i|in|iiotidndS(NsRemoving %s (link to %s)s$Link points to %s: uninstall aborteds5Note: you must uninstall or replace scripts manually!(sosspathsexistssselfsegg_linkslogsinfosegg_basesappends_[1]sfileslinesrstripscontentssegg_paths setup_pathswarnsdry_runsunlinks update_pthsdists distributionsscripts(sselfs_[1]slinescontents((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/develop.pysuninstall_linkis6%   cCs||ij oti||Sn|i|x|iipgD]k}ti i t |}ti i |}t|d}|i}|i|i||||qEWdS(NsrU(sdistsselfs easy_installsinstall_egg_scriptssinstall_wrapper_scriptss distributionsscriptss script_namesosspathsabspaths convert_paths script_pathsbasenamesopensfsreads script_textsclosesinstall_script(sselfsdistsfs script_names script_paths script_text((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/develop.pysinstall_egg_scripts|s   (s__name__s __module__s__doc__s descriptions easy_installs user_optionssNonesboolean_optionssFalsescommand_consumes_argumentssrunsinitialize_optionssfinalize_optionssinstall_for_developmentsuninstall_linksinstall_egg_scripts(((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/develop.pysdevelops %  )  (ssetuptools.command.easy_installs easy_installsdistutils.utils convert_paths pkg_resourcess Distributions PathMetadatasnormalize_paths distutilsslogsdistutils.errorsssyssoss setuptoolssdevelop( s convert_paths PathMetadatasdevelopslogsnormalize_pathssyss easy_installs setuptoolss Distributionsos((s>build/bdist.darwin-8.0.1-x86/egg/setuptools/command/develop.pys?s   PKd5C%setuptools/command/install_scripts.pyfrom distutils.command.install_scripts import install_scripts \ as _install_scripts from easy_install import get_script_args, sys_executable from pkg_resources import Distribution, PathMetadata, ensure_directory import os from distutils import log class install_scripts(_install_scripts): """Do normal script install, plus any egg_info wrapper scripts""" def initialize_options(self): _install_scripts.initialize_options(self) self.no_ep = False def run(self): self.run_command("egg_info") if self.distribution.scripts: _install_scripts.run(self) # run first to set up self.outfiles else: self.outfiles = [] if self.no_ep: # don't install entry point scripts into .egg file! return ei_cmd = self.get_finalized_command("egg_info") dist = Distribution( ei_cmd.egg_base, PathMetadata(ei_cmd.egg_base, ei_cmd.egg_info), ei_cmd.egg_name, ei_cmd.egg_version, ) bs_cmd = self.get_finalized_command('build_scripts') executable = getattr(bs_cmd,'executable',sys_executable) is_wininst = getattr( self.get_finalized_command("bdist_wininst"), '_is_running', False ) for args in get_script_args(dist, executable, is_wininst): self.write_script(*args) def write_script(self, script_name, contents, mode="t", *ignored): """Write an executable file to the scripts directory""" log.info("Installing %s script to %s", script_name, self.install_dir) target = os.path.join(self.install_dir, script_name) self.outfiles.append(target) if not self.dry_run: ensure_directory(target) f = open(target,"w"+mode) f.write(contents) f.close() try: os.chmod(target,0755) except (AttributeError, os.error): pass PKC8 C setuptools/command/bdist_rpm.pyc; fSFc@s9dklZdkZdkZdefdYZdS((s bdist_rpmNs bdist_rpmcBsCtZdZeidjoddZndZdZRS(NcCsti|t|_dS(N(s _bdist_rpmsinitialize_optionssselfsNonesno_egg(sself((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_rpm.pysinitialize_options s s2.5icCsti||||||ijo |idobt|i dgi d|idodp t i d t ii|t ii|fndS(Ns.rpms dist_filess bdist_rpms.src.rpmsanyi(s _bdist_rpms move_filesselfssrcsdstslevelsdist_dirsendswithsgetattrs distributionsappendssyssversionsosspathsjoinsbasename(sselfssrcsdstslevel((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_rpm.pys move_files cCs|idti|dS(Nsegg_info(sselfs run_commands _bdist_rpmsrun(sself((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_rpm.pysruns cCs|ii}|idd}ti|}d|}d|}gi }|D]@}||iddiddidd i||qR~}|i|i|d d ||SdS( Ns-s_s%define version sSource0: %{name}-%{version}.tars)Source0: %{name}-%{unmangled_version}.tarssetup.py install s5setup.py install --single-version-externally-managed s%setups&%setup -n %{name}-%{unmangled_version}is%define unmangled_version (sselfs distributions get_versionsversionsreplaces rpmversions _bdist_rpms_make_spec_filesspecsline23sline24sappends_[1]slinesinsertsindex(sselfsline24sline23s rpmversions_[1]sversionslinesspec((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_rpm.pys_make_spec_file*s     !(s__name__s __module__sinitialize_optionsssyssversions move_filesruns_make_spec_file(((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_rpm.pys bdist_rpm s   (sdistutils.command.bdist_rpms bdist_rpms _bdist_rpmssyssos(ssyss bdist_rpmsoss _bdist_rpm((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_rpm.pys?s PKC8'a:L:Lsetuptools/command/egg_info.pyc; Fc@sBdZdkZdkZdklZdkTdklZdkl Z dkl Z dk l Z dk lZd klZlZlZlZlZlZlZlZd k lZd efd YZd efdYZde fdYZdZdZdZdZdZe dZ!dZ"dZ#dS(sUsetuptools.command.egg_info Create a distribution's .egg-info directory and contentsN(sCommand(s*(slog(ssdist(s file_util(s convert_path(sFileList(sparse_requirementss safe_names parse_versions safe_versions yield_liness EntryPointsiter_entry_pointss to_filename(s walk_revctrlsegg_infocBstZdZdddfdddfdd d fd d d fdddfdddfgZddgZhdd<dd"), (""", '"'), ("'", "'"), ("&", "&") ] def unescape(data): for old,new in entities: data = data.replace(old,new) return data def re_finder(pattern, postproc=None): def find(dirname, filename): f = open(filename,'rU') data = f.read() f.close() for match in pattern.finditer(data): path = match.group(1) if postproc: path = postproc(path) yield joinpath(dirname,path) return find def joinpath(prefix,suffix): if not prefix: return suffix return os.path.join(prefix,suffix) def walk_revctrl(dirname=''): """Find all files under revision control""" for ep in pkg_resources.iter_entry_points('setuptools.file_finders'): for item in ep.load()(dirname): yield item def _default_revctrl(dirname=''): for path, finder in finders: path = joinpath(dirname,path) if os.path.isfile(path): for path in finder(dirname,path): if os.path.isfile(path): yield path elif os.path.isdir(path): for item in _default_revctrl(path): yield item def externals_finder(dirname, filename): """Find any 'svn:externals' directories""" found = False f = open(filename,'rb') for line in iter(f.readline, ''): # can't use direct iter! parts = line.split() if len(parts)==2: kind,length = parts data = f.read(int(length)) if kind=='K' and data=='svn:externals': found = True elif kind=='V' and found: f.close() break else: f.close() return for line in data.splitlines(): parts = line.split() if parts: yield joinpath(dirname, parts[0]) entries_pattern = re.compile(r'name="([^"]+)"(?![^>]+deleted="true")', re.I) def entries_finder(dirname, filename): f = open(filename,'rU') data = f.read() f.close() if data.startswith('8'): # subversion 1.4 for record in map(str.splitlines, data.split('\n\x0c\n')[1:]): if not record or len(record)>=6 and record[5]=="delete": continue # skip deleted yield joinpath(dirname, record[0]) elif data.startswith('s"s"s's's&s&cCs1x&tD]\}}|i||}qW|SdS(N(sentitiessoldsnewsdatasreplace(sdatasoldsnew((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/sdist.pysunescape s csd}|SdS(Nc#svt|d}|i}|ixJi|D]9}|i d}o|}nt ||Vq5WdS(NsrUi(sopensfilenamesfsreadsdatasclosespatternsfinditersmatchsgroupspathspostprocsjoinpathsdirname(sdirnamesfilenamesfspathsdatasmatch(spostprocspattern(s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/sdist.pysfinds  (sfind(spatternspostprocsfind((spatternspostprocs<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/sdist.pys re_finders cCs'| o|Sntii||SdS(N(sprefixssuffixsosspathsjoin(sprefixssuffix((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/sdist.pysjoinpathssccs?x8tidD]'}x|i|D] }|Vq)WqWdS(s%Find all files under revision controlssetuptools.file_findersN(s pkg_resourcessiter_entry_pointssepsloadsdirnamesitem(sdirnamesitemsep((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/sdist.pys walk_revctrl*s ccsxtD]\}}t||}tii|okxh|||D]S}tii|o|VqEtii|oxt|D] }|VqWqEqEWqqWdS(N( sfindersspathsfindersjoinpathsdirnamesossisfilesisdirs_default_revctrlsitem(sdirnamesitemspathsfinder((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/sdist.pys_default_revctrl0s  c cst}t|d}xt|idD]}|i}t |djol|\}}|i t|}|djo |djo t}q|djo|o|iPqq(q(W|idSx<|iD].}|i}|ot||dVqqWdS( s$Find any 'svn:externals' directoriessrbsisKs svn:externalssVNi(sFalsesfoundsopensfilenamesfsitersreadlineslinessplitspartsslenskindslengthsreadsintsdatasTruescloses splitlinessjoinpathsdirname( sdirnamesfilenameskindsfsdataslengthspartssfoundsline((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/sdist.pysexternals_finder;s*        s%name="([^"]+)"(?![^>]+deleted="true")ccst|d}|i}|i|idorxtti |i ddD]J}| p!t |djo|ddjoqUnt ||dVqUWn[|id o:xGti|D]"}t |t|idVqWntid |dS( NsrUs8s iiisdeleteis|iD]3}dd|f}||jo|i|qqWdS(Nsegg_infos SOURCES.txts dist_filesssdists(sselfs run_commandsget_finalized_commandsei_cmdsfilelistsappendsosspathsjoinsegg_infos check_readmescheck_metadatasmake_distributionsgetattrs distributions dist_filess archive_filessfilesdata(sselfsei_cmds dist_filessdatasfile((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/sdist.pysruns  "     cCsCyti|Wn+tidiiidinXdS(Nistemplate( s_sdists read_templatesselfssyssexc_infostb_nextstb_framesf_localssclose(sself((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/sdist.pys read_templates !cCsVddf}xC|D]!}tii|odSqqW|iddi|dS(NsREADMEs README.txts,standard file not found: should have one of s, (saltssfsosspathsexistssselfswarnsjoin(sselfsaltssf((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/sdist.pys check_readmes   cCsti|||tii|d}t tdotii |o!ti ||i d|n|i di|dS(Ns setup.cfgslinksegg_info(s_sdistsmake_release_treesselfsbase_dirsfilessosspathsjoinsdestshasattrsexistssunlinks copy_filesget_finalized_commandssave_version_info(sselfsbase_dirsfilessdest((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/sdist.pysmake_release_trees # ( s__name__s __module__s__doc__sNones user_optionss negative_optsruns read_templates check_readmesmake_release_tree(((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/sdist.pyssdist|s .   (sdistutils.command.sdistssdists_sdistsdistutils.utils convert_pathsossressyss pkg_resourcessentitiessunescapesNones re_findersjoinpaths walk_revctrls_default_revctrlsexternals_finderscompilesIsentries_patternsentries_findersMsfinders(s convert_pathsexternals_findersunescapesentitiessoss walk_revctrls pkg_resourcess_default_revctrlssyssresentries_patternsjoinpathsentries_finders re_finders_sdistsfindersssdist((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/sdist.pys?s  $3     WPKC8O*setuptools/command/saveopts.pyc; Ec@sLdkZdkZdklZdklZlZdefdYZdS(N(sCommand(s edit_configs option_basessaveoptscBstZdZdZdZRS(s#Save command-line options to a files7save supplied options to setup.cfg or other config filecCs|i}|ii}h}xu|D]m}|djoq%nxP|i|i D]9\}\}}|djo||i |h|flag: os.unlink(fn) elif safe is not None and bool(safe)==flag: f=open(fn,'wb'); f.write('\n'); f.close() safety_flags = { True: 'zip-safe', False: 'not-zip-safe', } def scan_module(egg_dir, base, name, stubs): """Check whether module possibly uses unsafe-for-zipfile stuff""" filename = os.path.join(base,name) if filename[:-1] in stubs: return True # Extension module pkg = base[len(egg_dir)+1:].replace(os.sep,'.') module = pkg+(pkg and '.' or '')+os.path.splitext(name)[0] f = open(filename,'rb'); f.read(8) # skip magic & date code = marshal.load(f); f.close() safe = True symbols = dict.fromkeys(iter_symbols(code)) for bad in ['__file__', '__path__']: if bad in symbols: log.warn("%s: module references %s", module, bad) safe = False if 'inspect' in symbols: for bad in [ 'getsource', 'getabsfile', 'getsourcefile', 'getfile' 'getsourcelines', 'findsource', 'getcomments', 'getframeinfo', 'getinnerframes', 'getouterframes', 'stack', 'trace' ]: if bad in symbols: log.warn("%s: module MAY be using inspect.%s", module, bad) safe = False if '__name__' in symbols and '__main__' in symbols and '.' not in module: if sys.version[:3]=="2.4": # -m works w/zipfiles in 2.5 log.warn("%s: top-level module may be 'python -m' script", module) safe = False return safe def iter_symbols(code): """Yield names and strings used by `code` and its nested code objects""" for name in code.co_names: yield name for const in code.co_consts: if isinstance(const,basestring): yield const elif isinstance(const,CodeType): for name in iter_symbols(const): yield name # Attribute names of options for commands that might need to be convinced to # install to the egg build directory INSTALL_DIRECTORY_ATTRS = [ 'install_lib', 'install_dir', 'install_data', 'install_base' ] def make_zipfile(zip_filename, base_dir, verbose=0, dry_run=0, compress=None, mode='w' ): """Create a zip file from all the files under 'base_dir'. The output zip file will be named 'base_dir' + ".zip". Uses either the "zipfile" Python module (if available) or the InfoZIP "zip" utility (if installed and found on the default search path). If neither tool is available, raises DistutilsExecError. Returns the name of the output zip file. """ import zipfile mkpath(os.path.dirname(zip_filename), dry_run=dry_run) log.info("creating '%s' and adding '%s' to it", zip_filename, base_dir) def visit(z, dirname, names): for name in names: path = os.path.normpath(os.path.join(dirname, name)) if os.path.isfile(path): p = path[len(base_dir)+1:] if not dry_run: z.write(path, p) log.debug("adding '%s'" % p) if compress is None: compress = (sys.version>="2.4") # avoid 2.3 zipimport bug when 64 bits compression = [zipfile.ZIP_STORED, zipfile.ZIP_DEFLATED][bool(compress)] if not dry_run: z = zipfile.ZipFile(zip_filename, mode, compression=compression) os.path.walk(base_dir, visit, z) z.close() else: os.path.walk(base_dir, visit, None) return zip_filename # PKC8o'setuptools/command/install_egg_info.pyo; Fc@sbdklZdklZdklZlZdkZdkZdk Z defdYZ dS((sCommand(sunpack_archive(slogsdir_utilNsinstall_egg_infocBsetZdZdZdddfgZdZdZdZdZdZ d Z d Z RS( s.Install an .egg-info directory for the packages install-dir=sdsdirectory to install tocCs t|_dS(N(sNonesselfs install_dir(sself((sGbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_egg_info.pysinitialize_optionsscCs|idddf|id}titt|i|iid}|i |_ t i i|i||_|ig|_dS(Ns install_libs install_dirsegg_infos .egg-info(sselfsset_undefined_optionssget_finalized_commandsei_cmds pkg_resourcess DistributionsNonesegg_names egg_versionsbasenamesegg_infossourcesosspathsjoins install_dirstargetsoutputs(sselfsei_cmdsbasename((sGbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_egg_info.pysfinalize_optionss ( cCs|id|i}tii|iotii|i oti|id|i n>tii |io'|i ti |ifd|in|i ot i|in|i |ifd|i|if|idS(Nsegg_infosdry_runs Removing sCopying %s to %s(sselfs run_commandstargetsosspathsisdirsislinksdir_utils remove_treesdry_runsexistssexecutesunlinks pkg_resourcessensure_directoryscopytreessourcesinstall_namespaces(sselfstarget((sGbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_egg_info.pysruns  -' cCs |iSdS(N(sselfsoutputs(sself((sGbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_egg_info.pys get_outputs*scs&d}tii|dS(Ncskx=ddfD]/}|i|pd||jotSq q Wii|ti d|||SdS(Ns.svn/sCVS/s/sCopying %s to %s( sskipssrcs startswithsNonesselfsoutputssappendsdstslogsdebug(ssrcsdstsskip(sself(sGbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_egg_info.pysskimmer/s ! (sskimmersunpack_archivesselfssourcestarget(sselfsskimmer((sselfsGbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_egg_info.pyscopytree-s cCs|i}| odSntii|i\}}|d7}|i i |t i d||i ot|d}xo|D]g}t|id}d}d|jo%ddi|d |df}n|idtqW|indS( Ns -nspkg.pths Installing %sswbs.s s(; m and setattr(sys.modules[%r], %r, m) is/import sys,new,os; p = os.path.join(sys._getframe(1).f_locals['sitedir'], *%(pth)r); ie = os.path.exists(os.path.join(p,'__init__.py')); m = not ie and sys.modules.setdefault(%(pkg)r,new.module(%(pkg)r)); mp = (m or []) and m.__dict__.setdefault('__path__',[]); (p not in mp) and mp.append(p)%(trailer)s(sselfs_get_all_ns_packagessnspsosspathssplitextstargetsfilenamesextsoutputssappendslogsinfosdry_runsopensfspkgstuplessplitspthstrailersjoinswriteslocalssclose(sselfsfspthsfilenamesextspkgsnspstrailer((sGbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_egg_info.pysinstall_namespacesSs    % cCs}h}xV|iipgD]A}|id}x)|o!d|di|<|iq2WqWt|}|i |SdS(Ns.i( snspsselfs distributionsnamespace_packagesspkgssplitsjoinspopslistssort(sselfsnspspkg((sGbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_egg_info.pys_get_all_ns_packagesps  ( s__name__s __module__s__doc__s descriptions user_optionssinitialize_optionssfinalize_optionssruns get_outputsscopytreesinstall_namespacess_get_all_ns_packages(((sGbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_egg_info.pysinstall_egg_infos     & ( s setuptoolssCommandssetuptools.archive_utilsunpack_archives distutilsslogsdir_utilsossshutils pkg_resourcessinstall_egg_info(slogsunpack_archives pkg_resourcessdir_utilsinstall_egg_infosCommandsshutilsos((sGbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/install_egg_info.pys?s  PKVb$7;setuptools/command/upload.py"""distutils.command.upload Implements the Distutils 'upload' subcommand (upload package to PyPI).""" from distutils.errors import * from distutils.core import Command from distutils.spawn import spawn from distutils import log from md5 import md5 import os import socket import platform import ConfigParser import httplib import base64 import urlparse import cStringIO as StringIO class upload(Command): description = "upload binary package to PyPI" DEFAULT_REPOSITORY = 'http://pypi.python.org/pypi' user_options = [ ('repository=', 'r', "url of repository [default: %s]" % DEFAULT_REPOSITORY), ('show-response', None, 'display full response text from server'), ('sign', 's', 'sign files to upload using gpg'), ('identity=', 'i', 'GPG identity used to sign files'), ] boolean_options = ['show-response', 'sign'] def initialize_options(self): self.username = '' self.password = '' self.repository = '' self.show_response = 0 self.sign = False self.identity = None def finalize_options(self): if self.identity and not self.sign: raise DistutilsOptionError( "Must use --sign for --identity to have meaning" ) if os.environ.has_key('HOME'): rc = os.path.join(os.environ['HOME'], '.pypirc') if os.path.exists(rc): self.announce('Using PyPI login from %s' % rc) config = ConfigParser.ConfigParser({ 'username':'', 'password':'', 'repository':''}) config.read(rc) if not self.repository: self.repository = config.get('server-login', 'repository') if not self.username: self.username = config.get('server-login', 'username') if not self.password: self.password = config.get('server-login', 'password') if not self.repository: self.repository = self.DEFAULT_REPOSITORY def run(self): if not self.distribution.dist_files: raise DistutilsOptionError("No dist file created in earlier command") for command, pyversion, filename in self.distribution.dist_files: self.upload_file(command, pyversion, filename) def upload_file(self, command, pyversion, filename): # Sign if requested if self.sign: gpg_args = ["gpg", "--detach-sign", "-a", filename] if self.identity: gpg_args[2:2] = ["--local-user", self.identity] spawn(gpg_args, dry_run=self.dry_run) # Fill in the data content = open(filename,'rb').read() basename = os.path.basename(filename) comment = '' if command=='bdist_egg' and self.distribution.has_ext_modules(): comment = "built on %s" % platform.platform(terse=1) data = { ':action':'file_upload', 'protcol_version':'1', 'name':self.distribution.get_name(), 'version':self.distribution.get_version(), 'content':(basename,content), 'filetype':command, 'pyversion':pyversion, 'md5_digest':md5(content).hexdigest(), } if command == 'bdist_rpm': dist, version, id = platform.dist() if dist: comment = 'built for %s %s' % (dist, version) elif command == 'bdist_dumb': comment = 'built for %s' % platform.platform(terse=1) data['comment'] = comment if self.sign: data['gpg_signature'] = (os.path.basename(filename) + ".asc", open(filename+".asc").read()) # set up the authentication auth = "Basic " + base64.encodestring(self.username + ":" + self.password).strip() # Build up the MIME payload for the POST data boundary = '--------------GHSKFJDLGDS7543FJKLFHRE75642756743254' sep_boundary = '\n--' + boundary end_boundary = sep_boundary + '--' body = StringIO.StringIO() for key, value in data.items(): # handle multiple entries for the same name if type(value) != type([]): value = [value] for value in value: if type(value) is tuple: fn = ';filename="%s"' % value[0] value = value[1] else: fn = "" value = str(value) body.write(sep_boundary) body.write('\nContent-Disposition: form-data; name="%s"'%key) body.write(fn) body.write("\n\n") body.write(value) if value and value[-1] == '\r': body.write('\n') # write an extra newline (lurve Macs) body.write(end_boundary) body.write("\n") body = body.getvalue() self.announce("Submitting %s to %s" % (filename, self.repository), log.INFO) # build the Request # We can't use urllib2 since we need to send the Basic # auth right with the first request schema, netloc, url, params, query, fragments = \ urlparse.urlparse(self.repository) assert not params and not query and not fragments if schema == 'http': http = httplib.HTTPConnection(netloc) elif schema == 'https': http = httplib.HTTPSConnection(netloc) else: raise AssertionError, "unsupported schema "+schema data = '' loglevel = log.INFO try: http.connect() http.putrequest("POST", url) http.putheader('Content-type', 'multipart/form-data; boundary=%s'%boundary) http.putheader('Content-length', str(len(body))) http.putheader('Authorization', auth) http.endheaders() http.send(body) except socket.error, e: self.announce(str(e), log.ERROR) return r = http.getresponse() if r.status == 200: self.announce('Server response (%s): %s' % (r.status, r.reason), log.INFO) else: self.announce('Upload failed (%s): %s' % (r.status, r.reason), log.ERROR) if self.show_response: print '-'*75, r.read(), '-'*75 PKC8 C setuptools/command/bdist_rpm.pyo; fSFc@s9dklZdkZdkZdefdYZdS((s bdist_rpmNs bdist_rpmcBsCtZdZeidjoddZndZdZRS(NcCsti|t|_dS(N(s _bdist_rpmsinitialize_optionssselfsNonesno_egg(sself((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_rpm.pysinitialize_options s s2.5icCsti||||||ijo |idobt|i dgi d|idodp t i d t ii|t ii|fndS(Ns.rpms dist_filess bdist_rpms.src.rpmsanyi(s _bdist_rpms move_filesselfssrcsdstslevelsdist_dirsendswithsgetattrs distributionsappendssyssversionsosspathsjoinsbasename(sselfssrcsdstslevel((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_rpm.pys move_files cCs|idti|dS(Nsegg_info(sselfs run_commands _bdist_rpmsrun(sself((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_rpm.pysruns cCs|ii}|idd}ti|}d|}d|}gi }|D]@}||iddiddidd i||qR~}|i|i|d d ||SdS( Ns-s_s%define version sSource0: %{name}-%{version}.tars)Source0: %{name}-%{unmangled_version}.tarssetup.py install s5setup.py install --single-version-externally-managed s%setups&%setup -n %{name}-%{unmangled_version}is%define unmangled_version (sselfs distributions get_versionsversionsreplaces rpmversions _bdist_rpms_make_spec_filesspecsline23sline24sappends_[1]slinesinsertsindex(sselfsline24sline23s rpmversions_[1]sversionslinesspec((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_rpm.pys_make_spec_file*s     !(s__name__s __module__sinitialize_optionsssyssversions move_filesruns_make_spec_file(((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_rpm.pys bdist_rpm s   (sdistutils.command.bdist_rpms bdist_rpms _bdist_rpmssyssos(ssyss bdist_rpmsoss _bdist_rpm((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_rpm.pys?s PK45 setuptools/command/rotate.pyimport distutils, os from setuptools import Command from distutils.util import convert_path from distutils import log from distutils.errors import * class rotate(Command): """Delete older distributions""" description = "delete older distributions, keeping N newest files" user_options = [ ('match=', 'm', "patterns to match (required)"), ('dist-dir=', 'd', "directory where the distributions are"), ('keep=', 'k', "number of matching distributions to keep"), ] boolean_options = [] def initialize_options(self): self.match = None self.dist_dir = None self.keep = None def finalize_options(self): if self.match is None: raise DistutilsOptionError( "Must specify one or more (comma-separated) match patterns " "(e.g. '.zip' or '.egg')" ) if self.keep is None: raise DistutilsOptionError("Must specify number of files to keep") try: self.keep = int(self.keep) except ValueError: raise DistutilsOptionError("--keep must be an integer") if isinstance(self.match, basestring): self.match = [ convert_path(p.strip()) for p in self.match.split(',') ] self.set_undefined_options('bdist',('dist_dir', 'dist_dir')) def run(self): self.run_command("egg_info") from glob import glob for pattern in self.match: pattern = self.distribution.get_name()+'*'+pattern files = glob(os.path.join(self.dist_dir,pattern)) files = [(os.path.getmtime(f),f) for f in files] files.sort() files.reverse() log.info("%d file(s) matching %s", len(files), pattern) files = files[self.keep:] for (t,f) in files: log.info("Deleting %s", f) if not self.dry_run: os.unlink(f) PKC87setuptools/command/sdist.pyo; GEc@s?dklZdklZdkZdkZdkZdkZddfddfddfd d fd d fgZ d Z e dZ dZ ddZddZdZeideiZdZede eideifedefedefedefgZdefdYZdS((ssdist(s convert_pathNs<ss"s"s's's&s&cCs1x&tD]\}}|i||}qW|SdS(N(sentitiessoldsnewsdatasreplace(sdatasoldsnew((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/sdist.pysunescape s csd}|SdS(Nc#svt|d}|i}|ixJi|D]9}|i d}o|}nt ||Vq5WdS(NsrUi(sopensfilenamesfsreadsdatasclosespatternsfinditersmatchsgroupspathspostprocsjoinpathsdirname(sdirnamesfilenamesfspathsdatasmatch(spostprocspattern(s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/sdist.pysfinds  (sfind(spatternspostprocsfind((spatternspostprocs<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/sdist.pys re_finders cCs'| o|Sntii||SdS(N(sprefixssuffixsosspathsjoin(sprefixssuffix((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/sdist.pysjoinpathssccs?x8tidD]'}x|i|D] }|Vq)WqWdS(s%Find all files under revision controlssetuptools.file_findersN(s pkg_resourcessiter_entry_pointssepsloadsdirnamesitem(sdirnamesitemsep((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/sdist.pys walk_revctrl*s ccsxtD]\}}t||}tii|okxh|||D]S}tii|o|VqEtii|oxt|D] }|VqWqEqEWqqWdS(N( sfindersspathsfindersjoinpathsdirnamesossisfilesisdirs_default_revctrlsitem(sdirnamesitemspathsfinder((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/sdist.pys_default_revctrl0s  c cst}t|d}xt|idD]}|i}t |djol|\}}|i t|}|djo |djo t}q|djo|o|iPqq(q(W|idSx<|iD].}|i}|ot||dVqqWdS( s$Find any 'svn:externals' directoriessrbsisKs svn:externalssVNi(sFalsesfoundsopensfilenamesfsitersreadlineslinessplitspartsslenskindslengthsreadsintsdatasTruescloses splitlinessjoinpathsdirname( sdirnamesfilenameskindsfsdataslengthspartssfoundsline((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/sdist.pysexternals_finder;s*        s%name="([^"]+)"(?![^>]+deleted="true")ccst|d}|i}|i|idorxtti |i ddD]J}| p!t |djo|ddjoqUnt ||dVqUWn[|id o:xGti|D]"}t |t|idVqWntid |dS( NsrUs8s iiisdeleteis|iD]3}dd|f}||jo|i|qqWdS(Nsegg_infos SOURCES.txts dist_filesssdists(sselfs run_commandsget_finalized_commandsei_cmdsfilelistsappendsosspathsjoinsegg_infos check_readmescheck_metadatasmake_distributionsgetattrs distributions dist_filess archive_filessfilesdata(sselfsei_cmds dist_filessdatasfile((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/sdist.pysruns  "     cCsCyti|Wn+tidiiidinXdS(Nistemplate( s_sdists read_templatesselfssyssexc_infostb_nextstb_framesf_localssclose(sself((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/sdist.pys read_templates !cCsVddf}xC|D]!}tii|odSqqW|iddi|dS(NsREADMEs README.txts,standard file not found: should have one of s, (saltssfsosspathsexistssselfswarnsjoin(sselfsaltssf((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/sdist.pys check_readmes   cCsti|||tii|d}t tdotii |o!ti ||i d|n|i di|dS(Ns setup.cfgslinksegg_info(s_sdistsmake_release_treesselfsbase_dirsfilessosspathsjoinsdestshasattrsexistssunlinks copy_filesget_finalized_commandssave_version_info(sselfsbase_dirsfilessdest((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/sdist.pysmake_release_trees # ( s__name__s __module__s__doc__sNones user_optionss negative_optsruns read_templates check_readmesmake_release_tree(((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/sdist.pyssdist|s .   (sdistutils.command.sdistssdists_sdistsdistutils.utils convert_pathsossressyss pkg_resourcessentitiessunescapesNones re_findersjoinpaths walk_revctrls_default_revctrlsexternals_finderscompilesIsentries_patternsentries_findersMsfinders(s convert_pathsexternals_findersunescapesentitiessoss walk_revctrls pkg_resourcess_default_revctrlssyssresentries_patternsjoinpathsentries_finders re_finders_sdistsfindersssdist((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/command/sdist.pys?s  $3     WPKC8E::setuptools/command/__init__.pyc; fEc@sdddddddddd d d d d ddddddgZdkZeidjoeidndklZdeijo'ddfeid 0: bytecode_files.append(py_file + "o") return bytecode_files def run(self): self.build() outfiles = self.install() if outfiles is not None: # always compile, in case we have any extension stubs to deal with self.byte_compile(outfiles) def get_exclusions(self): exclude = {} nsp = self.distribution.namespace_packages if (nsp and self.get_finalized_command('install') .single_version_externally_managed ): for pkg in nsp: parts = pkg.split('.') while parts: pkgdir = os.path.join(self.install_dir, *parts) for f in '__init__.py', '__init__.pyc', '__init__.pyo': exclude[os.path.join(pkgdir,f)] = 1 parts.pop() return exclude def copy_tree( self, infile, outfile, preserve_mode=1, preserve_times=1, preserve_symlinks=0, level=1 ): assert preserve_mode and preserve_times and not preserve_symlinks exclude = self.get_exclusions() if not exclude: return _install_lib.copy_tree(self, infile, outfile) # Exclude namespace package __init__.py* files from the output from setuptools.archive_util import unpack_directory from distutils import log outfiles = [] def pf(src, dst): if dst in exclude: log.warn("Skipping installation of %s (namespace package)",dst) return False log.info("copying %s -> %s", src, os.path.dirname(dst)) outfiles.append(dst) return dst unpack_directory(infile, outfile, pf) return outfiles def get_outputs(self): outputs = _install_lib.get_outputs(self) exclude = self.get_exclusions() if exclude: return [f for f in outputs if f not in exclude] return outputs PKC8qksSS setuptools/command/bdist_egg.pyc; _Fc@sadZdkZdkZdkZdklZdklZlZdk l Z l Z dk l Z dklZdklZlZlZdklZd klZd klZd Zd Zd ZdefdYZeidiZ dZ!dZ"dZ#he$d<e%d|i? ot@|id|intA|i%dgidtB|i<fdS(Nsegg_infosinstalling library code to %ssinstalls install_libswarn_diris.pyscreating stub loader for %ss/sEGG-INFOsscriptssinstalling scripts to %ssinstall_scriptss install_dirsno_episnative_libs.txts writing %sswts s removing %ss depends.txtsxWARNING: 'depends.txt' will not be used by setuptools 0.6! Use the install_requires/extras_require setup() args instead.sverbosesdry_runsmodes dist_filess bdist_egg(Csselfs run_commandslogsinfos bdist_dirsget_finalized_commandsinstcmdsrootsold_rootsNones call_commandscmdsget_ext_outputss all_outputss ext_outputssstubss to_compiles enumeratespsext_namesosspathssplitextsfilenamesextsjoins strip_modulespyfilesappendsdry_runs write_stubsbasenamesreplacessepsextendsmake_init_filess byte_compiles distributions data_filessdo_install_datas archive_rootsegg_infosmkpathsscriptss script_dirs native_libssopens libs_fileswritesclosesisfilesunlinkscopy_metadata_toswrite_safety_flagszip_safesexistsswarnsexclude_source_filess zap_pyfiless make_zipfiles egg_outputsverboses gen_headers keep_temps remove_treesgetattrsget_python_version(sselfs ext_outputss native_libssext_names libs_filesfilenames all_outputss script_dirs to_compilesinstcmdspyfilesegg_infoscmdspsextsold_roots archive_root((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_egg.pysrunsl    "          "%  cCstidxwt|iD]f\}}}xT|D]L}|i do6t i i ||}ti d|t i|q3q3WqWdS(Ns+Removing .py files from temporary directorys.pys Deleting %s(slogsinfoswalk_eggsselfs bdist_dirsbasesdirssfilessnamesendswithsosspathsjoinsdebugsunlink(sselfsdirssfilessbasespathsname((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_egg.pys zap_pyfiless cCsNt|idt}|tj o|Sntidt|i|i SdS(Nszip_safes4zip_safe flag not set; analyzing archive contents...( sgetattrsselfs distributionsNonessafeslogswarns analyze_eggs bdist_dirsstubs(sselfssafe((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_egg.pyszip_safes   c Cs*g}xt|iD]\}}}||ijoqnx|D]}|idod|jo|t |idi t i d}|ii|oktid|t ii|d}|i o*t|d}|it|in|i|qnPqCqCWg|(qW|SdS(s%Create missing package __init__ filess.pys __init__.pyis.s#Creating missing __init__.py for %sswN(s init_filesswalk_eggsselfs bdist_dirsbasesdirssfilessnamesendswithslensreplacesosssepspkgs distributionshas_contents_forslogswarnspathsjoinsfilenamesdry_runsopensfswrites NS_PKG_STUBsclosesappend( sselfsdirssfilessnamesfsfilenames init_filessbasespkg((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_egg.pysmake_init_filess* &   c Cs1ti|iipd}|idhid} | tjodSn| i p| i ot d| fnt i d }| i}di| i }| i d}tii|i}d t}|i oOttii|id |it|id}|i||i nd SdS( Nsssetuptools.installations eggsecutableswsGeggsecutable entry point (%r) cannot have 'extras' or refer to a moduleis.isH#!/bin/sh if [ `basename $0` = "%(basename)s" ] then exec python%(pyver)s -c "import sys, os; sys.path.insert(0, os.path.abspath('$0')); from %(pkg)s import %(base)s; sys.exit(%(full)s())" "$@" else echo $0 is not the correct name for this egg file. echo Please rename it back to %(basename)s and try again. exec false fi sdry_runsa(!s EntryPoints parse_mapsselfs distributions entry_pointssepmsgetsepsNonesattrssextrassDistutilsSetupErrorssyssversionspyvers module_namespkgsjoinsfullsbasesosspathsbasenames egg_outputslocalssheadersdry_runsmkpathsdirnamesopensfswritesclose( sselfsfullsfsheaderspyversepmspkgsbasesbasenamesep((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_egg.pys gen_header s$      " cCstii|id}xd|iiiD]S}|i |o=tii||t |}t ||i||q(q(WdS(Ns(sosspathsjoinsselfsegg_infosprefixsei_cmdsfilelistsfiless startswiths target_dirslenstargetsensure_directorys copy_file(sselfs target_dirstargetsprefixspath((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_egg.pyscopy_metadata_toIs c Csg}g}h|id<}xti|iD]\}}} xJ| D]B}ti i |di tjo|i|||qGqGWx3|D]+}|||d|ti i||dd gD]0} | |jotid || t} qqWd |jo`x]d d dddddddddg D]0} | |jotid|| t} qCqCWnd|jod|jo d|jo2ti d djotid|t} qn| SdS(s;Check whether module possibly uses unsafe-for-zipfile stuffiis.sisrbis__file__s__path__s%s: module references %ssinspects getsources getabsfiles getsourcefilesgetfilegetsourceliness findsources getcommentss getframeinfosgetinnerframessgetouterframessstackstraces"%s: module MAY be using inspect.%ss__name__s__main__is2.4s.%s: top-level module may be 'python -m' scriptN(!sosspathsjoinsbasesnamesfilenamesstubssTrueslensegg_dirsreplacessepspkgssplitextsmodulesopensfsreadsmarshalsloadscodesclosessafesdictsfromkeyss iter_symbolsssymbolssbadslogswarnsFalsessyssversion( segg_dirsbasesnamesstubsscodesmodulessymbolsspkgsfilenamessafesfsbad((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_egg.pys scan_modules4#,   ( 'ccswx|iD] }|Vq WxX|iD]M}t|to|Vq"t|toxt|D] }|Vq]Wq"q"WdS(sBYield names and strings used by `code` and its nested code objectsN( scodesco_namessnames co_constssconsts isinstances basestringsCodeTypes iter_symbols(scodesconstsname((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_egg.pys iter_symbolss   s install_libs install_dirs install_datas install_baseiswc sdk}ttii|dtid|d} |t jot idj}n|i|igt|} o<|i||d|}tii| ||intii| t |SdS(sqCreate a zip file from all the files under 'base_dir'. The output zip file will be named 'base_dir' + ".zip". Uses either the "zipfile" Python module (if available) or the InfoZIP "zip" utility (if installed and found on the default search path). If neither tool is available, raises DistutilsExecError. Returns the name of the output zip file. Nsdry_runs#creating '%s' and adding '%s' to itcsx|D]}tiitii||}tii|oE|td} o|i ||ntid|qqWdS(Nis adding '%s'(snamessnamesosspathsnormpathsjoinsdirnamesisfileslensbase_dirspsdry_runszswriteslogsdebug(szsdirnamesnamessnamespspath(sdry_runsbase_dir(s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_egg.pysvisits!s2.4s compression(szipfilesmkpathsosspathsdirnames zip_filenamesdry_runslogsinfosbase_dirsvisitscompresssNonessyssversions ZIP_STOREDs ZIP_DEFLATEDsbools compressionsZipFilesmodeszswalksclose( s zip_filenamesbase_dirsverbosesdry_runscompresssmodeszszipfiles compressionsvisit((sbase_dirsdry_runs@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_egg.pys make_zipfiles  (,s__doc__ssyssossmarshals setuptoolssCommandsdistutils.dir_utils remove_treesmkpathsdistutils.sysconfigsget_python_versionsget_python_libs distutilsslogsdistutils.errorssDistutilsSetupErrors pkg_resourcessget_build_platforms Distributionsensure_directorys EntryPointstypessCodeTypessetuptools.extensionsLibrarys strip_modules write_stubs NS_PKG_STUBs bdist_eggsdictsfromkeysssplitsNATIVE_EXTENSIONSswalk_eggs analyze_eggswrite_safety_flagsTruesFalses safety_flagss scan_modules iter_symbolssINSTALL_DIRECTORY_ATTRSsNones make_zipfile(s strip_modules make_zipfilesLibrarysCodeTypes iter_symbolss safety_flagss NS_PKG_STUBsNATIVE_EXTENSIONSslogsINSTALL_DIRECTORY_ATTRSsget_python_versionsDistutilsSetupErrors write_stubswalk_eggs remove_trees analyze_eggssyssget_build_platformsCommands Distributionswrite_safety_flagsmkpathsensure_directorys scan_modules EntryPoints bdist_eggsossmarshalsget_python_lib((s@build/bdist.darwin-8.0.1-x86/egg/setuptools/command/bdist_egg.pys?s0        D    PKr)6;q#setuptools/command/bdist_wininst.pyfrom distutils.command.bdist_wininst import bdist_wininst as _bdist_wininst import os, sys class bdist_wininst(_bdist_wininst): def create_exe(self, arcname, fullname, bitmap=None): _bdist_wininst.create_exe(self, arcname, fullname, bitmap) dist_files = getattr(self.distribution, 'dist_files', []) if self.target_version: installer_name = os.path.join(self.dist_dir, "%s.win32-py%s.exe" % (fullname, self.target_version)) pyversion = self.target_version # fix 2.5 bdist_wininst ignoring --target-version spec bad = ('bdist_wininst','any',installer_name) if bad in dist_files: dist_files.remove(bad) else: installer_name = os.path.join(self.dist_dir, "%s.win32.exe" % fullname) pyversion = 'any' dist_files.append(('bdist_wininst', pyversion, installer_name)) def reinitialize_command (self, command, reinit_subcommands=0): cmd = self.distribution.reinitialize_command( command, reinit_subcommands) if command in ('install', 'install_lib'): cmd.install_lib = None # work around distutils bug return cmd def run(self): self._is_running = True try: _bdist_wininst.run(self) finally: self._is_running = False PKC8setuptools/command/setopt.pyc; Ec@sdkZdkZdklZdklZdklZdkTddddgZd d Z e d Z defd YZ de fd YZ dS(N(sCommand(s convert_path(slog(s*s config_files edit_configs option_basessetoptslocalcCs|djodSn|djo&tiitiitidSn|djo;tidjodpd}tii t d |Snt d |d S( sGet the filename of the distutils, local, global, or per-user config `kind` must be one of "local", "global", or "user" slocals setup.cfgsglobals distutils.cfgsusersposixs.ss~/%spydistutils.cfgs7config_file() type must be 'local', 'global', or 'user'N( skindsosspathsjoinsdirnames distutilss__file__snamesdots expandusers convert_paths ValueError(skindsdot((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/setopt.pys config_file s  & c Csdkl}tid||}|i|gx5|iD]'\}}|t jo$ti d|||i |qC|i| o$tid|||i|nx|iD]\} }|t jo_tid|| ||i|| |i | o$ti d|||i |qfqtid|| |||i|| |qWqCWti d|| o*t|d }|i||ind S( sYEdit a configuration file to include `settings` `settings` is a dictionary of dictionaries or ``None`` values, keyed by command/section name. A ``None`` value means to delete the entire section, while a dictionary lists settings to be changed or deleted in that section. A setting of ``None`` means to delete that setting. (sRawConfigParsersReading configuration from %ssDeleting section [%s] from %ssAdding new section [%s] to %ssDeleting %s.%s from %ss#Deleting empty [%s] section from %ssSetting %s.%s to %r in %ss Writing %sswN(s ConfigParsersRawConfigParserslogsdebugsfilenamesoptssreadssettingssitemsssectionsoptionssNonesinfosremove_sections has_sections add_sectionsoptionsvalues remove_optionssetsdry_runsopensfswritesclose( sfilenamessettingssdry_runssectionsfsvaluesRawConfigParsersoptionssoptssoption((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/setopt.pys edit_config*s:           cBsVtZdZdddfdddfddd fgZddgZd Zd ZRS( s<Abstract base class for commands that mess with config filess global-configsgs0save options to the site-wide distutils.cfg files user-configsus7save options to the current user's pydistutils.cfg files filename=sfs-configuration file to use (default=setup.cfg)cCst|_t|_t|_dS(N(sNonesselfs global_configs user_configsfilename(sself((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/setopt.pysinitialize_optionscs  cCsg}|io|itdn|io|itdn|itj o|i|in| o|itdnt|djot d|n|\|_dS(Nsglobalsuserslocalis/Must specify only one configuration file option( s filenamessselfs global_configsappends config_files user_configsfilenamesNoneslensDistutilsOptionError(sselfs filenames((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/setopt.pysfinalize_optionshs   (s__name__s __module__s__doc__s user_optionssboolean_optionssinitialize_optionssfinalize_options(((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/setopt.pys option_baseSs *  cBs|tZdZdZdddfdddfdd d fd d d fgeiZeid gZdZdZdZ RS(s#Save command-line options to a files1set an option in setup.cfg or another config filescommand=scscommand to set an option forsoption=sos option to sets set-value=sssvalue of the optionsremovesrsremove (unset) the valuecCs5ti|t|_t|_t|_t|_dS(N(s option_basesinitialize_optionssselfsNonescommandsoptions set_valuesremove(sself((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/setopt.pysinitialize_optionss     cCslti||itjp |itjotdn|itjo|i otdndS(Ns%Must specify --command *and* --options$Must specify --set-value or --remove( s option_basesfinalize_optionssselfscommandsNonesoptionsDistutilsOptionErrors set_valuesremove(sself((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/setopt.pysfinalize_optionss   c CsAt|ih|ih|iidd|i<<|idS(Ns-s_(s edit_configsselfsfilenamescommandsoptionsreplaces set_valuesdry_run(sself((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/setopt.pysruns3( s__name__s __module__s__doc__s descriptions option_bases user_optionssboolean_optionssinitialize_optionssfinalize_optionssrun(((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/setopt.pyssetopt|s =  (s distutilssoss setuptoolssCommandsdistutils.utils convert_pathslogsdistutils.errorss__all__s config_filesFalses edit_configs option_basessetopt( s convert_paths config_fileslogs__all__s distutilssCommands edit_configsoss option_basessetopt((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/command/setopt.pys?s    ))PK45NNsetuptools/command/build_py.pyimport os.path, sys, fnmatch from distutils.command.build_py import build_py as _build_py from distutils.util import convert_path from glob import glob class build_py(_build_py): """Enhanced 'build_py' command that includes data files with packages The data files are specified via a 'package_data' argument to 'setup()'. See 'setuptools.dist.Distribution' for more details. Also, this version of the 'build_py' command allows you to specify both 'py_modules' and 'packages' in the same setup operation. """ def finalize_options(self): _build_py.finalize_options(self) self.package_data = self.distribution.package_data self.exclude_package_data = self.distribution.exclude_package_data or {} if 'data_files' in self.__dict__: del self.__dict__['data_files'] def run(self): """Build modules, packages, and copy data files to build directory""" if not self.py_modules and not self.packages: return if self.py_modules: self.build_modules() if self.packages: self.build_packages() self.build_package_data() # Only compile actual .py files, using our base class' idea of what our # output files are. self.byte_compile(_build_py.get_outputs(self, include_bytecode=0)) def __getattr__(self,attr): if attr=='data_files': # lazily compute data files self.data_files = files = self._get_data_files(); return files return _build_py.__getattr__(self,attr) def _get_data_files(self): """Generate list of '(package,src_dir,build_dir,filenames)' tuples""" self.analyze_manifest() data = [] for package in self.packages or (): # Locate package source directory src_dir = self.get_package_dir(package) # Compute package build directory build_dir = os.path.join(*([self.build_lib] + package.split('.'))) # Length of path to strip from found files plen = len(src_dir)+1 # Strip directory from globbed filenames filenames = [ file[plen:] for file in self.find_data_files(package, src_dir) ] data.append( (package, src_dir, build_dir, filenames) ) return data def find_data_files(self, package, src_dir): """Return filenames for package's data files in 'src_dir'""" globs = (self.package_data.get('', []) + self.package_data.get(package, [])) files = self.manifest_files.get(package, [])[:] for pattern in globs: # Each pattern has to be converted to a platform-specific path files.extend(glob(os.path.join(src_dir, convert_path(pattern)))) return self.exclude_data_files(package, src_dir, files) def build_package_data(self): """Copy data files into build directory""" lastdir = None for package, src_dir, build_dir, filenames in self.data_files: for filename in filenames: target = os.path.join(build_dir, filename) self.mkpath(os.path.dirname(target)) self.copy_file(os.path.join(src_dir, filename), target) def analyze_manifest(self): self.manifest_files = mf = {} if not self.distribution.include_package_data: return src_dirs = {} for package in self.packages or (): # Locate package source directory src_dirs[assert_relative(self.get_package_dir(package))] = package self.run_command('egg_info') ei_cmd = self.get_finalized_command('egg_info') for path in ei_cmd.filelist.files: d,f = os.path.split(assert_relative(path)) prev = None oldf = f while d and d!=prev and d not in src_dirs: prev = d d, df = os.path.split(d) f = os.path.join(df, f) if d in src_dirs: if path.endswith('.py') and f==oldf: continue # it's a module, not data mf.setdefault(src_dirs[d],[]).append(path) def get_data_files(self): pass # kludge 2.4 for lazy computation if sys.version<"2.4": # Python 2.4 already has this code def get_outputs(self, include_bytecode=1): """Return complete list of files copied to the build directory This includes both '.py' files and data files, as well as '.pyc' and '.pyo' files if 'include_bytecode' is true. (This method is needed for the 'install_lib' command to do its job properly, and to generate a correct installation manifest.) """ return _build_py.get_outputs(self, include_bytecode) + [ os.path.join(build_dir, filename) for package, src_dir, build_dir,filenames in self.data_files for filename in filenames ] def check_package(self, package, package_dir): """Check namespace packages' __init__ for declare_namespace""" try: return self.packages_checked[package] except KeyError: pass init_py = _build_py.check_package(self, package, package_dir) self.packages_checked[package] = init_py if not init_py or not self.distribution.namespace_packages: return init_py for pkg in self.distribution.namespace_packages: if pkg==package or pkg.startswith(package+'.'): break else: return init_py f = open(init_py,'rU') if 'declare_namespace' not in f.read(): from distutils import log log.warn( "WARNING: %s is a namespace package, but its __init__.py does\n" "not declare_namespace(); setuptools 0.7 will REQUIRE this!\n" '(See the setuptools manual under "Namespace Packages" for ' "details.)\n", package ) f.close() return init_py def initialize_options(self): self.packages_checked={} _build_py.initialize_options(self) def exclude_data_files(self, package, src_dir, files): """Filter filenames for package's data files in 'src_dir'""" globs = (self.exclude_package_data.get('', []) + self.exclude_package_data.get(package, [])) bad = [] for pattern in globs: bad.extend( fnmatch.filter( files, os.path.join(src_dir, convert_path(pattern)) ) ) bad = dict.fromkeys(bad) seen = {} return [ f for f in files if f not in bad and f not in seen and seen.setdefault(f,1) # ditch dupes ] def assert_relative(path): if not os.path.isabs(path): return path from distutils.errors import DistutilsSetupError raise DistutilsSetupError( """Error: setup script specifies an absolute path: %s setup() arguments must *always* be /-separated paths relative to the setup.py directory, *never* absolute paths. """ % path ) PKvk6T setuptools/command/develop.pyfrom setuptools.command.easy_install import easy_install from distutils.util import convert_path from pkg_resources import Distribution, PathMetadata, normalize_path from distutils import log from distutils.errors import * import sys, os, setuptools class develop(easy_install): """Set up package for development""" description = "install package in 'development mode'" user_options = easy_install.user_options + [ ("uninstall", "u", "Uninstall this source package"), ("egg-path=", None, "Set the path to be used in the .egg-link file"), ] boolean_options = easy_install.boolean_options + ['uninstall'] command_consumes_arguments = False # override base def run(self): if self.uninstall: self.multi_version = True self.uninstall_link() else: self.install_for_development() self.warn_deprecated_options() def initialize_options(self): self.uninstall = None self.egg_path = None easy_install.initialize_options(self) self.setup_path = None def finalize_options(self): ei = self.get_finalized_command("egg_info") if ei.broken_egg_info: raise DistutilsError( "Please rename %r to %r before using 'develop'" % (ei.egg_info, ei.broken_egg_info) ) self.args = [ei.egg_name] easy_install.finalize_options(self) self.egg_link = os.path.join(self.install_dir, ei.egg_name+'.egg-link') self.egg_base = ei.egg_base if self.egg_path is None: self.egg_path = os.path.abspath(ei.egg_base) target = normalize_path(self.egg_base) if normalize_path(os.path.join(self.install_dir, self.egg_path)) != target: raise DistutilsOptionError( "--egg-path must be a relative path from the install" " directory to "+target ) # Make a distribution for the package's source self.dist = Distribution( target, PathMetadata(target, os.path.abspath(ei.egg_info)), project_name = ei.egg_name ) p = self.egg_base.replace(os.sep,'/') if p!= os.curdir: p = '../' * (p.count('/')+1) self.setup_path = p p = normalize_path(os.path.join(self.install_dir, self.egg_path, p)) if p != normalize_path(os.curdir): raise DistutilsOptionError( "Can't get a consistent path to setup script from" " installation directory", p, normalize_path(os.curdir)) def install_for_development(self): # Ensure metadata is up-to-date self.run_command('egg_info') # Build extensions in-place self.reinitialize_command('build_ext', inplace=1) self.run_command('build_ext') self.install_site_py() # ensure that target dir is site-safe if setuptools.bootstrap_install_from: self.easy_install(setuptools.bootstrap_install_from) setuptools.bootstrap_install_from = None # create an .egg-link in the installation dir, pointing to our egg log.info("Creating %s (link to %s)", self.egg_link, self.egg_base) if not self.dry_run: f = open(self.egg_link,"w") f.write(self.egg_path + "\n" + self.setup_path) f.close() # postprocess the installed distro, fixing up .pth, installing scripts, # and handling requirements self.process_distribution(None, self.dist, not self.no_deps) def uninstall_link(self): if os.path.exists(self.egg_link): log.info("Removing %s (link to %s)", self.egg_link, self.egg_base) contents = [line.rstrip() for line in file(self.egg_link)] if contents not in ([self.egg_path], [self.egg_path, self.setup_path]): log.warn("Link points to %s: uninstall aborted", contents) return if not self.dry_run: os.unlink(self.egg_link) if not self.dry_run: self.update_pth(self.dist) # remove any .pth link to us if self.distribution.scripts: # XXX should also check for entry point scripts! log.warn("Note: you must uninstall or replace scripts manually!") def install_egg_scripts(self, dist): if dist is not self.dist: # Installing a dependency, so fall back to normal behavior return easy_install.install_egg_scripts(self,dist) # create wrapper scripts in the script dir, pointing to dist.scripts # new-style... self.install_wrapper_scripts(dist) # ...and old-style for script_name in self.distribution.scripts or []: script_path = os.path.abspath(convert_path(script_name)) script_name = os.path.basename(script_path) f = open(script_path,'rU') script_text = f.read() f.close() self.install_script(dist, script_name, script_text, script_path) PKC8As#setuptools/command/easy_install.pyc; eFc@s dZdkZdkZdkZdkZdkZdkZdkZdk Z dk Z dk l Z dk l Z dklZdklZlZdklZdklZlZlZdklZd klZlZd klZd kl Z l!Z!d k"Tei#i$ei%Z&d dddddgZ'dZ(de fdYZ)dZ*dZ+dZ,dZ-dZ.de/fdYZ0e&e1dZ2dZ3dZ4dZ5dd Z6d!Z7d"Z8e&e1d#Z9e1e3d$Z:d%Z;e<d&Z=dS('sEasy Install ------------ A tool for doing automatic download/extract/build of distutils-based Python packages. For detailed documentation, see the accompanying EasyInstall.txt file, or visit the `EasyInstall home page`__. __ http://peak.telecommunity.com/DevCenter/EasyInstall N(sglob(sCommand(s run_setup(slogsdir_util(sget_python_lib(sDistutilsArgErrorsDistutilsOptionErrorsDistutilsError(sunpack_archive(s PackageIndexsparse_bdist_wininst(s URL_SCHEME(s bdist_eggsegg_info(s*ssamefiles easy_installsPthDistributionssextract_wininst_cfgsmainsget_exe_prefixescCsttido#tii|otii|otii||Sntiitii|tiitii|jSdS(Nssamefile( shasattrsosspathsexistssp1sp2ssamefilesnormpathsnormcase(sp1sp2((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pyssamefile s9cBstZdZdZeZdedfdddfddd fd d d fd ddfdddfdddfdddfdddfdddfdd d!fd"ed!fd#d$d%fd&d'd(fd)ed*fd+d,d-fd.d/d0fd1d2d3fd4d5d6fd7d8d9fd:d;d<fgZdddd ddd"d1d4d:g Zhd+dZ d?Zd@ZdAZdBZdCZdDZdEZdFZdGZdHZdIZedJZedKZedLZdMZdNZdOZedPZ dQfdRZ!dSZ"dTZ#dUZ$dVZ%dWZ&dXZ'dYZ(dZd[Z)d\Z*d]Z+d^Z,d_Z-d`Z.daZ/dbZ0dcZ1ddZ2e3dee3dfdgdhdiZ4e3dfdjdhdkZ5dlZ6RS(ms'Manage a download/build/install processs Find/get/install Python packagessprefix=sinstallation prefixszip-okszsinstall package as a zipfiles multi-versionsms%make apps have to require() a versionsupgradesUs1force upgrade (searches PyPI for latest versions)s install-dir=sdsinstall package to DIRs script-dir=sssinstall scripts to DIRsexclude-scriptssxsDon't install scriptss always-copysas'Copy all needed packages to install dirs index-url=sis base URL of Python Package Indexs find-links=sfs(additional URL(s) to search for packagessdelete-conflictingsDs no longer needed; don't use thissignore-conflicts-at-my-risksbuild-directory=sbs/download/extract/build in DIR; keep the resultss optimize=sOslalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0]srecord=s3filename in which to record list of installed filess always-unzipsZs*don't install as a zipfile, no matter whats site-dirs=sSs)list of directories where .pth files workseditableses+Install specified packages in editable formsno-depssNsdon't install dependenciess allow-hosts=sHs$pattern(s) that hostnames must matchslocal-snapshots-oksls(allow building eggs from local checkoutscCst|_|_t|_|_|_t|_t|_t|_ t|_ t|_ |_ t|_ |_|_t|_|_|_t|_|_|_t|_t|_t|_t|_t|_h|_t|_t|_|ii |_ |ii!||ii"ddS(Ns easy_install(#sNonesselfszip_okslocal_snapshots_oks install_dirs script_dirsexclude_scriptss index_urls find_linkssbuild_directorysargssoptimizesrecordsupgrades always_copys multi_versionseditablesno_depss allow_hostssrootsprefixs no_reports package_indexspth_filesdelete_conflictingsignore_conflicts_at_my_risks site_dirssinstalled_projectssFalsessitepy_installeds_dry_runs distributionsverboses_set_command_optionssget_option_dict(sself((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysinitialize_optionsSs(            cCsx|D]}tii|ptii|oetid||i oFtii |otii| ot |qti |qqqWdS(Ns Deleting %s( sblockerssfilenamesosspathsexistssislinkslogsinfosselfsdry_runsisdirsrmtreesunlink(sselfsblockerssfilename((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysdelete_blockersrs& 'cCs|idddd|itjo|i|_n|idddf|idddf|idddfttti }t |_ |i tj ogi}|i id D]"}|ti i|iq~}xw|D]k}ti i| otid |qt||jot|d q|i it|qWn|i o|in|ipd |_|i |_xG|it|ifD]-}||ijo|iid |qqW|i tj o=gi}|i id D]}||iq~}n dg}|i"tjo(|i#|id|id||_"nt$|iti |_%|i&tj o-t'|i&t(o|i&i|_&qn g|_&|i)o|i"i*|iti n|i"i+|i&|idddft'|i,t- ohyBt-|i,|_,d |i,jo djn o t.nWqt.j otdqXn|i/o|i0otdn|io|i1 ot2dn|i3 ot2dng|_4dS(Ns install_dirs script_dirsbuild_directorys site_dirss install_libsinstall_scriptssinstallsrecords,s"%s (in --site-dirs) does not exists$ (in --site-dirs) is not on sys.pathshttp://pypi.python.org/simpleis*s search_pathshostssoptimizeis--optimize must be 0, 1, or 2sVCan't use both --delete-conflicting and --ignore-conflicts-at-my-risk at the same times9Must specify a build directory (-b) when using --editables:No urls, filenames, or requirements specified (see --help)(5sselfs_expands script_dirsNones install_dirsset_undefined_optionssmapsnormalize_pathssysspathsnormpaths get_site_dirss all_site_dirss site_dirssappends_[1]ssplitsssoss expandusersstripsdsisdirslogswarnsDistutilsOptionErrorseditablescheck_site_dirs index_urls shadow_paths path_itemsinserts allow_hostsshostss package_indexs create_indexs Environments local_indexs find_linkss isinstances basestringslocal_snapshots_oksscan_egg_linkssadd_find_linkssoptimizesints ValueErrorsdelete_conflictingsignore_conflicts_at_my_risksbuild_directorysDistutilsArgErrorsargssoutputs(sselfs path_itemsdsnormpaths_[1]ssshostss site_dirs((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysfinalize_options|sn     E  = (  " cCs|i|iijoti|inzx%|iD]}|i||i q7W|i o|i }|i oBt |i }x0tt |D]}|||||x;|idD]&}|i|||id|q+Wn|i|dS(s=Write all the scripts for `dist`, unless scripts are excludedsscriptssscripts/N( sselfsexclude_scriptssdistsmetadata_isdirsmetadata_listdirs script_namesinstall_scripts get_metadatasinstall_wrapper_scripts(sselfsdists script_name((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysinstall_egg_scriptsrs cCs~tii|oWxdti|D]?\}}}x-|D]%}|i i tii ||q9Wq#Wn|i i |dS(N( sosspathsisdirswalksbasesdirssfilessfilenamesselfsoutputssappendsjoin(sselfspathsdirssfilessfilenamesbase((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys add_output|s+cCs%|iotd|fndS(NsjInvalid argument %r: you can't use filenames or URLs with --editable (except via the --find-links option).(sselfseditablesDistutilsArgErrorsspec(sselfsspec((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys not_editables cCs_|i odSntiitii|i|io t d|i|ifndS(Ns2%r already exists in %s; can't do a checkout there( sselfseditablesosspathsexistssjoinsbuild_directorysspecskeysDistutilsArgError(sselfsspec((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pyscheck_editables (cCstidd}t}|i o|inzit|t  ot |o?|i ||i i||}|it|||tSqtii|o*|i ||it|||tSqt|}n|i||i i|||i|i|i }|tjo2d|}|io|d7}nt|nH|itjo|i|||d|Sn|i||i||SWdtii|ot |nXdS(Nsprefixs easy_install-s+Could not find suitable distribution for %rs2 (--always-copy skips system and development eggs)sUsing(!stempfilesmkdtempstmpdirsNonesdownloadsselfseditablesinstall_site_pys isinstancesspecs Requirements URL_SCHEMEs not_editables package_indexs install_itemsdepssTruesosspathsexistssparse_requirement_argscheck_editablesfetch_distributionsupgrades always_copysdistsmsgsDistutilsErrors precedences DEVELOP_DISTsprocess_distributionslocationsrmtree(sselfsspecsdepssdistsmsgsdownloadstmpdir((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys easy_installs8     (   cCs_|p|i}|ptii||j}|p|id }|o| o:x7|i |i D]}|i |joPqfqfWt}ntidtii||o=|i|||}xZ|D]}|i|||qWn6|i|i|g}|i||d|d|tj o*x'|D]}||jo|Sq8q8WndS(Ns.eggs Processing %sisUsing(sinstall_neededsselfs always_copysosspathsdirnamesdownloadstmpdirsendswithsspecs local_indexs project_namesdistslocationsTrueslogsinfosbasenames install_eggssdistssprocess_distributionsdepsscheck_conflictssegg_distributionsNone(sselfsspecsdownloadstmpdirsdepssinstall_neededsdistsdists((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys install_items,    cGs|i||ii||ii||i|||i|i=%(version)s") # this version or higher s Note also that the installation directory must be on sys.path at runtime for this to work. (e.g. by being the application's script directory, by being on PYTHONPATH, or by being added to sys.path by your code.) sN(smsgsselfs multi_versions no_reports install_dirsmapsnormalize_pathssysspathsdistslocationsegglocs project_namesnamesversionsextrasslocals( sselfsreqsdistswhatsnamesegglocsversionsmsgsextras((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysinstallation_report^s    cCs*tii|}ti}dtSdS(Ns" Extracted editable version of %(spec)s to %(dirname)s If it uses setuptools in its setup script, you can activate it in "development" mode by going to that directory and running:: %(python)s setup.py develop See the setuptools documentation for the "develop" command for more info. (sosspathsdirnames setup_scriptssyss executablespythonslocals(sselfsspecs setup_scriptspythonsdirname((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysreport_editablezs cCstiidttiidtt|}|idjo)d|id}|i dd|n%|idjo|i ddn|i o|i dd nt i d |t|dd i|yt||Wn/tj o#}td |idfnXdS( Nsdistutils.command.bdist_eggsdistutils.command.egg_infoisviis-s-qs-ns Running %s %ss sSetup script exited with %s(ssyssmoduless setdefaults bdist_eggsegg_infoslistsargssselfsverbosesvsinsertsdry_runslogsinfos setup_scriptslens setup_basesjoins run_setups SystemExitsDistutilsError(sselfs setup_scripts setup_basesargssv((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys run_setups  *c Csddg}tidddtii|}z|i||i |||t |g}g}x?|D]7}x.||D]"}|i|i|i|qWqoW| o|i otid|n|SWdt|ti|iXdS(Ns bdist_eggs --dist-dirsprefixs egg-dist-tmp-sdirs+No eggs found in %s (setup script problem?)(sargsstempfilesmkdtempsosspathsdirnames setup_scriptsdist_dirsappendsselfs run_setups setup_bases Environmentsall_eggsseggsskeysdists install_eggslocationsdry_runslogswarnsrmtrees set_verbositysverbose( sselfs setup_scripts setup_basesdistseggssargsskeysdist_dirsall_eggs((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysbuild_and_installs& $  $   cCs|itjodSnx|i|iD]q}|ip|i|ijoNti d||ii ||i|i jo|i i |iqq)q)W|i ox|i|ii joti d|q!ti d||ii ||i|i jo|i i|iq!n|i o|ii|idjoytii|id}tii|oti|nt|d}|i|ii|id|iqndS(Ns&Removing %s from easy-install.pth files4%s is already the active version in easy-install.pths"Adding %s to easy-install.pth files setuptoolsssetuptools.pthswts (sselfspth_filesNonesdistskeysds multi_versionslocationslogsinfosremoves shadow_pathspathssaddsappendsdry_runssavesosspathsjoins install_dirsfilenamesislinksunlinksopensfswrites make_relativesclose(sselfsdistsfsfilenamesd((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys update_pths4      cCstid|||SdS(NsUnpacking %s to %s(slogsdebugssrcsdst(sselfssrcsdst((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysunpack_progresssc sggd}t|||ii oft i t i B}xSD]G}t i |t idBd@}tid||t i||q]WndS(Ncsi|ido|id oi|ni||i|i o|pt SdS(Ns.pys EGG-INFO/( sdstsendswithssrcs startswiths to_compilesappendsselfsunpack_progresssto_chmodsdry_runsNone(ssrcsdst(s to_compilesto_chmodsself(sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pyspfs!imischanging mode of %s to %o(s to_compilesto_chmodspfsunpack_archivesegg_paths destinationsselfs byte_compilesdry_runsstatsS_IXGRPsflagssfsossST_MODEsmodeslogsdebugschmod( sselfsegg_paths destinations to_compilesfspfsmodesflagssto_chmod((sselfs to_compilesto_chmodsCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysunpack_and_compiles   cCsdkl}zgti|id||ddddd|i|io&||d|iddd|inWdti|iXdS(N(s byte_compileisoptimizeisforcesdry_run( sdistutils.utils byte_compileslogs set_verbositysselfsverboses to_compilesdry_runsoptimize(sselfs to_compiles byte_compile((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys byte_compiles  cCs$d|itiiddfSdS(Nsbad install directory or PYTHONPATH You are attempting to install a package to a directory that is not on PYTHONPATH and which Python does not read ".pth" files from. The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: %s and your PYTHONPATH environment variable currently contains: %r Here are some of your options for correcting the problem: * You can choose a different installation directory, i.e., one that is on PYTHONPATH or supports .pth files * You can add the installation directory to the PYTHONPATH environment variable. (It must then also be on PYTHONPATH whenever you run Python and want to use the package(s) you are installing.) * You can set up the installation directory to support ".pth" files by using one of the approaches described here: http://peak.telecommunity.com/EasyInstall.html#custom-installation-locations Please make the appropriate changes for your system and try again.s PYTHONPATHs(sselfs install_dirsossenvironsget(sself((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysno_default_version_msgscCs)|iodSntii|id}tti dd}d}tii |oQt id|it|di}|id otd|qn||joct id ||i o4t|t|d }|i||in|i|gnt|_dS( s8Make sure there's a site.py in the target dir, if neededNssite.pys setuptoolsssChecking existing site.py in %ssrbs def __boot():s;%s is not a setuptools-generated site.py; please remove it.s Creating %sswb(sselfssitepy_installedsosspathsjoins install_dirssitepysresource_strings Requirementsparsessourcescurrentsexistsslogsdebugsopensreads startswithsDistutilsErrorsinfosdry_runsensure_directorysfswritescloses byte_compilesTrue(sselfsfscurrentssourcessitepy((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysinstall_site_py+s(     sposixs install_dirs/$base/lib/python$py_version_short/site-packagess script_dirs $base/bins$base/Lib/site-packagess $base/ScriptscGs%|idi}|io|i}|i|d<|iiti|i }xK|i D]9\}}t||ttjot|||q]q]Wndkl}xs|D]k}t||}|tj oI|||}tidjotii|}nt|||qqWdS(Nsinstallsbase(s subst_varssposix(sselfsget_finalized_commands config_varssprefixscopysINSTALL_SCHEMESsgetsossnamesDEFAULT_SCHEMEsschemesitemssattrsvalsgetattrsNonessetattrsdistutils.utils subst_varssattrsspaths expanduser(sselfsattrssattrsvals subst_varss config_varssscheme((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys_expand`s$      (7s__name__s __module__s__doc__s descriptionsTruescommand_consumes_argumentssNones user_optionssboolean_optionss negative_opts PackageIndexs create_indexsinitialize_optionssdelete_blockerssfinalize_optionssrunspseudo_tempnameswarn_deprecated_optionsscheck_site_dirscant_write_to_targetscheck_pth_processingsinstall_egg_scriptss add_outputs not_editablescheck_editablesFalses easy_installs install_itemsprocess_distributions should_unzips maybe_movesinstall_wrapper_scriptssinstall_scripts write_scripts install_eggssegg_distributions install_eggs install_exes exe_to_eggscheck_conflictssfound_conflictssinstallation_reportsreport_editables run_setupsbuild_and_installs update_pthsunpack_progresssunpack_and_compiles byte_compilesno_default_version_msgsinstall_site_pysdictsINSTALL_SCHEMESsDEFAULT_SCHEMEs_expand(((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys easy_install*sf $  R   ) ) )    ) ) ,    )  " ) / # )    $    ) )  cCstttiidditi}ti g}ti ti jo|i ti nx>|D]6}|o)ti ddfjo#|i tii|ddntidjoI|itii|dd tid dtii|dd gn&|i|tii|ddgti d jo^d |joMtiid}|o0|i tii|ddtid dqqqqdqdWx>ddfD]0}t|}||jo|i |qqWtt|}|SdS(Ns PYTHONPATHssos2emxsriscossLibs site-packagess/slibspythonis site-pythonsdarwinsPython.frameworksHOMEsLibrarysPythonii(sfiltersNonesossenvironsgetssplitspathsepssitedirsssyssprefixsprefixess exec_prefixsappendsplatformspathsjoinssepsextendsversionshomes plat_specificsget_python_libssite_libsmapsnormalize_path(sprefixess plat_specificssitedirssprefixshomessite_lib((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys get_site_dirs}s>* #&%     ccsth}xg|D]_}t|}||joq nd||egg path translations for a given .exe filesPURELIB/ssPLATLIB/sSCRIPTS/sEGG-INFO/scripts/s/iisPKG-INFOis .egg-infois EGG-INFO/s.pths -nspkg.pthsPURELIBsPLATLIBs\simports%s/%s/N(sprefixesszipfilesZipFiles exe_filenameszsinfolistsinfosfilenamesnamessplitspartsslensendswithsinsertsjoins yield_linessreadspthsstripsreplaces startswithsappendsclosessortsreverse(s exe_filenamesinfosnamespthsprefixesspartssz((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysget_exe_prefixess4!  $# $5 cCs>yti|SWn&tj otd|fnXdS(Ns1Not a URL, existing file, or requirement spec: %r(s Requirementsparsesspecs ValueErrorsDistutilsError(sspec((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysparse_requirement_argscBsJtZdZeZdZdZdZdZdZ dZ RS(s)A .pth file with Distribution paths in itcCs~||_ttii|i|_|iti |gt t x0t |i D]}t |it|tqWWdS(N(sfilenamesselfsnormalize_pathsosspathsdirnamesbasedirs_loads Environments__init__sNones yield_linesspathssmapsaddsfind_distributionssTrue(sselfsfilenamespath((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys__init__&s   cCsxg|_t}h}tii|ioxt |idD]}|i do t }q>n|i }|ii||i p|ii doq>nttii|i|}|idnd||Wn|io| o t |_nx1|io|idi o|iiqCWdS(Nsrtsimports#ii(sselfspathssFalses saw_importsseensosspathsisfilesfilenamesopenslines startswithsTruesrstripsappendsstripsnormalize_pathsjoinsbasedirsexistsspopsdirty(sselfs saw_importspathsseensline((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys_load-s0  $)!   cCs|i odSndit|i|i}|ottid|i d|}t i i |i ot i |i nt|i d}|i||in>t i i|i o'tid|i t i |i nt|_dS(s$Write changed .pth file back to diskNs s Saving %ssimport sys; sys.__plen = len(sys.path) %s import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new) swbsDeleting empty %s(sselfsdirtysjoinsmaps make_relativespathssdataslogsdebugsfilenamesosspathsislinksunlinksopensfswritesclosesexistssFalse(sselfsfsdata((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pyssaveJs  cCsG|i|ijo |ii|it|_nti||dS(s"Add `dist` to the distribution mapN( sdistslocationsselfspathssappendsTruesdirtys Environmentsadd(sselfsdist((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysaddfs cCsKx4|i|ijo |ii|it|_qWti||dS(s'Remove `dist` from the distribution mapN(sdistslocationsselfspathssremovesTruesdirtys Environment(sselfsdist((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysremovels !cCstiit|\}}t|i}|g}ti djodpti }x|t||jod||ijo+|i ti|i|i|Sntii|\}}|i |qYW|SdS(Ns/(sosspathssplitsnormalize_pathsnpathslastslensselfsbasedirsbaselenspartssaltsepssepsappendscurdirsreversesjoin(sselfspathslastsnpathssepspartssbaselen((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys make_relativess   ( s__name__s __module__s__doc__sFalsesdirtys__init__s_loadssavesaddsremoves make_relative(((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysPthDistributions!s      cCsdkl}|did}|i|}d}|o/|idpd}|od|}qln|o d}n t |}dt }t |d d id |joP|o2|iid od |id}qnd }dt }n|Sd S(s;Create a #! line, getting options (if any) from script_text(s first_line_res isis s python.exes#!%(executable)s%(options)s sasciisignores-s -xN(sdistutils.command.build_scriptss first_line_res script_texts splitlinessfirstsmatchsoptionssgroupswininsts executables nt_quote_argslocalsshdrsunicodesencodesstrips startswith(s script_texts executableswininstshdrs first_line_resoptionssmatchsfirst((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysget_script_headers(    "cCs|tijo tidjo!ti|ti||Snti }|d|dd|ddd||ffdS(Nsntiis %s %s( sfuncsossremovesnameschmodsargsstatsS_IWRITEssyssexc_infosexc(sfuncsargsexc((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys auto_chmods   cCs.dkl}t||t|tidS(s?Ensure that the importer caches dont have stale info for `path`(s_zip_directory_cacheN(s zipimports_zip_directory_cacheszdcs_uncachespathssysspath_importer_cache(spathszdc((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysuncache_zipdirs  cCs[||jo ||=n@t|}x0|D](}t||jo||=dSq+q+WdS(N(spathscachesnormalize_pathsp(spathscachesp((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys_uncaches   scCs<yt||dWnttfj o tSnXtSdS(s%Is this string a valid Python script?sexecN(scompilestextsfilenames SyntaxErrors TypeErrorsFalsesTrue(stextsfilename((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys is_pythons  cCs$g}t}d}d|jp d|j}|o|idnx|D]}|djo|d7}qJ|djo#|id|ddd}qJ|o|id|d}n|i|qJW|o|id|n|o"|id||idnd i|Sd S( s@Quote a command line argument according to Windows parsing rulesis s s"s\iis\"sN(sresultsFalses needquotesnbsargsappendscsjoin(sargscs needquotesnbsresult((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys nt_quote_args0    cCsv|idp |idotSnt||otSn|idod|idijSntSdS(sMIs this text, as a whole, a Python script? (as opposed to shell/bat/etc. s.pys.pyws#!spythoniN( sfilenamesendswithsTrues is_pythons script_texts startswiths splitlinesslowersFalse(s script_textsfilename((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysis_python_scripts c cst|i}td||}xxddfD]j}xa|i |i D]J\} }dt }tidjp|o |djo4ddf\} } dg}tid d |}n7d d f\} } d ddg}tidd|}tii|dd!p tidjo |} n|} | | | |dgi} |D]}| | |qM~ fV| dtd| dfVqM| ||fVqMWq1WdS(sEYield write_script() argument tuples for a distribution's entrypointsssconsole_scriptss gui_scriptss# EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r __requires__ = %(spec)r import sys from pkg_resources import load_entry_point sys.exit( load_entry_point(%(spec)r, %(group)r, %(name)r)() ) swin32s -script.pywsgui.exes.pyws(?i)python.exes pythonw.exes -script.pyscli.exes.pys.pycs.pyos(?i)pythonw.exes python.exeiists.exes setuptoolssbN(sstrsdistsas_requirementsspecsget_script_headers executableswininstsheadersgroups get_entry_mapsitemssnamesepslocalss script_textssyssplatformsextslaunchersoldsressubs new_headersosspathsexistsshdrsappends_[1]sxsresource_string(sdists executableswininsts new_headersheadersoldsepsgroupsspecshdrsnameslaunchers_[1]sextsxs script_text((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysget_script_argss,     * =cCs|o d}n|tjo d}ng}yti|}Wn1tij o"}|ti|t i nXx|D]}tii ||}yti|i}Wntij o d}nXti|ot|||qyti|Wqtij o"}|ti|t i qXqWyti|Wn/tij o |ti|t i nXdS(sRecursively delete a directory tree. This code is taken from the Python 2.4 version of 'shutil', because the 2.3 version doesn't really work right. cGsdS(N((sargs((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysonerrorGscGsdS(N((sargs((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysonerrorJsiN(s ignore_errorssonerrorsNonesnamessosslistdirspathserrorserrssyssexc_infosnamesjoinsfullnameslstatsst_modesmodesstatsS_ISDIRsrmtreesremovesrmdir(spaths ignore_errorssonerrorsnameserrsnamessfullnamesmode((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysrmtree@s6    "cCsJdk}tii|id}|tids(s with_ei_usage(sselfsargsskw(s with_ei_usages Distribution(sselfsargsskwsCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys _show_helps(s__name__s __module__s _show_help((s Distributions with_ei_usage(sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysDistributionWithoutHelpCommandssics7ddddgdtidpddS(Ns script_argss-qs easy_installs-vs script_nameis distclass(ssetupsargvssyssDistributionWithoutHelpCommandsskw((ssetupskwsDistributionWithoutHelpCommandssargv(sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pyss( s setuptoolsssetupssetuptools.dists Distributionsdistutils.cores distutilssUSAGEs gen_usages with_ei_usagesDistributionWithoutHelpCommandssargvsNonessys( sargvskws gen_usages distutilsssetupsUSAGEs Distributions with_ei_usagesDistributionWithoutHelpCommands(( sargvskws gen_usages distutilsssetupsUSAGEs Distributions with_ei_usagesDistributionWithoutHelpCommandssCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pysmainis     (>s__doc__ssyssos.pathsoss zipimportsshutilstempfileszipfilesresstatsrandomsglobs setuptoolssCommandssetuptools.sandboxs run_setups distutilsslogsdir_utilsdistutils.sysconfigsget_python_libsdistutils.errorssDistutilsArgErrorsDistutilsOptionErrorsDistutilsErrorssetuptools.archive_utilsunpack_archivessetuptools.package_indexs PackageIndexsparse_bdist_wininsts URL_SCHEMEssetuptools.commands bdist_eggsegg_infos pkg_resourcesspathsnormpaths executablessys_executables__all__ssamefiles easy_installs get_site_dirss expand_pathssextract_wininst_cfgsget_exe_prefixessparse_requirement_args EnvironmentsPthDistributionssFalsesget_script_headers auto_chmodsuncache_zipdirs_uncaches is_pythons nt_quote_argsis_python_scriptsget_script_argssrmtrees bootstrapsNonesmain(-srandoms get_site_dirssdir_utilsshutilsDistutilsArgErrorslogs__all__stempfilesis_python_scriptsparse_bdist_wininstsPthDistributionssres is_pythonsextract_wininst_cfgsmains nt_quote_argsget_script_headerssamefilesstats zipimportsunpack_archives PackageIndexs auto_chmodsglobszipfilesparse_requirement_argssyssuncache_zipdirsCommandsrmtreessys_executablesDistutilsOptionErrorsDistutilsErrorsget_script_argssget_exe_prefixess URL_SCHEMEsegg_infos bootstraps run_setups easy_installs bdist_eggs_uncaches expand_pathssossget_python_lib((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/command/easy_install.pys? sJQ       W ) ) ) ! a    ) ))# PKC8/vZZ#setuptools/tests/test_resources.pyo; _Fc@sdklZlZdkTdkZdkZyeWn ej odklZnXde fdYZ defdYZ defd YZ d efd YZ d efd YZdS((sTestCases makeSuite(s*N(s ImmutableSetsMetadatacBs2tZdZdZdZdZdZRS(sAMock object to return metadata as if from an on-disk distributioncGst||_dS(N(sdictspairssselfsmetadata(sselfspairs((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys__init__ scCs||ijSdS(N(snamesselfsmetadata(sselfsname((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys has_metadatascCs|i|SdS(N(sselfsmetadatasname(sselfsname((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys get_metadatascCst|i|SdS(N(s yield_linessselfs get_metadatasname(sselfsname((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pysget_metadata_liness(s__name__s __module__s__doc__s__init__s has_metadatas get_metadatasget_metadata_lines(((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pysMetadata s    s DistroTestscBsetZdZdZdZdZdZdZfdZdZ d Z d Z RS( NcCstgdtdt}|it|g|i|dg|itid|itid|itid|i |d|it|dg|igi }|dD]}||i q~dd d g|i|dd |igi }|dD]}||i q~dd g|itid |igi }|dD]}||i qp~d dd gtg}tid}tid}td\}|i|i||i d |i||i|i||i dtg}|i||i||it|i||tg}|i||i||i||i|i||i ddS(NsplatformspythonsFooPkgsFooPkg-1.3_1.eggsFooPkg-1.4-py2.4-win32.eggsFooPkg-1.2-py2.4.eggsfoopkgs1.4s1.3-1s1.2isFooPkg-1.9.eggs1.9s FooPkg>=1.3(s EnvironmentsNonesadsselfs assertEqualslistsadds Distributions from_filenames failUnlesssappends_[1]sdistsversionsremoves WorkingSetswssfoo12sfoo14sparse_requirementssreqs best_matchs assertRaisessVersionConflict(sselfs_[1]sdistsadsreqswssfoo12sfoo14((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestCollections.A>A ,&3cCs||i|id|i|id|i|id|i|id|i|id|i|it ddS(NsFooPkgsfoopkgs1.3-1s2.4swin32( sselfs assertEqualsds project_nameskeysversions py_versionsplatformsparsed_versions parse_version(sselfsd((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys checkFooPkgMs c Csntddddddddd }|i|td}|i|itid |i|it dS( Ns /some/paths project_namesFooPkgsversions1.3-1s py_versions2.4splatformswin32i( s Distributionsdsselfs checkFooPkgs assertEquals py_versionssyssversionsplatformsNone(sselfsd((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestDistroBasicsUs   cCs<tid}|i|tid}|i|dS(NsFooPkg-1.3_1-py2.4-win32.eggs!FooPkg-1.3_1-py2.4-win32.egg-info(s Distributions from_filenamesdsselfs checkFooPkg(sselfsd((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestDistroParse`s c CsAtddddddddtd d f}|i|dS( Ns /some/paths project_namesFooPkgs py_versions2.4splatformswin32smetadatasPKG-INFOs%Metadata-Version: 1.0 Version: 1.3-1 (s DistributionsMetadatasdsselfs checkFooPkg(sselfsd((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestDistroMetadatafscCs tddtd|fSdS(Ns/foosmetadatas depends.txt(s DistributionsMetadatastxt(sselfstxt((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys distRequirespscCs/|it|i|tt|dS(N(sselfs assertEqualslistsdistsrequiressextrassparse_requirementsstxt(sselfsdiststxtsextras((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys checkRequiressscCs4x-ddfD]}|i|i||q WdS(Ns Twisted>=1.5sTwisted>=1.5 ZConfig>=2.0(svsselfs checkRequiress distRequires(sselfsv((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestDistroDependsSimpleys cCstg}tg}|it|ig|g|it |it d|t i ddt ddf}|i||it i dxUtdD]G}t|it d|}|i||gt|i|qW|it|it d|tg}|it |it d |t i d dt ddf}|i||it|it d |||g|it|it d |dS( NsFoos/foo_dir/Foo-1.2.eggsmetadatas depends.txts[bar] Baz>=2.0s Foo-0.9.eggisFoo==0.9sFoo[bar]s/foo_dir/Baz-2.1.eggsFoo==1.2 Foo!=1.2(s Environmentsads WorkingSetswssselfs assertEqualslistsresolves assertRaisessDistributionNotFoundsparse_requirementss Distributions from_filenamesMetadatasFoosaddsrangesistargetssmapsVersionConflictsBaz(sselfsadsBazstargetssiswssFoo((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys testResolve~s(" #  ! . cCs|id}|i|d|i|didg|i|didg|i|diddg|i|diddg|it|id gdS( Ns Twisted>=1.5 [docgen] ZConfig>=2.0 docutils>=0.3 [fastcgi] fcgiapp>=0.1s Twisted>=1.5s'Twisted>=1.5 ZConfig>=2.0 docutils>=0.3sdocgensTwisted>=1.5 fcgiapp>=0.1sfastcgis4Twisted>=1.5 ZConfig>=2.0 docutils>=0.3 fcgiapp>=0.1s4Twisted>=1.5 fcgiapp>=0.1 ZConfig>=2.0 docutils>=0.3sfoo(sselfs distRequiressds checkRequiresssplits assertRaisess UnknownExtrasrequires(sselfsd((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestDistroDependsOptionss  ( s__name__s __module__stestCollections checkFooPkgstestDistroBasicsstestDistroParsestestDistroMetadatas distRequiress checkRequiresstestDistroDependsSimples testResolvestestDistroDependsOptions(((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys DistroTestss 3      )sEntryPointTestscBsVtZdZdZdZdZdZdZdZdZ d Z RS( NcCs|i|id|i|id|i|idf|i|idf|i|it j|it |ddS(Nsfoossetuptools.tests.test_resourcessEntryPointTestssxs9foo = setuptools.tests.test_resources:EntryPointTests [x]( sselfs assertEqualsepsnames module_namesattrssextrass failUnlesssloadsEntryPointTestssstr(sselfsep((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys assertfieldsscCs(tiddtddf|_dS(NsFooPkg-1.2-py2.4.eggsmetadatas requires.txts[x](s Distributions from_filenamesMetadatasselfsdist(sself((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pyssetUpscCs2tdddgdg|i}|i|dS(Nsfoossetuptools.tests.test_resourcessEntryPointTestssx(s EntryPointsselfsdistseps assertfields(sselfsep((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys testBasicsscCsd}ti||i}|i|tid}|i|id|i|i d|i|i f|i|i dftid}|i|id|i|i d|i|i d f|i|i fdS( Ns9foo = setuptools.tests.test_resources:EntryPointTests [x]sbar baz= spammity[PING]sbar bazsspammityspings fizzly = wocka:foosfizzlyswockasfoo( sss EntryPointsparsesselfsdistseps assertfieldss assertEqualsnames module_namesattrssextras(sselfsssep((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys testParses cCs]xVddddddgD]<}yti|Wntj oqXtd|qWdS(Nsfoosx=1=2sx=a:b:csq=x/nasfez=pish:tush-zsx=f[a]>2sShould've been bad(seps EntryPointsparses ValueErrorsAssertionError(sselfsep((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys testRejectsscCs|it|ddS(Ns{'feature2': EntryPoint.parse('feature2 = another.module:SomeClass [extra1,extra2]'), 'feature3': EntryPoint.parse('feature3 = this.module [something]'), 'feature1': EntryPoint.parse('feature1 = somemodule:somefunction')}(sselfs assertEqualsstrsm(sselfsm((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys checkSubMapss # define features for blah blah feature1 = somemodule:somefunction feature2 = another.module:SomeClass [extra1,extra2] feature3 = this.module [something] cCsX|itid|i|ittidd|ittidddgdS(Nsxyzsx asfoo=barsxsfoo=baz(sselfs checkSubMaps EntryPoints parse_groups submap_strs assertRaisess ValueError(sself((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys testParseListscCstihd|i<}|i|d|i|idgtid|i}|i|d|i|idg|it tiddg|it ti|idS(Nsxyzs[xyz] s[xyz]( s EntryPoints parse_mapsselfs submap_strsms checkSubMaps assertEqualskeyss assertRaisess ValueError(sselfsm((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys testParseMaps( s__name__s __module__s assertfieldsssetUps testBasicss testParses testRejectss checkSubMaps submap_strs testParseLists testParseMap(((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pysEntryPointTestss      sRequirementsTestscBs>tZdZdZdZdZdZdZRS(NcCstid}|it|d|it|d|i|tdddfgf|i|tdddfgf|i|tdddfgf|i|tdddfgf|i|tddd fgf|i|tid dS( Ns Twisted>=1.2s!Requirement.parse('Twisted>=1.2')sTwisteds>=s1.2stwisTeds2.0sZopes3.0sTwisted[extras]>=1.2(s Requirementsparsesrsselfs assertEqualsstrsreprsassertNotEqual(sselfsr((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys testBasics$s%%%%%cCstdddfddfgf}tdddfddfgf}|i|||it|t||it|ddS(NsTwisteds==s1.2c1s>=s1.2sTwisted==1.2c1,>=1.2(s Requirementsr1sr2sselfs assertEqualsstr(sselfsr1sr2((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys testOrdering/s $$cCstdddfgf}tid}tid}tid}|it d|j|it d|j|id|j|id|j|i||j|i||j|i||jdS(NsTwisteds>=s1.2sFooPkg-1.3_1.eggsTwisted-1.1.eggsTwisted-1.2.eggs1.1( s Requirementsrs Distributions from_filenamesfoo_diststwist11stwist12sselfs failUnlesss parse_version(sselfsrsfoo_diststwist11stwist12((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestBasicContains6sc Cstd\}xEdddddddd d f D]"}|i||j||fq1WxBd d d dddddfD]"}|i||j||fqvWdS(Ns*Foo>=1.2,<=1.3,==1.9,>2.0,!=2.5,<3.0,==4.5s1.2s1.2.2s1.3s1.9s2.0.1s2.3s2.6s3.0c1s4.5s1.2c1s1.3.1s1.5s1.9.1s2.0s2.5s3.0s4.0(sparse_requirementssrsvsselfs failUnless(sselfsrsv((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestAdvancedContainsCs" cCstid}tid}tid}|i|||i|||i|iddf|i|iddf|it|t||it|tddt dfft ddgfdS( NsTwisted[foo,bar]>=1.2sTwisted[bar,FOO]>=1.2sTwisted[BAR,FOO]>=1.2.0sfoosbarstwisteds>=s1.2( s Requirementsparsesr1sr2sr3sselfs assertEqualsextrasshashs parse_versions frozenset(sselfsr1sr2sr3((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestOptionsAndHashingKscCstid}tid}ti}|i|d|j|i|d|j|i|d|j|i |d|j|i |d|j|i |d|j|i |d|jdS(Nssetuptools==0.3a2ssetuptools!=0.3a4ssetuptools-0.3a4.eggssetuptools-0.3a1.eggssetuptools-0.3a2.eggssetuptools-0.3a3.eggssetuptools-0.3a5.egg( s Requirementsparsesr1sr2s Distributions from_filenamesdsselfsfailIfs failUnless(sselfsr1sr2sd((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestVersionEqualityYs (s__name__s __module__s testBasicss testOrderingstestBasicContainsstestAdvancedContainsstestOptionsAndHashingstestVersionEquality(((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pysRequirementsTests"s    s ParseTestscBsPtZdZdZdZdZdZdZdZdZ RS( NcCs |ittdgdS(Ns(sselfs assertEqualslistsparse_requirements(sself((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestEmptyParsevscCsxxggfddgfgggfdddgfddgddgfgD]+\}}|itti||qLWdS(Nsxs x ysysx (sinpsoutsselfs assertEqualslists pkg_resourcess yield_lines(sselfsinpsout((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys testYieldingysL cCs{|ittidtdgfdddgfddgfdgfd d gfg|itttid dS( Ns x [Y] z a [b ] # foo c [ d] [q] v sxsYszsasbscsdsqsvs[foo(sselfs assertEqualslists pkg_resourcesssplit_sectionssNones assertRaisess ValueError(sself((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys testSplittingsCcCsr|itdd|itdd|itdd|itdd|itdddS( Ns adns-pythons WSGI Utilss WSGI-Utilss WSGI Utilss Money$$$Makers Money-Makerspeak.webspeak-web(sselfs assertEquals safe_namesassertNotEqual(sself((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys testSafeNames cCsr|itdd|itdd|itdd|itdd|itdddS( Ns1.2-1s 1.2 alphas 1.2.alphas2.3.4 20050521s2.3.4.20050521s Money$$$Makers Money-Makerspeak.web(sselfs assertEquals safe_version(sself((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestSafeVersions cCs|ittdtdddfgfg|ittdtdddfdd fgfg|itid td d d fgf|ittid|ittid|ittid|ittid|ittiddS(NsTwis-Ted>=1.2-1sTwis-Teds>=s1.2-1sTwisted >=1.2, \ # more <2.0sTwisteds1.2s=2.3sx\sx==2 qs X==1 Y==2s#(sselfs assertEqualslistsparse_requirementss Requirementsparses assertRaisess ValueError(sself((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestSimpleRequirementss(csd}|dd|dd|dd|dd|d d |d d |d d|d d|dd|dddS(NcsAt|t|f\}}i||||||fdS(N(s parse_versionss1ss2sp1sp2sselfs assertEqual(ss1ss2sp2sp1(sself(sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pyscss1.2-rc1s1.2rc1s0.4s0.4.0s0.4.0.0s0.4.0-0s0.4-0s0pl1s0.0pl1s0pre1s0.0c1s 0.0.0preview1s0c1s0-rc1s1.2a1s1.2.a.1s1.2...as1.2a(sc(sselfsc((sselfsCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestVersionEqualitys         csId}|dd|dd|dd|dd|dd |dd|dd |d d|d d |dd|dd|dd|dd|dd|dd|dd|dd|dddi}x@t|D]2\}}x#||d D]}|||q*WqWdS(!NcsDt|t|f\}}i||j||||fdS(N(s parse_versionss1ss2sp1sp2sselfs failUnless(ss1ss2sp2sp1(sself(sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pyscss2.1s2.1.1s2a1s2b0s2.3a1s2.3s2.1-1s2.1-2s2.1pl4s2.1a0-20040501s1.1s02.1sA56sB27s3.2s3.2.pl0s3.2-1s3.2pl1s3.2pl1-1s0.4s4.0s0.0.4s0.4.0s0pl1s0.4pl1s 2.1.0-rc1s2.1.0s2.1devs2.1a0s 0.80.1-3 0.80.1-2 0.80.1-1 0.79.9999+0.80.0pre4-1 0.79.9999+0.80.0pre2-3 0.79.9999+0.80.0pre2-2 0.77.2-1 0.77.1-1 0.77.0-1 i(scssplitstortures enumeratespsv1sv2(sselfscstorturesv1spsv2((sselfsCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestVersionOrderings2                     ( s__name__s __module__stestEmptyParses testYieldings testSplittings testSafeNamestestSafeVersionstestSimpleRequirementsstestVersionEqualitystestVersionOrdering(((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys ParseTeststs       (sunittestsTestCases makeSuites pkg_resourcesssyss frozensets NameErrorssetss ImmutableSets EmptyProvidersMetadatas DistroTestssEntryPointTestssRequirementsTestss ParseTests( ssyss ParseTestss makeSuites pkg_resourcessRequirementsTestssTestCases DistroTestssEntryPointTestss frozensetsMetadata((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys?sRRPK45]I,//setuptools/tests/__init__.py"""Tests for the 'setuptools' package""" from unittest import TestSuite, TestCase, makeSuite, defaultTestLoader import distutils.core, distutils.cmd from distutils.errors import DistutilsOptionError, DistutilsPlatformError from distutils.errors import DistutilsSetupError import setuptools, setuptools.dist from setuptools import Feature from distutils.core import Extension from setuptools.depends import extract_constant, get_module_constant from setuptools.depends import find_module, Require from distutils.version import StrictVersion, LooseVersion from distutils.util import convert_path import sys, os.path def additional_tests(): import doctest, unittest suite = unittest.TestSuite(( doctest.DocFileSuite( 'api_tests.txt', optionflags=doctest.ELLIPSIS, package='pkg_resources', ), )) if sys.platform == 'win32': suite.addTest(doctest.DocFileSuite('win_script_wrapper.txt')) return suite def makeSetup(**args): """Return distribution from 'setup(**args)', without executing commands""" distutils.core._setup_stop_after = "commandline" # Don't let system command line leak into tests! args.setdefault('script_args',['install']) try: return setuptools.setup(**args) finally: distutils.core_setup_stop_after = None class DependsTests(TestCase): def testExtractConst(self): from setuptools.depends import extract_constant def f1(): global x,y,z x = "test" y = z # unrecognized name self.assertEqual(extract_constant(f1.func_code,'q', -1), None) # constant assigned self.assertEqual(extract_constant(f1.func_code,'x', -1), "test") # expression assigned self.assertEqual(extract_constant(f1.func_code,'y', -1), -1) # recognized name, not assigned self.assertEqual(extract_constant(f1.func_code,'z', -1), None) def testFindModule(self): self.assertRaises(ImportError, find_module, 'no-such.-thing') self.assertRaises(ImportError, find_module, 'setuptools.non-existent') f,p,i = find_module('setuptools.tests'); f.close() def testModuleExtract(self): from distutils import __version__ self.assertEqual( get_module_constant('distutils','__version__'), __version__ ) self.assertEqual( get_module_constant('sys','version'), sys.version ) self.assertEqual( get_module_constant('setuptools.tests','__doc__'),__doc__ ) def testRequire(self): req = Require('Distutils','1.0.3','distutils') self.assertEqual(req.name, 'Distutils') self.assertEqual(req.module, 'distutils') self.assertEqual(req.requested_version, '1.0.3') self.assertEqual(req.attribute, '__version__') self.assertEqual(req.full_name(), 'Distutils-1.0.3') from distutils import __version__ self.assertEqual(req.get_version(), __version__) self.failUnless(req.version_ok('1.0.9')) self.failIf(req.version_ok('0.9.1')) self.failIf(req.version_ok('unknown')) self.failUnless(req.is_present()) self.failUnless(req.is_current()) req = Require('Distutils 3000','03000','distutils',format=LooseVersion) self.failUnless(req.is_present()) self.failIf(req.is_current()) self.failIf(req.version_ok('unknown')) req = Require('Do-what-I-mean','1.0','d-w-i-m') self.failIf(req.is_present()) self.failIf(req.is_current()) req = Require('Tests', None, 'tests', homepage="http://example.com") self.assertEqual(req.format, None) self.assertEqual(req.attribute, None) self.assertEqual(req.requested_version, None) self.assertEqual(req.full_name(), 'Tests') self.assertEqual(req.homepage, 'http://example.com') paths = [os.path.dirname(p) for p in __path__] self.failUnless(req.is_present(paths)) self.failUnless(req.is_current(paths)) class DistroTests(TestCase): def setUp(self): self.e1 = Extension('bar.ext',['bar.c']) self.e2 = Extension('c.y', ['y.c']) self.dist = makeSetup( packages=['a', 'a.b', 'a.b.c', 'b', 'c'], py_modules=['b.d','x'], ext_modules = (self.e1, self.e2), package_dir = {}, ) def testDistroType(self): self.failUnless(isinstance(self.dist,setuptools.dist.Distribution)) def testExcludePackage(self): self.dist.exclude_package('a') self.assertEqual(self.dist.packages, ['b','c']) self.dist.exclude_package('b') self.assertEqual(self.dist.packages, ['c']) self.assertEqual(self.dist.py_modules, ['x']) self.assertEqual(self.dist.ext_modules, [self.e1, self.e2]) self.dist.exclude_package('c') self.assertEqual(self.dist.packages, []) self.assertEqual(self.dist.py_modules, ['x']) self.assertEqual(self.dist.ext_modules, [self.e1]) # test removals from unspecified options makeSetup().exclude_package('x') def testIncludeExclude(self): # remove an extension self.dist.exclude(ext_modules=[self.e1]) self.assertEqual(self.dist.ext_modules, [self.e2]) # add it back in self.dist.include(ext_modules=[self.e1]) self.assertEqual(self.dist.ext_modules, [self.e2, self.e1]) # should not add duplicate self.dist.include(ext_modules=[self.e1]) self.assertEqual(self.dist.ext_modules, [self.e2, self.e1]) def testExcludePackages(self): self.dist.exclude(packages=['c','b','a']) self.assertEqual(self.dist.packages, []) self.assertEqual(self.dist.py_modules, ['x']) self.assertEqual(self.dist.ext_modules, [self.e1]) def testEmpty(self): dist = makeSetup() dist.include(packages=['a'], py_modules=['b'], ext_modules=[self.e2]) dist = makeSetup() dist.exclude(packages=['a'], py_modules=['b'], ext_modules=[self.e2]) def testContents(self): self.failUnless(self.dist.has_contents_for('a')) self.dist.exclude_package('a') self.failIf(self.dist.has_contents_for('a')) self.failUnless(self.dist.has_contents_for('b')) self.dist.exclude_package('b') self.failIf(self.dist.has_contents_for('b')) self.failUnless(self.dist.has_contents_for('c')) self.dist.exclude_package('c') self.failIf(self.dist.has_contents_for('c')) def testInvalidIncludeExclude(self): self.assertRaises(DistutilsSetupError, self.dist.include, nonexistent_option='x' ) self.assertRaises(DistutilsSetupError, self.dist.exclude, nonexistent_option='x' ) self.assertRaises(DistutilsSetupError, self.dist.include, packages={'x':'y'} ) self.assertRaises(DistutilsSetupError, self.dist.exclude, packages={'x':'y'} ) self.assertRaises(DistutilsSetupError, self.dist.include, ext_modules={'x':'y'} ) self.assertRaises(DistutilsSetupError, self.dist.exclude, ext_modules={'x':'y'} ) self.assertRaises(DistutilsSetupError, self.dist.include, package_dir=['q'] ) self.assertRaises(DistutilsSetupError, self.dist.exclude, package_dir=['q'] ) class FeatureTests(TestCase): def setUp(self): self.req = Require('Distutils','1.0.3','distutils') self.dist = makeSetup( features={ 'foo': Feature("foo",standard=True,require_features=['baz',self.req]), 'bar': Feature("bar", standard=True, packages=['pkg.bar'], py_modules=['bar_et'], remove=['bar.ext'], ), 'baz': Feature( "baz", optional=False, packages=['pkg.baz'], scripts = ['scripts/baz_it'], libraries=[('libfoo','foo/foofoo.c')] ), 'dwim': Feature("DWIM", available=False, remove='bazish'), }, script_args=['--without-bar', 'install'], packages = ['pkg.bar', 'pkg.foo'], py_modules = ['bar_et', 'bazish'], ext_modules = [Extension('bar.ext',['bar.c'])] ) def testDefaults(self): self.failIf( Feature( "test",standard=True,remove='x',available=False ).include_by_default() ) self.failUnless( Feature("test",standard=True,remove='x').include_by_default() ) # Feature must have either kwargs, removes, or require_features self.assertRaises(DistutilsSetupError, Feature, "test") def testAvailability(self): self.assertRaises( DistutilsPlatformError, self.dist.features['dwim'].include_in, self.dist ) def testFeatureOptions(self): dist = self.dist self.failUnless( ('with-dwim',None,'include DWIM') in dist.feature_options ) self.failUnless( ('without-dwim',None,'exclude DWIM (default)') in dist.feature_options ) self.failUnless( ('with-bar',None,'include bar (default)') in dist.feature_options ) self.failUnless( ('without-bar',None,'exclude bar') in dist.feature_options ) self.assertEqual(dist.feature_negopt['without-foo'],'with-foo') self.assertEqual(dist.feature_negopt['without-bar'],'with-bar') self.assertEqual(dist.feature_negopt['without-dwim'],'with-dwim') self.failIf('without-baz' in dist.feature_negopt) def testUseFeatures(self): dist = self.dist self.assertEqual(dist.with_foo,1) self.assertEqual(dist.with_bar,0) self.assertEqual(dist.with_baz,1) self.failIf('bar_et' in dist.py_modules) self.failIf('pkg.bar' in dist.packages) self.failUnless('pkg.baz' in dist.packages) self.failUnless('scripts/baz_it' in dist.scripts) self.failUnless(('libfoo','foo/foofoo.c') in dist.libraries) self.assertEqual(dist.ext_modules,[]) self.assertEqual(dist.require_features, [self.req]) # If we ask for bar, it should fail because we explicitly disabled # it on the command line self.assertRaises(DistutilsOptionError, dist.include_feature, 'bar') def testFeatureWithInvalidRemove(self): self.assertRaises( SystemExit, makeSetup, features = {'x':Feature('x', remove='y')} ) class TestCommandTests(TestCase): def testTestIsCommand(self): test_cmd = makeSetup().get_command_obj('test') self.failUnless(isinstance(test_cmd, distutils.cmd.Command)) def testLongOptSuiteWNoDefault(self): ts1 = makeSetup(script_args=['test','--test-suite=foo.tests.suite']) ts1 = ts1.get_command_obj('test') ts1.ensure_finalized() self.assertEqual(ts1.test_suite, 'foo.tests.suite') def testDefaultSuite(self): ts2 = makeSetup(test_suite='bar.tests.suite').get_command_obj('test') ts2.ensure_finalized() self.assertEqual(ts2.test_suite, 'bar.tests.suite') def testDefaultWModuleOnCmdLine(self): ts3 = makeSetup( test_suite='bar.tests', script_args=['test','-m','foo.tests'] ).get_command_obj('test') ts3.ensure_finalized() self.assertEqual(ts3.test_module, 'foo.tests') self.assertEqual(ts3.test_suite, 'foo.tests.test_suite') def testConflictingOptions(self): ts4 = makeSetup( script_args=['test','-m','bar.tests', '-s','foo.tests.suite'] ).get_command_obj('test') self.assertRaises(DistutilsOptionError, ts4.ensure_finalized) def testNoSuite(self): ts5 = makeSetup().get_command_obj('test') ts5.ensure_finalized() self.assertEqual(ts5.test_suite, None) PKC8,YBBsetuptools/tests/__init__.pyo; Ec@sIdZdklZlZlZlZdkZdkZdk l Z l Z dk l Z dk Z dkZ dk lZdklZdklZlZdklZlZd klZlZd klZdkZdkZd Zd Zd efdYZ defdYZ!defdYZ"defdYZ#dS(s"Tests for the 'setuptools' package(s TestSuitesTestCases makeSuitesdefaultTestLoaderN(sDistutilsOptionErrorsDistutilsPlatformError(sDistutilsSetupError(sFeature(s Extension(sextract_constantsget_module_constant(s find_modulesRequire(s StrictVersions LooseVersion(s convert_pathcCsndk}dk}|i|idd|iddf}tidjo|i|idn|SdS(Ns api_tests.txts optionflagsspackages pkg_resourcesswin32swin_script_wrapper.txt( sdoctestsunittests TestSuites DocFileSuitesELLIPSISssuitessyssplatformsaddTest(ssuitesunittestsdoctest((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pysadditional_testss cKsAdti_|iddgzti|SWdtt_XdS(sDReturn distribution from 'setup(**args)', without executing commandss commandlines script_argssinstallN( s distutilsscores_setup_stop_aftersargss setdefaults setuptoolsssetupsNonescore_setup_stop_after(sargs((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pys makeSetups s DependsTestscBs,tZdZdZdZdZRS(NcCsdkl}d}|i||iddt|i||iddd|i||iddd|i||iddtdS( N(sextract_constantcCsdatadS(Nstest(sxszsy(((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pysf15ssqisxstestsysz(ssetuptools.dependssextract_constantsf1sselfs assertEquals func_codesNone(sselfsf1sextract_constant((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pystestExtractConst1s   cCsI|ittd|ittdtd\}}}|idS(Nsno-such.-thingssetuptools.non-existentssetuptools.tests(sselfs assertRaisess ImportErrors find_modulesfspsisclose(sselfsisfsp((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pystestFindModuleGscCs_dkl}|itdd||itddti|itddtdS(N(s __version__s distutilss __version__ssyssversionssetuptools.testss__doc__(s distutilss __version__sselfs assertEqualsget_module_constantssyssversions__doc__(sselfs __version__((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pystestModuleExtractLs cCshtddd}|i|id|i|id|i|id|i|id|i|iddk l }|i|i ||i |i d|i|i d|i|i d |i |i|i |itd d dd t}|i |i|i|i|i|i d td dd}|i|i|i|itdtddd}|i|it|i|it|i|it|i|id|i|idgi}tD]}|tii|q~}|i |i||i |i|dS(Ns Distutilss1.0.3s distutilss __version__sDistutils-1.0.3(s __version__s1.0.9s0.9.1sunknownsDistutils 3000s03000sformatsDo-what-I-means1.0sd-w-i-msTestsstestsshomepageshttp://example.com(sRequiresreqsselfs assertEqualsnamesmodulesrequested_versions attributes full_names distutilss __version__s get_versions failUnlesss version_oksfailIfs is_presents is_currents LooseVersionsNonesformatshomepagesappends_[1]s__path__spsosspathsdirnamespaths(sselfspathssreqs_[1]sps __version__((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pys testRequireXs: 3(s__name__s __module__stestExtractConststestFindModulestestModuleExtracts testRequire(((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pys DependsTests/s   s DistroTestscBsPtZdZdZdZdZdZdZdZdZ RS( Nc Csstddg|_tddg|_tddddd d gd d d gd|i|ifdh|_dS(Nsbar.extsbar.csc.ysy.cspackagessasa.bsa.b.csbscs py_modulessb.dsxs ext_moduless package_dir(s Extensionsselfse1se2s makeSetupsdist(sself((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pyssetUps  cCs#|it|itiidS(N(sselfs failUnlesss isinstancesdists setuptoolss Distribution(sself((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pystestDistroTypescCs|iid|i|iiddg|iid|i|iidg|i|iidg|i|ii|i|ig|iid|i|iig|i|iidg|i|ii|igt iddS(Nsasbscsx( sselfsdistsexclude_packages assertEqualspackagess py_moduless ext_modulesse1se2s makeSetup(sself((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pystestExcludePackages"cCs|iid|ig|i|ii|ig|iid|ig|i|ii|i|ig|iid|ig|i|ii|i|igdS(Ns ext_modules(sselfsdistsexcludese1s assertEquals ext_modulesse2sinclude(sself((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pystestIncludeExcludes "cCsk|iiddddg|i|iig|i|iidg|i|ii|igdS(Nspackagesscsbsasx(sselfsdistsexcludes assertEqualspackagess py_moduless ext_modulesse1(sself((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pystestExcludePackagesscCsft}|iddgddgd|igt}|iddgddgd|igdS(Nspackagessas py_modulessbs ext_modules(s makeSetupsdistsincludesselfse2sexclude(sselfsdist((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pys testEmptys ( cCs|i|iid|iid|i|iid|i|iid|iid|i|iid|i|iid|iid|i|iiddS(Nsasbsc(sselfs failUnlesssdistshas_contents_forsexclude_packagesfailIf(sself((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pys testContentsscCs|it|iidd|it|iidd|it|iidhdd<|it|iidhdd<|it|iidhdd<|it|iidhdd<|it|iiddg|it|iiddgdS(Nsnonexistent_optionsxspackagessys ext_moduless package_dirsq(sselfs assertRaisessDistutilsSetupErrorsdistsincludesexclude(sself((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pystestInvalidIncludeExcludes         ( s__name__s __module__ssetUpstestDistroTypestestExcludePackagestestIncludeExcludestestExcludePackagess testEmptys testContentsstestInvalidIncludeExclude(((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pys DistroTestss     s FeatureTestscBs>tZdZdZdZdZdZdZRS(NcCs tddd|_tdhdtddtdd|ig<d td dtd d gd d gddg<dtddtd dgddgdddfg<dtddtddtZdZdZdZdZdZdZRS(NcCs2tid}|it|tiidS(Nstest( s makeSetupsget_command_objstest_cmdsselfs failUnlesss isinstances distutilsscmdsCommand(sselfstest_cmd((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pystestTestIsCommandPscCsEtdddg}|id}|i|i|iddS(Ns script_argsstests--test-suite=foo.tests.suitesfoo.tests.suite(s makeSetupsts1sget_command_objsensure_finalizedsselfs assertEquals test_suite(sselfsts1((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pystestLongOptSuiteWNoDefaultTs cCs9tddid}|i|i|iddS(Ns test_suitesbar.tests.suitestest(s makeSetupsget_command_objsts2sensure_finalizedsselfs assertEquals test_suite(sselfsts2((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pystestDefaultSuiteZs cCs[tddddddgid}|i|i|id|i|iddS(Ns test_suites bar.testss script_argsstests-ms foo.testssfoo.tests.test_suite(s makeSetupsget_command_objsts3sensure_finalizedsselfs assertEquals test_modules test_suite(sselfsts3((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pystestDefaultWModuleOnCmdLine_s   cCs>tddddddgid}|it|idS(Ns script_argsstests-ms bar.testss-ssfoo.tests.suite(s makeSetupsget_command_objsts4sselfs assertRaisessDistutilsOptionErrorsensure_finalized(sselfsts4((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pystestConflictingOptionshs'cCs3tid}|i|i|itdS(Nstest(s makeSetupsget_command_objsts5sensure_finalizedsselfs assertEquals test_suitesNone(sselfsts5((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pys testNoSuitens (s__name__s __module__stestTestIsCommandstestLongOptSuiteWNoDefaultstestDefaultSuitestestDefaultWModuleOnCmdLinestestConflictingOptionss testNoSuite(((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pysTestCommandTestsNs     ($s__doc__sunittests TestSuitesTestCases makeSuitesdefaultTestLoadersdistutils.cores distutilss distutils.cmdsdistutils.errorssDistutilsOptionErrorsDistutilsPlatformErrorsDistutilsSetupErrors setuptoolsssetuptools.distsFeatures Extensionssetuptools.dependssextract_constantsget_module_constants find_modulesRequiresdistutils.versions StrictVersions LooseVersionsdistutils.utils convert_pathssyssos.pathsossadditional_testss makeSetups DependsTestss DistroTestss FeatureTestssTestCommandTests(sDistutilsPlatformErrors distutilssFeatures LooseVersions makeSetupsextract_constants TestSuites DependsTestss find_modules FeatureTestssDistutilsSetupErrorsTestCasesget_module_constants convert_paths ExtensionsRequires makeSuitesadditional_testss StrictVersions DistroTestssDistutilsOptionErrorsTestCommandTestssdefaultTestLoaderssyss setuptoolssos((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pys?s$     R{RPKuk6Dp%setuptools/tests/test_packageindex.py"""Package Index Tests """ # More would be better! import os, shutil, tempfile, unittest import pkg_resources import setuptools.package_index class TestPackageIndex(unittest.TestCase): def test_bad_urls(self): index = setuptools.package_index.PackageIndex() url = 'http://127.0.0.1/nonesuch/test_package_index' try: index.open_url(url) except Exception, v: self.assert_(url in str(v)) else: self.assert_(False) PKuk6igBgB"setuptools/tests/test_resources.pyfrom unittest import TestCase, makeSuite from pkg_resources import * import pkg_resources, sys try: frozenset except NameError: from sets import ImmutableSet as frozenset class Metadata(EmptyProvider): """Mock object to return metadata as if from an on-disk distribution""" def __init__(self,*pairs): self.metadata = dict(pairs) def has_metadata(self,name): return name in self.metadata def get_metadata(self,name): return self.metadata[name] def get_metadata_lines(self,name): return yield_lines(self.get_metadata(name)) class DistroTests(TestCase): def testCollection(self): # empty path should produce no distributions ad = Environment([], platform=None, python=None) self.assertEqual(list(ad), []) self.assertEqual(ad['FooPkg'],[]) ad.add(Distribution.from_filename("FooPkg-1.3_1.egg")) ad.add(Distribution.from_filename("FooPkg-1.4-py2.4-win32.egg")) ad.add(Distribution.from_filename("FooPkg-1.2-py2.4.egg")) # Name is in there now self.failUnless(ad['FooPkg']) # But only 1 package self.assertEqual(list(ad), ['foopkg']) # Distributions sort by version self.assertEqual( [dist.version for dist in ad['FooPkg']], ['1.4','1.3-1','1.2'] ) # Removing a distribution leaves sequence alone ad.remove(ad['FooPkg'][1]) self.assertEqual( [dist.version for dist in ad['FooPkg']], ['1.4','1.2'] ) # And inserting adds them in order ad.add(Distribution.from_filename("FooPkg-1.9.egg")) self.assertEqual( [dist.version for dist in ad['FooPkg']], ['1.9','1.4','1.2'] ) ws = WorkingSet([]) foo12 = Distribution.from_filename("FooPkg-1.2-py2.4.egg") foo14 = Distribution.from_filename("FooPkg-1.4-py2.4-win32.egg") req, = parse_requirements("FooPkg>=1.3") # Nominal case: no distros on path, should yield all applicable self.assertEqual(ad.best_match(req,ws).version, '1.9') # If a matching distro is already installed, should return only that ws.add(foo14); self.assertEqual(ad.best_match(req,ws).version, '1.4') # If the first matching distro is unsuitable, it's a version conflict ws = WorkingSet([]); ws.add(foo12); ws.add(foo14) self.assertRaises(VersionConflict, ad.best_match, req, ws) # If more than one match on the path, the first one takes precedence ws = WorkingSet([]); ws.add(foo14); ws.add(foo12); ws.add(foo14); self.assertEqual(ad.best_match(req,ws).version, '1.4') def checkFooPkg(self,d): self.assertEqual(d.project_name, "FooPkg") self.assertEqual(d.key, "foopkg") self.assertEqual(d.version, "1.3-1") self.assertEqual(d.py_version, "2.4") self.assertEqual(d.platform, "win32") self.assertEqual(d.parsed_version, parse_version("1.3-1")) def testDistroBasics(self): d = Distribution( "/some/path", project_name="FooPkg",version="1.3-1",py_version="2.4",platform="win32" ) self.checkFooPkg(d) d = Distribution("/some/path") self.assertEqual(d.py_version, sys.version[:3]) self.assertEqual(d.platform, None) def testDistroParse(self): d = Distribution.from_filename("FooPkg-1.3_1-py2.4-win32.egg") self.checkFooPkg(d) d = Distribution.from_filename("FooPkg-1.3_1-py2.4-win32.egg-info") self.checkFooPkg(d) def testDistroMetadata(self): d = Distribution( "/some/path", project_name="FooPkg", py_version="2.4", platform="win32", metadata = Metadata( ('PKG-INFO',"Metadata-Version: 1.0\nVersion: 1.3-1\n") ) ) self.checkFooPkg(d) def distRequires(self, txt): return Distribution("/foo", metadata=Metadata(('depends.txt', txt))) def checkRequires(self, dist, txt, extras=()): self.assertEqual( list(dist.requires(extras)), list(parse_requirements(txt)) ) def testDistroDependsSimple(self): for v in "Twisted>=1.5", "Twisted>=1.5\nZConfig>=2.0": self.checkRequires(self.distRequires(v), v) def testResolve(self): ad = Environment([]); ws = WorkingSet([]) # Resolving no requirements -> nothing to install self.assertEqual( list(ws.resolve([],ad)), [] ) # Request something not in the collection -> DistributionNotFound self.assertRaises( DistributionNotFound, ws.resolve, parse_requirements("Foo"), ad ) Foo = Distribution.from_filename( "/foo_dir/Foo-1.2.egg", metadata=Metadata(('depends.txt', "[bar]\nBaz>=2.0")) ) ad.add(Foo); ad.add(Distribution.from_filename("Foo-0.9.egg")) # Request thing(s) that are available -> list to activate for i in range(3): targets = list(ws.resolve(parse_requirements("Foo"), ad)) self.assertEqual(targets, [Foo]) map(ws.add,targets) self.assertRaises(VersionConflict, ws.resolve, parse_requirements("Foo==0.9"), ad) ws = WorkingSet([]) # reset # Request an extra that causes an unresolved dependency for "Baz" self.assertRaises( DistributionNotFound, ws.resolve,parse_requirements("Foo[bar]"), ad ) Baz = Distribution.from_filename( "/foo_dir/Baz-2.1.egg", metadata=Metadata(('depends.txt', "Foo")) ) ad.add(Baz) # Activation list now includes resolved dependency self.assertEqual( list(ws.resolve(parse_requirements("Foo[bar]"), ad)), [Foo,Baz] ) # Requests for conflicting versions produce VersionConflict self.assertRaises( VersionConflict, ws.resolve, parse_requirements("Foo==1.2\nFoo!=1.2"), ad ) def testDistroDependsOptions(self): d = self.distRequires(""" Twisted>=1.5 [docgen] ZConfig>=2.0 docutils>=0.3 [fastcgi] fcgiapp>=0.1""") self.checkRequires(d,"Twisted>=1.5") self.checkRequires( d,"Twisted>=1.5 ZConfig>=2.0 docutils>=0.3".split(), ["docgen"] ) self.checkRequires( d,"Twisted>=1.5 fcgiapp>=0.1".split(), ["fastcgi"] ) self.checkRequires( d,"Twisted>=1.5 ZConfig>=2.0 docutils>=0.3 fcgiapp>=0.1".split(), ["docgen","fastcgi"] ) self.checkRequires( d,"Twisted>=1.5 fcgiapp>=0.1 ZConfig>=2.0 docutils>=0.3".split(), ["fastcgi", "docgen"] ) self.assertRaises(UnknownExtra, d.requires, ["foo"]) class EntryPointTests(TestCase): def assertfields(self, ep): self.assertEqual(ep.name,"foo") self.assertEqual(ep.module_name,"setuptools.tests.test_resources") self.assertEqual(ep.attrs, ("EntryPointTests",)) self.assertEqual(ep.extras, ("x",)) self.failUnless(ep.load() is EntryPointTests) self.assertEqual( str(ep), "foo = setuptools.tests.test_resources:EntryPointTests [x]" ) def setUp(self): self.dist = Distribution.from_filename( "FooPkg-1.2-py2.4.egg", metadata=Metadata(('requires.txt','[x]'))) def testBasics(self): ep = EntryPoint( "foo", "setuptools.tests.test_resources", ["EntryPointTests"], ["x"], self.dist ) self.assertfields(ep) def testParse(self): s = "foo = setuptools.tests.test_resources:EntryPointTests [x]" ep = EntryPoint.parse(s, self.dist) self.assertfields(ep) ep = EntryPoint.parse("bar baz= spammity[PING]") self.assertEqual(ep.name,"bar baz") self.assertEqual(ep.module_name,"spammity") self.assertEqual(ep.attrs, ()) self.assertEqual(ep.extras, ("ping",)) ep = EntryPoint.parse(" fizzly = wocka:foo") self.assertEqual(ep.name,"fizzly") self.assertEqual(ep.module_name,"wocka") self.assertEqual(ep.attrs, ("foo",)) self.assertEqual(ep.extras, ()) def testRejects(self): for ep in [ "foo", "x=1=2", "x=a:b:c", "q=x/na", "fez=pish:tush-z", "x=f[a]>2", ]: try: EntryPoint.parse(ep) except ValueError: pass else: raise AssertionError("Should've been bad", ep) def checkSubMap(self, m): self.assertEqual(str(m), "{'feature2': EntryPoint.parse(" "'feature2 = another.module:SomeClass [extra1,extra2]'), " "'feature3': EntryPoint.parse('feature3 = this.module [something]'), " "'feature1': EntryPoint.parse(" "'feature1 = somemodule:somefunction')}" ) submap_str = """ # define features for blah blah feature1 = somemodule:somefunction feature2 = another.module:SomeClass [extra1,extra2] feature3 = this.module [something] """ def testParseList(self): self.checkSubMap(EntryPoint.parse_group("xyz", self.submap_str)) self.assertRaises(ValueError, EntryPoint.parse_group, "x a", "foo=bar") self.assertRaises(ValueError, EntryPoint.parse_group, "x", ["foo=baz", "foo=bar"]) def testParseMap(self): m = EntryPoint.parse_map({'xyz':self.submap_str}) self.checkSubMap(m['xyz']) self.assertEqual(m.keys(),['xyz']) m = EntryPoint.parse_map("[xyz]\n"+self.submap_str) self.checkSubMap(m['xyz']) self.assertEqual(m.keys(),['xyz']) self.assertRaises(ValueError, EntryPoint.parse_map, ["[xyz]", "[xyz]"]) self.assertRaises(ValueError, EntryPoint.parse_map, self.submap_str) class RequirementsTests(TestCase): def testBasics(self): r = Requirement.parse("Twisted>=1.2") self.assertEqual(str(r),"Twisted>=1.2") self.assertEqual(repr(r),"Requirement.parse('Twisted>=1.2')") self.assertEqual(r, Requirement("Twisted", [('>=','1.2')], ())) self.assertEqual(r, Requirement("twisTed", [('>=','1.2')], ())) self.assertNotEqual(r, Requirement("Twisted", [('>=','2.0')], ())) self.assertNotEqual(r, Requirement("Zope", [('>=','1.2')], ())) self.assertNotEqual(r, Requirement("Zope", [('>=','3.0')], ())) self.assertNotEqual(r, Requirement.parse("Twisted[extras]>=1.2")) def testOrdering(self): r1 = Requirement("Twisted", [('==','1.2c1'),('>=','1.2')], ()) r2 = Requirement("Twisted", [('>=','1.2'),('==','1.2c1')], ()) self.assertEqual(r1,r2) self.assertEqual(str(r1),str(r2)) self.assertEqual(str(r2),"Twisted==1.2c1,>=1.2") def testBasicContains(self): r = Requirement("Twisted", [('>=','1.2')], ()) foo_dist = Distribution.from_filename("FooPkg-1.3_1.egg") twist11 = Distribution.from_filename("Twisted-1.1.egg") twist12 = Distribution.from_filename("Twisted-1.2.egg") self.failUnless(parse_version('1.2') in r) self.failUnless(parse_version('1.1') not in r) self.failUnless('1.2' in r) self.failUnless('1.1' not in r) self.failUnless(foo_dist not in r) self.failUnless(twist11 not in r) self.failUnless(twist12 in r) def testAdvancedContains(self): r, = parse_requirements("Foo>=1.2,<=1.3,==1.9,>2.0,!=2.5,<3.0,==4.5") for v in ('1.2','1.2.2','1.3','1.9','2.0.1','2.3','2.6','3.0c1','4.5'): self.failUnless(v in r, (v,r)) for v in ('1.2c1','1.3.1','1.5','1.9.1','2.0','2.5','3.0','4.0'): self.failUnless(v not in r, (v,r)) def testOptionsAndHashing(self): r1 = Requirement.parse("Twisted[foo,bar]>=1.2") r2 = Requirement.parse("Twisted[bar,FOO]>=1.2") r3 = Requirement.parse("Twisted[BAR,FOO]>=1.2.0") self.assertEqual(r1,r2) self.assertEqual(r1,r3) self.assertEqual(r1.extras, ("foo","bar")) self.assertEqual(r2.extras, ("bar","foo")) # extras are normalized self.assertEqual(hash(r1), hash(r2)) self.assertEqual( hash(r1), hash(("twisted", ((">=",parse_version("1.2")),), frozenset(["foo","bar"]))) ) def testVersionEquality(self): r1 = Requirement.parse("setuptools==0.3a2") r2 = Requirement.parse("setuptools!=0.3a4") d = Distribution.from_filename self.failIf(d("setuptools-0.3a4.egg") in r1) self.failIf(d("setuptools-0.3a1.egg") in r1) self.failIf(d("setuptools-0.3a4.egg") in r2) self.failUnless(d("setuptools-0.3a2.egg") in r1) self.failUnless(d("setuptools-0.3a2.egg") in r2) self.failUnless(d("setuptools-0.3a3.egg") in r2) self.failUnless(d("setuptools-0.3a5.egg") in r2) class ParseTests(TestCase): def testEmptyParse(self): self.assertEqual(list(parse_requirements('')), []) def testYielding(self): for inp,out in [ ([], []), ('x',['x']), ([[]],[]), (' x\n y', ['x','y']), (['x\n\n','y'], ['x','y']), ]: self.assertEqual(list(pkg_resources.yield_lines(inp)),out) def testSplitting(self): self.assertEqual( list( pkg_resources.split_sections(""" x [Y] z a [b ] # foo c [ d] [q] v """ ) ), [(None,["x"]), ("Y",["z","a"]), ("b",["c"]), ("d",[]), ("q",["v"])] ) self.assertRaises(ValueError,list,pkg_resources.split_sections("[foo")) def testSafeName(self): self.assertEqual(safe_name("adns-python"), "adns-python") self.assertEqual(safe_name("WSGI Utils"), "WSGI-Utils") self.assertEqual(safe_name("WSGI Utils"), "WSGI-Utils") self.assertEqual(safe_name("Money$$$Maker"), "Money-Maker") self.assertNotEqual(safe_name("peak.web"), "peak-web") def testSafeVersion(self): self.assertEqual(safe_version("1.2-1"), "1.2-1") self.assertEqual(safe_version("1.2 alpha"), "1.2.alpha") self.assertEqual(safe_version("2.3.4 20050521"), "2.3.4.20050521") self.assertEqual(safe_version("Money$$$Maker"), "Money-Maker") self.assertEqual(safe_version("peak.web"), "peak.web") def testSimpleRequirements(self): self.assertEqual( list(parse_requirements('Twis-Ted>=1.2-1')), [Requirement('Twis-Ted',[('>=','1.2-1')], ())] ) self.assertEqual( list(parse_requirements('Twisted >=1.2, \ # more\n<2.0')), [Requirement('Twisted',[('>=','1.2'),('<','2.0')], ())] ) self.assertEqual( Requirement.parse("FooBar==1.99a3"), Requirement("FooBar", [('==','1.99a3')], ()) ) self.assertRaises(ValueError,Requirement.parse,">=2.3") self.assertRaises(ValueError,Requirement.parse,"x\\") self.assertRaises(ValueError,Requirement.parse,"x==2 q") self.assertRaises(ValueError,Requirement.parse,"X==1\nY==2") self.assertRaises(ValueError,Requirement.parse,"#") def testVersionEquality(self): def c(s1,s2): p1, p2 = parse_version(s1),parse_version(s2) self.assertEqual(p1,p2, (s1,s2,p1,p2)) c('1.2-rc1', '1.2rc1') c('0.4', '0.4.0') c('0.4.0.0', '0.4.0') c('0.4.0-0', '0.4-0') c('0pl1', '0.0pl1') c('0pre1', '0.0c1') c('0.0.0preview1', '0c1') c('0.0c1', '0-rc1') c('1.2a1', '1.2.a.1'); c('1.2...a', '1.2a') def testVersionOrdering(self): def c(s1,s2): p1, p2 = parse_version(s1),parse_version(s2) self.failUnless(p1), and the final line of output is "Test failed.". Run it with the -v switch instead: python M.py -v and a detailed report of all examples tried is printed to stdout, along with assorted summaries at the end. You can force verbose mode by passing "verbose=True" to testmod, or prohibit it by passing "verbose=False". In either of those cases, sys.argv is not examined by testmod. There are a variety of other ways to run doctests, including integration with the unittest framework, and support for running non-Python text files containing doctests. There are also many ways to override parts of doctest's default behaviors. See the Library Reference Manual for details. """ __docformat__ = 'reStructuredText en' __all__ = [ # 0, Option Flags 'register_optionflag', 'DONT_ACCEPT_TRUE_FOR_1', 'DONT_ACCEPT_BLANKLINE', 'NORMALIZE_WHITESPACE', 'ELLIPSIS', 'IGNORE_EXCEPTION_DETAIL', 'COMPARISON_FLAGS', 'REPORT_UDIFF', 'REPORT_CDIFF', 'REPORT_NDIFF', 'REPORT_ONLY_FIRST_FAILURE', 'REPORTING_FLAGS', # 1. Utility Functions 'is_private', # 2. Example & DocTest 'Example', 'DocTest', # 3. Doctest Parser 'DocTestParser', # 4. Doctest Finder 'DocTestFinder', # 5. Doctest Runner 'DocTestRunner', 'OutputChecker', 'DocTestFailure', 'UnexpectedException', 'DebugRunner', # 6. Test Functions 'testmod', 'testfile', 'run_docstring_examples', # 7. Tester 'Tester', # 8. Unittest Support 'DocTestSuite', 'DocFileSuite', 'set_unittest_reportflags', # 9. Debugging Support 'script_from_examples', 'testsource', 'debug_src', 'debug', ] import __future__ import sys, traceback, inspect, linecache, os, re, types import unittest, difflib, pdb, tempfile import warnings from StringIO import StringIO # Don't whine about the deprecated is_private function in this # module's tests. warnings.filterwarnings("ignore", "is_private", DeprecationWarning, __name__, 0) # There are 4 basic classes: # - Example: a pair, plus an intra-docstring line number. # - DocTest: a collection of examples, parsed from a docstring, plus # info about where the docstring came from (name, filename, lineno). # - DocTestFinder: extracts DocTests from a given object's docstring and # its contained objects' docstrings. # - DocTestRunner: runs DocTest cases, and accumulates statistics. # # So the basic picture is: # # list of: # +------+ +---------+ +-------+ # |object| --DocTestFinder-> | DocTest | --DocTestRunner-> |results| # +------+ +---------+ +-------+ # | Example | # | ... | # | Example | # +---------+ # Option constants. OPTIONFLAGS_BY_NAME = {} def register_optionflag(name): flag = 1 << len(OPTIONFLAGS_BY_NAME) OPTIONFLAGS_BY_NAME[name] = flag return flag DONT_ACCEPT_TRUE_FOR_1 = register_optionflag('DONT_ACCEPT_TRUE_FOR_1') DONT_ACCEPT_BLANKLINE = register_optionflag('DONT_ACCEPT_BLANKLINE') NORMALIZE_WHITESPACE = register_optionflag('NORMALIZE_WHITESPACE') ELLIPSIS = register_optionflag('ELLIPSIS') IGNORE_EXCEPTION_DETAIL = register_optionflag('IGNORE_EXCEPTION_DETAIL') COMPARISON_FLAGS = (DONT_ACCEPT_TRUE_FOR_1 | DONT_ACCEPT_BLANKLINE | NORMALIZE_WHITESPACE | ELLIPSIS | IGNORE_EXCEPTION_DETAIL) REPORT_UDIFF = register_optionflag('REPORT_UDIFF') REPORT_CDIFF = register_optionflag('REPORT_CDIFF') REPORT_NDIFF = register_optionflag('REPORT_NDIFF') REPORT_ONLY_FIRST_FAILURE = register_optionflag('REPORT_ONLY_FIRST_FAILURE') REPORTING_FLAGS = (REPORT_UDIFF | REPORT_CDIFF | REPORT_NDIFF | REPORT_ONLY_FIRST_FAILURE) # Special string markers for use in `want` strings: BLANKLINE_MARKER = '' ELLIPSIS_MARKER = '...' ###################################################################### ## Table of Contents ###################################################################### # 1. Utility Functions # 2. Example & DocTest -- store test cases # 3. DocTest Parser -- extracts examples from strings # 4. DocTest Finder -- extracts test cases from objects # 5. DocTest Runner -- runs test cases # 6. Test Functions -- convenient wrappers for testing # 7. Tester Class -- for backwards compatibility # 8. Unittest Support # 9. Debugging Support # 10. Example Usage ###################################################################### ## 1. Utility Functions ###################################################################### def is_private(prefix, base): """prefix, base -> true iff name prefix + "." + base is "private". Prefix may be an empty string, and base does not contain a period. Prefix is ignored (although functions you write conforming to this protocol may make use of it). Return true iff base begins with an (at least one) underscore, but does not both begin and end with (at least) two underscores. >>> is_private("a.b", "my_func") False >>> is_private("____", "_my_func") True >>> is_private("someclass", "__init__") False >>> is_private("sometypo", "__init_") True >>> is_private("x.y.z", "_") True >>> is_private("_x.y.z", "__") False >>> is_private("", "") # senseless but consistent False """ warnings.warn("is_private is deprecated; it wasn't useful; " "examine DocTestFinder.find() lists instead", DeprecationWarning, stacklevel=2) return base[:1] == "_" and not base[:2] == "__" == base[-2:] def _extract_future_flags(globs): """ Return the compiler-flags associated with the future features that have been imported into the given namespace (globs). """ flags = 0 for fname in __future__.all_feature_names: feature = globs.get(fname, None) if feature is getattr(__future__, fname): flags |= feature.compiler_flag return flags def _normalize_module(module, depth=2): """ Return the module specified by `module`. In particular: - If `module` is a module, then return module. - If `module` is a string, then import and return the module with that name. - If `module` is None, then return the calling module. The calling module is assumed to be the module of the stack frame at the given depth in the call stack. """ if inspect.ismodule(module): return module elif isinstance(module, (str, unicode)): return __import__(module, globals(), locals(), ["*"]) elif module is None: return sys.modules[sys._getframe(depth).f_globals['__name__']] else: raise TypeError("Expected a module, string, or None") def _indent(s, indent=4): """ Add the given number of space characters to the beginning every non-blank line in `s`, and return the result. """ # This regexp matches the start of non-blank lines: return re.sub('(?m)^(?!$)', indent*' ', s) def _exception_traceback(exc_info): """ Return a string containing a traceback message for the given exc_info tuple (as returned by sys.exc_info()). """ # Get a traceback message. excout = StringIO() exc_type, exc_val, exc_tb = exc_info traceback.print_exception(exc_type, exc_val, exc_tb, file=excout) return excout.getvalue() # Override some StringIO methods. class _SpoofOut(StringIO): def getvalue(self): result = StringIO.getvalue(self) # If anything at all was written, make sure there's a trailing # newline. There's no way for the expected output to indicate # that a trailing newline is missing. if result and not result.endswith("\n"): result += "\n" # Prevent softspace from screwing up the next test case, in # case they used print with a trailing comma in an example. if hasattr(self, "softspace"): del self.softspace return result def truncate(self, size=None): StringIO.truncate(self, size) if hasattr(self, "softspace"): del self.softspace # Worst-case linear-time ellipsis matching. def _ellipsis_match(want, got): """ Essentially the only subtle case: >>> _ellipsis_match('aa...aa', 'aaa') False """ if want.find(ELLIPSIS_MARKER)==-1: return want == got # Find "the real" strings. ws = want.split(ELLIPSIS_MARKER) assert len(ws) >= 2 # Deal with exact matches possibly needed at one or both ends. startpos, endpos = 0, len(got) w = ws[0] if w: # starts with exact match if got.startswith(w): startpos = len(w) del ws[0] else: return False w = ws[-1] if w: # ends with exact match if got.endswith(w): endpos -= len(w) del ws[-1] else: return False if startpos > endpos: # Exact end matches required more characters than we have, as in # _ellipsis_match('aa...aa', 'aaa') return False # For the rest, we only need to find the leftmost non-overlapping # match for each piece. If there's no overall match that way alone, # there's no overall match period. for w in ws: # w may be '' at times, if there are consecutive ellipses, or # due to an ellipsis at the start or end of `want`. That's OK. # Search for an empty string succeeds, and doesn't change startpos. startpos = got.find(w, startpos, endpos) if startpos < 0: return False startpos += len(w) return True def _comment_line(line): "Return a commented form of the given line" line = line.rstrip() if line: return '# '+line else: return '#' class _OutputRedirectingPdb(pdb.Pdb): """ A specialized version of the python debugger that redirects stdout to a given stream when interacting with the user. Stdout is *not* redirected when traced code is executed. """ def __init__(self, out): self.__out = out pdb.Pdb.__init__(self) def trace_dispatch(self, *args): # Redirect stdout to the given stream. save_stdout = sys.stdout sys.stdout = self.__out # Call Pdb's trace dispatch method. try: return pdb.Pdb.trace_dispatch(self, *args) finally: sys.stdout = save_stdout # [XX] Normalize with respect to os.path.pardir? def _module_relative_path(module, path): if not inspect.ismodule(module): raise TypeError, 'Expected a module: %r' % module if path.startswith('/'): raise ValueError, 'Module-relative files may not have absolute paths' # Find the base directory for the path. if hasattr(module, '__file__'): # A normal module/package basedir = os.path.split(module.__file__)[0] elif module.__name__ == '__main__': # An interactive session. if len(sys.argv)>0 and sys.argv[0] != '': basedir = os.path.split(sys.argv[0])[0] else: basedir = os.curdir else: # A module w/o __file__ (this includes builtins) raise ValueError("Can't resolve paths relative to the module " + module + " (it has no __file__)") # Combine the base directory and the path. return os.path.join(basedir, *(path.split('/'))) ###################################################################### ## 2. Example & DocTest ###################################################################### ## - An "example" is a pair, where "source" is a ## fragment of source code, and "want" is the expected output for ## "source." The Example class also includes information about ## where the example was extracted from. ## ## - A "doctest" is a collection of examples, typically extracted from ## a string (such as an object's docstring). The DocTest class also ## includes information about where the string was extracted from. class Example: """ A single doctest example, consisting of source code and expected output. `Example` defines the following attributes: - source: A single Python statement, always ending with a newline. The constructor adds a newline if needed. - want: The expected output from running the source code (either from stdout, or a traceback in case of exception). `want` ends with a newline unless it's empty, in which case it's an empty string. The constructor adds a newline if needed. - exc_msg: The exception message generated by the example, if the example is expected to generate an exception; or `None` if it is not expected to generate an exception. This exception message is compared against the return value of `traceback.format_exception_only()`. `exc_msg` ends with a newline unless it's `None`. The constructor adds a newline if needed. - lineno: The line number within the DocTest string containing this Example where the Example begins. This line number is zero-based, with respect to the beginning of the DocTest. - indent: The example's indentation in the DocTest string. I.e., the number of space characters that preceed the example's first prompt. - options: A dictionary mapping from option flags to True or False, which is used to override default options for this example. Any option flags not contained in this dictionary are left at their default value (as specified by the DocTestRunner's optionflags). By default, no options are set. """ def __init__(self, source, want, exc_msg=None, lineno=0, indent=0, options=None): # Normalize inputs. if not source.endswith('\n'): source += '\n' if want and not want.endswith('\n'): want += '\n' if exc_msg is not None and not exc_msg.endswith('\n'): exc_msg += '\n' # Store properties. self.source = source self.want = want self.lineno = lineno self.indent = indent if options is None: options = {} self.options = options self.exc_msg = exc_msg class DocTest: """ A collection of doctest examples that should be run in a single namespace. Each `DocTest` defines the following attributes: - examples: the list of examples. - globs: The namespace (aka globals) that the examples should be run in. - name: A name identifying the DocTest (typically, the name of the object whose docstring this DocTest was extracted from). - filename: The name of the file that this DocTest was extracted from, or `None` if the filename is unknown. - lineno: The line number within filename where this DocTest begins, or `None` if the line number is unavailable. This line number is zero-based, with respect to the beginning of the file. - docstring: The string that the examples were extracted from, or `None` if the string is unavailable. """ def __init__(self, examples, globs, name, filename, lineno, docstring): """ Create a new DocTest containing the given examples. The DocTest's globals are initialized with a copy of `globs`. """ assert not isinstance(examples, basestring), \ "DocTest no longer accepts str; use DocTestParser instead" self.examples = examples self.docstring = docstring self.globs = globs.copy() self.name = name self.filename = filename self.lineno = lineno def __repr__(self): if len(self.examples) == 0: examples = 'no examples' elif len(self.examples) == 1: examples = '1 example' else: examples = '%d examples' % len(self.examples) return ('' % (self.name, self.filename, self.lineno, examples)) # This lets us sort tests by name: def __cmp__(self, other): if not isinstance(other, DocTest): return -1 return cmp((self.name, self.filename, self.lineno, id(self)), (other.name, other.filename, other.lineno, id(other))) ###################################################################### ## 3. DocTestParser ###################################################################### class DocTestParser: """ A class used to parse strings containing doctest examples. """ # This regular expression is used to find doctest examples in a # string. It defines three groups: `source` is the source code # (including leading indentation and prompts); `indent` is the # indentation of the first (PS1) line of the source code; and # `want` is the expected output (including leading indentation). _EXAMPLE_RE = re.compile(r''' # Source consists of a PS1 line followed by zero or more PS2 lines. (?P (?:^(?P [ ]*) >>> .*) # PS1 line (?:\n [ ]* \.\.\. .*)*) # PS2 lines \n? # Want consists of any non-blank lines that do not start with PS1. (?P (?:(?![ ]*$) # Not a blank line (?![ ]*>>>) # Not a line starting with PS1 .*$\n? # But any other line )*) ''', re.MULTILINE | re.VERBOSE) # A regular expression for handling `want` strings that contain # expected exceptions. It divides `want` into three pieces: # - the traceback header line (`hdr`) # - the traceback stack (`stack`) # - the exception message (`msg`), as generated by # traceback.format_exception_only() # `msg` may have multiple lines. We assume/require that the # exception message is the first non-indented line starting with a word # character following the traceback header line. _EXCEPTION_RE = re.compile(r""" # Grab the traceback header. Different versions of Python have # said different things on the first traceback line. ^(?P Traceback\ \( (?: most\ recent\ call\ last | innermost\ last ) \) : ) \s* $ # toss trailing whitespace on the header. (?P .*?) # don't blink: absorb stuff until... ^ (?P \w+ .*) # a line *starts* with alphanum. """, re.VERBOSE | re.MULTILINE | re.DOTALL) # A callable returning a true value iff its argument is a blank line # or contains a single comment. _IS_BLANK_OR_COMMENT = re.compile(r'^[ ]*(#.*)?$').match def parse(self, string, name=''): """ Divide the given string into examples and intervening text, and return them as a list of alternating Examples and strings. Line numbers for the Examples are 0-based. The optional argument `name` is a name identifying this string, and is only used for error messages. """ string = string.expandtabs() # If all lines begin with the same indentation, then strip it. min_indent = self._min_indent(string) if min_indent > 0: string = '\n'.join([l[min_indent:] for l in string.split('\n')]) output = [] charno, lineno = 0, 0 # Find all doctest examples in the string: for m in self._EXAMPLE_RE.finditer(string): # Add the pre-example text to `output`. output.append(string[charno:m.start()]) # Update lineno (lines before this example) lineno += string.count('\n', charno, m.start()) # Extract info from the regexp match. (source, options, want, exc_msg) = \ self._parse_example(m, name, lineno) # Create an Example, and add it to the list. if not self._IS_BLANK_OR_COMMENT(source): output.append( Example(source, want, exc_msg, lineno=lineno, indent=min_indent+len(m.group('indent')), options=options) ) # Update lineno (lines inside this example) lineno += string.count('\n', m.start(), m.end()) # Update charno. charno = m.end() # Add any remaining post-example text to `output`. output.append(string[charno:]) return output def get_doctest(self, string, globs, name, filename, lineno): """ Extract all doctest examples from the given string, and collect them into a `DocTest` object. `globs`, `name`, `filename`, and `lineno` are attributes for the new `DocTest` object. See the documentation for `DocTest` for more information. """ return DocTest(self.get_examples(string, name), globs, name, filename, lineno, string) def get_examples(self, string, name=''): """ Extract all doctest examples from the given string, and return them as a list of `Example` objects. Line numbers are 0-based, because it's most common in doctests that nothing interesting appears on the same line as opening triple-quote, and so the first interesting line is called \"line 1\" then. The optional argument `name` is a name identifying this string, and is only used for error messages. """ return [x for x in self.parse(string, name) if isinstance(x, Example)] def _parse_example(self, m, name, lineno): """ Given a regular expression match from `_EXAMPLE_RE` (`m`), return a pair `(source, want)`, where `source` is the matched example's source code (with prompts and indentation stripped); and `want` is the example's expected output (with indentation stripped). `name` is the string's name, and `lineno` is the line number where the example starts; both are used for error messages. """ # Get the example's indentation level. indent = len(m.group('indent')) # Divide source into lines; check that they're properly # indented; and then strip their indentation & prompts. source_lines = m.group('source').split('\n') self._check_prompt_blank(source_lines, indent, name, lineno) self._check_prefix(source_lines[1:], ' '*indent + '.', name, lineno) source = '\n'.join([sl[indent+4:] for sl in source_lines]) # Divide want into lines; check that it's properly indented; and # then strip the indentation. Spaces before the last newline should # be preserved, so plain rstrip() isn't good enough. want = m.group('want') want_lines = want.split('\n') if len(want_lines) > 1 and re.match(r' *$', want_lines[-1]): del want_lines[-1] # forget final newline & spaces after it self._check_prefix(want_lines, ' '*indent, name, lineno + len(source_lines)) want = '\n'.join([wl[indent:] for wl in want_lines]) # If `want` contains a traceback message, then extract it. m = self._EXCEPTION_RE.match(want) if m: exc_msg = m.group('msg') else: exc_msg = None # Extract options from the source. options = self._find_options(source, name, lineno) return source, options, want, exc_msg # This regular expression looks for option directives in the # source code of an example. Option directives are comments # starting with "doctest:". Warning: this may give false # positives for string-literals that contain the string # "#doctest:". Eliminating these false positives would require # actually parsing the string; but we limit them by ignoring any # line containing "#doctest:" that is *followed* by a quote mark. _OPTION_DIRECTIVE_RE = re.compile(r'#\s*doctest:\s*([^\n\'"]*)$', re.MULTILINE) def _find_options(self, source, name, lineno): """ Return a dictionary containing option overrides extracted from option directives in the given source string. `name` is the string's name, and `lineno` is the line number where the example starts; both are used for error messages. """ options = {} # (note: with the current regexp, this will match at most once:) for m in self._OPTION_DIRECTIVE_RE.finditer(source): option_strings = m.group(1).replace(',', ' ').split() for option in option_strings: if (option[0] not in '+-' or option[1:] not in OPTIONFLAGS_BY_NAME): raise ValueError('line %r of the doctest for %s ' 'has an invalid option: %r' % (lineno+1, name, option)) flag = OPTIONFLAGS_BY_NAME[option[1:]] options[flag] = (option[0] == '+') if options and self._IS_BLANK_OR_COMMENT(source): raise ValueError('line %r of the doctest for %s has an option ' 'directive on a line with no example: %r' % (lineno, name, source)) return options # This regular expression finds the indentation of every non-blank # line in a string. _INDENT_RE = re.compile('^([ ]*)(?=\S)', re.MULTILINE) def _min_indent(self, s): "Return the minimum indentation of any non-blank line in `s`" indents = [len(indent) for indent in self._INDENT_RE.findall(s)] if len(indents) > 0: return min(indents) else: return 0 def _check_prompt_blank(self, lines, indent, name, lineno): """ Given the lines of a source string (including prompts and leading indentation), check to make sure that every prompt is followed by a space character. If any line is not followed by a space character, then raise ValueError. """ for i, line in enumerate(lines): if len(line) >= indent+4 and line[indent+3] != ' ': raise ValueError('line %r of the docstring for %s ' 'lacks blank after %s: %r' % (lineno+i+1, name, line[indent:indent+3], line)) def _check_prefix(self, lines, prefix, name, lineno): """ Check that every line in the given list starts with the given prefix; if any line does not, then raise a ValueError. """ for i, line in enumerate(lines): if line and not line.startswith(prefix): raise ValueError('line %r of the docstring for %s has ' 'inconsistent leading whitespace: %r' % (lineno+i+1, name, line)) ###################################################################### ## 4. DocTest Finder ###################################################################### class DocTestFinder: """ A class used to extract the DocTests that are relevant to a given object, from its docstring and the docstrings of its contained objects. Doctests can currently be extracted from the following object types: modules, functions, classes, methods, staticmethods, classmethods, and properties. """ def __init__(self, verbose=False, parser=DocTestParser(), recurse=True, _namefilter=None, exclude_empty=True): """ Create a new doctest finder. The optional argument `parser` specifies a class or function that should be used to create new DocTest objects (or objects that implement the same interface as DocTest). The signature for this factory function should match the signature of the DocTest constructor. If the optional argument `recurse` is false, then `find` will only examine the given object, and not any contained objects. If the optional argument `exclude_empty` is false, then `find` will include tests for objects with empty docstrings. """ self._parser = parser self._verbose = verbose self._recurse = recurse self._exclude_empty = exclude_empty # _namefilter is undocumented, and exists only for temporary backward- # compatibility support of testmod's deprecated isprivate mess. self._namefilter = _namefilter def find(self, obj, name=None, module=None, globs=None, extraglobs=None): """ Return a list of the DocTests that are defined by the given object's docstring, or by any of its contained objects' docstrings. The optional parameter `module` is the module that contains the given object. If the module is not specified or is None, then the test finder will attempt to automatically determine the correct module. The object's module is used: - As a default namespace, if `globs` is not specified. - To prevent the DocTestFinder from extracting DocTests from objects that are imported from other modules. - To find the name of the file containing the object. - To help find the line number of the object within its file. Contained objects whose module does not match `module` are ignored. If `module` is False, no attempt to find the module will be made. This is obscure, of use mostly in tests: if `module` is False, or is None but cannot be found automatically, then all objects are considered to belong to the (non-existent) module, so all contained objects will (recursively) be searched for doctests. The globals for each DocTest is formed by combining `globs` and `extraglobs` (bindings in `extraglobs` override bindings in `globs`). A new copy of the globals dictionary is created for each DocTest. If `globs` is not specified, then it defaults to the module's `__dict__`, if specified, or {} otherwise. If `extraglobs` is not specified, then it defaults to {}. """ # If name was not specified, then extract it from the object. if name is None: name = getattr(obj, '__name__', None) if name is None: raise ValueError("DocTestFinder.find: name must be given " "when obj.__name__ doesn't exist: %r" % (type(obj),)) # Find the module that contains the given object (if obj is # a module, then module=obj.). Note: this may fail, in which # case module will be None. if module is False: module = None elif module is None: module = inspect.getmodule(obj) # Read the module's source code. This is used by # DocTestFinder._find_lineno to find the line number for a # given object's docstring. try: file = inspect.getsourcefile(obj) or inspect.getfile(obj) source_lines = linecache.getlines(file) if not source_lines: source_lines = None except TypeError: source_lines = None # Initialize globals, and merge in extraglobs. if globs is None: if module is None: globs = {} else: globs = module.__dict__.copy() else: globs = globs.copy() if extraglobs is not None: globs.update(extraglobs) # Recursively expore `obj`, extracting DocTests. tests = [] self._find(tests, obj, name, module, source_lines, globs, {}) return tests def _filter(self, obj, prefix, base): """ Return true if the given object should not be examined. """ return (self._namefilter is not None and self._namefilter(prefix, base)) def _from_module(self, module, object): """ Return true if the given object is defined in the given module. """ if module is None: return True elif inspect.isfunction(object): return module.__dict__ is object.func_globals elif inspect.isclass(object): return module.__name__ == object.__module__ elif inspect.getmodule(object) is not None: return module is inspect.getmodule(object) elif hasattr(object, '__module__'): return module.__name__ == object.__module__ elif isinstance(object, property): return True # [XX] no way not be sure. else: raise ValueError("object must be a class or function") def _find(self, tests, obj, name, module, source_lines, globs, seen): """ Find tests for the given object and any contained objects, and add them to `tests`. """ if self._verbose: print 'Finding tests in %s' % name # If we've already processed this object, then ignore it. if id(obj) in seen: return seen[id(obj)] = 1 # Find a test for this object, and add it to the list of tests. test = self._get_test(obj, name, module, globs, source_lines) if test is not None: tests.append(test) # Look for tests in a module's contained objects. if inspect.ismodule(obj) and self._recurse: for valname, val in obj.__dict__.items(): # Check if this contained object should be ignored. if self._filter(val, name, valname): continue valname = '%s.%s' % (name, valname) # Recurse to functions & classes. if ((inspect.isfunction(val) or inspect.isclass(val)) and self._from_module(module, val)): self._find(tests, val, valname, module, source_lines, globs, seen) # Look for tests in a module's __test__ dictionary. if inspect.ismodule(obj) and self._recurse: for valname, val in getattr(obj, '__test__', {}).items(): if not isinstance(valname, basestring): raise ValueError("DocTestFinder.find: __test__ keys " "must be strings: %r" % (type(valname),)) if not (inspect.isfunction(val) or inspect.isclass(val) or inspect.ismethod(val) or inspect.ismodule(val) or isinstance(val, basestring)): raise ValueError("DocTestFinder.find: __test__ values " "must be strings, functions, methods, " "classes, or modules: %r" % (type(val),)) valname = '%s.__test__.%s' % (name, valname) self._find(tests, val, valname, module, source_lines, globs, seen) # Look for tests in a class's contained objects. if inspect.isclass(obj) and self._recurse: for valname, val in obj.__dict__.items(): # Check if this contained object should be ignored. if self._filter(val, name, valname): continue # Special handling for staticmethod/classmethod. if isinstance(val, staticmethod): val = getattr(obj, valname) if isinstance(val, classmethod): val = getattr(obj, valname).im_func # Recurse to methods, properties, and nested classes. if ((inspect.isfunction(val) or inspect.isclass(val) or isinstance(val, property)) and self._from_module(module, val)): valname = '%s.%s' % (name, valname) self._find(tests, val, valname, module, source_lines, globs, seen) def _get_test(self, obj, name, module, globs, source_lines): """ Return a DocTest for the given object, if it defines a docstring; otherwise, return None. """ # Extract the object's docstring. If it doesn't have one, # then return None (no test for this object). if isinstance(obj, basestring): docstring = obj else: try: if obj.__doc__ is None: docstring = '' else: docstring = obj.__doc__ if not isinstance(docstring, basestring): docstring = str(docstring) except (TypeError, AttributeError): docstring = '' # Find the docstring's location in the file. lineno = self._find_lineno(obj, source_lines) # Don't bother if the docstring is empty. if self._exclude_empty and not docstring: return None # Return a DocTest for this object. if module is None: filename = None else: filename = getattr(module, '__file__', module.__name__) if filename[-4:] in (".pyc", ".pyo"): filename = filename[:-1] return self._parser.get_doctest(docstring, globs, name, filename, lineno) def _find_lineno(self, obj, source_lines): """ Return a line number of the given object's docstring. Note: this method assumes that the object has a docstring. """ lineno = None # Find the line number for modules. if inspect.ismodule(obj): lineno = 0 # Find the line number for classes. # Note: this could be fooled if a class is defined multiple # times in a single file. if inspect.isclass(obj): if source_lines is None: return None pat = re.compile(r'^\s*class\s*%s\b' % getattr(obj, '__name__', '-')) for i, line in enumerate(source_lines): if pat.match(line): lineno = i break # Find the line number for functions & methods. if inspect.ismethod(obj): obj = obj.im_func if inspect.isfunction(obj): obj = obj.func_code if inspect.istraceback(obj): obj = obj.tb_frame if inspect.isframe(obj): obj = obj.f_code if inspect.iscode(obj): lineno = getattr(obj, 'co_firstlineno', None)-1 # Find the line number where the docstring starts. Assume # that it's the first line that begins with a quote mark. # Note: this could be fooled by a multiline function # signature, where a continuation line begins with a quote # mark. if lineno is not None: if source_lines is None: return lineno+1 pat = re.compile('(^|.*:)\s*\w*("|\')') for lineno in range(lineno, len(source_lines)): if pat.match(source_lines[lineno]): return lineno # We couldn't find the line number. return None ###################################################################### ## 5. DocTest Runner ###################################################################### class DocTestRunner: """ A class used to run DocTest test cases, and accumulate statistics. The `run` method is used to process a single DocTest case. It returns a tuple `(f, t)`, where `t` is the number of test cases tried, and `f` is the number of test cases that failed. >>> tests = DocTestFinder().find(_TestClass) >>> runner = DocTestRunner(verbose=False) >>> for test in tests: ... print runner.run(test) (0, 2) (0, 1) (0, 2) (0, 2) The `summarize` method prints a summary of all the test cases that have been run by the runner, and returns an aggregated `(f, t)` tuple: >>> runner.summarize(verbose=1) 4 items passed all tests: 2 tests in _TestClass 2 tests in _TestClass.__init__ 2 tests in _TestClass.get 1 tests in _TestClass.square 7 tests in 4 items. 7 passed and 0 failed. Test passed. (0, 7) The aggregated number of tried examples and failed examples is also available via the `tries` and `failures` attributes: >>> runner.tries 7 >>> runner.failures 0 The comparison between expected outputs and actual outputs is done by an `OutputChecker`. This comparison may be customized with a number of option flags; see the documentation for `testmod` for more information. If the option flags are insufficient, then the comparison may also be customized by passing a subclass of `OutputChecker` to the constructor. The test runner's display output can be controlled in two ways. First, an output function (`out) can be passed to `TestRunner.run`; this function will be called with strings that should be displayed. It defaults to `sys.stdout.write`. If capturing the output is not sufficient, then the display output can be also customized by subclassing DocTestRunner, and overriding the methods `report_start`, `report_success`, `report_unexpected_exception`, and `report_failure`. """ # This divider string is used to separate failure messages, and to # separate sections of the summary. DIVIDER = "*" * 70 def __init__(self, checker=None, verbose=None, optionflags=0): """ Create a new test runner. Optional keyword arg `checker` is the `OutputChecker` that should be used to compare the expected outputs and actual outputs of doctest examples. Optional keyword arg 'verbose' prints lots of stuff if true, only failures if false; by default, it's true iff '-v' is in sys.argv. Optional argument `optionflags` can be used to control how the test runner compares expected output to actual output, and how it displays failures. See the documentation for `testmod` for more information. """ self._checker = checker or OutputChecker() if verbose is None: verbose = '-v' in sys.argv self._verbose = verbose self.optionflags = optionflags self.original_optionflags = optionflags # Keep track of the examples we've run. self.tries = 0 self.failures = 0 self._name2ft = {} # Create a fake output target for capturing doctest output. self._fakeout = _SpoofOut() #///////////////////////////////////////////////////////////////// # Reporting methods #///////////////////////////////////////////////////////////////// def report_start(self, out, test, example): """ Report that the test runner is about to process the given example. (Only displays a message if verbose=True) """ if self._verbose: if example.want: out('Trying:\n' + _indent(example.source) + 'Expecting:\n' + _indent(example.want)) else: out('Trying:\n' + _indent(example.source) + 'Expecting nothing\n') def report_success(self, out, test, example, got): """ Report that the given example ran successfully. (Only displays a message if verbose=True) """ if self._verbose: out("ok\n") def report_failure(self, out, test, example, got): """ Report that the given example failed. """ out(self._failure_header(test, example) + self._checker.output_difference(example, got, self.optionflags)) def report_unexpected_exception(self, out, test, example, exc_info): """ Report that the given example raised an unexpected exception. """ out(self._failure_header(test, example) + 'Exception raised:\n' + _indent(_exception_traceback(exc_info))) def _failure_header(self, test, example): out = [self.DIVIDER] if test.filename: if test.lineno is not None and example.lineno is not None: lineno = test.lineno + example.lineno + 1 else: lineno = '?' out.append('File "%s", line %s, in %s' % (test.filename, lineno, test.name)) else: out.append('Line %s, in %s' % (example.lineno+1, test.name)) out.append('Failed example:') source = example.source out.append(_indent(source)) return '\n'.join(out) #///////////////////////////////////////////////////////////////// # DocTest Running #///////////////////////////////////////////////////////////////// def __run(self, test, compileflags, out): """ Run the examples in `test`. Write the outcome of each example with one of the `DocTestRunner.report_*` methods, using the writer function `out`. `compileflags` is the set of compiler flags that should be used to execute examples. Return a tuple `(f, t)`, where `t` is the number of examples tried, and `f` is the number of examples that failed. The examples are run in the namespace `test.globs`. """ # Keep track of the number of failures and tries. failures = tries = 0 # Save the option flags (since option directives can be used # to modify them). original_optionflags = self.optionflags SUCCESS, FAILURE, BOOM = range(3) # `outcome` state check = self._checker.check_output # Process each example. for examplenum, example in enumerate(test.examples): # If REPORT_ONLY_FIRST_FAILURE is set, then supress # reporting after the first failure. quiet = (self.optionflags & REPORT_ONLY_FIRST_FAILURE and failures > 0) # Merge in the example's options. self.optionflags = original_optionflags if example.options: for (optionflag, val) in example.options.items(): if val: self.optionflags |= optionflag else: self.optionflags &= ~optionflag # Record that we started this example. tries += 1 if not quiet: self.report_start(out, test, example) # Use a special filename for compile(), so we can retrieve # the source code during interactive debugging (see # __patched_linecache_getlines). filename = '' % (test.name, examplenum) # Run the example in the given context (globs), and record # any exception that gets raised. (But don't intercept # keyboard interrupts.) try: # Don't blink! This is where the user's code gets run. exec compile(example.source, filename, "single", compileflags, 1) in test.globs self.debugger.set_continue() # ==== Example Finished ==== exception = None except KeyboardInterrupt: raise except: exception = sys.exc_info() self.debugger.set_continue() # ==== Example Finished ==== got = self._fakeout.getvalue() # the actual output self._fakeout.truncate(0) outcome = FAILURE # guilty until proved innocent or insane # If the example executed without raising any exceptions, # verify its output. if exception is None: if check(example.want, got, self.optionflags): outcome = SUCCESS # The example raised an exception: check if it was expected. else: exc_info = sys.exc_info() exc_msg = traceback.format_exception_only(*exc_info[:2])[-1] if not quiet: got += _exception_traceback(exc_info) # If `example.exc_msg` is None, then we weren't expecting # an exception. if example.exc_msg is None: outcome = BOOM # We expected an exception: see whether it matches. elif check(example.exc_msg, exc_msg, self.optionflags): outcome = SUCCESS # Another chance if they didn't care about the detail. elif self.optionflags & IGNORE_EXCEPTION_DETAIL: m1 = re.match(r'[^:]*:', example.exc_msg) m2 = re.match(r'[^:]*:', exc_msg) if m1 and m2 and check(m1.group(0), m2.group(0), self.optionflags): outcome = SUCCESS # Report the outcome. if outcome is SUCCESS: if not quiet: self.report_success(out, test, example, got) elif outcome is FAILURE: if not quiet: self.report_failure(out, test, example, got) failures += 1 elif outcome is BOOM: if not quiet: self.report_unexpected_exception(out, test, example, exc_info) failures += 1 else: assert False, ("unknown outcome", outcome) # Restore the option flags (in case they were modified) self.optionflags = original_optionflags # Record and return the number of failures and tries. self.__record_outcome(test, failures, tries) return failures, tries def __record_outcome(self, test, f, t): """ Record the fact that the given DocTest (`test`) generated `f` failures out of `t` tried examples. """ f2, t2 = self._name2ft.get(test.name, (0,0)) self._name2ft[test.name] = (f+f2, t+t2) self.failures += f self.tries += t __LINECACHE_FILENAME_RE = re.compile(r'[\w\.]+)' r'\[(?P\d+)\]>$') def __patched_linecache_getlines(self, filename, module_globals=None): m = self.__LINECACHE_FILENAME_RE.match(filename) if m and m.group('name') == self.test.name: example = self.test.examples[int(m.group('examplenum'))] return example.source.splitlines(True) elif self.save_linecache_getlines.func_code.co_argcount>1: return self.save_linecache_getlines(filename, module_globals) else: return self.save_linecache_getlines(filename) def run(self, test, compileflags=None, out=None, clear_globs=True): """ Run the examples in `test`, and display the results using the writer function `out`. The examples are run in the namespace `test.globs`. If `clear_globs` is true (the default), then this namespace will be cleared after the test runs, to help with garbage collection. If you would like to examine the namespace after the test completes, then use `clear_globs=False`. `compileflags` gives the set of flags that should be used by the Python compiler when running the examples. If not specified, then it will default to the set of future-import flags that apply to `globs`. The output of each example is checked using `DocTestRunner.check_output`, and the results are formatted by the `DocTestRunner.report_*` methods. """ self.test = test if compileflags is None: compileflags = _extract_future_flags(test.globs) save_stdout = sys.stdout if out is None: out = save_stdout.write sys.stdout = self._fakeout # Patch pdb.set_trace to restore sys.stdout during interactive # debugging (so it's not still redirected to self._fakeout). # Note that the interactive output will go to *our* # save_stdout, even if that's not the real sys.stdout; this # allows us to write test cases for the set_trace behavior. save_set_trace = pdb.set_trace self.debugger = _OutputRedirectingPdb(save_stdout) self.debugger.reset() pdb.set_trace = self.debugger.set_trace # Patch linecache.getlines, so we can see the example's source # when we're inside the debugger. self.save_linecache_getlines = linecache.getlines linecache.getlines = self.__patched_linecache_getlines try: return self.__run(test, compileflags, out) finally: sys.stdout = save_stdout pdb.set_trace = save_set_trace linecache.getlines = self.save_linecache_getlines if clear_globs: test.globs.clear() #///////////////////////////////////////////////////////////////// # Summarization #///////////////////////////////////////////////////////////////// def summarize(self, verbose=None): """ Print a summary of all the test cases that have been run by this DocTestRunner, and return a tuple `(f, t)`, where `f` is the total number of failed examples, and `t` is the total number of tried examples. The optional `verbose` argument controls how detailed the summary is. If the verbosity is not specified, then the DocTestRunner's verbosity is used. """ if verbose is None: verbose = self._verbose notests = [] passed = [] failed = [] totalt = totalf = 0 for x in self._name2ft.items(): name, (f, t) = x assert f <= t totalt += t totalf += f if t == 0: notests.append(name) elif f == 0: passed.append( (name, t) ) else: failed.append(x) if verbose: if notests: print len(notests), "items had no tests:" notests.sort() for thing in notests: print " ", thing if passed: print len(passed), "items passed all tests:" passed.sort() for thing, count in passed: print " %3d tests in %s" % (count, thing) if failed: print self.DIVIDER print len(failed), "items had failures:" failed.sort() for thing, (f, t) in failed: print " %3d of %3d in %s" % (f, t, thing) if verbose: print totalt, "tests in", len(self._name2ft), "items." print totalt - totalf, "passed and", totalf, "failed." if totalf: print "***Test Failed***", totalf, "failures." elif verbose: print "Test passed." return totalf, totalt #///////////////////////////////////////////////////////////////// # Backward compatibility cruft to maintain doctest.master. #///////////////////////////////////////////////////////////////// def merge(self, other): d = self._name2ft for name, (f, t) in other._name2ft.items(): if name in d: print "*** DocTestRunner.merge: '" + name + "' in both" \ " testers; summing outcomes." f2, t2 = d[name] f = f + f2 t = t + t2 d[name] = f, t class OutputChecker: """ A class used to check the whether the actual output from a doctest example matches the expected output. `OutputChecker` defines two methods: `check_output`, which compares a given pair of outputs, and returns true if they match; and `output_difference`, which returns a string describing the differences between two outputs. """ def check_output(self, want, got, optionflags): """ Return True iff the actual output from an example (`got`) matches the expected output (`want`). These strings are always considered to match if they are identical; but depending on what option flags the test runner is using, several non-exact match types are also possible. See the documentation for `TestRunner` for more information about option flags. """ # Handle the common case first, for efficiency: # if they're string-identical, always return true. if got == want: return True # The values True and False replaced 1 and 0 as the return # value for boolean comparisons in Python 2.3. if not (optionflags & DONT_ACCEPT_TRUE_FOR_1): if (got,want) == ("True\n", "1\n"): return True if (got,want) == ("False\n", "0\n"): return True # can be used as a special sequence to signify a # blank line, unless the DONT_ACCEPT_BLANKLINE flag is used. if not (optionflags & DONT_ACCEPT_BLANKLINE): # Replace in want with a blank line. want = re.sub('(?m)^%s\s*?$' % re.escape(BLANKLINE_MARKER), '', want) # If a line in got contains only spaces, then remove the # spaces. got = re.sub('(?m)^\s*?$', '', got) if got == want: return True # This flag causes doctest to ignore any differences in the # contents of whitespace strings. Note that this can be used # in conjunction with the ELLIPSIS flag. if optionflags & NORMALIZE_WHITESPACE: got = ' '.join(got.split()) want = ' '.join(want.split()) if got == want: return True # The ELLIPSIS flag says to let the sequence "..." in `want` # match any substring in `got`. if optionflags & ELLIPSIS: if _ellipsis_match(want, got): return True # We didn't find any match; return false. return False # Should we do a fancy diff? def _do_a_fancy_diff(self, want, got, optionflags): # Not unless they asked for a fancy diff. if not optionflags & (REPORT_UDIFF | REPORT_CDIFF | REPORT_NDIFF): return False # If expected output uses ellipsis, a meaningful fancy diff is # too hard ... or maybe not. In two real-life failures Tim saw, # a diff was a major help anyway, so this is commented out. # [todo] _ellipsis_match() knows which pieces do and don't match, # and could be the basis for a kick-ass diff in this case. ##if optionflags & ELLIPSIS and ELLIPSIS_MARKER in want: ## return False # ndiff does intraline difference marking, so can be useful even # for 1-line differences. if optionflags & REPORT_NDIFF: return True # The other diff types need at least a few lines to be helpful. return want.count('\n') > 2 and got.count('\n') > 2 def output_difference(self, example, got, optionflags): """ Return a string describing the differences between the expected output for a given example (`example`) and the actual output (`got`). `optionflags` is the set of option flags used to compare `want` and `got`. """ want = example.want # If s are being used, then replace blank lines # with in the actual output string. if not (optionflags & DONT_ACCEPT_BLANKLINE): got = re.sub('(?m)^[ ]*(?=\n)', BLANKLINE_MARKER, got) # Check if we should use diff. if self._do_a_fancy_diff(want, got, optionflags): # Split want & got into lines. want_lines = want.splitlines(True) # True == keep line ends got_lines = got.splitlines(True) # Use difflib to find their differences. if optionflags & REPORT_UDIFF: diff = difflib.unified_diff(want_lines, got_lines, n=2) diff = list(diff)[2:] # strip the diff header kind = 'unified diff with -expected +actual' elif optionflags & REPORT_CDIFF: diff = difflib.context_diff(want_lines, got_lines, n=2) diff = list(diff)[2:] # strip the diff header kind = 'context diff with expected followed by actual' elif optionflags & REPORT_NDIFF: engine = difflib.Differ(charjunk=difflib.IS_CHARACTER_JUNK) diff = list(engine.compare(want_lines, got_lines)) kind = 'ndiff with -expected +actual' else: assert 0, 'Bad diff option' # Remove trailing whitespace on diff output. diff = [line.rstrip() + '\n' for line in diff] return 'Differences (%s):\n' % kind + _indent(''.join(diff)) # If we're not using diff, then simply list the expected # output followed by the actual output. if want and got: return 'Expected:\n%sGot:\n%s' % (_indent(want), _indent(got)) elif want: return 'Expected:\n%sGot nothing\n' % _indent(want) elif got: return 'Expected nothing\nGot:\n%s' % _indent(got) else: return 'Expected nothing\nGot nothing\n' class DocTestFailure(Exception): """A DocTest example has failed in debugging mode. The exception instance has variables: - test: the DocTest object being run - excample: the Example object that failed - got: the actual output """ def __init__(self, test, example, got): self.test = test self.example = example self.got = got def __str__(self): return str(self.test) class UnexpectedException(Exception): """A DocTest example has encountered an unexpected exception The exception instance has variables: - test: the DocTest object being run - excample: the Example object that failed - exc_info: the exception info """ def __init__(self, test, example, exc_info): self.test = test self.example = example self.exc_info = exc_info def __str__(self): return str(self.test) class DebugRunner(DocTestRunner): r"""Run doc tests but raise an exception as soon as there is a failure. If an unexpected exception occurs, an UnexpectedException is raised. It contains the test, the example, and the original exception: >>> runner = DebugRunner(verbose=False) >>> test = DocTestParser().get_doctest('>>> raise KeyError\n42', ... {}, 'foo', 'foo.py', 0) >>> try: ... runner.run(test) ... except UnexpectedException, failure: ... pass >>> failure.test is test True >>> failure.example.want '42\n' >>> exc_info = failure.exc_info >>> raise exc_info[0], exc_info[1], exc_info[2] Traceback (most recent call last): ... KeyError We wrap the original exception to give the calling application access to the test and example information. If the output doesn't match, then a DocTestFailure is raised: >>> test = DocTestParser().get_doctest(''' ... >>> x = 1 ... >>> x ... 2 ... ''', {}, 'foo', 'foo.py', 0) >>> try: ... runner.run(test) ... except DocTestFailure, failure: ... pass DocTestFailure objects provide access to the test: >>> failure.test is test True As well as to the example: >>> failure.example.want '2\n' and the actual output: >>> failure.got '1\n' If a failure or error occurs, the globals are left intact: >>> del test.globs['__builtins__'] >>> test.globs {'x': 1} >>> test = DocTestParser().get_doctest(''' ... >>> x = 2 ... >>> raise KeyError ... ''', {}, 'foo', 'foo.py', 0) >>> runner.run(test) Traceback (most recent call last): ... UnexpectedException: >>> del test.globs['__builtins__'] >>> test.globs {'x': 2} But the globals are cleared if there is no error: >>> test = DocTestParser().get_doctest(''' ... >>> x = 2 ... ''', {}, 'foo', 'foo.py', 0) >>> runner.run(test) (0, 1) >>> test.globs {} """ def run(self, test, compileflags=None, out=None, clear_globs=True): r = DocTestRunner.run(self, test, compileflags, out, False) if clear_globs: test.globs.clear() return r def report_unexpected_exception(self, out, test, example, exc_info): raise UnexpectedException(test, example, exc_info) def report_failure(self, out, test, example, got): raise DocTestFailure(test, example, got) ###################################################################### ## 6. Test Functions ###################################################################### # These should be backwards compatible. # For backward compatibility, a global instance of a DocTestRunner # class, updated by testmod. master = None def testmod(m=None, name=None, globs=None, verbose=None, isprivate=None, report=True, optionflags=0, extraglobs=None, raise_on_error=False, exclude_empty=False): """m=None, name=None, globs=None, verbose=None, isprivate=None, report=True, optionflags=0, extraglobs=None, raise_on_error=False, exclude_empty=False Test examples in docstrings in functions and classes reachable from module m (or the current module if m is not supplied), starting with m.__doc__. Unless isprivate is specified, private names are not skipped. Also test examples reachable from dict m.__test__ if it exists and is not None. m.__test__ maps names to functions, classes and strings; function and class docstrings are tested even if the name is private; strings are tested directly, as if they were docstrings. Return (#failures, #tests). See doctest.__doc__ for an overview. Optional keyword arg "name" gives the name of the module; by default use m.__name__. Optional keyword arg "globs" gives a dict to be used as the globals when executing examples; by default, use m.__dict__. A copy of this dict is actually used for each docstring, so that each docstring's examples start with a clean slate. Optional keyword arg "extraglobs" gives a dictionary that should be merged into the globals that are used to execute examples. By default, no extra globals are used. This is new in 2.4. Optional keyword arg "verbose" prints lots of stuff if true, prints only failures if false; by default, it's true iff "-v" is in sys.argv. Optional keyword arg "report" prints a summary at the end when true, else prints nothing at the end. In verbose mode, the summary is detailed, else very brief (in fact, empty if all tests passed). Optional keyword arg "optionflags" or's together module constants, and defaults to 0. This is new in 2.3. Possible values (see the docs for details): DONT_ACCEPT_TRUE_FOR_1 DONT_ACCEPT_BLANKLINE NORMALIZE_WHITESPACE ELLIPSIS IGNORE_EXCEPTION_DETAIL REPORT_UDIFF REPORT_CDIFF REPORT_NDIFF REPORT_ONLY_FIRST_FAILURE Optional keyword arg "raise_on_error" raises an exception on the first unexpected exception or failure. This allows failures to be post-mortem debugged. Deprecated in Python 2.4: Optional keyword arg "isprivate" specifies a function used to determine whether a name is private. The default function is treat all functions as public. Optionally, "isprivate" can be set to doctest.is_private to skip over functions marked as private using the underscore naming convention; see its docs for details. Advanced tomfoolery: testmod runs methods of a local instance of class doctest.Tester, then merges the results into (or creates) global Tester instance doctest.master. Methods of doctest.master can be called directly too, if you want to do something unusual. Passing report=0 to testmod is especially useful then, to delay displaying a summary. Invoke doctest.master.summarize(verbose) when you're done fiddling. """ global master if isprivate is not None: warnings.warn("the isprivate argument is deprecated; " "examine DocTestFinder.find() lists instead", DeprecationWarning) # If no module was given, then use __main__. if m is None: # DWA - m will still be None if this wasn't invoked from the command # line, in which case the following TypeError is about as good an error # as we should expect m = sys.modules.get('__main__') # Check that we were actually given a module. if not inspect.ismodule(m): raise TypeError("testmod: module required; %r" % (m,)) # If no name was given, then use the module's name. if name is None: name = m.__name__ # Find, parse, and run all tests in the given module. finder = DocTestFinder(_namefilter=isprivate, exclude_empty=exclude_empty) if raise_on_error: runner = DebugRunner(verbose=verbose, optionflags=optionflags) else: runner = DocTestRunner(verbose=verbose, optionflags=optionflags) for test in finder.find(m, name, globs=globs, extraglobs=extraglobs): runner.run(test) if report: runner.summarize() if master is None: master = runner else: master.merge(runner) return runner.failures, runner.tries def testfile(filename, module_relative=True, name=None, package=None, globs=None, verbose=None, report=True, optionflags=0, extraglobs=None, raise_on_error=False, parser=DocTestParser()): """ Test examples in the given file. Return (#failures, #tests). Optional keyword arg "module_relative" specifies how filenames should be interpreted: - If "module_relative" is True (the default), then "filename" specifies a module-relative path. By default, this path is relative to the calling module's directory; but if the "package" argument is specified, then it is relative to that package. To ensure os-independence, "filename" should use "/" characters to separate path segments, and should not be an absolute path (i.e., it may not begin with "/"). - If "module_relative" is False, then "filename" specifies an os-specific path. The path may be absolute or relative (to the current working directory). Optional keyword arg "name" gives the name of the test; by default use the file's basename. Optional keyword argument "package" is a Python package or the name of a Python package whose directory should be used as the base directory for a module relative filename. If no package is specified, then the calling module's directory is used as the base directory for module relative filenames. It is an error to specify "package" if "module_relative" is False. Optional keyword arg "globs" gives a dict to be used as the globals when executing examples; by default, use {}. A copy of this dict is actually used for each docstring, so that each docstring's examples start with a clean slate. Optional keyword arg "extraglobs" gives a dictionary that should be merged into the globals that are used to execute examples. By default, no extra globals are used. Optional keyword arg "verbose" prints lots of stuff if true, prints only failures if false; by default, it's true iff "-v" is in sys.argv. Optional keyword arg "report" prints a summary at the end when true, else prints nothing at the end. In verbose mode, the summary is detailed, else very brief (in fact, empty if all tests passed). Optional keyword arg "optionflags" or's together module constants, and defaults to 0. Possible values (see the docs for details): DONT_ACCEPT_TRUE_FOR_1 DONT_ACCEPT_BLANKLINE NORMALIZE_WHITESPACE ELLIPSIS IGNORE_EXCEPTION_DETAIL REPORT_UDIFF REPORT_CDIFF REPORT_NDIFF REPORT_ONLY_FIRST_FAILURE Optional keyword arg "raise_on_error" raises an exception on the first unexpected exception or failure. This allows failures to be post-mortem debugged. Optional keyword arg "parser" specifies a DocTestParser (or subclass) that should be used to extract tests from the files. Advanced tomfoolery: testmod runs methods of a local instance of class doctest.Tester, then merges the results into (or creates) global Tester instance doctest.master. Methods of doctest.master can be called directly too, if you want to do something unusual. Passing report=0 to testmod is especially useful then, to delay displaying a summary. Invoke doctest.master.summarize(verbose) when you're done fiddling. """ global master if package and not module_relative: raise ValueError("Package may only be specified for module-" "relative paths.") # Relativize the path if module_relative: package = _normalize_module(package) filename = _module_relative_path(package, filename) # If no name was given, then use the file's name. if name is None: name = os.path.basename(filename) # Assemble the globals. if globs is None: globs = {} else: globs = globs.copy() if extraglobs is not None: globs.update(extraglobs) if raise_on_error: runner = DebugRunner(verbose=verbose, optionflags=optionflags) else: runner = DocTestRunner(verbose=verbose, optionflags=optionflags) # Read the file, convert it to a test, and run it. s = open(filename).read() test = parser.get_doctest(s, globs, name, filename, 0) runner.run(test) if report: runner.summarize() if master is None: master = runner else: master.merge(runner) return runner.failures, runner.tries def run_docstring_examples(f, globs, verbose=False, name="NoName", compileflags=None, optionflags=0): """ Test examples in the given object's docstring (`f`), using `globs` as globals. Optional argument `name` is used in failure messages. If the optional argument `verbose` is true, then generate output even if there are no failures. `compileflags` gives the set of flags that should be used by the Python compiler when running the examples. If not specified, then it will default to the set of future-import flags that apply to `globs`. Optional keyword arg `optionflags` specifies options for the testing and output. See the documentation for `testmod` for more information. """ # Find, parse, and run all tests in the given module. finder = DocTestFinder(verbose=verbose, recurse=False) runner = DocTestRunner(verbose=verbose, optionflags=optionflags) for test in finder.find(f, name, globs=globs): runner.run(test, compileflags=compileflags) ###################################################################### ## 7. Tester ###################################################################### # This is provided only for backwards compatibility. It's not # actually used in any way. class Tester: def __init__(self, mod=None, globs=None, verbose=None, isprivate=None, optionflags=0): warnings.warn("class Tester is deprecated; " "use class doctest.DocTestRunner instead", DeprecationWarning, stacklevel=2) if mod is None and globs is None: raise TypeError("Tester.__init__: must specify mod or globs") if mod is not None and not inspect.ismodule(mod): raise TypeError("Tester.__init__: mod must be a module; %r" % (mod,)) if globs is None: globs = mod.__dict__ self.globs = globs self.verbose = verbose self.isprivate = isprivate self.optionflags = optionflags self.testfinder = DocTestFinder(_namefilter=isprivate) self.testrunner = DocTestRunner(verbose=verbose, optionflags=optionflags) def runstring(self, s, name): test = DocTestParser().get_doctest(s, self.globs, name, None, None) if self.verbose: print "Running string", name (f,t) = self.testrunner.run(test) if self.verbose: print f, "of", t, "examples failed in string", name return (f,t) def rundoc(self, object, name=None, module=None): f = t = 0 tests = self.testfinder.find(object, name, module=module, globs=self.globs) for test in tests: (f2, t2) = self.testrunner.run(test) (f,t) = (f+f2, t+t2) return (f,t) def rundict(self, d, name, module=None): import new m = new.module(name) m.__dict__.update(d) if module is None: module = False return self.rundoc(m, name, module) def run__test__(self, d, name): import new m = new.module(name) m.__test__ = d return self.rundoc(m, name) def summarize(self, verbose=None): return self.testrunner.summarize(verbose) def merge(self, other): self.testrunner.merge(other.testrunner) ###################################################################### ## 8. Unittest Support ###################################################################### _unittest_reportflags = 0 def set_unittest_reportflags(flags): """Sets the unittest option flags. The old flag is returned so that a runner could restore the old value if it wished to: >>> old = _unittest_reportflags >>> set_unittest_reportflags(REPORT_NDIFF | ... REPORT_ONLY_FIRST_FAILURE) == old True >>> import doctest >>> doctest._unittest_reportflags == (REPORT_NDIFF | ... REPORT_ONLY_FIRST_FAILURE) True Only reporting flags can be set: >>> set_unittest_reportflags(ELLIPSIS) Traceback (most recent call last): ... ValueError: ('Only reporting flags allowed', 8) >>> set_unittest_reportflags(old) == (REPORT_NDIFF | ... REPORT_ONLY_FIRST_FAILURE) True """ global _unittest_reportflags if (flags & REPORTING_FLAGS) != flags: raise ValueError("Only reporting flags allowed", flags) old = _unittest_reportflags _unittest_reportflags = flags return old class DocTestCase(unittest.TestCase): def __init__(self, test, optionflags=0, setUp=None, tearDown=None, checker=None): unittest.TestCase.__init__(self) self._dt_optionflags = optionflags self._dt_checker = checker self._dt_test = test self._dt_setUp = setUp self._dt_tearDown = tearDown def setUp(self): test = self._dt_test if self._dt_setUp is not None: self._dt_setUp(test) def tearDown(self): test = self._dt_test if self._dt_tearDown is not None: self._dt_tearDown(test) test.globs.clear() def runTest(self): test = self._dt_test old = sys.stdout new = StringIO() optionflags = self._dt_optionflags if not (optionflags & REPORTING_FLAGS): # The option flags don't include any reporting flags, # so add the default reporting flags optionflags |= _unittest_reportflags runner = DocTestRunner(optionflags=optionflags, checker=self._dt_checker, verbose=False) try: runner.DIVIDER = "-"*70 failures, tries = runner.run( test, out=new.write, clear_globs=False) finally: sys.stdout = old if failures: raise self.failureException(self.format_failure(new.getvalue())) def format_failure(self, err): test = self._dt_test if test.lineno is None: lineno = 'unknown line number' else: lineno = '%s' % test.lineno lname = '.'.join(test.name.split('.')[-1:]) return ('Failed doctest test for %s\n' ' File "%s", line %s, in %s\n\n%s' % (test.name, test.filename, lineno, lname, err) ) def debug(self): r"""Run the test case without results and without catching exceptions The unit test framework includes a debug method on test cases and test suites to support post-mortem debugging. The test code is run in such a way that errors are not caught. This way a caller can catch the errors and initiate post-mortem debugging. The DocTestCase provides a debug method that raises UnexpectedException errors if there is an unexepcted exception: >>> test = DocTestParser().get_doctest('>>> raise KeyError\n42', ... {}, 'foo', 'foo.py', 0) >>> case = DocTestCase(test) >>> try: ... case.debug() ... except UnexpectedException, failure: ... pass The UnexpectedException contains the test, the example, and the original exception: >>> failure.test is test True >>> failure.example.want '42\n' >>> exc_info = failure.exc_info >>> raise exc_info[0], exc_info[1], exc_info[2] Traceback (most recent call last): ... KeyError If the output doesn't match, then a DocTestFailure is raised: >>> test = DocTestParser().get_doctest(''' ... >>> x = 1 ... >>> x ... 2 ... ''', {}, 'foo', 'foo.py', 0) >>> case = DocTestCase(test) >>> try: ... case.debug() ... except DocTestFailure, failure: ... pass DocTestFailure objects provide access to the test: >>> failure.test is test True As well as to the example: >>> failure.example.want '2\n' and the actual output: >>> failure.got '1\n' """ self.setUp() runner = DebugRunner(optionflags=self._dt_optionflags, checker=self._dt_checker, verbose=False) runner.run(self._dt_test) self.tearDown() def id(self): return self._dt_test.name def __repr__(self): name = self._dt_test.name.split('.') return "%s (%s)" % (name[-1], '.'.join(name[:-1])) __str__ = __repr__ def shortDescription(self): return "Doctest: " + self._dt_test.name def DocTestSuite(module=None, globs=None, extraglobs=None, test_finder=None, **options): """ Convert doctest tests for a module to a unittest test suite. This converts each documentation string in a module that contains doctest tests to a unittest test case. If any of the tests in a doc string fail, then the test case fails. An exception is raised showing the name of the file containing the test and a (sometimes approximate) line number. The `module` argument provides the module to be tested. The argument can be either a module or a module name. If no argument is given, the calling module is used. A number of options may be provided as keyword arguments: setUp A set-up function. This is called before running the tests in each file. The setUp function will be passed a DocTest object. The setUp function can access the test globals as the globs attribute of the test passed. tearDown A tear-down function. This is called after running the tests in each file. The tearDown function will be passed a DocTest object. The tearDown function can access the test globals as the globs attribute of the test passed. globs A dictionary containing initial global variables for the tests. optionflags A set of doctest option flags expressed as an integer. """ if test_finder is None: test_finder = DocTestFinder() module = _normalize_module(module) tests = test_finder.find(module, globs=globs, extraglobs=extraglobs) if globs is None: globs = module.__dict__ if not tests: # Why do we want to do this? Because it reveals a bug that might # otherwise be hidden. raise ValueError(module, "has no tests") tests.sort() suite = unittest.TestSuite() for test in tests: if len(test.examples) == 0: continue if not test.filename: filename = module.__file__ if filename[-4:] in (".pyc", ".pyo"): filename = filename[:-1] test.filename = filename suite.addTest(DocTestCase(test, **options)) return suite class DocFileCase(DocTestCase): def id(self): return '_'.join(self._dt_test.name.split('.')) def __repr__(self): return self._dt_test.filename __str__ = __repr__ def format_failure(self, err): return ('Failed doctest test for %s\n File "%s", line 0\n\n%s' % (self._dt_test.name, self._dt_test.filename, err) ) def DocFileTest(path, module_relative=True, package=None, globs=None, parser=DocTestParser(), **options): if globs is None: globs = {} if package and not module_relative: raise ValueError("Package may only be specified for module-" "relative paths.") # Relativize the path. if module_relative: package = _normalize_module(package) path = _module_relative_path(package, path) # Find the file and read it. name = os.path.basename(path) doc = open(path).read() # Convert it to a test, and wrap it in a DocFileCase. test = parser.get_doctest(doc, globs, name, path, 0) return DocFileCase(test, **options) def DocFileSuite(*paths, **kw): """A unittest suite for one or more doctest files. The path to each doctest file is given as a string; the interpretation of that string depends on the keyword argument "module_relative". A number of options may be provided as keyword arguments: module_relative If "module_relative" is True, then the given file paths are interpreted as os-independent module-relative paths. By default, these paths are relative to the calling module's directory; but if the "package" argument is specified, then they are relative to that package. To ensure os-independence, "filename" should use "/" characters to separate path segments, and may not be an absolute path (i.e., it may not begin with "/"). If "module_relative" is False, then the given file paths are interpreted as os-specific paths. These paths may be absolute or relative (to the current working directory). package A Python package or the name of a Python package whose directory should be used as the base directory for module relative paths. If "package" is not specified, then the calling module's directory is used as the base directory for module relative filenames. It is an error to specify "package" if "module_relative" is False. setUp A set-up function. This is called before running the tests in each file. The setUp function will be passed a DocTest object. The setUp function can access the test globals as the globs attribute of the test passed. tearDown A tear-down function. This is called after running the tests in each file. The tearDown function will be passed a DocTest object. The tearDown function can access the test globals as the globs attribute of the test passed. globs A dictionary containing initial global variables for the tests. optionflags A set of doctest option flags expressed as an integer. parser A DocTestParser (or subclass) that should be used to extract tests from the files. """ suite = unittest.TestSuite() # We do this here so that _normalize_module is called at the right # level. If it were called in DocFileTest, then this function # would be the caller and we might guess the package incorrectly. if kw.get('module_relative', True): kw['package'] = _normalize_module(kw.get('package')) for path in paths: suite.addTest(DocFileTest(path, **kw)) return suite ###################################################################### ## 9. Debugging Support ###################################################################### def script_from_examples(s): r"""Extract script from text with examples. Converts text with examples to a Python script. Example input is converted to regular code. Example output and all other words are converted to comments: >>> text = ''' ... Here are examples of simple math. ... ... Python has super accurate integer addition ... ... >>> 2 + 2 ... 5 ... ... And very friendly error messages: ... ... >>> 1/0 ... To Infinity ... And ... Beyond ... ... You can use logic if you want: ... ... >>> if 0: ... ... blah ... ... blah ... ... ... ... Ho hum ... ''' >>> print script_from_examples(text) # Here are examples of simple math. # # Python has super accurate integer addition # 2 + 2 # Expected: ## 5 # # And very friendly error messages: # 1/0 # Expected: ## To Infinity ## And ## Beyond # # You can use logic if you want: # if 0: blah blah # # Ho hum """ output = [] for piece in DocTestParser().parse(s): if isinstance(piece, Example): # Add the example's source code (strip trailing NL) output.append(piece.source[:-1]) # Add the expected output: want = piece.want if want: output.append('# Expected:') output += ['## '+l for l in want.split('\n')[:-1]] else: # Add non-example text. output += [_comment_line(l) for l in piece.split('\n')[:-1]] # Trim junk on both ends. while output and output[-1] == '#': output.pop() while output and output[0] == '#': output.pop(0) # Combine the output, and return it. return '\n'.join(output) def testsource(module, name): """Extract the test sources from a doctest docstring as a script. Provide the module (or dotted name of the module) containing the test to be debugged and the name (within the module) of the object with the doc string with tests to be debugged. """ module = _normalize_module(module) tests = DocTestFinder().find(module) test = [t for t in tests if t.name == name] if not test: raise ValueError(name, "not found in tests") test = test[0] testsrc = script_from_examples(test.docstring) return testsrc def debug_src(src, pm=False, globs=None): """Debug a single doctest docstring, in argument `src`'""" testsrc = script_from_examples(src) debug_script(testsrc, pm, globs) def debug_script(src, pm=False, globs=None): "Debug a test script. `src` is the script, as a string." import pdb # Note that tempfile.NameTemporaryFile() cannot be used. As the # docs say, a file so created cannot be opened by name a second time # on modern Windows boxes, and execfile() needs to open it. srcfilename = tempfile.mktemp(".py", "doctestdebug") f = open(srcfilename, 'w') f.write(src) f.close() try: if globs: globs = globs.copy() else: globs = {} if pm: try: execfile(srcfilename, globs, globs) except: print sys.exc_info()[1] pdb.post_mortem(sys.exc_info()[2]) else: # Note that %r is vital here. '%s' instead can, e.g., cause # backslashes to get treated as metacharacters on Windows. pdb.run("execfile(%r)" % srcfilename, globs, globs) finally: os.remove(srcfilename) def debug(module, name, pm=False): """Debug a single doctest docstring. Provide the module (or dotted name of the module) containing the test to be debugged and the name (within the module) of the object with the docstring with tests to be debugged. """ module = _normalize_module(module) testsrc = testsource(module, name) debug_script(testsrc, pm, module.__dict__) ###################################################################### ## 10. Example Usage ###################################################################### class _TestClass: """ A pointless class, for sanity-checking of docstring testing. Methods: square() get() >>> _TestClass(13).get() + _TestClass(-12).get() 1 >>> hex(_TestClass(13).square().get()) '0xa9' """ def __init__(self, val): """val -> _TestClass object with associated value val. >>> t = _TestClass(123) >>> print t.get() 123 """ self.val = val def square(self): """square() -> square TestClass's associated value >>> _TestClass(13).square().get() 169 """ self.val = self.val ** 2 return self def get(self): """get() -> return TestClass's associated value. >>> x = _TestClass(-42) >>> print x.get() -42 """ return self.val __test__ = {"_TestClass": _TestClass, "string": r""" Example of a string object, searched as-is. >>> x = 1; y = 2 >>> x + y, x * y (3, 2) """, "bool-int equivalence": r""" In 2.2, boolean expressions displayed 0 or 1. By default, we still accept them. This can be disabled by passing DONT_ACCEPT_TRUE_FOR_1 to the new optionflags argument. >>> 4 == 4 1 >>> 4 == 4 True >>> 4 > 4 0 >>> 4 > 4 False """, "blank lines": r""" Blank lines can be marked with : >>> print 'foo\n\nbar\n' foo bar """, "ellipsis": r""" If the ellipsis flag is used, then '...' can be used to elide substrings in the desired output: >>> print range(1000) #doctest: +ELLIPSIS [0, 1, 2, ..., 999] """, "whitespace normalization": r""" If the whitespace normalization flag is used, then differences in whitespace are ignored. >>> print range(30) #doctest: +NORMALIZE_WHITESPACE [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29] """, } def _test(): r = unittest.TextTestRunner() r.run(DocTestSuite()) if __name__ == "__main__": _test() PKC8 գyysetuptools/tests/doctest.pyo; Ec!@syeWnej oeefZnXyeWnej odZnXdZdddddddd d d d d ddddddddddddddddddd d!d"g!Zd#kZd#kZd#k Z d#k Z d#k Z d#k Z d#k Z d#kZd#kZd#kZd#kZd#kZd#kZd$klZeid%deed&hZd'ZedZedZedZedZedZeeBeBeBeBZed Z ed Z!ed Z"ed Z#e e!Be"Be#BZ$d(Z%d)Z&d*Z'd+Z(d,d-Z)d.d/Z*d0Z+d1efd2YZ,d3Z-d4Z.d5ei/fd6YZ0d7Z1dfd8YZ2dfd9YZ3dfd:YZ4dfd;YZ5dfd<YZ6dfd=YZ7de8fd>YZ9de8fd?YZ:de6fd@YZ;e<a=e<e<e<e<e<e>d&e<e?e?dA Z@e>e<e<e<e<e>d&e<e?e4dB ZAe?dCe<d&dDZBdfdEYZCd&aDdFZEdGeiFfdHYZGe<e<e<e<dIZHdJeGfdKYZIe>e<e<e4dLZJdMZKdNZLdOZMe?e<dPZNe?e<dQZOe?dRZPdSfdTYZQhdSeQ<dUdV<dWdX<dYdZ<d[d\<d]d^}|t|<|SdS(Ni(slensOPTIONFLAGS_BY_NAMEsflagsname(snamesflag((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysregister_optionflags s s...cCsOtidtdd|d djo$|d djo|djn SdS( sprefix, base -> true iff name prefix + "." + base is "private". Prefix may be an empty string, and base does not contain a period. Prefix is ignored (although functions you write conforming to this protocol may make use of it). Return true iff base begins with an (at least one) underscore, but does not both begin and end with (at least) two underscores. >>> is_private("a.b", "my_func") False >>> is_private("____", "_my_func") True >>> is_private("someclass", "__init__") False >>> is_private("sometypo", "__init_") True >>> is_private("x.y.z", "_") True >>> is_private("_x.y.z", "__") False >>> is_private("", "") # senseless but consistent False sVis_private is deprecated; it wasn't useful; examine DocTestFinder.find() lists insteads stackleveliis_s__iN(swarningsswarnsDeprecationWarningsbase(sprefixsbase((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys is_privates  cCs[d}xJtiD]?}|i|t}|tt|jo||i O}qqW|SdS(s Return the compiler-flags associated with the future features that have been imported into the given namespace (globs). iN( sflagss __future__sall_feature_namessfnamesglobssgetsNonesfeaturesgetattrs compiler_flag(sglobssfeaturesflagssfname((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys_extract_future_flagss icCsti|o|Snot|ttfo t|ttdgSn9|t jot i t i |idSn tddS(s Return the module specified by `module`. In particular: - If `module` is a module, then return module. - If `module` is a string, then import and return the module with that name. - If `module` is None, then return the calling module. The calling module is assumed to be the module of the stack frame at the given depth in the call stack. s*s__name__s"Expected a module, string, or NoneN(sinspectsismodulesmodules isinstancesstrsunicodes __import__sglobalsslocalssNonessyssmoduless _getframesdepths f_globalss TypeError(smodulesdepth((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys_normalize_modules   icCstid|d|SdS(s{ Add the given number of space characters to the beginning every non-blank line in `s`, and return the result. s (?m)^(?!$)s N(sressubsindentss(sssindent((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys_indentscCs?t}|\}}}ti|||d||iSdS(sz Return a string containing a traceback message for the given exc_info tuple (as returned by sys.exc_info()). sfileN( sStringIOsexcoutsexc_infosexc_typesexc_valsexc_tbs tracebacksprint_exceptionsgetvalue(sexc_infosexc_valsexc_typesexcoutsexc_tb((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys_exception_tracebacks  s _SpoofOutcBstZdZedZRS(NcCsWti|}|o|id o|d7}nt|do |`n|SdS(Ns s softspace(sStringIOsgetvaluesselfsresultsendswithshasattrs softspace(sselfsresult((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysgetvalues  cCs.ti||t|do |`ndS(Ns softspace(sStringIOstruncatesselfssizeshasattrs softspace(sselfssize((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pystruncates(s__name__s __module__sgetvaluesNonestruncate(((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys _SpoofOuts cCs7|itdjo||jSn|it}dt|f\}}|d}|o/|i |ot|}|d=qt Sn|d}|o3|i |o|t|8}|d=qt Sn||jot SnxH|D]@}|i|||}|djot Sn|t|7}qWt SdS(s_ Essentially the only subtle case: >>> _ellipsis_match('aa...aa', 'aaa') False iiN(swantsfindsELLIPSIS_MARKERsgotssplitswsslensstartpossendpossws startswithsFalsesendswithsTrue(swantsgotswswssstartpossendpos((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys_ellipsis_match"s6       cCs'|i}|o d|SndSdS(s)Return a commented form of the given lines# s#N(slinesrstrip(sline((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys _comment_lineSs   s_OutputRedirectingPdbcBs tZdZdZdZRS(s A specialized version of the python debugger that redirects stdout to a given stream when interacting with the user. Stdout is *not* redirected when traced code is executed. cCs||_tii|dS(N(soutsselfs_OutputRedirectingPdb__outspdbsPdbs__init__(sselfsout((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__init__as cGs=ti}|it_ztii||SWd|t_XdS(N( ssyssstdouts save_stdoutsselfs_OutputRedirectingPdb__outspdbsPdbstrace_dispatchsargs(sselfsargss save_stdout((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pystrace_dispatches   (s__name__s __module__s__doc__s__init__strace_dispatch(((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys_OutputRedirectingPdb[s  cCsti| otd|n|ido tdnt|dotii |i d}n}|i djoXt tidjotiddjo!tii tidd}qti}ntd|d tii||i dSdS( NsExpected a module: %rs/s1Module-relative files may not have absolute pathss__file__is__main__ss+Can't resolve paths relative to the module s (it has no __file__)(sinspectsismodulesmodules TypeErrorspaths startswiths ValueErrorshasattrsosssplits__file__sbasedirs__name__slenssyssargvscurdirsjoin(smodulespathsbasedir((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys_module_relative_pathps *! cBs#tZdZeddedZRS(sn A single doctest example, consisting of source code and expected output. `Example` defines the following attributes: - source: A single Python statement, always ending with a newline. The constructor adds a newline if needed. - want: The expected output from running the source code (either from stdout, or a traceback in case of exception). `want` ends with a newline unless it's empty, in which case it's an empty string. The constructor adds a newline if needed. - exc_msg: The exception message generated by the example, if the example is expected to generate an exception; or `None` if it is not expected to generate an exception. This exception message is compared against the return value of `traceback.format_exception_only()`. `exc_msg` ends with a newline unless it's `None`. The constructor adds a newline if needed. - lineno: The line number within the DocTest string containing this Example where the Example begins. This line number is zero-based, with respect to the beginning of the DocTest. - indent: The example's indentation in the DocTest string. I.e., the number of space characters that preceed the example's first prompt. - options: A dictionary mapping from option flags to True or False, which is used to override default options for this example. Any option flags not contained in this dictionary are left at their default value (as specified by the DocTestRunner's optionflags). By default, no options are set. icCs|id o|d7}n|o|id o|d7}n|tj o|id o|d7}n||_||_||_||_|tjo h}n||_||_dS(Ns ( ssourcesendswithswantsexc_msgsNonesselfslinenosindentsoptions(sselfssourceswantsexc_msgslinenosindentsoptions((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__init__s      (s__name__s __module__s__doc__sNones__init__(((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysExamples "cBs)tZdZdZdZdZRS(se A collection of doctest examples that should be run in a single namespace. Each `DocTest` defines the following attributes: - examples: the list of examples. - globs: The namespace (aka globals) that the examples should be run in. - name: A name identifying the DocTest (typically, the name of the object whose docstring this DocTest was extracted from). - filename: The name of the file that this DocTest was extracted from, or `None` if the filename is unknown. - lineno: The line number within filename where this DocTest begins, or `None` if the line number is unavailable. This line number is zero-based, with respect to the beginning of the file. - docstring: The string that the examples were extracted from, or `None` if the string is unavailable. cCs@||_||_|i|_||_||_||_dS(s Create a new DocTest containing the given examples. The DocTest's globals are initialized with a copy of `globs`. N(sexamplessselfs docstringsglobsscopysnamesfilenameslineno(sselfsexamplessglobssnamesfilenameslinenos docstring((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__init__s    cCstt|idjo d}n4t|idjo d}ndt|i}d|i|i|i|fSdS(Nis no examplesis 1 examples %d exampless(slensselfsexamplessnamesfilenameslineno(sselfsexamples((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__repr__s   cCs`t|t odSnt|i|i|it|f|i|i|it|fSdS(Ni( s isinstancesothersDocTestscmpsselfsnamesfilenameslinenosid(sselfsother((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__cmp__s!(s__name__s __module__s__doc__s__init__s__repr__s__cmp__(((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysDocTests   cBstZdZeideieiBZeideieiBeiBZ eidi Z ddZ dZ ddZdZeid eiZd Zeid eiZd Zd ZdZRS(sD A class used to parse strings containing doctest examples. s # Source consists of a PS1 line followed by zero or more PS2 lines. (?P (?:^(?P [ ]*) >>> .*) # PS1 line (?:\n [ ]* \.\.\. .*)*) # PS2 lines \n? # Want consists of any non-blank lines that do not start with PS1. (?P (?:(?![ ]*$) # Not a blank line (?![ ]*>>>) # Not a line starting with PS1 .*$\n? # But any other line )*) s # Grab the traceback header. Different versions of Python have # said different things on the first traceback line. ^(?P Traceback\ \( (?: most\ recent\ call\ last | innermost\ last ) \) : ) \s* $ # toss trailing whitespace on the header. (?P .*?) # don't blink: absorb stuff until... ^ (?P \w+ .*) # a line *starts* with alphanum. s ^[ ]*(#.*)?$sc Cs|i}|i|}|djoAdigi}|idD]}|||qE~}ng} ddf\} } x|i i|D]}| i|| |i!| |id| |i7} |i||| \}} } }|i| oB| it|| |d| d|t|idd| n| |id|i|i7} |i} qW| i|| | SdS(s= Divide the given string into examples and intervening text, and return them as a list of alternating Examples and strings. Line numbers for the Examples are 0-based. The optional argument `name` is a name identifying this string, and is only used for error messages. is slinenosindentsoptionsN(sstrings expandtabssselfs _min_indents min_indentsjoinsappends_[1]ssplitslsoutputscharnoslinenos _EXAMPLE_REsfinditersmsstartscounts_parse_examplesnamessourcesoptionsswantsexc_msgs_IS_BLANK_OR_COMMENTsExampleslensgroupsend(sselfsstringsnames min_indentsexc_msgsmsls_[1]ssourceslinenoswantsoutputscharnosoptions((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysparse5s*  A!%cCs)t|i|||||||SdS(s" Extract all doctest examples from the given string, and collect them into a `DocTest` object. `globs`, `name`, `filename`, and `lineno` are attributes for the new `DocTest` object. See the documentation for `DocTest` for more information. N(sDocTestsselfs get_examplessstringsnamesglobssfilenameslineno(sselfsstringsglobssnamesfilenameslineno((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys get_doctest\scCsIgi}|i||D]$}t|to||qq~SdS(s Extract all doctest examples from the given string, and return them as a list of `Example` objects. Line numbers are 0-based, because it's most common in doctests that nothing interesting appears on the same line as opening triple-quote, and so the first interesting line is called "line 1" then. The optional argument `name` is a name identifying this string, and is only used for error messages. N( sappends_[1]sselfsparsesstringsnamesxs isinstancesExample(sselfsstringsnames_[1]sx((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys get_exampleshs cCst|id}|idid} |i| ||||i | dd|d||di gi }| D]} || |dqy~} |id} | id}t|djotid |d o |d =n|i |d|||t| di gi }|D]}|||q(~} |ii| }|o|id }nt}|i| ||} | | | |fSd S( s Given a regular expression match from `_EXAMPLE_RE` (`m`), return a pair `(source, want)`, where `source` is the matched example's source code (with prompts and indentation stripped); and `want` is the example's expected output (with indentation stripped). `name` is the string's name, and `lineno` is the line number where the example starts; both are used for error messages. sindentssources is s.iswants *$ismsgN(slensmsgroupsindentssplits source_linessselfs_check_prompt_blanksnameslinenos _check_prefixsjoinsappends_[1]sslssourceswants want_linessresmatchswls _EXCEPTION_REsexc_msgsNones _find_optionssoptions(sselfsmsnameslinenosindents want_linessexc_msgswls_[1]ssourceswantssls source_linessoptions((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys_parse_examplevs& "8* 4s#\s*doctest:\s*([^\n\'"]*)$c Csh}x|ii|D]}|ididdi}xs|D]k}|ddjp|dt jo!t d|d||fnt |d}|ddj||>> tests = DocTestFinder().find(_TestClass) >>> runner = DocTestRunner(verbose=False) >>> for test in tests: ... print runner.run(test) (0, 2) (0, 1) (0, 2) (0, 2) The `summarize` method prints a summary of all the test cases that have been run by the runner, and returns an aggregated `(f, t)` tuple: >>> runner.summarize(verbose=1) 4 items passed all tests: 2 tests in _TestClass 2 tests in _TestClass.__init__ 2 tests in _TestClass.get 1 tests in _TestClass.square 7 tests in 4 items. 7 passed and 0 failed. Test passed. (0, 7) The aggregated number of tried examples and failed examples is also available via the `tries` and `failures` attributes: >>> runner.tries 7 >>> runner.failures 0 The comparison between expected outputs and actual outputs is done by an `OutputChecker`. This comparison may be customized with a number of option flags; see the documentation for `testmod` for more information. If the option flags are insufficient, then the comparison may also be customized by passing a subclass of `OutputChecker` to the constructor. The test runner's display output can be controlled in two ways. First, an output function (`out) can be passed to `TestRunner.run`; this function will be called with strings that should be displayed. It defaults to `sys.stdout.write`. If capturing the output is not sufficient, then the display output can be also customized by subclassing DocTestRunner, and overriding the methods `report_start`, `report_success`, `report_unexpected_exception`, and `report_failure`. s*iFicCsy|pt|_|tjodtij}n||_||_ ||_ d|_ d|_ h|_ t|_dS(sc Create a new test runner. Optional keyword arg `checker` is the `OutputChecker` that should be used to compare the expected outputs and actual outputs of doctest examples. Optional keyword arg 'verbose' prints lots of stuff if true, only failures if false; by default, it's true iff '-v' is in sys.argv. Optional argument `optionflags` can be used to control how the test runner compares expected output to actual output, and how it displays failures. See the documentation for `testmod` for more information. s-viN(scheckers OutputCheckersselfs_checkersverbosesNonessyssargvs_verboses optionflagssoriginal_optionflagsstriessfailuress_name2fts _SpoofOuts_fakeout(sselfscheckersverboses optionflags((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__init__Us       cCsc|ioU|io,|dt|idt|iq_|dt|idndS(s Report that the test runner is about to process the given example. (Only displays a message if verbose=True) sTrying: s Expecting: sExpecting nothing N(sselfs_verbosesexampleswantsouts_indentssource(sselfsoutstestsexample((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys report_startys   ,cCs|io|dndS(st Report that the given example ran successfully. (Only displays a message if verbose=True) sok N(sselfs_verbosesout(sselfsoutstestsexamplesgot((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysreport_successs cCs3||i|||ii|||idS(s7 Report that the given example failed. N( soutsselfs_failure_headerstestsexamples_checkersoutput_differencesgots optionflags(sselfsoutstestsexamplesgot((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysreport_failurescCs.||i||dtt|dS(sO Report that the given example raised an unexpected exception. sException raised: N(soutsselfs_failure_headerstestsexamples_indents_exception_tracebacksexc_info(sselfsoutstestsexamplesexc_info((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysreport_unexpected_exceptionscCs|ig}|iob|itj o |itj o|i|id}nd}|id|i||i fn"|id|id|i f|id|i }|it |di |SdS(Nis?sFile "%s", line %s, in %ssLine %s, in %ssFailed example:s ( sselfsDIVIDERsoutstestsfilenameslinenosNonesexamplesappendsnamessources_indentsjoin(sselfstestsexamplessourceslinenosout((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys_failure_headers   $!  cBsd}} |i} ed\} }}|i i }x>e |iD]-\}}|ie@o |dj}| |_|ioNxK|iiD]6\}}|o|i|O_q|i|M_qWn| d7} | o|i|||nd|i|f}y7e|i|d|d|iU|ii e!}Wn5e#j o n!e$i%}|ii nX|i&i'} |i&i)d|}|e!jo'||i+| |io | }qne$i%}e,i-|d d} | o| e/|7} n|i.e!jo |}n||i.| |io | }nz|ie0@oke1i2d|i.}e1i2d| }|o,|o%||i5d|i5d|io | }qn|| jo&| o|i6|||| qqqD||jo0| o|i7|||| n|d7}qD||jo0| o|i8||||n|d7}qDqDW| |_|i9||| || fSd S( s Run the examples in `test`. Write the outcome of each example with one of the `DocTestRunner.report_*` methods, using the writer function `out`. `compileflags` is the set of compiler flags that should be used to execute examples. Return a tuple `(f, t)`, where `t` is the number of examples tried, and `f` is the number of examples that failed. The examples are run in the namespace `test.globs`. iiisssingleiis[^:]*:N(:sfailuresstriessselfs optionflagssoriginal_optionflagssrangesSUCCESSsFAILUREsBOOMs_checkers check_outputschecks enumeratestestsexampless examplenumsexamplesREPORT_ONLY_FIRST_FAILUREsquietsoptionssitemss optionflagsvals report_startsoutsnamesfilenamescompilessources compileflagssglobssdebuggers set_continuesNones exceptionsKeyboardInterruptssyssexc_infos_fakeoutsgetvaluesgotstruncatesoutcomeswants tracebacksformat_exception_onlysexc_msgs_exception_tracebacksIGNORE_EXCEPTION_DETAILsresmatchsm1sm2sgroupsreport_successsreport_failuresreport_unexpected_exceptions_DocTestRunner__record_outcome(sselfstests compileflagssoutschecksvalsfilenamesm1sm2sgotsoriginal_optionflagssSUCCESSsexc_msgstriessexc_infos exceptions optionflagsquietsFAILUREsBOOMs examplenumsfailuressoutcomesexample((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__runs                )      cCsd|ii|iddf\}}||||f|i|i<|i |7_ |i |7_ dS(s{ Record the fact that the given DocTest (`test`) generated `f` failures out of `t` tried examples. iN( sselfs_name2ftsgetstestsnamesf2st2sfstsfailuresstries(sselfstestsfstsf2st2((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__record_outcome(s $s3[\w\.]+)\[(?P\d+)\]>$cCs|ii|}|o|id|iijo3|iit |id}|i i t Sn8|iiidjo|i||Sn|i|SdS(Nsnames examplenumi(sselfs%_DocTestRunner__LINECACHE_FILENAME_REsmatchsfilenamesmsgroupstestsnamesexamplessintsexamplessources splitlinessTruessave_linecache_getliness func_codes co_argcountsmodule_globals(sselfsfilenamesmodule_globalssmsexample((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__patched_linecache_getlines5s#cCs||_|tjot|i}nti}|tjo |i }n|i t_t i }t||_|ii|ii t _ ti|_|it_z|i|||SWd|t_|t _ |it_|o|iinXdS(sJ Run the examples in `test`, and display the results using the writer function `out`. The examples are run in the namespace `test.globs`. If `clear_globs` is true (the default), then this namespace will be cleared after the test runs, to help with garbage collection. If you would like to examine the namespace after the test completes, then use `clear_globs=False`. `compileflags` gives the set of flags that should be used by the Python compiler when running the examples. If not specified, then it will default to the set of future-import flags that apply to `globs`. The output of each example is checked using `DocTestRunner.check_output`, and the results are formatted by the `DocTestRunner.report_*` methods. N(stestsselfs compileflagssNones_extract_future_flagssglobsssyssstdouts save_stdoutsoutswrites_fakeoutspdbs set_tracessave_set_traces_OutputRedirectingPdbsdebuggersresets linecachesgetlinesssave_linecache_getliness*_DocTestRunner__patched_linecache_getliness_DocTestRunner__runs clear_globssclear(sselfstests compileflagssouts clear_globss save_stdoutssave_set_trace((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysrun?s,             c Cs#|tjo |i}ng} g}g}d}} x|i i D]{} | \}\}}||7}| |7} |djo| i|qF|djo|i||fqF|i| qFW|o| o7t| GdGH| ix| D]} dG| GHqWn|oCt|GdGH|ix'|D]\} }d|| fGHq1WqXn|oT|iGHt|GdGH|ix0|D]$\} \}}d||| fGHqWn|o3|GdGt|i Gd GH|| Gd G| Gd GHn| od G| Gd GHn|o dGHn| |fSdS(s Print a summary of all the test cases that have been run by this DocTestRunner, and return a tuple `(f, t)`, where `f` is the total number of failed examples, and `t` is the total number of tried examples. The optional `verbose` argument controls how detailed the summary is. If the verbosity is not specified, then the DocTestRunner's verbosity is used. isitems had no tests:s sitems passed all tests:s %3d tests in %ssitems had failures:s %3d of %3d in %sstests insitems.s passed andsfailed.s***Test Failed***s failures.s Test passed.N(sverbosesNonesselfs_verbosesnotestsspassedsfailedstotaltstotalfs_name2ftsitemssxsnamesfstsappendslenssortsthingscountsDIVIDER( sselfsverbosescountsfstotaltsnamesfailedstspassedsxstotalfsthingsnotests((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys summarizexs\             cCs|i}xu|iiD]d\}\}}||jo5d|dGH||\}}||}||}n||f||>> runner = DebugRunner(verbose=False) >>> test = DocTestParser().get_doctest('>>> raise KeyError\n42', ... {}, 'foo', 'foo.py', 0) >>> try: ... runner.run(test) ... except UnexpectedException, failure: ... pass >>> failure.test is test True >>> failure.example.want '42\n' >>> exc_info = failure.exc_info >>> raise exc_info[0], exc_info[1], exc_info[2] Traceback (most recent call last): ... KeyError We wrap the original exception to give the calling application access to the test and example information. If the output doesn't match, then a DocTestFailure is raised: >>> test = DocTestParser().get_doctest(''' ... >>> x = 1 ... >>> x ... 2 ... ''', {}, 'foo', 'foo.py', 0) >>> try: ... runner.run(test) ... except DocTestFailure, failure: ... pass DocTestFailure objects provide access to the test: >>> failure.test is test True As well as to the example: >>> failure.example.want '2\n' and the actual output: >>> failure.got '1\n' If a failure or error occurs, the globals are left intact: >>> del test.globs['__builtins__'] >>> test.globs {'x': 1} >>> test = DocTestParser().get_doctest(''' ... >>> x = 2 ... >>> raise KeyError ... ''', {}, 'foo', 'foo.py', 0) >>> runner.run(test) Traceback (most recent call last): ... UnexpectedException: >>> del test.globs['__builtins__'] >>> test.globs {'x': 2} But the globals are cleared if there is no error: >>> test = DocTestParser().get_doctest(''' ... >>> x = 2 ... ''', {}, 'foo', 'foo.py', 0) >>> runner.run(test) (0, 1) >>> test.globs {} cCs;ti||||t}|o|i i n|SdS(N( s DocTestRunnersrunsselfstests compileflagssoutsFalsesrs clear_globssglobssclear(sselfstests compileflagssouts clear_globssr((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysrunscCst|||dS(N(sUnexpectedExceptionstestsexamplesexc_info(sselfsoutstestsexamplesexc_info((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysreport_unexpected_exceptionscCst|||dS(N(sDocTestFailurestestsexamplesgot(sselfsoutstestsexamplesgot((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysreport_failures(s__name__s __module__s__doc__sNonesTruesrunsreport_unexpected_exceptionsreport_failure(((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys DebugRunnergs Y c CsS|tj otidtn|tjotiid}nt i | ot d|fn|tjo |i }ntd|d| } |otd|d|} ntd|d|} x3| i||d|d |D]} | i| qW|o| inttjo | anti| | i | i!fSd S( s m=None, name=None, globs=None, verbose=None, isprivate=None, report=True, optionflags=0, extraglobs=None, raise_on_error=False, exclude_empty=False Test examples in docstrings in functions and classes reachable from module m (or the current module if m is not supplied), starting with m.__doc__. Unless isprivate is specified, private names are not skipped. Also test examples reachable from dict m.__test__ if it exists and is not None. m.__test__ maps names to functions, classes and strings; function and class docstrings are tested even if the name is private; strings are tested directly, as if they were docstrings. Return (#failures, #tests). See doctest.__doc__ for an overview. Optional keyword arg "name" gives the name of the module; by default use m.__name__. Optional keyword arg "globs" gives a dict to be used as the globals when executing examples; by default, use m.__dict__. A copy of this dict is actually used for each docstring, so that each docstring's examples start with a clean slate. Optional keyword arg "extraglobs" gives a dictionary that should be merged into the globals that are used to execute examples. By default, no extra globals are used. This is new in 2.4. Optional keyword arg "verbose" prints lots of stuff if true, prints only failures if false; by default, it's true iff "-v" is in sys.argv. Optional keyword arg "report" prints a summary at the end when true, else prints nothing at the end. In verbose mode, the summary is detailed, else very brief (in fact, empty if all tests passed). Optional keyword arg "optionflags" or's together module constants, and defaults to 0. This is new in 2.3. Possible values (see the docs for details): DONT_ACCEPT_TRUE_FOR_1 DONT_ACCEPT_BLANKLINE NORMALIZE_WHITESPACE ELLIPSIS IGNORE_EXCEPTION_DETAIL REPORT_UDIFF REPORT_CDIFF REPORT_NDIFF REPORT_ONLY_FIRST_FAILURE Optional keyword arg "raise_on_error" raises an exception on the first unexpected exception or failure. This allows failures to be post-mortem debugged. Deprecated in Python 2.4: Optional keyword arg "isprivate" specifies a function used to determine whether a name is private. The default function is treat all functions as public. Optionally, "isprivate" can be set to doctest.is_private to skip over functions marked as private using the underscore naming convention; see its docs for details. Advanced tomfoolery: testmod runs methods of a local instance of class doctest.Tester, then merges the results into (or creates) global Tester instance doctest.master. Methods of doctest.master can be called directly too, if you want to do something unusual. Passing report=0 to testmod is especially useful then, to delay displaying a summary. Invoke doctest.master.summarize(verbose) when you're done fiddling. sPthe isprivate argument is deprecated; examine DocTestFinder.find() lists insteads__main__stestmod: module required; %rs _namefilters exclude_emptysverboses optionflagssglobss extraglobsN("s isprivatesNoneswarningsswarnsDeprecationWarningsmssyssmodulessgetsinspectsismodules TypeErrorsnames__name__s DocTestFinders exclude_emptysfindersraise_on_errors DebugRunnersverboses optionflagssrunners DocTestRunnersfindsglobss extraglobsstestsrunsreports summarizesmastersmergesfailuresstries( smsnamesglobssverboses isprivatesreports optionflagss extraglobssraise_on_errors exclude_emptysrunnerstestsfinder((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pystestmods0H         c Cse|o| otdn|ot|}t||}n|tjoti i |}n|tjo h}n |i }|tj o|i|n| otd|d|} ntd|d|} t|i} | i| |||d} | i| |o| inttjo | anti| | i | i!fSdS(s Test examples in the given file. Return (#failures, #tests). Optional keyword arg "module_relative" specifies how filenames should be interpreted: - If "module_relative" is True (the default), then "filename" specifies a module-relative path. By default, this path is relative to the calling module's directory; but if the "package" argument is specified, then it is relative to that package. To ensure os-independence, "filename" should use "/" characters to separate path segments, and should not be an absolute path (i.e., it may not begin with "/"). - If "module_relative" is False, then "filename" specifies an os-specific path. The path may be absolute or relative (to the current working directory). Optional keyword arg "name" gives the name of the test; by default use the file's basename. Optional keyword argument "package" is a Python package or the name of a Python package whose directory should be used as the base directory for a module relative filename. If no package is specified, then the calling module's directory is used as the base directory for module relative filenames. It is an error to specify "package" if "module_relative" is False. Optional keyword arg "globs" gives a dict to be used as the globals when executing examples; by default, use {}. A copy of this dict is actually used for each docstring, so that each docstring's examples start with a clean slate. Optional keyword arg "extraglobs" gives a dictionary that should be merged into the globals that are used to execute examples. By default, no extra globals are used. Optional keyword arg "verbose" prints lots of stuff if true, prints only failures if false; by default, it's true iff "-v" is in sys.argv. Optional keyword arg "report" prints a summary at the end when true, else prints nothing at the end. In verbose mode, the summary is detailed, else very brief (in fact, empty if all tests passed). Optional keyword arg "optionflags" or's together module constants, and defaults to 0. Possible values (see the docs for details): DONT_ACCEPT_TRUE_FOR_1 DONT_ACCEPT_BLANKLINE NORMALIZE_WHITESPACE ELLIPSIS IGNORE_EXCEPTION_DETAIL REPORT_UDIFF REPORT_CDIFF REPORT_NDIFF REPORT_ONLY_FIRST_FAILURE Optional keyword arg "raise_on_error" raises an exception on the first unexpected exception or failure. This allows failures to be post-mortem debugged. Optional keyword arg "parser" specifies a DocTestParser (or subclass) that should be used to extract tests from the files. Advanced tomfoolery: testmod runs methods of a local instance of class doctest.Tester, then merges the results into (or creates) global Tester instance doctest.master. Methods of doctest.master can be called directly too, if you want to do something unusual. Passing report=0 to testmod is especially useful then, to delay displaying a summary. Invoke doctest.master.summarize(verbose) when you're done fiddling. s8Package may only be specified for module-relative paths.sverboses optionflagsiN("spackagesmodule_relatives ValueErrors_normalize_modules_module_relative_pathsfilenamesnamesNonesosspathsbasenamesglobsscopys extraglobssupdatesraise_on_errors DebugRunnersverboses optionflagssrunners DocTestRunnersopensreadsssparsers get_docteststestsrunsreports summarizesmastersmergesfailuresstries(sfilenamesmodule_relativesnamespackagesglobssverbosesreports optionflagss extraglobssraise_on_errorsparsersrunnerstestss((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pystestfileKs4J          sNoNamec Csdtd|dt}td|d|}x3|i||d|D]}|i |d|qCWdS(sr Test examples in the given object's docstring (`f`), using `globs` as globals. Optional argument `name` is used in failure messages. If the optional argument `verbose` is true, then generate output even if there are no failures. `compileflags` gives the set of flags that should be used by the Python compiler when running the examples. If not specified, then it will default to the set of future-import flags that apply to `globs`. Optional keyword arg `optionflags` specifies options for the testing and output. See the documentation for `testmod` for more information. sverbosesrecurses optionflagssglobss compileflagsN(s DocTestFindersverbosesFalsesfinders DocTestRunners optionflagssrunnersfindsfsnamesglobsstestsruns compileflags( sfsglobssverbosesnames compileflagss optionflagssrunnerstestsfinder((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysrun_docstring_exampless cBsbtZeeeeddZdZeedZedZdZedZdZ RS( NicCstidtdd|tjo |tjotdn|tj oti| otd|fn|tjo |i }n||_||_ ||_ ||_ td||_td|d||_dS( NsCclass Tester is deprecated; use class doctest.DocTestRunner insteads stacklevelis*Tester.__init__: must specify mod or globss)Tester.__init__: mod must be a module; %rs _namefiltersverboses optionflags(swarningsswarnsDeprecationWarningsmodsNonesglobss TypeErrorsinspectsismodules__dict__sselfsverboses isprivates optionflagss DocTestFinders testfinders DocTestRunners testrunner(sselfsmodsglobssverboses isprivates optionflags((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__init__s         cCsti||i|tt}|io dG|GHn|i i |\}}|io|GdG|GdG|GHn||fSdS(NsRunning stringsofsexamples failed in string( s DocTestParsers get_doctestsssselfsglobssnamesNonestestsverboses testrunnersrunsfst(sselfsssnamesfststest((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys runstrings!   c Csd}}|ii||d|d|i}x@|D]8} |i i | \}}||||f\}}q5W||fSdS(Nismodulesglobs(sfstsselfs testfindersfindsobjectsnamesmodulesglobsstestsstests testrunnersrunsf2st2( sselfsobjectsnamesmodulestestssfst2sf2ststest((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysrundocs cCsVdk}|i|}|ii||tjo t}n|i |||SdS(N( snewsmodulesnamesms__dict__supdatesdsNonesFalsesselfsrundoc(sselfsdsnamesmodulesmsnew((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysrundicts    cCs5dk}|i|}||_|i||SdS(N(snewsmodulesnamesmsds__test__sselfsrundoc(sselfsdsnamesnewsm((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys run__test__s  cCs|ii|SdS(N(sselfs testrunners summarizesverbose(sselfsverbose((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys summarizescCs|ii|idS(N(sselfs testrunnersmergesother(sselfsother((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysmerges( s__name__s __module__sNones__init__s runstringsrundocsrundicts run__test__s summarizesmerge(((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysTesters    cCs8|t@|jotd|nt}|a|SdS(sSets the unittest option flags. The old flag is returned so that a runner could restore the old value if it wished to: >>> old = _unittest_reportflags >>> set_unittest_reportflags(REPORT_NDIFF | ... REPORT_ONLY_FIRST_FAILURE) == old True >>> import doctest >>> doctest._unittest_reportflags == (REPORT_NDIFF | ... REPORT_ONLY_FIRST_FAILURE) True Only reporting flags can be set: >>> set_unittest_reportflags(ELLIPSIS) Traceback (most recent call last): ... ValueError: ('Only reporting flags allowed', 8) >>> set_unittest_reportflags(old) == (REPORT_NDIFF | ... REPORT_ONLY_FIRST_FAILURE) True sOnly reporting flags allowedN(sflagssREPORTING_FLAGSs ValueErrors_unittest_reportflagssold(sflagssold((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysset_unittest_reportflags!ss DocTestCasecBsktZdeeedZdZdZdZdZdZdZ d Z e Z d Z RS( NicCsAtii|||_||_||_ ||_ ||_ dS(N(sunittestsTestCases__init__sselfs optionflagss_dt_optionflagsscheckers _dt_checkerstests_dt_testssetUps _dt_setUpstearDowns _dt_tearDown(sselfstests optionflagsssetUpstearDownschecker((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__init__Gs     cCs.|i}|itj o|i|ndS(N(sselfs_dt_teststests _dt_setUpsNone(sselfstest((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pyssetUpQs cCs;|i}|itj o|i|n|iidS(N(sselfs_dt_teststests _dt_tearDownsNonesglobssclear(sselfstest((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pystearDownWs cCs|i}ti}t}|i}|t @ o|t O}nt d|d|i dt}z5dd|_|i|d|idt\}}Wd|t_X|o"|i|i|indS(Ns optionflagsscheckersverboses-iFsouts clear_globs(sselfs_dt_teststestssyssstdoutsoldsStringIOsnews_dt_optionflagss optionflagssREPORTING_FLAGSs_unittest_reportflagss DocTestRunners _dt_checkersFalsesrunnersDIVIDERsrunswritesfailuresstriessfailureExceptionsformat_failuresgetvalue(sselfsoldsrunnerstriessfailuresstestsnews optionflags((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysrunTest_s       ( cCsp|i}|itjo d}nd|i}di|iidd}d|i|i |||fSdS(Nsunknown line numbers%ss.is:Failed doctest test for %s File "%s", line %s, in %s %s( sselfs_dt_teststestslinenosNonesjoinsnamessplitslnamesfilenameserr(sselfserrslnameslinenostest((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysformat_failurews    cCsI|itd|id|idt}|i|i|i dS(sRun the test case without results and without catching exceptions The unit test framework includes a debug method on test cases and test suites to support post-mortem debugging. The test code is run in such a way that errors are not caught. This way a caller can catch the errors and initiate post-mortem debugging. The DocTestCase provides a debug method that raises UnexpectedException errors if there is an unexepcted exception: >>> test = DocTestParser().get_doctest('>>> raise KeyError\n42', ... {}, 'foo', 'foo.py', 0) >>> case = DocTestCase(test) >>> try: ... case.debug() ... except UnexpectedException, failure: ... pass The UnexpectedException contains the test, the example, and the original exception: >>> failure.test is test True >>> failure.example.want '42\n' >>> exc_info = failure.exc_info >>> raise exc_info[0], exc_info[1], exc_info[2] Traceback (most recent call last): ... KeyError If the output doesn't match, then a DocTestFailure is raised: >>> test = DocTestParser().get_doctest(''' ... >>> x = 1 ... >>> x ... 2 ... ''', {}, 'foo', 'foo.py', 0) >>> case = DocTestCase(test) >>> try: ... case.debug() ... except DocTestFailure, failure: ... pass DocTestFailure objects provide access to the test: >>> failure.test is test True As well as to the example: >>> failure.example.want '2\n' and the actual output: >>> failure.got '1\n' s optionflagsscheckersverboseN( sselfssetUps DebugRunners_dt_optionflagss _dt_checkersFalsesrunnersruns_dt_teststearDown(sselfsrunner((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysdebugs @  cCs|iiSdS(N(sselfs_dt_testsname(sself((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysidscCs8|iiid}d|ddi|d fSdS(Ns.s%s (%s)i(sselfs_dt_testsnamessplitsjoin(sselfsname((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__repr__scCsd|iiSdS(Ns Doctest: (sselfs_dt_testsname(sself((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysshortDescriptions( s__name__s __module__sNones__init__ssetUpstearDownsrunTestsformat_failuresdebugsids__repr__s__str__sshortDescription(((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys DocTestCaseEs    H  c Ks|tjo t}nt|}|i|d|d|}|tjo |i }n| ot |dn|i t i }x|D]}t|idjoqn|i o;|i}|dddfjo|d }n||_n|it||qW|Sd S( s Convert doctest tests for a module to a unittest test suite. This converts each documentation string in a module that contains doctest tests to a unittest test case. If any of the tests in a doc string fail, then the test case fails. An exception is raised showing the name of the file containing the test and a (sometimes approximate) line number. The `module` argument provides the module to be tested. The argument can be either a module or a module name. If no argument is given, the calling module is used. A number of options may be provided as keyword arguments: setUp A set-up function. This is called before running the tests in each file. The setUp function will be passed a DocTest object. The setUp function can access the test globals as the globs attribute of the test passed. tearDown A tear-down function. This is called after running the tests in each file. The tearDown function will be passed a DocTest object. The tearDown function can access the test globals as the globs attribute of the test passed. globs A dictionary containing initial global variables for the tests. optionflags A set of doctest option flags expressed as an integer. sglobss extraglobss has no testsiis.pycs.pyoiN(s test_findersNones DocTestFinders_normalize_modulesmodulesfindsglobss extraglobsstestss__dict__s ValueErrorssortsunittests TestSuitessuitestestslensexamplessfilenames__file__saddTests DocTestCasesoptions( smodulesglobss extraglobss test_findersoptionsstestsstestssuitesfilename((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys DocTestSuites,#          s DocFileCasecBs)tZdZdZeZdZRS(NcCs di|iiidSdS(Ns_s.(sjoinsselfs_dt_testsnamessplit(sself((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysid scCs|iiSdS(N(sselfs_dt_testsfilename(sself((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__repr__ scCs!d|ii|ii|fSdS(Ns2Failed doctest test for %s File "%s", line 0 %s(sselfs_dt_testsnamesfilenameserr(sselfserr((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysformat_failure s(s__name__s __module__sids__repr__s__str__sformat_failure(((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys DocFileCase s  c Ks|tjo h}n|o| otdn|ot|}t||}ntii |}t |i }|i||||d}t||SdS(Ns8Package may only be specified for module-relative paths.i(sglobssNonespackagesmodule_relatives ValueErrors_normalize_modules_module_relative_pathspathsossbasenamesnamesopensreadsdocsparsers get_docteststests DocFileCasesoptions( spathsmodule_relativespackagesglobssparsersoptionssnamesdocstest((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys DocFileTest$ s   cOskti}|idtot|id|dA unittest suite for one or more doctest files. The path to each doctest file is given as a string; the interpretation of that string depends on the keyword argument "module_relative". A number of options may be provided as keyword arguments: module_relative If "module_relative" is True, then the given file paths are interpreted as os-independent module-relative paths. By default, these paths are relative to the calling module's directory; but if the "package" argument is specified, then they are relative to that package. To ensure os-independence, "filename" should use "/" characters to separate path segments, and may not be an absolute path (i.e., it may not begin with "/"). If "module_relative" is False, then the given file paths are interpreted as os-specific paths. These paths may be absolute or relative (to the current working directory). package A Python package or the name of a Python package whose directory should be used as the base directory for module relative paths. If "package" is not specified, then the calling module's directory is used as the base directory for module relative filenames. It is an error to specify "package" if "module_relative" is False. setUp A set-up function. This is called before running the tests in each file. The setUp function will be passed a DocTest object. The setUp function can access the test globals as the globs attribute of the test passed. tearDown A tear-down function. This is called after running the tests in each file. The tearDown function will be passed a DocTest object. The tearDown function can access the test globals as the globs attribute of the test passed. globs A dictionary containing initial global variables for the tests. optionflags A set of doctest option flags expressed as an integer. parser A DocTestParser (or subclass) that should be used to extract tests from the files. smodule_relativespackageN( sunittests TestSuitessuiteskwsgetsTrues_normalize_modulespathsspathsaddTests DocFileTest(spathsskwspathssuite((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys DocFileSuite: s4 cCsNg}xti|D]}t|tou|i|id |i }|oM|id|gi}|i dd D]}|d|q~~7}qq|gi}|i dd D]}|t |q~7}qWx'|o|ddjo|iqWx*|o|ddjo|idqWdi|SdS(scExtract script from text with examples. Converts text with examples to a Python script. Example input is converted to regular code. Example output and all other words are converted to comments: >>> text = ''' ... Here are examples of simple math. ... ... Python has super accurate integer addition ... ... >>> 2 + 2 ... 5 ... ... And very friendly error messages: ... ... >>> 1/0 ... To Infinity ... And ... Beyond ... ... You can use logic if you want: ... ... >>> if 0: ... ... blah ... ... blah ... ... ... ... Ho hum ... ''' >>> print script_from_examples(text) # Here are examples of simple math. # # Python has super accurate integer addition # 2 + 2 # Expected: ## 5 # # And very friendly error messages: # 1/0 # Expected: ## To Infinity ## And ## Beyond # # You can use logic if you want: # if 0: blah blah # # Ho hum is # Expected:s s## s#iN(soutputs DocTestParsersparsessspieces isinstancesExamplesappendssourceswants_[1]ssplitsls _comment_linespopsjoin(ssspiecesls_[1]swantsoutput((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysscript_from_examples s$8  DBcCst|}ti|}gi}|D]$}|i|jo||q,q,~}| ot |dn|d}t |i }|SdS(sExtract the test sources from a doctest docstring as a script. Provide the module (or dotted name of the module) containing the test to be debugged and the name (within the module) of the object with the doc string with tests to be debugged. snot found in testsiN(s_normalize_modulesmodules DocTestFindersfindstestssappends_[1]stsnamestests ValueErrorsscript_from_exampless docstringstestsrc(smodulesnamestestss_[1]stestsrcststest((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys testsource s ; cCs t|}t|||dS(s4Debug a single doctest docstring, in argument `src`'N(sscript_from_examplesssrcstestsrcs debug_scriptspmsglobs(ssrcspmsglobsstestsrc((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys debug_src s cCsdk}tidd}t|d}|i||iz|o|i }nh}|oHyt |||Wqt idGH|it idqXn|id|||Wdti|XdS(s7Debug a test script. `src` is the script, as a string.Ns.pys doctestdebugswiis execfile(%r)(spdbstempfilesmktemps srcfilenamesopensfswritessrcsclosesglobsscopyspmsexecfilessyssexc_infos post_mortemsrunsossremove(ssrcspmsglobssfs srcfilenamespdb((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys debug_script s&   cCs2t|}t||}t|||idS(sDebug a single doctest docstring. Provide the module (or dotted name of the module) containing the test to be debugged and the name (within the module) of the object with the docstring with tests to be debugged. N(s_normalize_modulesmodules testsourcesnamestestsrcs debug_scriptspms__dict__(smodulesnamespmstestsrc((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysdebug s s _TestClasscBs)tZdZdZdZdZRS(s A pointless class, for sanity-checking of docstring testing. Methods: square() get() >>> _TestClass(13).get() + _TestClass(-12).get() 1 >>> hex(_TestClass(13).square().get()) '0xa9' cCs ||_dS(sval -> _TestClass object with associated value val. >>> t = _TestClass(123) >>> print t.get() 123 N(svalsself(sselfsval((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__init__! scCs|id|_|SdS(sosquare() -> square TestClass's associated value >>> _TestClass(13).square().get() 169 iN(sselfsval(sself((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pyssquare+ scCs |iSdS(s}get() -> return TestClass's associated value. >>> x = _TestClass(-42) >>> print x.get() -42 N(sselfsval(sself((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysget5 s(s__name__s __module__s__doc__s__init__ssquaresget(((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys _TestClass s  sstrings Example of a string object, searched as-is. >>> x = 1; y = 2 >>> x + y, x * y (3, 2) sbool-int equivalences In 2.2, boolean expressions displayed 0 or 1. By default, we still accept them. This can be disabled by passing DONT_ACCEPT_TRUE_FOR_1 to the new optionflags argument. >>> 4 == 4 1 >>> 4 == 4 True >>> 4 > 4 0 >>> 4 > 4 False s blank liness Blank lines can be marked with : >>> print 'foo\n\nbar\n' foo bar sellipsiss If the ellipsis flag is used, then '...' can be used to elide substrings in the desired output: >>> print range(1000) #doctest: +ELLIPSIS [0, 1, 2, ..., 999] swhitespace normalizations| If the whitespace normalization flag is used, then differences in whitespace are ignored. >>> print range(30) #doctest: +NORMALIZE_WHITESPACE [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29] cCs ti}|itdS(N(sunittestsTextTestRunnersrsruns DocTestSuite(sr((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys_testq s s__main__(Ts basestrings NameErrorsstrsunicodes enumerates __docformat__s__all__s __future__ssyss tracebacksinspects linecachesossrestypessunittestsdifflibspdbstempfileswarningssStringIOsfilterwarningssDeprecationWarnings__name__sOPTIONFLAGS_BY_NAMEsregister_optionflagsDONT_ACCEPT_TRUE_FOR_1sDONT_ACCEPT_BLANKLINEsNORMALIZE_WHITESPACEsELLIPSISsIGNORE_EXCEPTION_DETAILsCOMPARISON_FLAGSs REPORT_UDIFFs REPORT_CDIFFs REPORT_NDIFFsREPORT_ONLY_FIRST_FAILUREsREPORTING_FLAGSsBLANKLINE_MARKERsELLIPSIS_MARKERs is_privates_extract_future_flagss_normalize_modules_indents_exception_tracebacks _SpoofOuts_ellipsis_matchs _comment_linesPdbs_OutputRedirectingPdbs_module_relative_pathsExamplesDocTests DocTestParsers DocTestFinders DocTestRunners OutputCheckers ExceptionsDocTestFailuresUnexpectedExceptions DebugRunnersNonesmastersTruesFalsestestmodstestfilesrun_docstring_examplessTesters_unittest_reportflagssset_unittest_reportflagssTestCases DocTestCases DocTestSuites DocFileCases DocFileTests DocFileSuitesscript_from_exampless testsources debug_srcs debug_scriptsdebugs _TestClasss__test__s_test(Fs_module_relative_paths __future__s OutputCheckersBLANKLINE_MARKERsunittestsNORMALIZE_WHITESPACEs __docformat__stestmods_normalize_modules REPORT_UDIFFsDONT_ACCEPT_TRUE_FOR_1s enumerates_OutputRedirectingPdbs_ellipsis_matchs basestringsIGNORE_EXCEPTION_DETAILs__all__sTesterstempfiles DocFileCases DocTestRunners DocFileTestsres is_privatesDocTestFailures DocTestCasesELLIPSISs_tests _comment_lines REPORT_CDIFFs testsourcesDocTestsDONT_ACCEPT_BLANKLINEs _SpoofOutswarningss DocFileSuitesrun_docstring_examplessREPORT_ONLY_FIRST_FAILUREsinspects _TestClasss debug_scriptssyssdebugsscript_from_exampless debug_srcs__test__s_extract_future_flagss_indentsExamplestypess DocTestSuitesregister_optionflagsOPTIONFLAGS_BY_NAMEs DocTestParsersStringIOsset_unittest_reportflagss REPORT_NDIFFs tracebacksdifflibs linecaches DocTestFinders DebugRunnersELLIPSIS_MARKERsREPORTING_FLAGSsCOMPARISON_FLAGSsUnexpectedExceptionsosspdbstestfiles_exception_traceback((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys? s(i. ?$                  1  $5<+n't*vA $? F P  ,<2  PKC8/vZZ#setuptools/tests/test_resources.pyc; _Fc@sdklZlZdkTdkZdkZyeWn ej odklZnXde fdYZ defdYZ defd YZ d efd YZ d efd YZdS((sTestCases makeSuite(s*N(s ImmutableSetsMetadatacBs2tZdZdZdZdZdZRS(sAMock object to return metadata as if from an on-disk distributioncGst||_dS(N(sdictspairssselfsmetadata(sselfspairs((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys__init__ scCs||ijSdS(N(snamesselfsmetadata(sselfsname((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys has_metadatascCs|i|SdS(N(sselfsmetadatasname(sselfsname((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys get_metadatascCst|i|SdS(N(s yield_linessselfs get_metadatasname(sselfsname((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pysget_metadata_liness(s__name__s __module__s__doc__s__init__s has_metadatas get_metadatasget_metadata_lines(((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pysMetadata s    s DistroTestscBsetZdZdZdZdZdZdZfdZdZ d Z d Z RS( NcCstgdtdt}|it|g|i|dg|itid|itid|itid|i |d|it|dg|igi }|dD]}||i q~dd d g|i|dd |igi }|dD]}||i q~dd g|itid |igi }|dD]}||i qp~d dd gtg}tid}tid}td\}|i|i||i d |i||i|i||i dtg}|i||i||it|i||tg}|i||i||i||i|i||i ddS(NsplatformspythonsFooPkgsFooPkg-1.3_1.eggsFooPkg-1.4-py2.4-win32.eggsFooPkg-1.2-py2.4.eggsfoopkgs1.4s1.3-1s1.2isFooPkg-1.9.eggs1.9s FooPkg>=1.3(s EnvironmentsNonesadsselfs assertEqualslistsadds Distributions from_filenames failUnlesssappends_[1]sdistsversionsremoves WorkingSetswssfoo12sfoo14sparse_requirementssreqs best_matchs assertRaisessVersionConflict(sselfs_[1]sdistsadsreqswssfoo12sfoo14((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestCollections.A>A ,&3cCs||i|id|i|id|i|id|i|id|i|id|i|it ddS(NsFooPkgsfoopkgs1.3-1s2.4swin32( sselfs assertEqualsds project_nameskeysversions py_versionsplatformsparsed_versions parse_version(sselfsd((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys checkFooPkgMs c Csntddddddddd }|i|td}|i|itid |i|it dS( Ns /some/paths project_namesFooPkgsversions1.3-1s py_versions2.4splatformswin32i( s Distributionsdsselfs checkFooPkgs assertEquals py_versionssyssversionsplatformsNone(sselfsd((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestDistroBasicsUs   cCs<tid}|i|tid}|i|dS(NsFooPkg-1.3_1-py2.4-win32.eggs!FooPkg-1.3_1-py2.4-win32.egg-info(s Distributions from_filenamesdsselfs checkFooPkg(sselfsd((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestDistroParse`s c CsAtddddddddtd d f}|i|dS( Ns /some/paths project_namesFooPkgs py_versions2.4splatformswin32smetadatasPKG-INFOs%Metadata-Version: 1.0 Version: 1.3-1 (s DistributionsMetadatasdsselfs checkFooPkg(sselfsd((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestDistroMetadatafscCs tddtd|fSdS(Ns/foosmetadatas depends.txt(s DistributionsMetadatastxt(sselfstxt((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys distRequirespscCs/|it|i|tt|dS(N(sselfs assertEqualslistsdistsrequiressextrassparse_requirementsstxt(sselfsdiststxtsextras((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys checkRequiressscCs4x-ddfD]}|i|i||q WdS(Ns Twisted>=1.5sTwisted>=1.5 ZConfig>=2.0(svsselfs checkRequiress distRequires(sselfsv((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestDistroDependsSimpleys cCstg}tg}|it|ig|g|it |it d|t i ddt ddf}|i||it i dxUtdD]G}t|it d|}|i||gt|i|qW|it|it d|tg}|it |it d |t i d dt ddf}|i||it|it d |||g|it|it d |dS( NsFoos/foo_dir/Foo-1.2.eggsmetadatas depends.txts[bar] Baz>=2.0s Foo-0.9.eggisFoo==0.9sFoo[bar]s/foo_dir/Baz-2.1.eggsFoo==1.2 Foo!=1.2(s Environmentsads WorkingSetswssselfs assertEqualslistsresolves assertRaisessDistributionNotFoundsparse_requirementss Distributions from_filenamesMetadatasFoosaddsrangesistargetssmapsVersionConflictsBaz(sselfsadsBazstargetssiswssFoo((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys testResolve~s(" #  ! . cCs|id}|i|d|i|didg|i|didg|i|diddg|i|diddg|it|id gdS( Ns Twisted>=1.5 [docgen] ZConfig>=2.0 docutils>=0.3 [fastcgi] fcgiapp>=0.1s Twisted>=1.5s'Twisted>=1.5 ZConfig>=2.0 docutils>=0.3sdocgensTwisted>=1.5 fcgiapp>=0.1sfastcgis4Twisted>=1.5 ZConfig>=2.0 docutils>=0.3 fcgiapp>=0.1s4Twisted>=1.5 fcgiapp>=0.1 ZConfig>=2.0 docutils>=0.3sfoo(sselfs distRequiressds checkRequiresssplits assertRaisess UnknownExtrasrequires(sselfsd((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestDistroDependsOptionss  ( s__name__s __module__stestCollections checkFooPkgstestDistroBasicsstestDistroParsestestDistroMetadatas distRequiress checkRequiresstestDistroDependsSimples testResolvestestDistroDependsOptions(((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys DistroTestss 3      )sEntryPointTestscBsVtZdZdZdZdZdZdZdZdZ d Z RS( NcCs|i|id|i|id|i|idf|i|idf|i|it j|it |ddS(Nsfoossetuptools.tests.test_resourcessEntryPointTestssxs9foo = setuptools.tests.test_resources:EntryPointTests [x]( sselfs assertEqualsepsnames module_namesattrssextrass failUnlesssloadsEntryPointTestssstr(sselfsep((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys assertfieldsscCs(tiddtddf|_dS(NsFooPkg-1.2-py2.4.eggsmetadatas requires.txts[x](s Distributions from_filenamesMetadatasselfsdist(sself((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pyssetUpscCs2tdddgdg|i}|i|dS(Nsfoossetuptools.tests.test_resourcessEntryPointTestssx(s EntryPointsselfsdistseps assertfields(sselfsep((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys testBasicsscCsd}ti||i}|i|tid}|i|id|i|i d|i|i f|i|i dftid}|i|id|i|i d|i|i d f|i|i fdS( Ns9foo = setuptools.tests.test_resources:EntryPointTests [x]sbar baz= spammity[PING]sbar bazsspammityspings fizzly = wocka:foosfizzlyswockasfoo( sss EntryPointsparsesselfsdistseps assertfieldss assertEqualsnames module_namesattrssextras(sselfsssep((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys testParses cCs]xVddddddgD]<}yti|Wntj oqXtd|qWdS(Nsfoosx=1=2sx=a:b:csq=x/nasfez=pish:tush-zsx=f[a]>2sShould've been bad(seps EntryPointsparses ValueErrorsAssertionError(sselfsep((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys testRejectsscCs|it|ddS(Ns{'feature2': EntryPoint.parse('feature2 = another.module:SomeClass [extra1,extra2]'), 'feature3': EntryPoint.parse('feature3 = this.module [something]'), 'feature1': EntryPoint.parse('feature1 = somemodule:somefunction')}(sselfs assertEqualsstrsm(sselfsm((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys checkSubMapss # define features for blah blah feature1 = somemodule:somefunction feature2 = another.module:SomeClass [extra1,extra2] feature3 = this.module [something] cCsX|itid|i|ittidd|ittidddgdS(Nsxyzsx asfoo=barsxsfoo=baz(sselfs checkSubMaps EntryPoints parse_groups submap_strs assertRaisess ValueError(sself((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys testParseListscCstihd|i<}|i|d|i|idgtid|i}|i|d|i|idg|it tiddg|it ti|idS(Nsxyzs[xyz] s[xyz]( s EntryPoints parse_mapsselfs submap_strsms checkSubMaps assertEqualskeyss assertRaisess ValueError(sselfsm((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys testParseMaps( s__name__s __module__s assertfieldsssetUps testBasicss testParses testRejectss checkSubMaps submap_strs testParseLists testParseMap(((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pysEntryPointTestss      sRequirementsTestscBs>tZdZdZdZdZdZdZRS(NcCstid}|it|d|it|d|i|tdddfgf|i|tdddfgf|i|tdddfgf|i|tdddfgf|i|tddd fgf|i|tid dS( Ns Twisted>=1.2s!Requirement.parse('Twisted>=1.2')sTwisteds>=s1.2stwisTeds2.0sZopes3.0sTwisted[extras]>=1.2(s Requirementsparsesrsselfs assertEqualsstrsreprsassertNotEqual(sselfsr((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys testBasics$s%%%%%cCstdddfddfgf}tdddfddfgf}|i|||it|t||it|ddS(NsTwisteds==s1.2c1s>=s1.2sTwisted==1.2c1,>=1.2(s Requirementsr1sr2sselfs assertEqualsstr(sselfsr1sr2((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys testOrdering/s $$cCstdddfgf}tid}tid}tid}|it d|j|it d|j|id|j|id|j|i||j|i||j|i||jdS(NsTwisteds>=s1.2sFooPkg-1.3_1.eggsTwisted-1.1.eggsTwisted-1.2.eggs1.1( s Requirementsrs Distributions from_filenamesfoo_diststwist11stwist12sselfs failUnlesss parse_version(sselfsrsfoo_diststwist11stwist12((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestBasicContains6sc Cstd\}xEdddddddd d f D]"}|i||j||fq1WxBd d d dddddfD]"}|i||j||fqvWdS(Ns*Foo>=1.2,<=1.3,==1.9,>2.0,!=2.5,<3.0,==4.5s1.2s1.2.2s1.3s1.9s2.0.1s2.3s2.6s3.0c1s4.5s1.2c1s1.3.1s1.5s1.9.1s2.0s2.5s3.0s4.0(sparse_requirementssrsvsselfs failUnless(sselfsrsv((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestAdvancedContainsCs" cCstid}tid}tid}|i|||i|||i|iddf|i|iddf|it|t||it|tddt dfft ddgfdS( NsTwisted[foo,bar]>=1.2sTwisted[bar,FOO]>=1.2sTwisted[BAR,FOO]>=1.2.0sfoosbarstwisteds>=s1.2( s Requirementsparsesr1sr2sr3sselfs assertEqualsextrasshashs parse_versions frozenset(sselfsr1sr2sr3((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestOptionsAndHashingKscCstid}tid}ti}|i|d|j|i|d|j|i|d|j|i |d|j|i |d|j|i |d|j|i |d|jdS(Nssetuptools==0.3a2ssetuptools!=0.3a4ssetuptools-0.3a4.eggssetuptools-0.3a1.eggssetuptools-0.3a2.eggssetuptools-0.3a3.eggssetuptools-0.3a5.egg( s Requirementsparsesr1sr2s Distributions from_filenamesdsselfsfailIfs failUnless(sselfsr1sr2sd((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestVersionEqualityYs (s__name__s __module__s testBasicss testOrderingstestBasicContainsstestAdvancedContainsstestOptionsAndHashingstestVersionEquality(((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pysRequirementsTests"s    s ParseTestscBsPtZdZdZdZdZdZdZdZdZ RS( NcCs |ittdgdS(Ns(sselfs assertEqualslistsparse_requirements(sself((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestEmptyParsevscCsxxggfddgfgggfdddgfddgddgfgD]+\}}|itti||qLWdS(Nsxs x ysysx (sinpsoutsselfs assertEqualslists pkg_resourcess yield_lines(sselfsinpsout((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys testYieldingysL cCs{|ittidtdgfdddgfddgfdgfd d gfg|itttid dS( Ns x [Y] z a [b ] # foo c [ d] [q] v sxsYszsasbscsdsqsvs[foo(sselfs assertEqualslists pkg_resourcesssplit_sectionssNones assertRaisess ValueError(sself((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys testSplittingsCcCsr|itdd|itdd|itdd|itdd|itdddS( Ns adns-pythons WSGI Utilss WSGI-Utilss WSGI Utilss Money$$$Makers Money-Makerspeak.webspeak-web(sselfs assertEquals safe_namesassertNotEqual(sself((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys testSafeNames cCsr|itdd|itdd|itdd|itdd|itdddS( Ns1.2-1s 1.2 alphas 1.2.alphas2.3.4 20050521s2.3.4.20050521s Money$$$Makers Money-Makerspeak.web(sselfs assertEquals safe_version(sself((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestSafeVersions cCs|ittdtdddfgfg|ittdtdddfdd fgfg|itid td d d fgf|ittid|ittid|ittid|ittid|ittiddS(NsTwis-Ted>=1.2-1sTwis-Teds>=s1.2-1sTwisted >=1.2, \ # more <2.0sTwisteds1.2s=2.3sx\sx==2 qs X==1 Y==2s#(sselfs assertEqualslistsparse_requirementss Requirementsparses assertRaisess ValueError(sself((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestSimpleRequirementss(csd}|dd|dd|dd|dd|d d |d d |d d|d d|dd|dddS(NcsAt|t|f\}}i||||||fdS(N(s parse_versionss1ss2sp1sp2sselfs assertEqual(ss1ss2sp2sp1(sself(sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pyscss1.2-rc1s1.2rc1s0.4s0.4.0s0.4.0.0s0.4.0-0s0.4-0s0pl1s0.0pl1s0pre1s0.0c1s 0.0.0preview1s0c1s0-rc1s1.2a1s1.2.a.1s1.2...as1.2a(sc(sselfsc((sselfsCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestVersionEqualitys         csId}|dd|dd|dd|dd|dd |dd|dd |d d|d d |dd|dd|dd|dd|dd|dd|dd|dd|dddi}x@t|D]2\}}x#||d D]}|||q*WqWdS(!NcsDt|t|f\}}i||j||||fdS(N(s parse_versionss1ss2sp1sp2sselfs failUnless(ss1ss2sp2sp1(sself(sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pyscss2.1s2.1.1s2a1s2b0s2.3a1s2.3s2.1-1s2.1-2s2.1pl4s2.1a0-20040501s1.1s02.1sA56sB27s3.2s3.2.pl0s3.2-1s3.2pl1s3.2pl1-1s0.4s4.0s0.0.4s0.4.0s0pl1s0.4pl1s 2.1.0-rc1s2.1.0s2.1devs2.1a0s 0.80.1-3 0.80.1-2 0.80.1-1 0.79.9999+0.80.0pre4-1 0.79.9999+0.80.0pre2-3 0.79.9999+0.80.0pre2-2 0.77.2-1 0.77.1-1 0.77.0-1 i(scssplitstortures enumeratespsv1sv2(sselfscstorturesv1spsv2((sselfsCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pystestVersionOrderings2                     ( s__name__s __module__stestEmptyParses testYieldings testSplittings testSafeNamestestSafeVersionstestSimpleRequirementsstestVersionEqualitystestVersionOrdering(((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys ParseTeststs       (sunittestsTestCases makeSuites pkg_resourcesssyss frozensets NameErrorssetss ImmutableSets EmptyProvidersMetadatas DistroTestssEntryPointTestssRequirementsTestss ParseTests( ssyss ParseTestss makeSuites pkg_resourcessRequirementsTestssTestCases DistroTestssEntryPointTestss frozensetsMetadata((sCbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_resources.pys?sRRPKC8,[&setuptools/tests/test_packageindex.pyc; _Fc@sYdZdkZdkZdkZdkZdkZdkZdeifdYZ dS(sPackage Index Tests NsTestPackageIndexcBstZdZRS(NcCshtii}d}y|i|Wn.tj o"}|i |t |jnX|i t dS(Ns,http://127.0.0.1/nonesuch/test_package_index( s setuptoolss package_indexs PackageIndexsindexsurlsopen_urls Exceptionsvsselfsassert_sstrsFalse(sselfsindexsurlsv((sFbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_packageindex.pys test_bad_urls s(s__name__s __module__s test_bad_urls(((sFbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_packageindex.pysTestPackageIndex s( s__doc__sossshutilstempfilesunittests pkg_resourcesssetuptools.package_indexs setuptoolssTestCasesTestPackageIndex(stempfilesunittests pkg_resourcessTestPackageIndexs setuptoolssshutilsos((sFbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_packageindex.pys?s$  PKC8,YBBsetuptools/tests/__init__.pyc; Ec@sIdZdklZlZlZlZdkZdkZdk l Z l Z dk l Z dk Z dkZ dk lZdklZdklZlZdklZlZd klZlZd klZdkZdkZd Zd Zd efdYZ defdYZ!defdYZ"defdYZ#dS(s"Tests for the 'setuptools' package(s TestSuitesTestCases makeSuitesdefaultTestLoaderN(sDistutilsOptionErrorsDistutilsPlatformError(sDistutilsSetupError(sFeature(s Extension(sextract_constantsget_module_constant(s find_modulesRequire(s StrictVersions LooseVersion(s convert_pathcCsndk}dk}|i|idd|iddf}tidjo|i|idn|SdS(Ns api_tests.txts optionflagsspackages pkg_resourcesswin32swin_script_wrapper.txt( sdoctestsunittests TestSuites DocFileSuitesELLIPSISssuitessyssplatformsaddTest(ssuitesunittestsdoctest((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pysadditional_testss cKsAdti_|iddgzti|SWdtt_XdS(sDReturn distribution from 'setup(**args)', without executing commandss commandlines script_argssinstallN( s distutilsscores_setup_stop_aftersargss setdefaults setuptoolsssetupsNonescore_setup_stop_after(sargs((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pys makeSetups s DependsTestscBs,tZdZdZdZdZRS(NcCsdkl}d}|i||iddt|i||iddd|i||iddd|i||iddtdS( N(sextract_constantcCsdatadS(Nstest(sxszsy(((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pysf15ssqisxstestsysz(ssetuptools.dependssextract_constantsf1sselfs assertEquals func_codesNone(sselfsf1sextract_constant((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pystestExtractConst1s   cCsI|ittd|ittdtd\}}}|idS(Nsno-such.-thingssetuptools.non-existentssetuptools.tests(sselfs assertRaisess ImportErrors find_modulesfspsisclose(sselfsisfsp((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pystestFindModuleGscCs_dkl}|itdd||itddti|itddtdS(N(s __version__s distutilss __version__ssyssversionssetuptools.testss__doc__(s distutilss __version__sselfs assertEqualsget_module_constantssyssversions__doc__(sselfs __version__((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pystestModuleExtractLs cCshtddd}|i|id|i|id|i|id|i|id|i|iddk l }|i|i ||i |i d|i|i d|i|i d |i |i|i |itd d dd t}|i |i|i|i|i|i d td dd}|i|i|i|itdtddd}|i|it|i|it|i|it|i|id|i|idgi}tD]}|tii|q~}|i |i||i |i|dS(Ns Distutilss1.0.3s distutilss __version__sDistutils-1.0.3(s __version__s1.0.9s0.9.1sunknownsDistutils 3000s03000sformatsDo-what-I-means1.0sd-w-i-msTestsstestsshomepageshttp://example.com(sRequiresreqsselfs assertEqualsnamesmodulesrequested_versions attributes full_names distutilss __version__s get_versions failUnlesss version_oksfailIfs is_presents is_currents LooseVersionsNonesformatshomepagesappends_[1]s__path__spsosspathsdirnamespaths(sselfspathssreqs_[1]sps __version__((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pys testRequireXs: 3(s__name__s __module__stestExtractConststestFindModulestestModuleExtracts testRequire(((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pys DependsTests/s   s DistroTestscBsPtZdZdZdZdZdZdZdZdZ RS( Nc Csstddg|_tddg|_tddddd d gd d d gd|i|ifdh|_dS(Nsbar.extsbar.csc.ysy.cspackagessasa.bsa.b.csbscs py_modulessb.dsxs ext_moduless package_dir(s Extensionsselfse1se2s makeSetupsdist(sself((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pyssetUps  cCs#|it|itiidS(N(sselfs failUnlesss isinstancesdists setuptoolss Distribution(sself((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pystestDistroTypescCs|iid|i|iiddg|iid|i|iidg|i|iidg|i|ii|i|ig|iid|i|iig|i|iidg|i|ii|igt iddS(Nsasbscsx( sselfsdistsexclude_packages assertEqualspackagess py_moduless ext_modulesse1se2s makeSetup(sself((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pystestExcludePackages"cCs|iid|ig|i|ii|ig|iid|ig|i|ii|i|ig|iid|ig|i|ii|i|igdS(Ns ext_modules(sselfsdistsexcludese1s assertEquals ext_modulesse2sinclude(sself((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pystestIncludeExcludes "cCsk|iiddddg|i|iig|i|iidg|i|ii|igdS(Nspackagesscsbsasx(sselfsdistsexcludes assertEqualspackagess py_moduless ext_modulesse1(sself((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pystestExcludePackagesscCsft}|iddgddgd|igt}|iddgddgd|igdS(Nspackagessas py_modulessbs ext_modules(s makeSetupsdistsincludesselfse2sexclude(sselfsdist((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pys testEmptys ( cCs|i|iid|iid|i|iid|i|iid|iid|i|iid|i|iid|iid|i|iiddS(Nsasbsc(sselfs failUnlesssdistshas_contents_forsexclude_packagesfailIf(sself((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pys testContentsscCs|it|iidd|it|iidd|it|iidhdd<|it|iidhdd<|it|iidhdd<|it|iidhdd<|it|iiddg|it|iiddgdS(Nsnonexistent_optionsxspackagessys ext_moduless package_dirsq(sselfs assertRaisessDistutilsSetupErrorsdistsincludesexclude(sself((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pystestInvalidIncludeExcludes         ( s__name__s __module__ssetUpstestDistroTypestestExcludePackagestestIncludeExcludestestExcludePackagess testEmptys testContentsstestInvalidIncludeExclude(((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pys DistroTestss     s FeatureTestscBs>tZdZdZdZdZdZdZRS(NcCs tddd|_tdhdtddtdd|ig<d td dtd d gd d gddg<dtddtd dgddgdddfg<dtddtddtZdZdZdZdZdZdZRS(NcCs2tid}|it|tiidS(Nstest( s makeSetupsget_command_objstest_cmdsselfs failUnlesss isinstances distutilsscmdsCommand(sselfstest_cmd((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pystestTestIsCommandPscCsEtdddg}|id}|i|i|iddS(Ns script_argsstests--test-suite=foo.tests.suitesfoo.tests.suite(s makeSetupsts1sget_command_objsensure_finalizedsselfs assertEquals test_suite(sselfsts1((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pystestLongOptSuiteWNoDefaultTs cCs9tddid}|i|i|iddS(Ns test_suitesbar.tests.suitestest(s makeSetupsget_command_objsts2sensure_finalizedsselfs assertEquals test_suite(sselfsts2((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pystestDefaultSuiteZs cCs[tddddddgid}|i|i|id|i|iddS(Ns test_suites bar.testss script_argsstests-ms foo.testssfoo.tests.test_suite(s makeSetupsget_command_objsts3sensure_finalizedsselfs assertEquals test_modules test_suite(sselfsts3((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pystestDefaultWModuleOnCmdLine_s   cCs>tddddddgid}|it|idS(Ns script_argsstests-ms bar.testss-ssfoo.tests.suite(s makeSetupsget_command_objsts4sselfs assertRaisessDistutilsOptionErrorsensure_finalized(sselfsts4((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pystestConflictingOptionshs'cCs3tid}|i|i|itdS(Nstest(s makeSetupsget_command_objsts5sensure_finalizedsselfs assertEquals test_suitesNone(sselfsts5((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pys testNoSuitens (s__name__s __module__stestTestIsCommandstestLongOptSuiteWNoDefaultstestDefaultSuitestestDefaultWModuleOnCmdLinestestConflictingOptionss testNoSuite(((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pysTestCommandTestsNs     ($s__doc__sunittests TestSuitesTestCases makeSuitesdefaultTestLoadersdistutils.cores distutilss distutils.cmdsdistutils.errorssDistutilsOptionErrorsDistutilsPlatformErrorsDistutilsSetupErrors setuptoolsssetuptools.distsFeatures Extensionssetuptools.dependssextract_constantsget_module_constants find_modulesRequiresdistutils.versions StrictVersions LooseVersionsdistutils.utils convert_pathssyssos.pathsossadditional_testss makeSetups DependsTestss DistroTestss FeatureTestssTestCommandTests(sDistutilsPlatformErrors distutilssFeatures LooseVersions makeSetupsextract_constants TestSuites DependsTestss find_modules FeatureTestssDistutilsSetupErrorsTestCasesget_module_constants convert_paths ExtensionsRequires makeSuitesadditional_testss StrictVersions DistroTestssDistutilsOptionErrorsTestCommandTestssdefaultTestLoaderssyss setuptoolssos((s=build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/__init__.pys?s$     R{RPKC8,[&setuptools/tests/test_packageindex.pyo; _Fc@sYdZdkZdkZdkZdkZdkZdkZdeifdYZ dS(sPackage Index Tests NsTestPackageIndexcBstZdZRS(NcCshtii}d}y|i|Wn.tj o"}|i |t |jnX|i t dS(Ns,http://127.0.0.1/nonesuch/test_package_index( s setuptoolss package_indexs PackageIndexsindexsurlsopen_urls Exceptionsvsselfsassert_sstrsFalse(sselfsindexsurlsv((sFbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_packageindex.pys test_bad_urls s(s__name__s __module__s test_bad_urls(((sFbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_packageindex.pysTestPackageIndex s( s__doc__sossshutilstempfilesunittests pkg_resourcesssetuptools.package_indexs setuptoolssTestCasesTestPackageIndex(stempfilesunittests pkg_resourcessTestPackageIndexs setuptoolssshutilsos((sFbuild/bdist.darwin-8.0.1-x86/egg/setuptools/tests/test_packageindex.pys?s$  PKC8 4 { {setuptools/tests/doctest.pyc; Ec!@syeWnej oeefZnXyeWnej odZnXdZdddddddd d d d d ddddddddddddddddddd d!d"g!Zd#kZd#kZd#k Z d#k Z d#k Z d#k Z d#k Z d#kZd#kZd#kZd#kZd#kZd#kZd$klZeid%deed&hZd'ZedZedZedZedZedZeeBeBeBeBZed Z ed Z!ed Z"ed Z#e e!Be"Be#BZ$d(Z%d)Z&d*Z'd+Z(d,d-Z)d.d/Z*d0Z+d1efd2YZ,d3Z-d4Z.d5ei/fd6YZ0d7Z1dfd8YZ2dfd9YZ3dfd:YZ4dfd;YZ5dfd<YZ6dfd=YZ7de8fd>YZ9de8fd?YZ:de6fd@YZ;e<a=e<e<e<e<e<e>d&e<e?e?dA Z@e>e<e<e<e<e>d&e<e?e4dB ZAe?dCe<d&dDZBdfdEYZCd&aDdFZEdGeiFfdHYZGe<e<e<e<dIZHdJeGfdKYZIe>e<e<e4dLZJdMZKdNZLdOZMe?e<dPZNe?e<dQZOe?dRZPdSfdTYZQhdSeQ<dUdV<dWdX<dYdZ<d[d\<d]d^}|t|<|SdS(Ni(slensOPTIONFLAGS_BY_NAMEsflagsname(snamesflag((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysregister_optionflags s s...cCsOtidtdd|d djo$|d djo|djn SdS( sprefix, base -> true iff name prefix + "." + base is "private". Prefix may be an empty string, and base does not contain a period. Prefix is ignored (although functions you write conforming to this protocol may make use of it). Return true iff base begins with an (at least one) underscore, but does not both begin and end with (at least) two underscores. >>> is_private("a.b", "my_func") False >>> is_private("____", "_my_func") True >>> is_private("someclass", "__init__") False >>> is_private("sometypo", "__init_") True >>> is_private("x.y.z", "_") True >>> is_private("_x.y.z", "__") False >>> is_private("", "") # senseless but consistent False sVis_private is deprecated; it wasn't useful; examine DocTestFinder.find() lists insteads stackleveliis_s__iN(swarningsswarnsDeprecationWarningsbase(sprefixsbase((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys is_privates  cCs[d}xJtiD]?}|i|t}|tt|jo||i O}qqW|SdS(s Return the compiler-flags associated with the future features that have been imported into the given namespace (globs). iN( sflagss __future__sall_feature_namessfnamesglobssgetsNonesfeaturesgetattrs compiler_flag(sglobssfeaturesflagssfname((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys_extract_future_flagss icCsti|o|Snot|ttfo t|ttdgSn9|t jot i t i |idSn tddS(s Return the module specified by `module`. In particular: - If `module` is a module, then return module. - If `module` is a string, then import and return the module with that name. - If `module` is None, then return the calling module. The calling module is assumed to be the module of the stack frame at the given depth in the call stack. s*s__name__s"Expected a module, string, or NoneN(sinspectsismodulesmodules isinstancesstrsunicodes __import__sglobalsslocalssNonessyssmoduless _getframesdepths f_globalss TypeError(smodulesdepth((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys_normalize_modules   icCstid|d|SdS(s{ Add the given number of space characters to the beginning every non-blank line in `s`, and return the result. s (?m)^(?!$)s N(sressubsindentss(sssindent((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys_indentscCs?t}|\}}}ti|||d||iSdS(sz Return a string containing a traceback message for the given exc_info tuple (as returned by sys.exc_info()). sfileN( sStringIOsexcoutsexc_infosexc_typesexc_valsexc_tbs tracebacksprint_exceptionsgetvalue(sexc_infosexc_valsexc_typesexcoutsexc_tb((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys_exception_tracebacks  s _SpoofOutcBstZdZedZRS(NcCsWti|}|o|id o|d7}nt|do |`n|SdS(Ns s softspace(sStringIOsgetvaluesselfsresultsendswithshasattrs softspace(sselfsresult((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysgetvalues  cCs.ti||t|do |`ndS(Ns softspace(sStringIOstruncatesselfssizeshasattrs softspace(sselfssize((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pystruncates(s__name__s __module__sgetvaluesNonestruncate(((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys _SpoofOuts cCsQ|itdjo||jSn|it}t|djptdt|f\}}|d}|o/|i |ot|}|d=qt Sn|d}|o3|i |o|t|8}|d=qt Sn||jot SnxH|D]@}|i|||}|djot Sn|t|7}qWtSdS(s_ Essentially the only subtle case: >>> _ellipsis_match('aa...aa', 'aaa') False iiiN(swantsfindsELLIPSIS_MARKERsgotssplitswsslensAssertionErrorsstartpossendpossws startswithsFalsesendswithsTrue(swantsgotswswssstartpossendpos((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys_ellipsis_match"s6       cCs'|i}|o d|SndSdS(s)Return a commented form of the given lines# s#N(slinesrstrip(sline((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys _comment_lineSs   s_OutputRedirectingPdbcBs tZdZdZdZRS(s A specialized version of the python debugger that redirects stdout to a given stream when interacting with the user. Stdout is *not* redirected when traced code is executed. cCs||_tii|dS(N(soutsselfs_OutputRedirectingPdb__outspdbsPdbs__init__(sselfsout((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__init__as cGs=ti}|it_ztii||SWd|t_XdS(N( ssyssstdouts save_stdoutsselfs_OutputRedirectingPdb__outspdbsPdbstrace_dispatchsargs(sselfsargss save_stdout((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pystrace_dispatches   (s__name__s __module__s__doc__s__init__strace_dispatch(((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys_OutputRedirectingPdb[s  cCsti| otd|n|ido tdnt|dotii |i d}n}|i djoXt tidjotiddjo!tii tidd}qti}ntd|d tii||i dSdS( NsExpected a module: %rs/s1Module-relative files may not have absolute pathss__file__is__main__ss+Can't resolve paths relative to the module s (it has no __file__)(sinspectsismodulesmodules TypeErrorspaths startswiths ValueErrorshasattrsosssplits__file__sbasedirs__name__slenssyssargvscurdirsjoin(smodulespathsbasedir((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys_module_relative_pathps *! cBs#tZdZeddedZRS(sn A single doctest example, consisting of source code and expected output. `Example` defines the following attributes: - source: A single Python statement, always ending with a newline. The constructor adds a newline if needed. - want: The expected output from running the source code (either from stdout, or a traceback in case of exception). `want` ends with a newline unless it's empty, in which case it's an empty string. The constructor adds a newline if needed. - exc_msg: The exception message generated by the example, if the example is expected to generate an exception; or `None` if it is not expected to generate an exception. This exception message is compared against the return value of `traceback.format_exception_only()`. `exc_msg` ends with a newline unless it's `None`. The constructor adds a newline if needed. - lineno: The line number within the DocTest string containing this Example where the Example begins. This line number is zero-based, with respect to the beginning of the DocTest. - indent: The example's indentation in the DocTest string. I.e., the number of space characters that preceed the example's first prompt. - options: A dictionary mapping from option flags to True or False, which is used to override default options for this example. Any option flags not contained in this dictionary are left at their default value (as specified by the DocTestRunner's optionflags). By default, no options are set. icCs|id o|d7}n|o|id o|d7}n|tj o|id o|d7}n||_||_||_||_|tjo h}n||_||_dS(Ns ( ssourcesendswithswantsexc_msgsNonesselfslinenosindentsoptions(sselfssourceswantsexc_msgslinenosindentsoptions((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__init__s      (s__name__s __module__s__doc__sNones__init__(((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysExamples "cBs)tZdZdZdZdZRS(se A collection of doctest examples that should be run in a single namespace. Each `DocTest` defines the following attributes: - examples: the list of examples. - globs: The namespace (aka globals) that the examples should be run in. - name: A name identifying the DocTest (typically, the name of the object whose docstring this DocTest was extracted from). - filename: The name of the file that this DocTest was extracted from, or `None` if the filename is unknown. - lineno: The line number within filename where this DocTest begins, or `None` if the line number is unavailable. This line number is zero-based, with respect to the beginning of the file. - docstring: The string that the examples were extracted from, or `None` if the string is unavailable. cCs[t|t p td||_||_|i|_||_||_ ||_ dS(s Create a new DocTest containing the given examples. The DocTest's globals are initialized with a copy of `globs`. s8DocTest no longer accepts str; use DocTestParser insteadN( s isinstancesexampless basestringsAssertionErrorsselfs docstringsglobsscopysnamesfilenameslineno(sselfsexamplessglobssnamesfilenameslinenos docstring((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__init__s    cCstt|idjo d}n4t|idjo d}ndt|i}d|i|i|i|fSdS(Nis no examplesis 1 examples %d exampless(slensselfsexamplessnamesfilenameslineno(sselfsexamples((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__repr__s   cCs`t|t odSnt|i|i|it|f|i|i|it|fSdS(Ni( s isinstancesothersDocTestscmpsselfsnamesfilenameslinenosid(sselfsother((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__cmp__s!(s__name__s __module__s__doc__s__init__s__repr__s__cmp__(((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysDocTests   cBstZdZeideieiBZeideieiBeiBZ eidi Z ddZ dZ ddZdZeid eiZd Zeid eiZd Zd ZdZRS(sD A class used to parse strings containing doctest examples. s # Source consists of a PS1 line followed by zero or more PS2 lines. (?P (?:^(?P [ ]*) >>> .*) # PS1 line (?:\n [ ]* \.\.\. .*)*) # PS2 lines \n? # Want consists of any non-blank lines that do not start with PS1. (?P (?:(?![ ]*$) # Not a blank line (?![ ]*>>>) # Not a line starting with PS1 .*$\n? # But any other line )*) s # Grab the traceback header. Different versions of Python have # said different things on the first traceback line. ^(?P Traceback\ \( (?: most\ recent\ call\ last | innermost\ last ) \) : ) \s* $ # toss trailing whitespace on the header. (?P .*?) # don't blink: absorb stuff until... ^ (?P \w+ .*) # a line *starts* with alphanum. s ^[ ]*(#.*)?$sc Cs|i}|i|}|djoAdigi}|idD]}|||qE~}ng} ddf\} } x|i i|D]}| i|| |i!| |id| |i7} |i||| \}} } }|i| oB| it|| |d| d|t|idd| n| |id|i|i7} |i} qW| i|| | SdS(s= Divide the given string into examples and intervening text, and return them as a list of alternating Examples and strings. Line numbers for the Examples are 0-based. The optional argument `name` is a name identifying this string, and is only used for error messages. is slinenosindentsoptionsN(sstrings expandtabssselfs _min_indents min_indentsjoinsappends_[1]ssplitslsoutputscharnoslinenos _EXAMPLE_REsfinditersmsstartscounts_parse_examplesnamessourcesoptionsswantsexc_msgs_IS_BLANK_OR_COMMENTsExampleslensgroupsend(sselfsstringsnames min_indentsexc_msgsmsls_[1]ssourceslinenoswantsoutputscharnosoptions((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysparse5s*  A!%cCs)t|i|||||||SdS(s" Extract all doctest examples from the given string, and collect them into a `DocTest` object. `globs`, `name`, `filename`, and `lineno` are attributes for the new `DocTest` object. See the documentation for `DocTest` for more information. N(sDocTestsselfs get_examplessstringsnamesglobssfilenameslineno(sselfsstringsglobssnamesfilenameslineno((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys get_doctest\scCsIgi}|i||D]$}t|to||qq~SdS(s Extract all doctest examples from the given string, and return them as a list of `Example` objects. Line numbers are 0-based, because it's most common in doctests that nothing interesting appears on the same line as opening triple-quote, and so the first interesting line is called "line 1" then. The optional argument `name` is a name identifying this string, and is only used for error messages. N( sappends_[1]sselfsparsesstringsnamesxs isinstancesExample(sselfsstringsnames_[1]sx((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys get_exampleshs cCst|id}|idid} |i| ||||i | dd|d||di gi }| D]} || |dqy~} |id} | id}t|djotid |d o |d =n|i |d|||t| di gi }|D]}|||q(~} |ii| }|o|id }nt}|i| ||} | | | |fSd S( s Given a regular expression match from `_EXAMPLE_RE` (`m`), return a pair `(source, want)`, where `source` is the matched example's source code (with prompts and indentation stripped); and `want` is the example's expected output (with indentation stripped). `name` is the string's name, and `lineno` is the line number where the example starts; both are used for error messages. sindentssources is s.iswants *$ismsgN(slensmsgroupsindentssplits source_linessselfs_check_prompt_blanksnameslinenos _check_prefixsjoinsappends_[1]sslssourceswants want_linessresmatchswls _EXCEPTION_REsexc_msgsNones _find_optionssoptions(sselfsmsnameslinenosindents want_linessexc_msgswls_[1]ssourceswantssls source_linessoptions((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys_parse_examplevs& "8* 4s#\s*doctest:\s*([^\n\'"]*)$c Csh}x|ii|D]}|ididdi}xs|D]k}|ddjp|dt jo!t d|d||fnt |d}|ddj||>> tests = DocTestFinder().find(_TestClass) >>> runner = DocTestRunner(verbose=False) >>> for test in tests: ... print runner.run(test) (0, 2) (0, 1) (0, 2) (0, 2) The `summarize` method prints a summary of all the test cases that have been run by the runner, and returns an aggregated `(f, t)` tuple: >>> runner.summarize(verbose=1) 4 items passed all tests: 2 tests in _TestClass 2 tests in _TestClass.__init__ 2 tests in _TestClass.get 1 tests in _TestClass.square 7 tests in 4 items. 7 passed and 0 failed. Test passed. (0, 7) The aggregated number of tried examples and failed examples is also available via the `tries` and `failures` attributes: >>> runner.tries 7 >>> runner.failures 0 The comparison between expected outputs and actual outputs is done by an `OutputChecker`. This comparison may be customized with a number of option flags; see the documentation for `testmod` for more information. If the option flags are insufficient, then the comparison may also be customized by passing a subclass of `OutputChecker` to the constructor. The test runner's display output can be controlled in two ways. First, an output function (`out) can be passed to `TestRunner.run`; this function will be called with strings that should be displayed. It defaults to `sys.stdout.write`. If capturing the output is not sufficient, then the display output can be also customized by subclassing DocTestRunner, and overriding the methods `report_start`, `report_success`, `report_unexpected_exception`, and `report_failure`. s*iFicCsy|pt|_|tjodtij}n||_||_ ||_ d|_ d|_ h|_ t|_dS(sc Create a new test runner. Optional keyword arg `checker` is the `OutputChecker` that should be used to compare the expected outputs and actual outputs of doctest examples. Optional keyword arg 'verbose' prints lots of stuff if true, only failures if false; by default, it's true iff '-v' is in sys.argv. Optional argument `optionflags` can be used to control how the test runner compares expected output to actual output, and how it displays failures. See the documentation for `testmod` for more information. s-viN(scheckers OutputCheckersselfs_checkersverbosesNonessyssargvs_verboses optionflagssoriginal_optionflagsstriessfailuress_name2fts _SpoofOuts_fakeout(sselfscheckersverboses optionflags((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__init__Us       cCsc|ioU|io,|dt|idt|iq_|dt|idndS(s Report that the test runner is about to process the given example. (Only displays a message if verbose=True) sTrying: s Expecting: sExpecting nothing N(sselfs_verbosesexampleswantsouts_indentssource(sselfsoutstestsexample((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys report_startys   ,cCs|io|dndS(st Report that the given example ran successfully. (Only displays a message if verbose=True) sok N(sselfs_verbosesout(sselfsoutstestsexamplesgot((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysreport_successs cCs3||i|||ii|||idS(s7 Report that the given example failed. N( soutsselfs_failure_headerstestsexamples_checkersoutput_differencesgots optionflags(sselfsoutstestsexamplesgot((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysreport_failurescCs.||i||dtt|dS(sO Report that the given example raised an unexpected exception. sException raised: N(soutsselfs_failure_headerstestsexamples_indents_exception_tracebacksexc_info(sselfsoutstestsexamplesexc_info((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysreport_unexpected_exceptionscCs|ig}|iob|itj o |itj o|i|id}nd}|id|i||i fn"|id|id|i f|id|i }|it |di |SdS(Nis?sFile "%s", line %s, in %ssLine %s, in %ssFailed example:s ( sselfsDIVIDERsoutstestsfilenameslinenosNonesexamplesappendsnamessources_indentsjoin(sselfstestsexamplessourceslinenosout((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys_failure_headers   $!  cBsd}} |i} ed\} }}|i i }xUe |iD]D\}}|ie@o |dj}| |_|ioNxK|iiD]6\}}|o|i|O_q|i|M_qWn| d7} | o|i|||nd|i|f}y7e|i|d|d|iU|ii e!}Wn5e#j o n!e$i%}|ii nX|i&i'} |i&i)d|}|e!jo'||i+| |io | }qne$i%}e,i-|d d} | o| e/|7} n|i.e!jo |}n||i.| |io | }nz|ie0@oke1i2d|i.}e1i2d| }|o,|o%||i5d|i5d|io | }qn|| jo&| o|i6|||| qqD||jo0| o|i7|||| n|d7}qD||jo0| o|i8||||n|d7}qDe9pt:d |fqDW| |_|i;||| || fSd S( s Run the examples in `test`. Write the outcome of each example with one of the `DocTestRunner.report_*` methods, using the writer function `out`. `compileflags` is the set of compiler flags that should be used to execute examples. Return a tuple `(f, t)`, where `t` is the number of examples tried, and `f` is the number of examples that failed. The examples are run in the namespace `test.globs`. iiisssingleiis[^:]*:sunknown outcomeN(<sfailuresstriessselfs optionflagssoriginal_optionflagssrangesSUCCESSsFAILUREsBOOMs_checkers check_outputschecks enumeratestestsexampless examplenumsexamplesREPORT_ONLY_FIRST_FAILUREsquietsoptionssitemss optionflagsvals report_startsoutsnamesfilenamescompilessources compileflagssglobssdebuggers set_continuesNones exceptionsKeyboardInterruptssyssexc_infos_fakeoutsgetvaluesgotstruncatesoutcomeswants tracebacksformat_exception_onlysexc_msgs_exception_tracebacksIGNORE_EXCEPTION_DETAILsresmatchsm1sm2sgroupsreport_successsreport_failuresreport_unexpected_exceptionsFalsesAssertionErrors_DocTestRunner__record_outcome(sselfstests compileflagssoutschecksvalsfilenamesm1sm2sgotsoriginal_optionflagssSUCCESSsexc_msgstriessexc_infos exceptions optionflagsquietsFAILUREsBOOMs examplenumsfailuressoutcomesexample((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__runs                )      cCsd|ii|iddf\}}||||f|i|i<|i |7_ |i |7_ dS(s{ Record the fact that the given DocTest (`test`) generated `f` failures out of `t` tried examples. iN( sselfs_name2ftsgetstestsnamesf2st2sfstsfailuresstries(sselfstestsfstsf2st2((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__record_outcome(s $s3[\w\.]+)\[(?P\d+)\]>$cCs|ii|}|o|id|iijo3|iit |id}|i i t Sn8|iiidjo|i||Sn|i|SdS(Nsnames examplenumi(sselfs%_DocTestRunner__LINECACHE_FILENAME_REsmatchsfilenamesmsgroupstestsnamesexamplessintsexamplessources splitlinessTruessave_linecache_getliness func_codes co_argcountsmodule_globals(sselfsfilenamesmodule_globalssmsexample((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__patched_linecache_getlines5s#cCs||_|tjot|i}nti}|tjo |i }n|i t_t i }t||_|ii|ii t _ ti|_|it_z|i|||SWd|t_|t _ |it_|o|iinXdS(sJ Run the examples in `test`, and display the results using the writer function `out`. The examples are run in the namespace `test.globs`. If `clear_globs` is true (the default), then this namespace will be cleared after the test runs, to help with garbage collection. If you would like to examine the namespace after the test completes, then use `clear_globs=False`. `compileflags` gives the set of flags that should be used by the Python compiler when running the examples. If not specified, then it will default to the set of future-import flags that apply to `globs`. The output of each example is checked using `DocTestRunner.check_output`, and the results are formatted by the `DocTestRunner.report_*` methods. N(stestsselfs compileflagssNones_extract_future_flagssglobsssyssstdouts save_stdoutsoutswrites_fakeoutspdbs set_tracessave_set_traces_OutputRedirectingPdbsdebuggersresets linecachesgetlinesssave_linecache_getliness*_DocTestRunner__patched_linecache_getliness_DocTestRunner__runs clear_globssclear(sselfstests compileflagssouts clear_globss save_stdoutssave_set_trace((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysrun?s,             c Cs7|tjo |i}ng} g}g}d}} x|i i D]} | \}\}}||jpt||7}| |7} |djo| i|qF|djo|i||fqF|i| qFW|o| o7t| GdGH| ix| D]} dG| GHqWn|oCt|GdGH|ix'|D]\} }d|| fGHqEWqln|oT|iGHt|GdGH|ix0|D]$\} \}}d||| fGHqWn|o3|GdGt|i Gd GH|| Gd G| Gd GHn| od G| Gd GHn|o dGHn| |fSdS(s Print a summary of all the test cases that have been run by this DocTestRunner, and return a tuple `(f, t)`, where `f` is the total number of failed examples, and `t` is the total number of tried examples. The optional `verbose` argument controls how detailed the summary is. If the verbosity is not specified, then the DocTestRunner's verbosity is used. isitems had no tests:s sitems passed all tests:s %3d tests in %ssitems had failures:s %3d of %3d in %sstests insitems.s passed andsfailed.s***Test Failed***s failures.s Test passed.N(sverbosesNonesselfs_verbosesnotestsspassedsfailedstotaltstotalfs_name2ftsitemssxsnamesfstsAssertionErrorsappendslenssortsthingscountsDIVIDER( sselfsverbosescountsfstotaltsnamesfailedstspassedsxstotalfsthingsnotests((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys summarizexs\             cCs|i}xu|iiD]d\}\}}||jo5d|dGH||\}}||}||}n||f||>> runner = DebugRunner(verbose=False) >>> test = DocTestParser().get_doctest('>>> raise KeyError\n42', ... {}, 'foo', 'foo.py', 0) >>> try: ... runner.run(test) ... except UnexpectedException, failure: ... pass >>> failure.test is test True >>> failure.example.want '42\n' >>> exc_info = failure.exc_info >>> raise exc_info[0], exc_info[1], exc_info[2] Traceback (most recent call last): ... KeyError We wrap the original exception to give the calling application access to the test and example information. If the output doesn't match, then a DocTestFailure is raised: >>> test = DocTestParser().get_doctest(''' ... >>> x = 1 ... >>> x ... 2 ... ''', {}, 'foo', 'foo.py', 0) >>> try: ... runner.run(test) ... except DocTestFailure, failure: ... pass DocTestFailure objects provide access to the test: >>> failure.test is test True As well as to the example: >>> failure.example.want '2\n' and the actual output: >>> failure.got '1\n' If a failure or error occurs, the globals are left intact: >>> del test.globs['__builtins__'] >>> test.globs {'x': 1} >>> test = DocTestParser().get_doctest(''' ... >>> x = 2 ... >>> raise KeyError ... ''', {}, 'foo', 'foo.py', 0) >>> runner.run(test) Traceback (most recent call last): ... UnexpectedException: >>> del test.globs['__builtins__'] >>> test.globs {'x': 2} But the globals are cleared if there is no error: >>> test = DocTestParser().get_doctest(''' ... >>> x = 2 ... ''', {}, 'foo', 'foo.py', 0) >>> runner.run(test) (0, 1) >>> test.globs {} cCs;ti||||t}|o|i i n|SdS(N( s DocTestRunnersrunsselfstests compileflagssoutsFalsesrs clear_globssglobssclear(sselfstests compileflagssouts clear_globssr((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysrunscCst|||dS(N(sUnexpectedExceptionstestsexamplesexc_info(sselfsoutstestsexamplesexc_info((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysreport_unexpected_exceptionscCst|||dS(N(sDocTestFailurestestsexamplesgot(sselfsoutstestsexamplesgot((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysreport_failures(s__name__s __module__s__doc__sNonesTruesrunsreport_unexpected_exceptionsreport_failure(((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys DebugRunnergs Y c CsS|tj otidtn|tjotiid}nt i | ot d|fn|tjo |i }ntd|d| } |otd|d|} ntd|d|} x3| i||d|d |D]} | i| qW|o| inttjo | anti| | i | i!fSd S( s m=None, name=None, globs=None, verbose=None, isprivate=None, report=True, optionflags=0, extraglobs=None, raise_on_error=False, exclude_empty=False Test examples in docstrings in functions and classes reachable from module m (or the current module if m is not supplied), starting with m.__doc__. Unless isprivate is specified, private names are not skipped. Also test examples reachable from dict m.__test__ if it exists and is not None. m.__test__ maps names to functions, classes and strings; function and class docstrings are tested even if the name is private; strings are tested directly, as if they were docstrings. Return (#failures, #tests). See doctest.__doc__ for an overview. Optional keyword arg "name" gives the name of the module; by default use m.__name__. Optional keyword arg "globs" gives a dict to be used as the globals when executing examples; by default, use m.__dict__. A copy of this dict is actually used for each docstring, so that each docstring's examples start with a clean slate. Optional keyword arg "extraglobs" gives a dictionary that should be merged into the globals that are used to execute examples. By default, no extra globals are used. This is new in 2.4. Optional keyword arg "verbose" prints lots of stuff if true, prints only failures if false; by default, it's true iff "-v" is in sys.argv. Optional keyword arg "report" prints a summary at the end when true, else prints nothing at the end. In verbose mode, the summary is detailed, else very brief (in fact, empty if all tests passed). Optional keyword arg "optionflags" or's together module constants, and defaults to 0. This is new in 2.3. Possible values (see the docs for details): DONT_ACCEPT_TRUE_FOR_1 DONT_ACCEPT_BLANKLINE NORMALIZE_WHITESPACE ELLIPSIS IGNORE_EXCEPTION_DETAIL REPORT_UDIFF REPORT_CDIFF REPORT_NDIFF REPORT_ONLY_FIRST_FAILURE Optional keyword arg "raise_on_error" raises an exception on the first unexpected exception or failure. This allows failures to be post-mortem debugged. Deprecated in Python 2.4: Optional keyword arg "isprivate" specifies a function used to determine whether a name is private. The default function is treat all functions as public. Optionally, "isprivate" can be set to doctest.is_private to skip over functions marked as private using the underscore naming convention; see its docs for details. Advanced tomfoolery: testmod runs methods of a local instance of class doctest.Tester, then merges the results into (or creates) global Tester instance doctest.master. Methods of doctest.master can be called directly too, if you want to do something unusual. Passing report=0 to testmod is especially useful then, to delay displaying a summary. Invoke doctest.master.summarize(verbose) when you're done fiddling. sPthe isprivate argument is deprecated; examine DocTestFinder.find() lists insteads__main__stestmod: module required; %rs _namefilters exclude_emptysverboses optionflagssglobss extraglobsN("s isprivatesNoneswarningsswarnsDeprecationWarningsmssyssmodulessgetsinspectsismodules TypeErrorsnames__name__s DocTestFinders exclude_emptysfindersraise_on_errors DebugRunnersverboses optionflagssrunners DocTestRunnersfindsglobss extraglobsstestsrunsreports summarizesmastersmergesfailuresstries( smsnamesglobssverboses isprivatesreports optionflagss extraglobssraise_on_errors exclude_emptysrunnerstestsfinder((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pystestmods0H         c Cse|o| otdn|ot|}t||}n|tjoti i |}n|tjo h}n |i }|tj o|i|n| otd|d|} ntd|d|} t|i} | i| |||d} | i| |o| inttjo | anti| | i | i!fSdS(s Test examples in the given file. Return (#failures, #tests). Optional keyword arg "module_relative" specifies how filenames should be interpreted: - If "module_relative" is True (the default), then "filename" specifies a module-relative path. By default, this path is relative to the calling module's directory; but if the "package" argument is specified, then it is relative to that package. To ensure os-independence, "filename" should use "/" characters to separate path segments, and should not be an absolute path (i.e., it may not begin with "/"). - If "module_relative" is False, then "filename" specifies an os-specific path. The path may be absolute or relative (to the current working directory). Optional keyword arg "name" gives the name of the test; by default use the file's basename. Optional keyword argument "package" is a Python package or the name of a Python package whose directory should be used as the base directory for a module relative filename. If no package is specified, then the calling module's directory is used as the base directory for module relative filenames. It is an error to specify "package" if "module_relative" is False. Optional keyword arg "globs" gives a dict to be used as the globals when executing examples; by default, use {}. A copy of this dict is actually used for each docstring, so that each docstring's examples start with a clean slate. Optional keyword arg "extraglobs" gives a dictionary that should be merged into the globals that are used to execute examples. By default, no extra globals are used. Optional keyword arg "verbose" prints lots of stuff if true, prints only failures if false; by default, it's true iff "-v" is in sys.argv. Optional keyword arg "report" prints a summary at the end when true, else prints nothing at the end. In verbose mode, the summary is detailed, else very brief (in fact, empty if all tests passed). Optional keyword arg "optionflags" or's together module constants, and defaults to 0. Possible values (see the docs for details): DONT_ACCEPT_TRUE_FOR_1 DONT_ACCEPT_BLANKLINE NORMALIZE_WHITESPACE ELLIPSIS IGNORE_EXCEPTION_DETAIL REPORT_UDIFF REPORT_CDIFF REPORT_NDIFF REPORT_ONLY_FIRST_FAILURE Optional keyword arg "raise_on_error" raises an exception on the first unexpected exception or failure. This allows failures to be post-mortem debugged. Optional keyword arg "parser" specifies a DocTestParser (or subclass) that should be used to extract tests from the files. Advanced tomfoolery: testmod runs methods of a local instance of class doctest.Tester, then merges the results into (or creates) global Tester instance doctest.master. Methods of doctest.master can be called directly too, if you want to do something unusual. Passing report=0 to testmod is especially useful then, to delay displaying a summary. Invoke doctest.master.summarize(verbose) when you're done fiddling. s8Package may only be specified for module-relative paths.sverboses optionflagsiN("spackagesmodule_relatives ValueErrors_normalize_modules_module_relative_pathsfilenamesnamesNonesosspathsbasenamesglobsscopys extraglobssupdatesraise_on_errors DebugRunnersverboses optionflagssrunners DocTestRunnersopensreadsssparsers get_docteststestsrunsreports summarizesmastersmergesfailuresstries(sfilenamesmodule_relativesnamespackagesglobssverbosesreports optionflagss extraglobssraise_on_errorsparsersrunnerstestss((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pystestfileKs4J          sNoNamec Csdtd|dt}td|d|}x3|i||d|D]}|i |d|qCWdS(sr Test examples in the given object's docstring (`f`), using `globs` as globals. Optional argument `name` is used in failure messages. If the optional argument `verbose` is true, then generate output even if there are no failures. `compileflags` gives the set of flags that should be used by the Python compiler when running the examples. If not specified, then it will default to the set of future-import flags that apply to `globs`. Optional keyword arg `optionflags` specifies options for the testing and output. See the documentation for `testmod` for more information. sverbosesrecurses optionflagssglobss compileflagsN(s DocTestFindersverbosesFalsesfinders DocTestRunners optionflagssrunnersfindsfsnamesglobsstestsruns compileflags( sfsglobssverbosesnames compileflagss optionflagssrunnerstestsfinder((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysrun_docstring_exampless cBsbtZeeeeddZdZeedZedZdZedZdZ RS( NicCstidtdd|tjo |tjotdn|tj oti| otd|fn|tjo |i }n||_||_ ||_ ||_ td||_td|d||_dS( NsCclass Tester is deprecated; use class doctest.DocTestRunner insteads stacklevelis*Tester.__init__: must specify mod or globss)Tester.__init__: mod must be a module; %rs _namefiltersverboses optionflags(swarningsswarnsDeprecationWarningsmodsNonesglobss TypeErrorsinspectsismodules__dict__sselfsverboses isprivates optionflagss DocTestFinders testfinders DocTestRunners testrunner(sselfsmodsglobssverboses isprivates optionflags((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__init__s         cCsti||i|tt}|io dG|GHn|i i |\}}|io|GdG|GdG|GHn||fSdS(NsRunning stringsofsexamples failed in string( s DocTestParsers get_doctestsssselfsglobssnamesNonestestsverboses testrunnersrunsfst(sselfsssnamesfststest((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys runstrings!   c Csd}}|ii||d|d|i}x@|D]8} |i i | \}}||||f\}}q5W||fSdS(Nismodulesglobs(sfstsselfs testfindersfindsobjectsnamesmodulesglobsstestsstests testrunnersrunsf2st2( sselfsobjectsnamesmodulestestssfst2sf2ststest((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysrundocs cCsVdk}|i|}|ii||tjo t}n|i |||SdS(N( snewsmodulesnamesms__dict__supdatesdsNonesFalsesselfsrundoc(sselfsdsnamesmodulesmsnew((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysrundicts    cCs5dk}|i|}||_|i||SdS(N(snewsmodulesnamesmsds__test__sselfsrundoc(sselfsdsnamesnewsm((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys run__test__s  cCs|ii|SdS(N(sselfs testrunners summarizesverbose(sselfsverbose((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys summarizescCs|ii|idS(N(sselfs testrunnersmergesother(sselfsother((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysmerges( s__name__s __module__sNones__init__s runstringsrundocsrundicts run__test__s summarizesmerge(((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysTesters    cCs8|t@|jotd|nt}|a|SdS(sSets the unittest option flags. The old flag is returned so that a runner could restore the old value if it wished to: >>> old = _unittest_reportflags >>> set_unittest_reportflags(REPORT_NDIFF | ... REPORT_ONLY_FIRST_FAILURE) == old True >>> import doctest >>> doctest._unittest_reportflags == (REPORT_NDIFF | ... REPORT_ONLY_FIRST_FAILURE) True Only reporting flags can be set: >>> set_unittest_reportflags(ELLIPSIS) Traceback (most recent call last): ... ValueError: ('Only reporting flags allowed', 8) >>> set_unittest_reportflags(old) == (REPORT_NDIFF | ... REPORT_ONLY_FIRST_FAILURE) True sOnly reporting flags allowedN(sflagssREPORTING_FLAGSs ValueErrors_unittest_reportflagssold(sflagssold((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysset_unittest_reportflags!ss DocTestCasecBsktZdeeedZdZdZdZdZdZdZ d Z e Z d Z RS( NicCsAtii|||_||_||_ ||_ ||_ dS(N(sunittestsTestCases__init__sselfs optionflagss_dt_optionflagsscheckers _dt_checkerstests_dt_testssetUps _dt_setUpstearDowns _dt_tearDown(sselfstests optionflagsssetUpstearDownschecker((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__init__Gs     cCs.|i}|itj o|i|ndS(N(sselfs_dt_teststests _dt_setUpsNone(sselfstest((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pyssetUpQs cCs;|i}|itj o|i|n|iidS(N(sselfs_dt_teststests _dt_tearDownsNonesglobssclear(sselfstest((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pystearDownWs cCs|i}ti}t}|i}|t @ o|t O}nt d|d|i dt}z5dd|_|i|d|idt\}}Wd|t_X|o"|i|i|indS(Ns optionflagsscheckersverboses-iFsouts clear_globs(sselfs_dt_teststestssyssstdoutsoldsStringIOsnews_dt_optionflagss optionflagssREPORTING_FLAGSs_unittest_reportflagss DocTestRunners _dt_checkersFalsesrunnersDIVIDERsrunswritesfailuresstriessfailureExceptionsformat_failuresgetvalue(sselfsoldsrunnerstriessfailuresstestsnews optionflags((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysrunTest_s       ( cCsp|i}|itjo d}nd|i}di|iidd}d|i|i |||fSdS(Nsunknown line numbers%ss.is:Failed doctest test for %s File "%s", line %s, in %s %s( sselfs_dt_teststestslinenosNonesjoinsnamessplitslnamesfilenameserr(sselfserrslnameslinenostest((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysformat_failurews    cCsI|itd|id|idt}|i|i|i dS(sRun the test case without results and without catching exceptions The unit test framework includes a debug method on test cases and test suites to support post-mortem debugging. The test code is run in such a way that errors are not caught. This way a caller can catch the errors and initiate post-mortem debugging. The DocTestCase provides a debug method that raises UnexpectedException errors if there is an unexepcted exception: >>> test = DocTestParser().get_doctest('>>> raise KeyError\n42', ... {}, 'foo', 'foo.py', 0) >>> case = DocTestCase(test) >>> try: ... case.debug() ... except UnexpectedException, failure: ... pass The UnexpectedException contains the test, the example, and the original exception: >>> failure.test is test True >>> failure.example.want '42\n' >>> exc_info = failure.exc_info >>> raise exc_info[0], exc_info[1], exc_info[2] Traceback (most recent call last): ... KeyError If the output doesn't match, then a DocTestFailure is raised: >>> test = DocTestParser().get_doctest(''' ... >>> x = 1 ... >>> x ... 2 ... ''', {}, 'foo', 'foo.py', 0) >>> case = DocTestCase(test) >>> try: ... case.debug() ... except DocTestFailure, failure: ... pass DocTestFailure objects provide access to the test: >>> failure.test is test True As well as to the example: >>> failure.example.want '2\n' and the actual output: >>> failure.got '1\n' s optionflagsscheckersverboseN( sselfssetUps DebugRunners_dt_optionflagss _dt_checkersFalsesrunnersruns_dt_teststearDown(sselfsrunner((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysdebugs @  cCs|iiSdS(N(sselfs_dt_testsname(sself((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysidscCs8|iiid}d|ddi|d fSdS(Ns.s%s (%s)i(sselfs_dt_testsnamessplitsjoin(sselfsname((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__repr__scCsd|iiSdS(Ns Doctest: (sselfs_dt_testsname(sself((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysshortDescriptions( s__name__s __module__sNones__init__ssetUpstearDownsrunTestsformat_failuresdebugsids__repr__s__str__sshortDescription(((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys DocTestCaseEs    H  c Ks|tjo t}nt|}|i|d|d|}|tjo |i }n| ot |dn|i t i }x|D]}t|idjoqn|i o;|i}|dddfjo|d }n||_n|it||qW|Sd S( s Convert doctest tests for a module to a unittest test suite. This converts each documentation string in a module that contains doctest tests to a unittest test case. If any of the tests in a doc string fail, then the test case fails. An exception is raised showing the name of the file containing the test and a (sometimes approximate) line number. The `module` argument provides the module to be tested. The argument can be either a module or a module name. If no argument is given, the calling module is used. A number of options may be provided as keyword arguments: setUp A set-up function. This is called before running the tests in each file. The setUp function will be passed a DocTest object. The setUp function can access the test globals as the globs attribute of the test passed. tearDown A tear-down function. This is called after running the tests in each file. The tearDown function will be passed a DocTest object. The tearDown function can access the test globals as the globs attribute of the test passed. globs A dictionary containing initial global variables for the tests. optionflags A set of doctest option flags expressed as an integer. sglobss extraglobss has no testsiis.pycs.pyoiN(s test_findersNones DocTestFinders_normalize_modulesmodulesfindsglobss extraglobsstestss__dict__s ValueErrorssortsunittests TestSuitessuitestestslensexamplessfilenames__file__saddTests DocTestCasesoptions( smodulesglobss extraglobss test_findersoptionsstestsstestssuitesfilename((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys DocTestSuites,#          s DocFileCasecBs)tZdZdZeZdZRS(NcCs di|iiidSdS(Ns_s.(sjoinsselfs_dt_testsnamessplit(sself((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysid scCs|iiSdS(N(sselfs_dt_testsfilename(sself((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__repr__ scCs!d|ii|ii|fSdS(Ns2Failed doctest test for %s File "%s", line 0 %s(sselfs_dt_testsnamesfilenameserr(sselfserr((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysformat_failure s(s__name__s __module__sids__repr__s__str__sformat_failure(((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys DocFileCase s  c Ks|tjo h}n|o| otdn|ot|}t||}ntii |}t |i }|i||||d}t||SdS(Ns8Package may only be specified for module-relative paths.i(sglobssNonespackagesmodule_relatives ValueErrors_normalize_modules_module_relative_pathspathsossbasenamesnamesopensreadsdocsparsers get_docteststests DocFileCasesoptions( spathsmodule_relativespackagesglobssparsersoptionssnamesdocstest((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys DocFileTest$ s   cOskti}|idtot|id|dA unittest suite for one or more doctest files. The path to each doctest file is given as a string; the interpretation of that string depends on the keyword argument "module_relative". A number of options may be provided as keyword arguments: module_relative If "module_relative" is True, then the given file paths are interpreted as os-independent module-relative paths. By default, these paths are relative to the calling module's directory; but if the "package" argument is specified, then they are relative to that package. To ensure os-independence, "filename" should use "/" characters to separate path segments, and may not be an absolute path (i.e., it may not begin with "/"). If "module_relative" is False, then the given file paths are interpreted as os-specific paths. These paths may be absolute or relative (to the current working directory). package A Python package or the name of a Python package whose directory should be used as the base directory for module relative paths. If "package" is not specified, then the calling module's directory is used as the base directory for module relative filenames. It is an error to specify "package" if "module_relative" is False. setUp A set-up function. This is called before running the tests in each file. The setUp function will be passed a DocTest object. The setUp function can access the test globals as the globs attribute of the test passed. tearDown A tear-down function. This is called after running the tests in each file. The tearDown function will be passed a DocTest object. The tearDown function can access the test globals as the globs attribute of the test passed. globs A dictionary containing initial global variables for the tests. optionflags A set of doctest option flags expressed as an integer. parser A DocTestParser (or subclass) that should be used to extract tests from the files. smodule_relativespackageN( sunittests TestSuitessuiteskwsgetsTrues_normalize_modulespathsspathsaddTests DocFileTest(spathsskwspathssuite((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys DocFileSuite: s4 cCsNg}xti|D]}t|tou|i|id |i }|oM|id|gi}|i dd D]}|d|q~~7}qq|gi}|i dd D]}|t |q~7}qWx'|o|ddjo|iqWx*|o|ddjo|idqWdi|SdS(scExtract script from text with examples. Converts text with examples to a Python script. Example input is converted to regular code. Example output and all other words are converted to comments: >>> text = ''' ... Here are examples of simple math. ... ... Python has super accurate integer addition ... ... >>> 2 + 2 ... 5 ... ... And very friendly error messages: ... ... >>> 1/0 ... To Infinity ... And ... Beyond ... ... You can use logic if you want: ... ... >>> if 0: ... ... blah ... ... blah ... ... ... ... Ho hum ... ''' >>> print script_from_examples(text) # Here are examples of simple math. # # Python has super accurate integer addition # 2 + 2 # Expected: ## 5 # # And very friendly error messages: # 1/0 # Expected: ## To Infinity ## And ## Beyond # # You can use logic if you want: # if 0: blah blah # # Ho hum is # Expected:s s## s#iN(soutputs DocTestParsersparsessspieces isinstancesExamplesappendssourceswants_[1]ssplitsls _comment_linespopsjoin(ssspiecesls_[1]swantsoutput((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysscript_from_examples s$8  DBcCst|}ti|}gi}|D]$}|i|jo||q,q,~}| ot |dn|d}t |i }|SdS(sExtract the test sources from a doctest docstring as a script. Provide the module (or dotted name of the module) containing the test to be debugged and the name (within the module) of the object with the doc string with tests to be debugged. snot found in testsiN(s_normalize_modulesmodules DocTestFindersfindstestssappends_[1]stsnamestests ValueErrorsscript_from_exampless docstringstestsrc(smodulesnamestestss_[1]stestsrcststest((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys testsource s ; cCs t|}t|||dS(s4Debug a single doctest docstring, in argument `src`'N(sscript_from_examplesssrcstestsrcs debug_scriptspmsglobs(ssrcspmsglobsstestsrc((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys debug_src s cCsdk}tidd}t|d}|i||iz|o|i }nh}|oHyt |||Wqt idGH|it idqXn|id|||Wdti|XdS(s7Debug a test script. `src` is the script, as a string.Ns.pys doctestdebugswiis execfile(%r)(spdbstempfilesmktemps srcfilenamesopensfswritessrcsclosesglobsscopyspmsexecfilessyssexc_infos post_mortemsrunsossremove(ssrcspmsglobssfs srcfilenamespdb((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys debug_script s&   cCs2t|}t||}t|||idS(sDebug a single doctest docstring. Provide the module (or dotted name of the module) containing the test to be debugged and the name (within the module) of the object with the docstring with tests to be debugged. N(s_normalize_modulesmodules testsourcesnamestestsrcs debug_scriptspms__dict__(smodulesnamespmstestsrc((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysdebug s s _TestClasscBs)tZdZdZdZdZRS(s A pointless class, for sanity-checking of docstring testing. Methods: square() get() >>> _TestClass(13).get() + _TestClass(-12).get() 1 >>> hex(_TestClass(13).square().get()) '0xa9' cCs ||_dS(sval -> _TestClass object with associated value val. >>> t = _TestClass(123) >>> print t.get() 123 N(svalsself(sselfsval((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys__init__! scCs|id|_|SdS(sosquare() -> square TestClass's associated value >>> _TestClass(13).square().get() 169 iN(sselfsval(sself((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pyssquare+ scCs |iSdS(s}get() -> return TestClass's associated value. >>> x = _TestClass(-42) >>> print x.get() -42 N(sselfsval(sself((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pysget5 s(s__name__s __module__s__doc__s__init__ssquaresget(((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys _TestClass s  sstrings Example of a string object, searched as-is. >>> x = 1; y = 2 >>> x + y, x * y (3, 2) sbool-int equivalences In 2.2, boolean expressions displayed 0 or 1. By default, we still accept them. This can be disabled by passing DONT_ACCEPT_TRUE_FOR_1 to the new optionflags argument. >>> 4 == 4 1 >>> 4 == 4 True >>> 4 > 4 0 >>> 4 > 4 False s blank liness Blank lines can be marked with : >>> print 'foo\n\nbar\n' foo bar sellipsiss If the ellipsis flag is used, then '...' can be used to elide substrings in the desired output: >>> print range(1000) #doctest: +ELLIPSIS [0, 1, 2, ..., 999] swhitespace normalizations| If the whitespace normalization flag is used, then differences in whitespace are ignored. >>> print range(30) #doctest: +NORMALIZE_WHITESPACE [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29] cCs ti}|itdS(N(sunittestsTextTestRunnersrsruns DocTestSuite(sr((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys_testq s s__main__(Ts basestrings NameErrorsstrsunicodes enumerates __docformat__s__all__s __future__ssyss tracebacksinspects linecachesossrestypessunittestsdifflibspdbstempfileswarningssStringIOsfilterwarningssDeprecationWarnings__name__sOPTIONFLAGS_BY_NAMEsregister_optionflagsDONT_ACCEPT_TRUE_FOR_1sDONT_ACCEPT_BLANKLINEsNORMALIZE_WHITESPACEsELLIPSISsIGNORE_EXCEPTION_DETAILsCOMPARISON_FLAGSs REPORT_UDIFFs REPORT_CDIFFs REPORT_NDIFFsREPORT_ONLY_FIRST_FAILUREsREPORTING_FLAGSsBLANKLINE_MARKERsELLIPSIS_MARKERs is_privates_extract_future_flagss_normalize_modules_indents_exception_tracebacks _SpoofOuts_ellipsis_matchs _comment_linesPdbs_OutputRedirectingPdbs_module_relative_pathsExamplesDocTests DocTestParsers DocTestFinders DocTestRunners OutputCheckers ExceptionsDocTestFailuresUnexpectedExceptions DebugRunnersNonesmastersTruesFalsestestmodstestfilesrun_docstring_examplessTesters_unittest_reportflagssset_unittest_reportflagssTestCases DocTestCases DocTestSuites DocFileCases DocFileTests DocFileSuitesscript_from_exampless testsources debug_srcs debug_scriptsdebugs _TestClasss__test__s_test(Fs_module_relative_paths __future__s OutputCheckersBLANKLINE_MARKERsunittestsNORMALIZE_WHITESPACEs __docformat__stestmods_normalize_modules REPORT_UDIFFsDONT_ACCEPT_TRUE_FOR_1s enumerates_OutputRedirectingPdbs_ellipsis_matchs basestringsIGNORE_EXCEPTION_DETAILs__all__sTesterstempfiles DocFileCases DocTestRunners DocFileTestsres is_privatesDocTestFailures DocTestCasesELLIPSISs_tests _comment_lines REPORT_CDIFFs testsourcesDocTestsDONT_ACCEPT_BLANKLINEs _SpoofOutswarningss DocFileSuitesrun_docstring_examplessREPORT_ONLY_FIRST_FAILUREsinspects _TestClasss debug_scriptssyssdebugsscript_from_exampless debug_srcs__test__s_extract_future_flagss_indentsExamplestypess DocTestSuitesregister_optionflagsOPTIONFLAGS_BY_NAMEs DocTestParsersStringIOsset_unittest_reportflagss REPORT_NDIFFs tracebacksdifflibs linecaches DocTestFinders DebugRunnersELLIPSIS_MARKERsREPORTING_FLAGSsCOMPARISON_FLAGSsUnexpectedExceptionsosspdbstestfiles_exception_traceback((s<build/bdist.darwin-8.0.1-x86/egg/setuptools/tests/doctest.pys? s(i. ?$                  1  $5<+n't*vA $? F P  ,<2  PKC8O11EGG-INFO/SOURCES.txtEasyInstall.txt README.txt api_tests.txt easy_install.py ez_setup.py launcher.c pkg_resources.py pkg_resources.txt release.sh setup.cfg setup.py setuptools.txt site.py version version.dat virtual-python.py setuptools/__init__.py setuptools/archive_util.py setuptools/cli.exe setuptools/depends.py setuptools/dist.py setuptools/extension.py setuptools/gui.exe setuptools/package_index.py setuptools/sandbox.py setuptools.egg-info/PKG-INFO setuptools.egg-info/SOURCES.txt setuptools.egg-info/dependency_links.txt setuptools.egg-info/entry_points.txt setuptools.egg-info/not-zip-safe setuptools.egg-info/top_level.txt setuptools/command/__init__.py setuptools/command/alias.py setuptools/command/bdist_egg.py setuptools/command/bdist_rpm.py setuptools/command/bdist_wininst.py setuptools/command/build_ext.py setuptools/command/build_py.py setuptools/command/develop.py setuptools/command/easy_install.py setuptools/command/egg_info.py setuptools/command/install.py setuptools/command/install_egg_info.py setuptools/command/install_lib.py setuptools/command/install_scripts.py setuptools/command/register.py setuptools/command/rotate.py setuptools/command/saveopts.py setuptools/command/sdist.py setuptools/command/setopt.py setuptools/command/test.py setuptools/command/upload.py setuptools/tests/__init__.py setuptools/tests/doctest.py setuptools/tests/test_packageindex.py setuptools/tests/test_resources.py setuptools/tests/win_script_wrapper.txt tests/shlib_test/hello.c tests/shlib_test/hello.pyx tests/shlib_test/hellolib.c tests/shlib_test/setup.py tests/shlib_test/test_hello.py PKC8,_ EGG-INFO/entry_points.txt[distutils.commands] bdist_rpm = setuptools.command.bdist_rpm:bdist_rpm rotate = setuptools.command.rotate:rotate develop = setuptools.command.develop:develop setopt = setuptools.command.setopt:setopt build_py = setuptools.command.build_py:build_py saveopts = setuptools.command.saveopts:saveopts egg_info = setuptools.command.egg_info:egg_info register = setuptools.command.register:register upload = setuptools.command.upload:upload install_egg_info = setuptools.command.install_egg_info:install_egg_info alias = setuptools.command.alias:alias easy_install = setuptools.command.easy_install:easy_install install_scripts = setuptools.command.install_scripts:install_scripts bdist_wininst = setuptools.command.bdist_wininst:bdist_wininst bdist_egg = setuptools.command.bdist_egg:bdist_egg install = setuptools.command.install:install test = setuptools.command.test:test install_lib = setuptools.command.install_lib:install_lib build_ext = setuptools.command.build_ext:build_ext sdist = setuptools.command.sdist:sdist [egg_info.writers] dependency_links.txt = setuptools.command.egg_info:overwrite_arg requires.txt = setuptools.command.egg_info:write_requirements PKG-INFO = setuptools.command.egg_info:write_pkg_info eager_resources.txt = setuptools.command.egg_info:overwrite_arg top_level.txt = setuptools.command.egg_info:write_toplevel_names namespace_packages.txt = setuptools.command.egg_info:overwrite_arg entry_points.txt = setuptools.command.egg_info:write_entries depends.txt = setuptools.command.egg_info:warn_depends_obsolete [console_scripts] easy_install = setuptools.command.easy_install:main easy_install-2.3 = setuptools.command.easy_install:main [setuptools.file_finders] svn_cvs = setuptools.command.sdist:_default_revctrl [distutils.setup_keywords] dependency_links = setuptools.dist:assert_string_list entry_points = setuptools.dist:check_entry_points extras_require = setuptools.dist:check_extras package_data = setuptools.dist:check_package_data install_requires = setuptools.dist:check_requirements include_package_data = setuptools.dist:assert_bool exclude_package_data = setuptools.dist:check_package_data namespace_packages = setuptools.dist:check_nsp test_suite = setuptools.dist:check_test_suite eager_resources = setuptools.dist:assert_string_list zip_safe = setuptools.dist:assert_bool test_loader = setuptools.dist:check_importable tests_require = setuptools.dist:check_requirements [setuptools.installation] eggsecutable = setuptools.command.easy_install:bootstrap PKC82EGG-INFO/dependency_links.txt PKC8d##EGG-INFO/PKG-INFOMetadata-Version: 1.0 Name: setuptools Version: 0.6c7 Summary: Download, build, install, upgrade, and uninstall Python packages -- easily! Home-page: http://pypi.python.org/pypi/setuptools Author: Phillip J. Eby Author-email: distutils-sig@python.org License: PSF or ZPL Description: =============================== Installing and Using Setuptools =============================== .. contents:: **Table of Contents** ------------------------- Installation Instructions ------------------------- Windows ======= Install setuptools using the provided ``.exe`` installer. If you've previously installed older versions of setuptools, please delete all ``setuptools*.egg`` and ``setuptools.pth`` files from your system's ``site-packages`` directory (and any other ``sys.path`` directories) FIRST. If you are upgrading a previous version of setuptools that was installed using an ``.exe`` installer, please be sure to also *uninstall that older version* via your system's "Add/Remove Programs" feature, BEFORE installing the newer version. Once installation is complete, you will find an ``easy_install.exe`` program in your Python ``Scripts`` subdirectory. Be sure to add this directory to your ``PATH`` environment variable, if you haven't already done so. RPM-Based Systems ================= Install setuptools using the provided source RPM. The included ``.spec`` file assumes you are installing using the default ``python`` executable, and is not specific to a particular Python version. The ``easy_install`` executable will be installed to a system ``bin`` directory such as ``/usr/bin``. If you wish to install to a location other than the default Python installation's default ``site-packages`` directory (and ``$prefix/bin`` for scripts), please use the ``.egg``-based installation approach described in the following section. Cygwin, Mac OS X, Linux, Other ============================== 1. Download the appropriate egg for your version of Python (e.g. ``setuptools-0.6c4-py2.4.egg``). Do NOT rename it. 2. Run it as if it were a shell script, e.g. ``sh setuptools-0.6c4-py2.4.egg``. Setuptools will install itself using the matching version of Python (e.g. ``python2.4``), and will place the ``easy_install`` executable in the default location for installing Python scripts (as determined by the standard distutils configuration files, or by the Python installation). If you want to install setuptools to somewhere other than ``site-packages`` or your default distutils installation locations for libraries and scripts, you may include EasyInstall command-line options such as ``--prefix``, ``--install-dir``, and so on, following the ``.egg`` filename on the same command line. For example:: sh setuptools-0.6c4-py2.4.egg --prefix=~ You can use ``--help`` to get a full options list, but we recommend consulting the `EasyInstall manual`_ for detailed instructions, especially `the section on custom installation locations`_. .. _EasyInstall manual: http://peak.telecommunity.com/DevCenter/EasyInstall .. _the section on custom installation locations: http://peak.telecommunity.com/DevCenter/EasyInstall#custom-installation-locations Cygwin Note ----------- If you are trying to install setuptools for the **Windows** version of Python (as opposed to the Cygwin version that lives in ``/usr/bin``), you must make sure that an appropriate executable (``python2.3``, ``python2.4``, or ``python2.5``) is on your **Cygwin** ``PATH`` when invoking the egg. For example, doing the following at a Cygwin bash prompt will install setuptools for the **Windows** Python found at ``C:\\Python24``:: ln -s /cygdrive/c/Python24/python.exe python2.4 PATH=.:$PATH sh setuptools-0.6c4-py2.4.egg rm python2.4 Downloads ========= All setuptools downloads can be found at `the project's home page in the Python Package Index`_. Scroll to the very bottom of the page to find the links. .. _the project's home page in the Python Package Index: http://pypi.python.org/pypi/setuptools In addition to the PyPI downloads, the development version of ``setuptools`` is available from the `Python SVN sandbox`_, and in-development versions of the `0.6 branch`_ are available as well. .. _0.6 branch: http://svn.python.org/projects/sandbox/branches/setuptools-0.6/#egg=setuptools-dev06 .. _Python SVN sandbox: http://svn.python.org/projects/sandbox/trunk/setuptools/#egg=setuptools-dev -------------------------------- Using Setuptools and EasyInstall -------------------------------- Here are some of the available manuals, tutorials, and other resources for learning about Setuptools, Python Eggs, and EasyInstall: * `The EasyInstall user's guide and reference manual`_ * `The setuptools Developer's Guide`_ * `The pkg_resources API reference`_ * `Package Compatibility Notes`_ (user-maintained) * `The Internal Structure of Python Eggs`_ Questions, comments, and bug reports should be directed to the `distutils-sig mailing list`_. If you have written (or know of) any tutorials, documentation, plug-ins, or other resources for setuptools users, please let us know about them there, so this reference list can be updated. .. _Package Compatibility Notes: http://peak.telecommunity.com/DevCenter/PackageNotes .. _The Internal Structure of Python Eggs: http://peak.telecommunity.com/DevCenter/EggFormats .. _The setuptools Developer's Guide: http://peak.telecommunity.com/DevCenter/setuptools .. _The pkg_resources API reference: http://peak.telecommunity.com/DevCenter/PkgResources .. _The EasyInstall user's guide and reference manual: http://peak.telecommunity.com/DevCenter/EasyInstall .. _distutils-sig mailing list: http://mail.python.org/pipermail/distutils-sig/ ------- Credits ------- * The original design for the ``.egg`` format and the ``pkg_resources`` API was co-created by Phillip Eby and Bob Ippolito. Bob also implemented the first version of ``pkg_resources``, and supplied the OS X operating system version compatibility algorithm. * Ian Bicking implemented many early "creature comfort" features of easy_install, including support for downloading via Sourceforge and Subversion repositories. Ian's comments on the Web-SIG about WSGI application deployment also inspired the concept of "entry points" in eggs, and he has given talks at PyCon and elsewhere to inform and educate the community about eggs and setuptools. * Jim Fulton contributed time and effort to build automated tests of various aspects of ``easy_install``, and supplied the doctests for the command-line ``.exe`` wrappers on Windows. * Phillip J. Eby is the principal author and maintainer of setuptools, and first proposed the idea of an importable binary distribution format for Python application plug-ins. * Significant parts of the implementation of setuptools were funded by the Open Source Applications Foundation, to provide a plug-in infrastructure for the Chandler PIM application. In addition, many OSAF staffers (such as Mike "Code Bear" Taylor) contributed their time and stress as guinea pigs for the use of eggs and setuptools, even before eggs were "cool". (Thanks, guys!) Keywords: CPAN PyPI distutils eggs package management Platform: UNKNOWN Classifier: Development Status :: 3 - Alpha Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Python Software Foundation License Classifier: License :: OSI Approved :: Zope Public License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Topic :: System :: Archiving :: Packaging Classifier: Topic :: System :: Systems Administration Classifier: Topic :: Utilities PKC8 ++EGG-INFO/top_level.txteasy_install pkg_resources setuptools site PKf$72EGG-INFO/not-zip-safe PKC80xsite.pycPKC8.k pkg_resources.pyoPKC8.pkg_resources.pycPKC8~=;;oeasy_install.pyoPK45\OE~~Xqeasy_install.pyPKC80rsite.pyoPKd$7~aGaGypkg_resources.pyPK45&: : site.pyPKC8~=;;easy_install.pycPKC8DMsetuptools/archive_util.pyoPKVb$7+7klkl{setuptools/package_index.pyPK$7!qh Tsetuptools/__init__.pyPKC8|G G R_setuptools/depends.pycPKC8|G G setuptools/depends.pyoPKC8VHsetuptools/__init__.pyoPKC8}Â1212Xsetuptools/sandbox.pycPKC8Dsetuptools/archive_util.pycPKd)6:f+setuptools/sandbox.pyPKC8qFosetuptools/package_index.pyoPKC8}Â1212Nsetuptools/sandbox.pyoPKC8n66setuptools/extension.pycPKC8Y?setuptools/dist.pyoPKC8asetuptools/dist.pycPK45M>88!setuptools/depends.pyPKC8qFosetuptools/package_index.pycPK45+E:srsrsetuptools/dist.pyPKC8n66setuptools/extension.pyoPKC8Vsetuptools/__init__.pycPK45QjAA setuptools/extension.pyPKvk6ôv setuptools/cli.exePK45o/ setuptools/archive_util.pyPKvk6{ `F setuptools/gui.exePKC8'a:L:L` setuptools/command/egg_info.pyoPKC8E6%6% setuptools/command/build_py.pycPK45Gh,h,z setuptools/command/build_ext.pyPKC8؈~3~3  setuptools/command/build_ext.pycPK5Trr2 setuptools/command/__init__.pyPKC8?5 setuptools/command/upload.pycPKvk6@QQ setuptools/command/install.pyPKC8_` setuptools/command/setopt.pyoPKC8!N N &z setuptools/command/install_scripts.pycPKC8Inn setuptools/command/upload.pyoPKC8o'V setuptools/command/install_egg_info.pycPKC8e8^ setuptools/command/install.pyoPKC8qksSS 7 setuptools/command/bdist_egg.pyoPKC8xi)) setuptools/command/develop.pyoPKC8RYD  "1 setuptools/command/install_lib.pyoPKC83U5A setuptools/command/register.pyoPKC8setuptools/tests/__init__.pycPKC8,[&Asetuptools/tests/test_packageindex.pyoPKC8 4 { {dsetuptools/tests/doctest.pycPKC8O11EGG-INFO/SOURCES.txtPKC8,_  EGG-INFO/entry_points.txtPKC82 EGG-INFO/dependency_links.txtPKC8d##FEGG-INFO/PKG-INFOPKC8 ++}5EGG-INFO/top_level.txtPKf$725EGG-INFO/not-zip-safePKqq 6