9acc@sdgZddlZddlZddlZddlZddlZddlZddlZddl Zddl Zddl Zddl m Z ddlmZddlmZddlZddlmZddlmZddlmZmZmZdd l mZdd lmZdd lmZdd lm Z dd lm!Z!ddl"m#Z#m$Z$m%Z%ddl&m'Z'ddl(m)Z)ddl*m+Z+ddl,m-Z-ddl.m/Z/ddl0Z0e1de1ddZ2dZ3dZ4dZ5e6e7fZ8dZ9dZ:dZ;dZ<dZ=d Z>d!Z?d"Z@d#ZAd$ZBd%ZCd&ZDe-ejEjFZGdeGfd'YZFd(fd)YZHd*e'fd+YZIdS(,t DistributioniN(t strtobool(tDEBUG(ttranslate_longopt(t defaultdict(tmessage_from_file(tDistutilsOptionErrortDistutilsPlatformErrortDistutilsSetupError(t rfc822_escape(t StrictVersion(tsix(t packaging(t ordered_set(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((s3/usr/lib/python2.7/dist-packages/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((s3/usr/lib/python2.7/dist-packages/setuptools/dist.pytget_metadata_version2s    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(s3/usr/lib/python2.7/dist-packages/setuptools/dist.pyt _read_fieldLs  cs&j|d}|gkr"dS|S(N(tget_allR(R-tvalues(R/(s3/usr/lib/python2.7/dist-packages/setuptools/dist.pyt _read_listRs smetadata-versionR-tversiontsummarytauthors author-emails home-pagetlicenses download-urlt descriptiontkeywordst,tplatformt classifiers1.1R%R$R&N(RR RR-R4R8R6RR!t author_emailR"turlR7R(tlong_descriptiontsplitR9t platformsR'R%R$R&(R)tfileR0R3((R/s3/usr/lib/python2.7/dist-packages/setuptools/dist.pyt read_pkg_fileHs:        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'tjD]} |d | qWnd!S(&s5Write the PKG-INFO format data to a file object. cs$jd|j|fdS(Ns%s: %s (twritet _encode_field(tkeyR.(RBR)(s3/usr/lib/python2.7/dist-packages/setuptools/dist.pyt write_fieldscsjd||fdS(Ns%s: %s (RD(RFR.(RB(s3/usr/lib/python2.7/dist-packages/setuptools/dist.pyRGssMetadata-VersiontNametVersiontSummarys Home-pages1.2tAuthors Author-emailR6R=t MaintainerR!sMaintainer-emailR"tLicenses Download-URLs Project-URLs%s, %st DescriptionR:tKeywordstPlatformt ClassifiertRequirestProvidest ObsoletesRsRequires-PythonsDescription-Content-TypesProvides-ExtraN(RKR6(s Author-emailR=(RLR!(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 tsorted( R)RBR4RGtoptional_fieldstfieldtattrtattr_valt project_urlt long_descR9R;textra((RBR)s3/usr/lib/python2.7/dist-packages/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(tdistRlR.tep((s3/usr/lib/python2.7/dist-packages/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 isinstancetlistttupleRvR`RwRxRyR(RzRlR.((s3/usr/lib/python2.7/dist-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(Rthas_contents_forRt rpartitiont distutilstlogR(RzRlR.t ns_packagestnsptparenttseptchild((s3/usr/lib/python2.7/dist-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( Rt itertoolststarmapt _check_extraR^RwRxRyR(RzRlR.((s3/usr/lib/python2.7/dist-packages/setuptools/dist.pyt check_extrass  cCsW|jd\}}}|r@tj|r@td|nttj|dS(Nt:sInvalid environment marker: (t partitionRrtinvalid_markerRRtparse_requirements(RptreqsR-Rtmarker((s3/usr/lib/python2.7/dist-packages/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})RlR.N(tboolRtformat(RzRlR.ttmpl((s3/usr/lib/python2.7/dist-packages/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}RlterrorN( RRrRR~tdicttsetRwRxRR(RzRlR.RR((s3/usr/lib/python2.7/dist-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}RlRN(R t specifierst SpecifierSettInvalidSpecifierRR(RzRlR.RR((s3/usr/lib/python2.7/dist-packages/setuptools/dist.pytcheck_specifier s cCs:ytjj|Wntk r5}t|nXdS(s)Verify that entry_points map is parseableN(RrRst parse_mapRxR(RzRlR.te((s3/usr/lib/python2.7/dist-packages/setuptools/dist.pytcheck_entry_points,scCs%t|tjs!tdndS(Nstest_suite must be a string(R~R t string_typesR(RzRlR.((s3/usr/lib/python2.7/dist-packages/setuptools/dist.pytcheck_test_suite4scCst|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(RzRlR.tktv((s3/usr/lib/python2.7/dist-packages/setuptools/dist.pytcheck_package_data9scCs=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(RzRlR.tpkgname((s3/usr/lib/python2.7/dist-packages/setuptools/dist.pytcheck_packagesHs   cBseZdZid+d6ed6ejd6ejd6Zd+ZdZ d+dZ dZ dZ e d Zd Zd Zd+d Ze d Zd+dZd+edZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#dZ$dZ%d Z&d!Z'd"Z(d#Z)d$Z*d%Z+d&Z,d'Z-d(Z.d)Z/d*Z0RS(,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#R t license_filescCs| sd|ksd|kr#dStjt|dj}tjjj|}|dk r|jd rtj t|d|_ ||_ ndS(NR-R4sPKG-INFO( Rrt safe_nameRVtlowert working_settby_keytgetRt has_metadatat safe_versiont_versiont _patched_dist(R)tattrsRFRz((s3/usr/lib/python2.7/dist-packages/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)(s3/usr/lib/python2.7/dist-packages/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.(%RhRtFeaturetwarn_deprecatedRRt dist_filestpopRRRRRRrtiter_entry_pointstvarst setdefaultR-t _Distributiont__init__R^Rtmetadatat__dict__tsetattrR~R4tnumberstNumberRVR RIRRtInvalidVersionRwt_finalize_requires( R)Rthave_package_dataR{toptiontdefaulttsourceR.tvertnormalized_version((R)s3/usr/lib/python2.7/dist-packages/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@R taddt_convert_extras_requirementst"_move_install_requirements_markers(R)Rp((s3/usr/lib/python2.7/dist-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( RRRRt_tmp_extras_requireR^RrRt _suffix_fortappend(R)t spec_ext_reqstsectionRtrtsuffix((s3/usr/lib/python2.7/dist-packages/setuptools/dist.pyRs cCs|jrdt|jSdS(se For a requirement, return the 'extras_require' suffix for that requirement. RR}(RRV(treq((s3/usr/lib/python2.7/dist-packages/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((s3/usr/lib/python2.7/dist-packages/setuptools/dist.pyt is_simple_reqstinstall_requiresRc3sF|]<\}}|gtj|D]}t|^q%fVqdS(N(Rt _clean_reqRV(RRRR(R)(s3/usr/lib/python2.7/dist-packages/setuptools/dist.pys *sN((RRRRrRRRRRVRRRRRR^R(R)Rtspec_inst_reqst inst_reqst simple_reqst complex_reqsR((R)s3/usr/lib/python2.7/dist-packages/setuptools/dist.pyRs  % cCs d|_|S(sP Given a Requirement, remove environment markers and return it. N(RR(R)R((s3/usr/lib/python2.7/dist-packages/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(RRR R(R)R R#((s3/usr/lib/python2.7/dist-packages/setuptools/dist.pytparse_config_filesscCs)tj|}|jr%|jn|S(s3Process features after parsing command line options(Rtparse_command_lineRt_finalize_features(R)tresult((s3/usr/lib/python2.7/dist-packages/setuptools/dist.pyR%s  cCsd|jddS(s;Convert feature name to corresponding option attribute nametwith_RR(R (R)R-((s3/usr/lib/python2.7/dist-packages/setuptools/dist.pyt_feature_attrnamescCsUtjjtj|d|jdt}x$|D]}tjj|dtq1W|S(sResolve pre-setup requirementst installertreplace_conflictingR (RrRtresolveRtfetch_build_eggtTrueR(R)R%tresolved_distsRz((s3/usr/lib/python2.7/dist-packages/setuptools/dist.pytfetch_build_eggss    cCsOd}d}tj|}x*t|d|D]}|j|q1WdS(s Allow plugins to apply arbitrary operations to the distribution. Each hook may optionally define a 'order' to influence the order of execution. Smaller numbers go first and the default is 0. s(setuptools.finalize_distribution_optionscSst|ddS(Ntorderi(R(thook((s3/usr/lib/python2.7/dist-packages/setuptools/dist.pytby_ordersRFN(RrRRitload(R)thook_keyR3tepsR{((s3/usr/lib/python2.7/dist-packages/setuptools/dist.pytfinalize_optionss  cCsnxgtjdD]V}t||jd}|dk r|jd|j|j||j|qqWdS(Nsdistutils.setup_keywordsR*(RrRRR-RtrequireR-R4(R)R{R.((s3/usr/lib/python2.7/dist-packages/setuptools/dist.pyt_finalize_setup_keywordss  cCsMt|ddr@g|jD]}tjj|^q|_n g|_dS(Ntconvert_2to3_doctests(RRR:tostpathtabspath(R)tp((s3/usr/lib/python2.7/dist-packages/setuptools/dist.pyt_finalize_2to3_doctestss+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. ( R;R<R`tcurdirtexiststmkdirRt hide_fileRRD(R)t egg_cache_dirtreadme_txt_filenametf((s3/usr/lib/python2.7/dist-packages/setuptools/dist.pytget_egg_cache_dirs    cCsddlm}|||S(s Fetch an egg needed for buildingi(R-(tsetuptools.installerR-(R)RR-((s3/usr/lib/python2.7/dist-packages/setuptools/dist.pyR-sc Cs|js dSg}|jj}x|jjD]\}}|j|d|j||jr2|j}d}d}|j s||}}nd|dd||fd|dd||ff}|j |d||d|((s3/usr/lib/python2.7/dist-packages/setuptools/dist.pytexclude_packages  . . cCsD|d}x3|jD]%}||ks8|j|rtSqWdS(s<Return true if 'exclude_package(package)' would do somethingRN(titer_distribution_namesRjR.(R)RmRnR>((s3/usr/lib/python2.7/dist-packages/setuptools/dist.pyRs cCst|ts(td||fnyt||}Wn!tk r^td|nX|dk rt|t rt|dn8|rt||g|D]}||kr|^qndS(sAHandle 'exclude()' for list/tuple attrs without a special handlers(%s: setting must be a list or tuple (%r)s %s: No such distribution settings4: this setting cannot be changed via include/excludeN(R~tsequenceRRRyRR(R)R-R.toldtitem((s3/usr/lib/python2.7/dist-packages/setuptools/dist.pyt _exclude_miscs cCst|ts(td||fnyt||}Wn!tk r^td|nX|dkr~t|||n[t|tst|dn9g|D]}||kr|^q}t||||dS(sAHandle 'include()' for list/tuple attrs without a special handlers%s: setting must be a list (%r)s %s: No such distribution settings4: this setting cannot be changed via include/excludeN(R~RqRRRyRR(R)R-R.RrRsRY((s3/usr/lib/python2.7/dist-packages/setuptools/dist.pyRgs  %cKsZxS|jD]E\}}t|d|d}|rB||q |j||q WdS(sRemove 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. t _exclude_N(R^RRRt(R)RRRtexclude((s3/usr/lib/python2.7/dist-packages/setuptools/dist.pyRvs  cCs?t|ts%td|fntt|j|dS(Ns.packages: setting must be a list or tuple (%r)(R~RqRRRRo(R)Ri((s3/usr/lib/python2.7/dist-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 linetargs( t __class__RPR RtshlexR@R.Rt_parse_command_optsR`RR( R)RRzRaRxRRR|tnargst cmd_class((s3/usr/lib/python2.7/dist-packages/setuptools/dist.pyR}s"   c Cs'i}x|jjD] \}}x|jD]\}\}}|dkrSq/n|jdd}|dkr|j|}|jj}|jt|dixZ|jD](\} } | |kr| }d}PqqWt dn|dkrd}n||j |i| /                    ( 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/((s3/usr/lib/python2.7/dist-packages/setuptools/dist.pyRsc Ks |j||_||_||_||_t|ttfrO|f}ng|D]}t|trV|^qV|_g|D]}t|ts|^q} | r| |dsn                  6 L