fc@sKdgZddlZddlZddlZddlZddlZddlZddlZddl Zddl Z ddl m Z ddl mZmZmZddlmZddlmZddlmZddlmZdd lmZmZmZdd lmZdd lmZdd l m!Z!dd l"m#Z#ddl$Z$ddl%m&Z&e'de'ddZ(dZ)dZ*dZ+e,e-fZ.dZ/dZ0dZ1dZ2dZ3dZ4dZ5dZ6dZ7dZ8d Z9d!Z:e!ej;j<Z=de&e=fd"YZ<d#fd$YZ>dS(%t DistributioniN(t defaultdict(tDistutilsOptionErrortDistutilsPlatformErrortDistutilsSetupError(t rfc822_escape(t StrictVersion(tsix(t packaging(tmaptfiltert filterfalse(tRequire(twindows_support(t get_unpatched(tparse_configurationi(tDistribution_parse_config_filess&setuptools.extern.packaging.specifierss#setuptools.extern.packaging.versioncCstjdtt|S(NsDo not call this function(twarningstwarntDeprecationWarningR(tcls((s3/usr/lib/python2.7/site-packages/setuptools/dist.pyt_get_unpatched#scCs|js|jrtdS|jdk sR|jdk sRt|dddk r\tdS|js|js|j s|j s|j rtdStdS(Ns2.1tpython_requiress1.2s1.1s1.0( tlong_description_content_typetprovides_extrasRt maintainertNonetmaintainer_emailtgetattrtprovidestrequirest obsoletest classifierst download_url(tdist_md((s3/usr/lib/python2.7/site-packages/setuptools/dist.pytget_metadata_version(s   c Cst|}|jd||jd|j|jd|j|jd|j|jd|j|tdkr|jd|j|jd|jnyd#d$d%d&f}xd|D]\\}}t ||}t j r |j |}n|d"k r|jd||fqqW|jd|j|jrl|jd|jnx(|jjD]}|jd|q|Wt|j}|jd|dj|j} | r|jd| n|tdkr&xA|jD]} |jd| qWn|j|d|j|j|d|j|j|d|j|j|d|j|j|d|jt|dr|jd|jn|jr|jd |jn|jrx%|jD]} |jd!| qWnd"S('s5Write the PKG-INFO format data to a file object. sMetadata-Version: %s s Name: %s s Version: %s s Summary: %s sHome-page: %s s1.2s Author: %s sAuthor-email: %s tAuthortauthors Author-emailt author_emailt MaintainerRsMaintainer-emailRs%s: %s s License: %s sDownload-URL: %s sProject-URL: %s, %s sDescription: %s t,s Keywords: %s s Platform: %s tPlatformt ClassifiertRequirestProvidest ObsoletesRsRequires-Python: %s sDescription-Content-Type: %s sProvides-Extra: %s N(R$R%(s Author-emailR&(R'R(sMaintainer-emailR( R#twritetget_namet get_versiontget_descriptiontget_urlRt get_contacttget_contact_emailRRtPY2t _encode_fieldRt get_licenseR!t project_urlstitemsRtget_long_descriptiontjoint get_keywordst get_platformst _write_listtget_classifierst get_requirest get_providest get_obsoletesthasattrRRR( tselftfiletversiontoptional_fieldstfieldtattrtattr_valt project_urlt long_desctkeywordstplatformtextra((s3/usr/lib/python2.7/site-packages/setuptools/dist.pytwrite_pkg_file7s\       cCs>ttjj|dddd}|j|WdQXdS(s3Write the PKG-INFO file into the release tree. sPKG-INFOtwtencodingsUTF-8N(topentostpathR;RP(RDtbase_dirtpkg_info((s3/usr/lib/python2.7/site-packages/setuptools/dist.pytwrite_pkg_infos cCsTytjjd|}Wn3ttttfk rOtd||fnXdS(Nsx=s4%r must be importable 'module:attrs' string (got %r)(t pkg_resourcest EntryPointtparset TypeErrort ValueErrortAttributeErrortAssertionErrorR(tdistRItvaluetep((s3/usr/lib/python2.7/site-packages/setuptools/dist.pytcheck_importablescCs>yWn3ttttfk r9td||fnXdS(s*Verify that value is a string list or Nones%%r must be a list of strings (got %r)N(R\R]R^R_R(R`RIRa((s3/usr/lib/python2.7/site-packages/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(Rdthas_contents_forRt rpartitiont distutilstlogR(R`RIRat ns_packagestnsptparenttseptchild((s3/usr/lib/python2.7/site-packages/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( tlistt itertoolststarmapt _check_extraR9R\R]R^R(R`RIRa((s3/usr/lib/python2.7/site-packages/setuptools/dist.pyt check_extrass  cCsW|jd\}}}|r@tj|r@td|nttj|dS(Nt:sInvalid environment marker: (t partitionRYtinvalid_markerRRptparse_requirements(ROtreqstnameRmtmarker((s3/usr/lib/python2.7/site-packages/setuptools/dist.pyRsscCs=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})RIRaN(tboolRtformat(R`RIRattmpl((s3/usr/lib/python2.7/site-packages/setuptools/dist.pyt assert_boolscCsy;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}RIterrorN( RpRYRxt isinstancetdicttsetR\R]RR}(R`RIRaRR~((s3/usr/lib/python2.7/site-packages/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}RIRN(Rt specifierst SpecifierSettInvalidSpecifierRR}(R`RIRaRR~((s3/usr/lib/python2.7/site-packages/setuptools/dist.pytcheck_specifiers cCs:ytjj|Wntk r5}t|nXdS(s)Verify that entry_points map is parseableN(RYRZt parse_mapR]R(R`RIRate((s3/usr/lib/python2.7/site-packages/setuptools/dist.pytcheck_entry_pointsscCs%t|tjs!tdndS(Nstest_suite must be a string(RRt string_typesR(R`RIRa((s3/usr/lib/python2.7/site-packages/setuptools/dist.pytcheck_test_suitescCs}t|trixW|jD]B\}}t|ts;Pnyt|Wqtk r]PqXqWdSnt|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(RRR9tstrtiterR\R(R`RIRatktv((s3/usr/lib/python2.7/site-packages/setuptools/dist.pytcheck_package_datas  cCs=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(tretmatchRhRiR(R`RIRatpkgname((s3/usr/lib/python2.7/site-packages/setuptools/dist.pytcheck_packagess   cBsLeZdZd"ZdZd"dZdZdZe dZ dZ dZ d"e dZd Zd Zd Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#dZ$dZ%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. cCs| sd|ksd|kr#dStjt|dj}tjjj|}|dk r|jd rtj t|d|_ ||_ ndS(NRzRFsPKG-INFO( RYt safe_nameRtlowert working_settby_keytgetRt has_metadatat safe_versiont_versiont _patched_dist(RDtattrstkeyR`((s3/usr/lib/python2.7/site-packages/setuptools/dist.pytpatch_missing_pkg_infoVscCsUt|d}|s!i|_n|p*i}d|ksEd|krRtjng|_i|_g|_|jdd|_ |j ||j di|_ |jdg|_ |jdg|_x0tjdD]}t|j|jdqWtj||t|jd|j |j_ |j d |j_t|jd t|j_t|jjtjrt|jj|j_n|jjdk rGyft jj!|jj}t|}|jj|kr t"j#d |jj|f||j_nWqGt jj$t%fk rCt"j#d |jjqGXn|j&dS( Nt package_datatfeaturestrequire_featurestsrc_rootR8tdependency_linkstsetup_requiressdistutils.setup_keywordsRRsNormalizing '%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.('RCRtFeaturetwarn_deprecatedRRt dist_filestpopRRRRR8RRRYtiter_entry_pointstvarst setdefaultRzt _Distributiont__init__RtmetadataRRRRRFtnumberstNumberRRtVersionRRtInvalidVersionR\t_finalize_requires(RDRthave_package_dataRbtvertnormalized_version((s3/usr/lib/python2.7/site-packages/setuptools/dist.pyRcsP          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_requireRuiN( RRRRRtkeystsplitRtaddt_convert_extras_requirementst"_move_install_requirements_markers(RDRO((s3/usr/lib/python2.7/site-packages/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( RRRRpt_tmp_extras_requireR9RYRxt _suffix_fortappend(RDt spec_ext_reqstsectionRtrtsuffix((s3/usr/lib/python2.7/site-packages/setuptools/dist.pyRs cCs|jrdt|jSdS(se For a requirement, return the 'extras_require' suffix for that requirement. Rut(R{R(treq((s3/usr/lib/python2.7/site-packages/setuptools/dist.pyRscsd}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((s3/usr/lib/python2.7/site-packages/setuptools/dist.pyt is_simple_reqstinstall_requiresRuc3sF|]<\}}|gtj|D]}t|^q%fVqdS(N(R t _clean_reqR(t.0RRR(RD(s3/usr/lib/python2.7/site-packages/setuptools/dist.pys sN((RRRpRYRxR R R RRRR{RRR9R(RDRtspec_inst_reqst inst_reqst simple_reqst complex_reqsR((RDs3/usr/lib/python2.7/site-packages/setuptools/dist.pyRs  % cCs d|_|S(sP Given a Requirement, remove environment markers and return it. N(RR{(RDR((s3/usr/lib/python2.7/site-packages/setuptools/dist.pyRs cCs7tj|d|t||jd||jdS(sYParses configuration files from various levels and loads configuration. t filenamestignore_option_errorsN(Rtparse_config_filesRtcommand_optionsR(RDRR((s3/usr/lib/python2.7/site-packages/setuptools/dist.pyRscCs)tj|}|jr%|jn|S(s3Process features after parsing command line options(Rtparse_command_lineRt_finalize_features(RDtresult((s3/usr/lib/python2.7/site-packages/setuptools/dist.pyRs  cCsd|jddS(s;Convert feature name to corresponding option attribute nametwith_t-t_(treplace(RDRz((s3/usr/lib/python2.7/site-packages/setuptools/dist.pyt_feature_attrnamescCsUtjjtj|d|jdt}x$|D]}tjj|dtq1W|S(sResolve pre-setup requirementst installertreplace_conflictingR(RYRtresolveRxtfetch_build_eggtTrueR(RDRtresolved_distsR`((s3/usr/lib/python2.7/site-packages/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_keywordsRtconvert_2to3_doctests(Rtfinalize_optionsRt_set_global_opts_from_featuresRYRRRzRtrequireRtloadRRTRUtabspath(RDRbRatp((s3/usr/lib/python2.7/site-packages/setuptools/dist.pyRs     +cCstjjtjd}tjj|stj|tj|tjj|d}t|d.}|j d|j d|j dWdQXn|S(Ns.eggss README.txtRQscThis 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. ( RTRUR;tcurdirtexiststmkdirR t hide_fileRSR.(RDt egg_cache_dirtreadme_txt_filenametf((s3/usr/lib/python2.7/site-packages/setuptools/dist.pytget_egg_cache_dirs    cCsddlm}|jidgd6}|jd}|j|jd|jdjD|jr|j}d|kr|dd|}nd|f|d0s Ritsetuptargstxt install_dirtexclude_scriptst always_copytbuild_directoryteditabletupgradet multi_versiont no_reporttuserN( tsetuptools.command.easy_installRt __class__tget_option_dicttcleartupdateR9RRRtFalseRtensure_finalized(RDRRR`toptstlinksRtcmd((s3/usr/lib/python2.7/site-packages/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|(RDRRRtexclude((s3/usr/lib/python2.7/site-packages/setuptools/dist.pyR@s  cCs?t|ts%td|fntt|j|dS(Ns.packages: setting must be a list or tuple (%r)(RR;RRpR R9(RDR3((s3/usr/lib/python2.7/site-packages/setuptools/dist.pyt_exclude_packagessc Cs|jj|_|jj|_|d}|jd}xS||kr||\}}||=ddl}|j|t|d*|d}q:Wtj|||}|j |} t | ddrd|f|j|d<|dk rgSn|S(Nitaliasesiitcommand_consumes_argumentss command lineR( RRRR tshlexRRRt_parse_command_optsR(RR( RDtparserRR)RBtsrctaliasRDtnargst cmd_class((s3/usr/lib/python2.7/site-packages/setuptools/dist.pyREs"   c Cs'i}x|jjD] \}}x|jD]\}\}}|dkrSq/n|jdd}|dkr|j|}|jj}|jt|dixZ|jD](\} } | |kr| }d}PqqWt dn|dkrd}n||j |i|R1R@RARERSR:R^(((s3/usr/lib/python2.7/site-packages/setuptools/dist.pyRsFB 7                       ( 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(tmsg((s3/usr/lib/python2.7/site-packages/setuptools/dist.pyRsc Ks |j||_||_||_||_t|ttfrO|f}ng|D]}t|trV|^qV|_g|D]}t|ts|^q} | r| |ds\                H