v]c@sdgZddlZddlZddlZddlZddlZddlZddlZddl Zddl Zddl Zddl m Z ddlmZddlmZddlZddlmZddlmZddlmZmZmZdd l mZdd lmZdd lmZdd lm Z dd l!m"Z"m#Z#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*ddl+m,Z,ddl-m.Z.ddl/Z/e0de0ddZ1dZ2dZ3dZ4e5e6fZ7dZ8dZ9dZ:dZ;dZ<dZ=d Z>d!Z?d"Z@d#ZAd$ZBd%ZCe,ejDjEZFdeFfd&YZEd'fd(YZGd)e&fd*YZHdS(+t DistributioniN(t strtobool(tDEBUG(ttranslate_longopt(t defaultdict(tmessage_from_file(tDistutilsOptionErrortDistutilsPlatformErrortDistutilsSetupError(t rfc822_escape(t StrictVersion(tsix(t packaging(tmaptfiltert filterfalsei(tSetuptoolsDeprecationWarning(tRequire(twindows_support(t get_unpatched(tparse_configurations&setuptools.extern.packaging.specifierss#setuptools.extern.packaging.versioncCstjdtt|S(NsDo not call this function(twarningstwarntDistDeprecationWarningR(tcls((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyt_get_unpatched,scCst|dd}|dkr|js0|jr?td}n|jdk s~|jdk s~t|dddk s~|jrtd}nH|js|j s|j s|j s|j rtd}n td}||_ n|S(Ntmetadata_versions2.1tpython_requiress1.2s1.1s1.0(tgetattrtNonetlong_description_content_typetprovides_extrasR t maintainertmaintainer_emailt project_urlstprovidestrequirest obsoletest classifierst download_urlR(tselftmv((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pytget_metadata_version1s    cst|fd}fd}td|_|d|_|d|_|d|_|d|_d|_|d|_ d|_ |d |_ |d |_ d kr|d |_ n d|_ |d |_|d|_d kr$|d jd|_n|d|_|d|_|jtdkr|d|_|d|_|d|_nd|_d|_d|_dS(s-Reads the metadata values from a file object.cs|}|dkrdS|S(NtUNKNOWN(R(tnametvalue(tmsg(s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyt _read_fieldKs  cs&j|d}|gkr"dS|S(N(tget_allR(R,tvalues(R.(s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyt _read_listQs smetadata-versionR,tversiontsummarytauthors author-emails home-pagetlicenses download-urlt descriptiontkeywordst,tplatformt classifiers1.1R$R#R%N(RR RR,R3R7R5RR t author_emailR!turlR6R'tlong_descriptiontsplitR8t platformsR&R$R#R%(R(tfileR/R2((R.s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyt read_pkg_fileGs:        c sj}tjr*fd}nfd}|dt||dj|dj|dj|dj|tdkr|d j |d j nTd"d#d$d%f}x?|D]7\}}t |}|d!k r|||qqW|dj jrV|djnx(jjD]}|dd|qfWtj} |d| djj} | r|d| n|tdkrx=jD]} |d| qWnjdjjdjjdjjdjjdjtdr|djnjr|djnjrx!jD]} |d | qWnd!S(&s5Write the PKG-INFO format data to a file object. cs$jd|j|fdS(Ns%s: %s (twritet _encode_field(tkeyR-(RAR((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyt write_fieldscsjd||fdS(Ns%s: %s (RC(RER-(RA(s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyRFssMetadata-VersiontNametVersiontSummarys Home-pages1.2tAuthors Author-emailR5R<t MaintainerR sMaintainer-emailR!tLicenses Download-URLs Project-URLs%s, %st DescriptionR9tKeywordstPlatformt ClassifiertRequirestProvidest ObsoletesRsRequires-PythonsDescription-Content-TypesProvides-ExtraN(RJR5(s Author-emailR<(RKR (sMaintainer-emailR!(R*R tPY2tstrtget_namet get_versiontget_descriptiontget_urlR t get_contacttget_contact_emailRRt get_licenseR'R"titemsR tget_long_descriptiontjoint get_keywordst get_platformst _write_listtget_classifierst get_requirest get_providest get_obsoletesthasattrRRR( R(RAR3RFtoptional_fieldstfieldtattrtattr_valt project_urlt long_descR8R:textra((RAR(s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pytwrite_pkg_file}s^         cCsdy*tjjd|}|j s)tWn3ttttfk r_td||fnXdS(Nsx=s4%r must be importable 'module:attrs' string (got %r)( t pkg_resourcest EntryPointtparsetextrastAssertionErrort TypeErrort ValueErrortAttributeErrorR(tdistRjR-tep((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pytcheck_importablescCsty:t|ttfstdj||ks9tWn3ttttfk rotd||fnXdS(s"Verify that value is a string listts%%r must be a list of strings (got %r)N( t isinstancetlistttupleRtR_RuRvRwR(RxRjR-((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pytassert_string_lists cCs|}t|||xw|D]o}|j|sItdd|n|jd\}}}|r||krtjjd||qqWdS(s(Verify that namespace packages are valids1Distribution contains no modules or packages for snamespace package %rt.s^WARNING: %r is declared as a package namespace, but %r is not: please correct this in setup.pyN(Rthas_contents_forRt rpartitiont distutilstlogR(RxRjR-t ns_packagestnsptparenttseptchild((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyt check_nsps  cCsMy ttjt|jWn&tttfk rHtdnXdS(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( R}t itertoolststarmapt _check_extraR]RuRvRwR(RxRjR-((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyt check_extrass  cCsW|jd\}}}|r@tj|r@td|nttj|dS(Nt:sInvalid environment marker: (t partitionRptinvalid_markerRR}tparse_requirements(RntreqsR,Rtmarker((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyRscCs=t||kr9d}t|jd|d|ndS(s)Verify that value is True, False, 0, or 1s0{attr!r} must be a boolean value (got {value!r})RjR-N(tboolRtformat(RxRjR-ttmpl((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyt assert_bool scCsy;ttj|t|ttfr:tdnWn=ttfk rz}d}t|j d|d|nXdS(s9Verify that install_requires is a valid requirements listsUnordered types are not allowedsm{attr!r} must be a string or list of strings containing valid project/version requirement specifiers; {error}RjterrorN( R}RpRR|tdicttsetRuRvRR(RxRjR-RR((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pytcheck_requirementsscCsXytjj|Wn=tjjk rS}d}t|jd|d|nXdS(s.Verify that value is a valid version specifiersF{attr!r} must be a string containing valid version specifiers; {error}RjRN(R t specifierst SpecifierSettInvalidSpecifierRR(RxRjR-RR((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pytcheck_specifiers cCs:ytjj|Wntk r5}t|nXdS(s)Verify that entry_points map is parseableN(RpRqt parse_mapRvR(RxRjR-te((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pytcheck_entry_points+scCs%t|tjs!tdndS(Nstest_suite must be a string(R|R t string_typesR(RxRjR-((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pytcheck_test_suite3scCst|ts'tdj|nx`|jD]R\}}t|tjsmtdj||nt|dj||q4WdS(s@Verify that value is a dictionary of package names to glob listssT{!r} must be a dictionary mapping package names to lists of string wildcard patternss,keys of {!r} dict must be strings (got {!r})svalues of {!r} dictN(R|RRRR]R RR(RxRjR-tktv((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pytcheck_package_data8scCs=x6|D].}tjd|stjjd|qqWdS(Ns \w+(\.\w+)*s[WARNING: %r not a valid package name; please use only .-separated package names in setup.py(tretmatchRRR(RxRjR-tpkgname((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pytcheck_packagesGs   cBseZdZid(d6ed6ed6Zd(ZdZd(dZ dZ dZ e dZ d Zd Zd(d Ze d Zd(d Zd(edZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#dZ$dZ%d Z&d!Z'd"Z(d#Z)d$Z*d%Z+d&Z,d'Z-RS()sDistribution 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' **deprecated** -- 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. RR"RcCs| sd|ksd|kr#dStjt|dj}tjjj|}|dk r|jd rtj t|d|_ ||_ ndS(NR,R3sPKG-INFO( Rpt safe_nameRUtlowert working_settby_keytgetRt has_metadatat safe_versiont_versiont _patched_dist(R(tattrsRERx((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pytpatch_missing_pkg_infosc std}|s!i_n|p*i}d|ksEd|krRtjng_i_g_|jdd_ j ||jdg_ |jdg_ x0t jdD]}tj|jdqWtjfd|jDx|jjD]k\}}xIjj|fD] }||krA||}PqAqAW|rt|nd}tj||q"Wtjjtjrtjjj_njjdk rvyftjjjj}t|} jj| kr;t j!d jj| f| j_nWqvtjj"t#fk rrt j!d jjqvXnj$dS( Nt package_datatfeaturestrequire_featurestsrc_roottdependency_linkstsetup_requiressdistutils.setup_keywordscs.i|]$\}}|jkr||qS((t_DISTUTILS_UNSUPPORTED_METADATA(t.0RR(R((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pys s sNormalizing '%s' to '%s'sThe version specified (%r) is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.(%RgRtFeaturetwarn_deprecatedRRt dist_filestpopRRRRRRptiter_entry_pointstvarst setdefaultR,t _Distributiont__init__R]Rtmetadatat__dict__tsetattrR|R3tnumberstNumberRUR RHRRtInvalidVersionRut_finalize_requires( R(Rthave_package_dataRytoptiontdefaulttsourceR-tvertnormalized_version((R(s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyRsR             cCst|ddr$|j|j_nt|ddrxI|jjD]5}|jdd}|rF|jjj|qFqFWn|j |j dS(s Set `metadata.python_requires` and fix environment markers in `install_requires` and `extras_require`. Rtextras_requireRiN( RRRRRtkeysR?Rtaddt_convert_extras_requirementst"_move_install_requirements_markers(R(Rn((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyRs cCst|ddpi}tt|_xf|jD]X\}}|j|x>tj|D]-}|j|}|j||j |q[Wq4WdS(s Convert requirements in `extras_require` of the form `"extra": ["barbazquux; {marker}"]` to `"extra:{marker}": ["barbazquux"]`. RN( RRRR}t_tmp_extras_requireR]RpRt _suffix_fortappend(R(t spec_ext_reqstsectionRtrtsuffix((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyRs cCs|jrdt|jSdS(se For a requirement, return the 'extras_require' suffix for that requirement. RR{(RRU(treq((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyR scsd}tddpd}ttj|}t||}t||}ttt|_ x/|D]'}j dt|j j |qsWt fdj jD_dS(sv Move requirements in `install_requires` that are using environment markers `extras_require`. cSs|j S(N(R(R((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyt is_simple_reqstinstall_requiresRc3sF|]<\}}|gtj|D]}t|^q%fVqdS(N(R t _clean_reqRU(RRRR(R((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pys (sN((RRR}RpRRRR RURRRRRR]R(R(Rtspec_inst_reqst inst_reqst simple_reqst complex_reqsR((R(s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyRs  % cCs d|_|S(sP Given a Requirement, remove environment markers and return it. N(RR(R(R((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyR,s c Csddlm}tjr[tjtjkr[ddddddd d d d d ddg }ng}t|}|dkr|j }nt r|j dn|}x|D] }t j |ddH}t r|j djtntjr|jn|j|WdQXx|jD]}|j|}|j|} xf|D]^} | dkrK| |krK|j|j|| } | jdd} || f| |  #     cCs4|jd|t||jd||jdS(sYParses configuration files from various levels and loads configuration. R tignore_option_errorsN(RRRR(R(R R ((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pytparse_config_filesscCs)tj|}|jr%|jn|S(s3Process features after parsing command line options(Rtparse_command_lineRt_finalize_features(R(tresult((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyR"s  cCsd|jddS(s;Convert feature name to corresponding option attribute nametwith_RR(R(R(R,((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyt_feature_attrnamescCsUtjjtj|d|jdt}x$|D]}tjj|dtq1W|S(sResolve pre-setup requirementst installertreplace_conflictingR(RpRtresolveRtfetch_build_eggtTrueR(R(R$tresolved_distsRx((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pytfetch_build_eggss    cCstj||jr#|jnxgtjdD]V}t||jd}|dk r3|j d|j |j ||j|q3q3Wt|ddrg|j D]}t jj|^q|_ n g|_ dS(Nsdistutils.setup_keywordsR'tconvert_2to3_doctests(Rtfinalize_optionsRt_set_global_opts_from_featuresRpRRR,RtrequireR*tloadR.tostpathtabspath(R(RyR-tp((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyR/s     +cCstjjtjd}tjj|stj|tj|tjj|d}t|d.}|j d|j d|j dWdQXn|S(Ns.eggss README.txttwscThis directory contains eggs that were downloaded by setuptools to build, test, and run plug-ins. sAThis directory caches those eggs to prevent repeated downloads. s/However, it is safe to delete this directory. ( R3R4R_tcurdirtexiststmkdirRt hide_fileRRC(R(t egg_cache_dirtreadme_txt_filenametf((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pytget_egg_cache_dirs    cCsddlm}|jidgd6}|jd}|j|jd|jdjD|jr|j}d|kr|dd|}nd|f|ds RBitsetuptargstxt install_dirtexclude_scriptst always_copytbuild_directoryteditabletupgradet multi_versiont no_reportRN( tsetuptools.command.easy_installR@t __class__RtcleartupdateR]RR?R+tFalseRtensure_finalized(R(RR@RxtoptstlinksRJtcmd((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyR*s(      c Csg}|jj}x|jjD]\}}|j|d|j||jr%|j}d}d}|j s||}}nd|dd||fd|dd||ff}|j |d||d| /                   ( RcBsYeZdZedZeeedddZdZdZ dZ dZ RS( s **deprecated** -- The `Feature` facility was never completely implemented or supported, `has reported issues `_ and will be removed in a future version. 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'. cCs d}tj|tdddS(NsrFeatures are deprecated and will be removed in a future version. See https://github.com/pypa/setuptools/issues/65.t stackleveli(RRR(R.((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyRsc Ks |j||_||_||_||_t|ttfrO|f}ng|D]}t|trV|^qV|_g|D]}t|ts|^q} | r| |d((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyRls cCsA|j|j|jr=x!|jD]}|j|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(RRsRR(R(RxR((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyRms  cCsFx?|jD]4}|j|s td|j||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(RRRR7(R(RxR((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyR]s ((( RRRRRRVR+RR_RlRmR](((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyRds7    RcBseZdZRS(srClass for warning about deprecations in dist in setuptools. Not ignored by default, unlike DeprecationWarning.(RRR(((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pyRs(It__all__RRRR3RRt distutils.logRtdistutils.coret distutils.cmdtdistutils.disttdistutils.utilRtdistutils.debugRtdistutils.fancy_getoptRRt collectionsRtemailRtdistutils.errorsRRRR tdistutils.versionR tsetuptools.externR R tsetuptools.extern.six.movesR RRR{Rtsetuptools.dependsRt setuptoolsRtsetuptools.monkeyRtsetuptools.configRRpt __import__RR*RBRoR~R}RRzRRRRRRRRRRRtcoreRRRR(((s5/tmp/pip-install-vZZv26/setuptools/setuptools/dist.pytsl                  6 L