U â€C^ÈÂã@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/ddl0Z0e1dƒe1dƒdd„Z2dd„Z3dd„Z4dd„Z5e6e7fZ8dd „Z9d!d"„Z:d#d$„Z;d%d&„Zd+d,„Z?d-d.„Z@d/d0„ZAd1d2„ZBd3d4„ZCd5d6„ZDe-ejEjFƒZGGd7d„deGƒZFGd8d9„d9ƒZHGd:d;„d;e'ƒZIdS)<Ú DistributionéN)Ú strtobool)ÚDEBUG©Útranslate_longopt)Ú defaultdict)Úmessage_from_file)ÚDistutilsOptionErrorÚDistutilsPlatformErrorÚDistutilsSetupError)Ú rfc822_escape)Ú StrictVersion)Úsix)Ú packaging)Ú ordered_set)ÚmapÚfilterÚ filterfalseé)ÚSetuptoolsDeprecationWarning)ÚRequire)Úwindows_support)Ú get_unpatched)Úparse_configurationz&setuptools.extern.packaging.specifiersz#setuptools.extern.packaging.versioncCst dt¡t|ƒS)NzDo not call this function)ÚwarningsÚwarnÚDistDeprecationWarningr)Úcls©rú7/tmp/pip-install-6_kvzl1k/setuptools/setuptools/dist.pyÚ_get_unpatched-s r cCs˜t|ddƒ}|dkr”|js |jr*tdƒ}nd|jdk sT|jdk sTt|ddƒdk sT|jr^tdƒ}n0|js||js||j s||j s||j r†tdƒ}ntdƒ}||_ |S)NÚmetadata_versionz2.1Úpython_requiresú1.2ú1.1z1.0) ÚgetattrÚlong_description_content_typeÚprovides_extrasr Ú maintainerÚmaintainer_emailÚ project_urlsÚprovidesÚrequiresÚ obsoletesÚ classifiersÚ download_urlr!)ÚselfÚmvrrrÚget_metadata_version2s*    ÿþý ÿÿ r2cs t|ƒ‰‡fdd„}‡fdd„}tˆdƒ|_|dƒ|_|dƒ|_|dƒ|_|d ƒ|_d |_|d ƒ|_d |_ |d ƒ|_ |d ƒ|_ dˆkr”|dƒ|_ nd |_ |dƒ|_ |dƒ|_dˆkrÆ|dƒ d¡|_|dƒ|_|dƒ|_|jtdƒk�r |dƒ|_|dƒ|_|dƒ|_nd |_d |_d |_d S)z-Reads the metadata values from a file object.csˆ|}|dkrdS|S)NÚUNKNOWNr)ÚnameÚvalue©ÚmsgrrÚ _read_fieldLsz"read_pkg_file.._read_fieldcsˆ |d¡}|gkrdS|S©N)Úget_all)r4Úvaluesr6rrÚ _read_listRs z!read_pkg_file.._read_listzmetadata-versionr4ÚversionÚsummaryÚauthorNz author-emailz home-pageÚlicensez download-urlÚ descriptionÚkeywordsú,ÚplatformÚ classifierr$r,r+r-)rr r!r4r=rAr?r(Ú author_emailr)Úurlr@r/Úlong_descriptionÚsplitrBÚ platformsr.r,r+r-)r0Úfiler8r<rr6rÚ read_pkg_fileHs:                 rLc sˆ ¡}tjr‡‡fdd„}n ‡fdd„}|dt|ƒƒ|dˆ ¡ƒ|dˆ ¡ƒ|dˆ ¡ƒ|dˆ ¡ƒ|td ƒkrš|d ˆ  ¡ƒ|d ˆ  ¡ƒn.d }|D]$\}}t ˆ|ƒ}|d k r¢|||ƒq¢|dˆ  ¡ƒˆj rè|dˆj ƒˆj ¡D]}|dd|ƒqòtˆ ¡ƒ} |d| ƒd ˆ ¡¡} | �r:|d| ƒ|td ƒk�rdˆ ¡D]} |d| ƒ�qPnˆ ˆdˆ ¡¡ˆ ˆdˆ ¡¡ˆ ˆdˆ ¡¡ˆ ˆdˆ ¡¡ˆ ˆdˆ ¡¡tˆdƒ�rÖ|dˆjƒˆj�rê|dˆjƒˆj�r ˆjD]} |d| ƒ�qød S)z5Write the PKG-INFO format data to a file object. csˆ d|ˆ |¡f¡dS©Nz%s: %s )ÚwriteZ _encode_field©Úkeyr5©rKr0rrÚ write_field„sz#write_pkg_file..write_fieldcsˆ d||f¡dSrM)rNrO)rKrrrR‡szMetadata-VersionÚNameÚVersionZSummaryz Home-pager#ÚAuthorú Author-email))rUr?)rVrF)Z Maintainerr()zMaintainer-emailr)NZLicensez Download-URLz Project-URLz%s, %sÚ DescriptionrCZKeywordsÚPlatformÚ ClassifierÚRequiresÚProvidesÚ Obsoletesr"zRequires-PythonzDescription-Content-TypezProvides-Extra)r2rÚPY2ÚstrÚget_nameÚ get_versionÚget_descriptionÚget_urlr Ú get_contactÚget_contact_emailr%Ú get_licenser/r*Úitemsr Úget_long_descriptionÚjoinÚ get_keywordsÚ get_platformsÚ _write_listÚget_classifiersÚ get_requiresÚ get_providesÚ get_obsoletesÚhasattrr"r&r') r0rKr=rRZoptional_fieldsÚfieldÚattrZattr_valZ project_urlÚ long_descrBrDÚextrarrQrÚwrite_pkg_file~sZ            þ ruc CsPztj d|¡}|jrt‚Wn,ttttfk rJtd||fƒ‚YnXdS)Nzx=z4%r must be importable 'module:attrs' string (got %r)) Ú pkg_resourcesÚ EntryPointÚparseÚextrasÚAssertionErrorÚ TypeErrorÚ ValueErrorÚAttributeErrorr )Údistrrr5ÚeprrrÚcheck_importableÍsÿÿr€c CsZz(t|ttfƒst‚d |¡|ks&t‚Wn,ttttfk rTtd||fƒ‚YnXdS)z"Verify that value is a string listÚz%%r must be a list of strings (got %r)N) Ú isinstanceÚlistÚtuplerzrhr{r|r}r ©r~rrr5rrrÚassert_string_listØs ÿr†cCsd|}t|||ƒ|D]J}| |¡s2tdd|ƒ‚| d¡\}}}|r||krtj d||¡qdS)z(Verify that namespace packages are validz1Distribution contains no modules or packages for znamespace package %rÚ.z^WARNING: %r is declared as a package namespace, but %r is not: please correct this in setup.pyN)r†Úhas_contents_forr Ú rpartitionÚ distutilsÚlogr)r~rrr5Z ns_packagesÚnspÚparentÚsepÚchildrrrÚ check_nspæs   ÿÿ þr�c Cs@ztt t| ¡¡ƒWn"tttfk r:tdƒ‚YnXdS)z+Verify that extras_require mapping is validz‹'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers.N) rƒÚ itertoolsÚstarmapÚ _check_extrarfr{r|r}r r…rrrÚ check_extrasøs ÿr”cCs<| d¡\}}}|r*t |¡r*td|ƒ‚tt |¡ƒdS)Nú:zInvalid environment marker: )Ú partitionrvÚinvalid_markerr rƒÚparse_requirements)rtÚreqsr4rŽÚmarkerrrrr“s r“cCs&t|ƒ|kr"d}t|j||d�ƒ‚dS)z)Verify that value is True, False, 0, or 1z0{attr!r} must be a boolean value (got {value!r}))rrr5N)Úboolr Úformat)r~rrr5ÚtmplrrrÚ assert_bool s ržc Csjz(tt |¡ƒt|ttfƒr&tdƒ‚Wn<ttfk rd}zd}t|j ||d�ƒ‚W5d}~XYnXdS)z9Verify that install_requires is a valid requirements listzUnordered types are not allowedzm{attr!r} must be a string or list of strings containing valid project/version requirement specifiers; {error}©rrÚerrorN) rƒrvr˜r‚ÚdictÚsetr{r|r rœ©r~rrr5r r�rrrÚcheck_requirementss ÿr¤c CsRztj |¡Wn<tjjk rL}zd}t|j||d�ƒ‚W5d}~XYnXdS)z.Verify that value is a valid version specifierzF{attr!r} must be a string containing valid version specifiers; {error}rŸN)rÚ specifiersÚ SpecifierSetÚInvalidSpecifierr rœr£rrrÚcheck_specifier s ÿr¨c Cs@ztj |¡Wn*tk r:}z t|ƒ‚W5d}~XYnXdS)z)Verify that entry_points map is parseableN)rvrwÚ parse_mapr|r )r~rrr5ÚerrrÚcheck_entry_points,sr«cCst|tjƒstdƒ‚dS)Nztest_suite must be a string)r‚rÚ string_typesr r…rrrÚcheck_test_suite4s r­cCs\t|tƒstd |¡ƒ‚| ¡D]6\}}t|tjƒsDtd ||¡ƒ‚t|d |¡|ƒq dS)z@Verify that value is a dictionary of package names to glob listszT{!r} must be a dictionary mapping package names to lists of string wildcard patternsz,keys of {!r} dict must be strings (got {!r})zvalues of {!r} dictN)r‚r¡r rœrfrr¬r†)r~rrr5ÚkÚvrrrÚcheck_package_data9s ÿÿ ÿÿr°cCs(|D]}t d|¡stj d|¡qdS)Nz \w+(\.\w+)*z[WARNING: %r not a valid package name; please use only .-separated package names in setup.py)ÚreÚmatchrŠr‹r)r~rrr5ÚpkgnamerrrÚcheck_packagesHs  þr´c@sfeZdZdZdeejejdœZdZdd„Z dQdd„Z dd „Z d d „Z e d d „ƒZdd„Zdd„ZdRdd„Ze dd„ƒZdSdd„ZdTdd„Zdd„Zdd„Zdd „Zd!d"„Zd#d$„Zd%d&„Zd'd(„Zd)d*„Zd+d,„Zd-d.„Zd/d0„Zd1d2„Z d3d4„Z!d5d6„Z"d7d8„Z#d9d:„Z$d;d<„Z%d=d>„Z&d?d@„Z'dAdB„Z(dCdD„Z)dEdF„Z*dGdH„Z+dIdJ„Z,dKdL„Z-dMdN„Z.dOdP„Z/dS)Ura�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' **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. N)r&r*r'Z license_filescCsl|rd|ksd|krdSt t|dƒ¡ ¡}tjj |¡}|dk rh| d¡sht t|dƒ¡|_ ||_ dS)Nr4r=zPKG-INFO) rvÚ safe_namer^ÚlowerÚ working_setÚby_keyÚgetÚ has_metadataÚ safe_versionÚ_versionÚ _patched_dist)r0ÚattrsrPr~rrrÚpatch_missing_pkg_info¡sz#Distribution.patch_missing_pkg_infoc sÈtˆdƒ}|siˆ_|pi}d|ks,d|kr4t ¡gˆ_iˆ_gˆ_| dd¡ˆ_ˆ  |¡| dg¡ˆ_ | dg¡ˆ_ t   d¡D]}tˆƒ |jd¡q„t ˆ‡fdd „| ¡Dƒ¡ˆj ¡D]L\}}ˆjj|fD]}||krØ||}�qqØ|rþ|ƒnd}tˆj||ƒqÄtˆjjtjƒ�r4tˆjjƒˆj_ˆjjdk �r¼zHtj ˆjj¡}t|ƒ} ˆjj| k�rˆt  d ˆjj| f¡| ˆj_Wn0tjj!t"fk �rºt  d ˆjj¡YnXˆ #¡dS) NÚ package_dataÚfeaturesÚrequire_featuresÚsrc_rootÚdependency_linksÚsetup_requiresúdistutils.setup_keywordscs i|]\}}|ˆjkr||“qSr)Ú_DISTUTILS_UNSUPPORTED_METADATA©Ú.0r®r¯©r0rrÚ ¿s ÿz)Distribution.__init__..zNormalizing '%s' to '%s'z¦The 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.)$rprÀÚFeatureÚwarn_deprecatedrÂrÁÚ dist_filesÚpoprÃr¿rÄrÅrvÚiter_entry_pointsÚvarsÚ setdefaultr4Ú _DistributionÚ__init__rfrÇÚmetadataÚ__dict__Úsetattrr‚r=ÚnumbersÚNumberr^rrTrrÚInvalidVersionr{Ú_finalize_requires) r0r¾Zhave_package_datarÚoptionÚdefaultÚsourcer5ÚverZnormalized_versionrrÊrrÔ®s\  ÿþÿ ýÿ zDistribution.__init__cCsft|ddƒr|j|j_t|ddƒrR|j ¡D]$}| d¡d}|r,|jj |¡q,| ¡|  ¡dS)z€ Set `metadata.python_requires` and fix environment markers in `install_requires` and `extras_require`. r"NÚextras_requirer•r) r%r"rÕràÚkeysrIr'ÚaddÚ_convert_extras_requirementsÚ"_move_install_requirements_markers)r0rtrrrrÛés   zDistribution._finalize_requirescCsht|ddƒpi}ttƒ|_| ¡D]@\}}|j|t |¡D]"}| |¡}|j|| |¡q>q"dS)z¡ Convert requirements in `extras_require` of the form `"extra": ["barbazquux; {marker}"]` to `"extra:{marker}": ["barbazquux"]`. ràN) r%rrƒÚ_tmp_extras_requirerfrvr˜Ú _suffix_forÚappend)r0Z spec_ext_reqsÚsectionr¯ÚrÚsuffixrrrrãýs   z)Distribution._convert_extras_requirementscCs|jrdt|jƒSdS)ze For a requirement, return the 'extras_require' suffix for that requirement. r•r�)ršr^©Úreqrrrræ szDistribution._suffix_forcs�dd„}tˆddƒpd}tt |¡ƒ}t||ƒ}t||ƒ}ttt|ƒƒˆ_|D]}ˆj dt|j ƒ  |¡qNt ‡fdd„ˆj   ¡Dƒƒˆ_dS) zv Move requirements in `install_requires` that are using environment markers `extras_require`. cSs|j Sr9©ršrërrrÚ is_simple_reqszFDistribution._move_install_requirements_markers..is_simple_reqÚinstall_requiresNrr•c3s,|]$\}}|dd„tˆj|ƒDƒfVqdS)cSsg|] }t|ƒ‘qSr)r^©rÉrérrrÚ *szMDistribution._move_install_requirements_markers...N)rÚ _clean_reqrÈrÊrrÚ )sÿzBDistribution._move_install_requirements_markers..)r%rƒrvr˜rrrr^rïråršrçr¡rfrà)r0rîZspec_inst_reqsZ inst_reqsZ simple_reqsZ complex_reqsrérrÊrräs    þz/Distribution._move_install_requirements_markerscCs d|_|S)zP Given a Requirement, remove environment markers and return it. Nrí)r0rìrrrrò.szDistribution._clean_reqc CsÜddlm}tjs>tjtjkr>ddddddd d d d d ddg }ng}t|ƒ}|dkrZ| ¡}t rh|  d¡|ƒ}|D]º}t j |dd��4}t rž|  dj ftƒŽ¡tjrª|jn|j|ƒW5QRX| ¡D]\}| |¡}| |¡} |D]>} | dkrâ| |krâ| | || ¡¡} |  dd¡} || f| | <qâqÆ| ¡qrd|jk�rØ|jd ¡D]Ž\} \} } |j | ¡} zF| �r|t|| t| ƒ ƒn(| dk�r˜t|| t| ƒƒn t|| | ƒWn,tk �rÒ}z t|ƒ‚W5d}~XYnX�qHdS)z£ Adapted from distutils.dist.Distribution.parse_config_files, this method provides the same functionality in subtly-improved ways. r)Ú ConfigParserz install-basezinstall-platbasez install-libzinstall-platlibzinstall-purelibzinstall-headerszinstall-scriptsz install-dataÚprefixz exec-prefixÚhomeÚuserÚrootNz"Distribution.parse_config_files():úutf-8)Úencodingz reading {filename}Ú__name__ú-Ú_Úglobal)ÚverboseÚdry_run)Z(setuptools.extern.six.moves.configparserrôrr]ÚsysrõÚ base_prefixÚ frozensetÚfind_config_filesrÚannounceÚioÚopenrœÚlocalsÚreadfpÚ read_fileÚsectionsÚoptionsÚget_option_dictÚ_try_strr¹ÚreplacerÔÚcommand_optionsrfÚ negative_optr×rr|r )r0Ú filenamesrôÚignore_optionsÚparserÚfilenameÚreaderrèr Úopt_dictÚoptÚvalÚsrcÚaliasr7rrrÚ_parse_config_files5s` ü          z Distribution._parse_config_filescCs.tjs |Sz | ¡WStk r(YnX|S)ab On Python 2, much of distutils relies on string values being of type 'str' (bytes) and not unicode text. If the value can be safely encoded to bytes using the default encoding, prefer that. Why the default encoding? Because that value can be implicitly decoded back to text if needed. Ref #1653 )rr]ÚencodeÚUnicodeEncodeError)rrrrrss  zDistribution._try_strc Cs^| ¡}|dkr| |¡}tr,| d|¡| ¡D�]"\}\}}trZ| d|||f¡zdd„|jDƒ}Wntk r†g}YnXz |j}Wntk rªi}YnXz~t|t j ƒ} ||krÞ| rÞt |||t |ƒ ƒnJ||krü| rüt ||t |ƒƒn,t ||ƒ�rt |||ƒntd|||fƒ‚Wq4tk �rV} z t| ƒ‚W5d} ~ XYq4Xq4dS)aË Set the options for 'command_obj' from 'option_dict'. Basically this means copying elements of a dictionary ('option_dict') to attributes of an instance ('command'). 'command_obj' must be a Command instance. If 'option_dict' is not supplied, uses the standard option dictionary for this command (from 'self.command_options'). (Adopted from distutils.dist.Distribution._set_command_options) Nz# setting options for '%s' command:z %s = %s (from %s)cSsg|] }t|ƒ‘qSrr)rÉÚorrrrñžsÿz5Distribution._set_command_options..z1error in %s: command '%s' has no such option '%s')Úget_command_namer rrrfÚboolean_optionsr}rr‚rr¬r×rrpr r|) r0Ú command_objÚ option_dictÚ command_namerÜrÞr5Ú bool_optsÚneg_optÚ is_stringr7rrrÚ_set_command_options‡sF   ÿÿ        ÿÿz!Distribution._set_command_optionsFcCs(|j|d�t||j|d�| ¡dS)zYParses configuration files from various levels and loads configuration. )r)Úignore_option_errorsN)rrrrÛ)r0rr)rrrÚparse_config_files¶s  ÿzDistribution.parse_config_filescCst |¡}|jr| ¡|S)z3Process features after parsing command line options)rÓÚparse_command_linerÁÚ_finalize_features)r0Úresultrrrr+Ás zDistribution.parse_command_linecCsd| dd¡S)z;Convert feature name to corresponding option attribute nameZwith_rürý©r©r0r4rrrÚ_feature_attrnameÈszDistribution._feature_attrnamecCs8tjjt |¡|jdd�}|D]}tjj|dd�q|S)zResolve pre-setup requirementsT)Ú installerÚreplace_conflictingr.)rvr·Úresolver˜Úfetch_build_eggrâ)r0r,Zresolved_distsr~rrrÚfetch_build_eggsÌsýzDistribution.fetch_build_eggscCs8d}dd„}t |¡}t||d�D]}| ¡|ƒq"dS)zè 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. z(setuptools.finalize_distribution_optionscSs t|ddƒS)NÚorderr)r%)ÚhookrrrÚby_orderàsz/Distribution.finalize_options..by_order)rPN)rvrÐÚsortedÚload)r0Zhook_keyr8ÚepsrrrrÚfinalize_options×s  zDistribution.finalize_optionscCsJt d¡D]:}t||jdƒ}|dk r |j|jd�| ¡||j|ƒq dS)NrÆ©r1)rvrÐr%r4Úrequirer4r:)r0rr5rrrÚ_finalize_setup_keywordsæs z%Distribution._finalize_setup_keywordscCs*t|ddƒr dd„|jDƒ|_ng|_dS)NÚconvert_2to3_doctestscSsg|]}tj |¡‘qSr)ÚosÚpathÚabspath©rÉÚprrrrñðsÿz8Distribution._finalize_2to3_doctests..)r%r@rÊrrrÚ_finalize_2to3_doctestsís  þ z$Distribution._finalize_2to3_doctestsc Csvtj tjd¡}tj |¡srt |¡t |¡tj |d¡}t|dƒ�$}|  d¡|  d¡|  d¡W5QRX|S)Nz.eggsz README.txtÚwzcThis directory contains eggs that were downloaded by setuptools to build, test, and run plug-ins. zAThis directory caches those eggs to prevent repeated downloads. z/However, it is safe to delete this directory. ) rArBrhÚcurdirÚexistsÚmkdirrZ hide_filerrN)r0Z egg_cache_dirZreadme_txt_filenameÚfrrrÚget_egg_cache_dir÷s      zDistribution.get_egg_cache_dircCsddlm}|||ƒS)z Fetch an egg needed for buildingr)r4)Zsetuptools.installerr4)r0rìr4rrrr4s zDistribution.fetch_build_eggc CsÐ|js dSg}|j ¡}|j ¡D]Š\}}| |d¡| |¡|jr"|j}d}d}| ¡sf||}}d|dd||fd|dd||ff}|  |¡d||d|<q"||j |_ |_ ||_|_ dS)z;Add --with-X/--without-X options based on optional featuresNz (default)r�zwith-zinclude zwithout-zexclude ) rÁrÚcopyrfÚ _set_featureÚvalidateÚoptionalrAÚinclude_by_defaultÚextendÚglobal_optionsZfeature_optionsZfeature_negopt) r0ZgoÚnor4ÚfeatureÚdescrZincdefZexcdefÚnewrrrÚ_finalize_feature_opts s(    þ z#Distribution._finalize_feature_optscCs€|j ¡D]<\}}| |¡}|s0|dkr | ¡r | |¡| |d¡q |j ¡D](\}}| |¡sR| |¡| |d¡qRdS)z9Add/remove features and resolve dependencies between themNrr)rÁrfÚfeature_is_includedrQÚ include_inrNÚ exclude_from)r0r4rUZenabledrrrr,)s    zDistribution._finalize_featurescCs\||jkr|j|St d|¡}|D]*}|j|jd�| ¡|j|<}|St ||¡S)z(Pluggable version of get_command_class()údistutils.commandsr=N)ÚcmdclassrvrÐr>r4r:rÓÚget_command_class)r0Úcommandr;rr]rrrr^:s   zDistribution.get_command_classcCs:t d¡D]$}|j|jkr | ¡}||j|j<q t |¡S©Nr\)rvrÐr4r]r3rÓÚprint_commands©r0rr]rrrraGs  zDistribution.print_commandscCs:t d¡D]$}|j|jkr | ¡}||j|j<q t |¡Sr`)rvrÐr4r]r3rÓÚget_command_listrbrrrrcOs  zDistribution.get_command_listcCst|| |¡|ƒdS)zSet feature's inclusion statusN)r×r0)r0r4ÚstatusrrrrNWszDistribution._set_featurecCst|| |¡ƒS)zAReturn 1 if feature is included, 0 if excluded, 'None' if unknown)r%r0r/rrrrY[sz Distribution.feature_is_includedcCsF| |¡dkr&|j|j}t|dƒ‚|j| |¡| |d¡dS)z)Request inclusion of feature named 'name'rz2 is required, but was excluded or is not availablerN)rYrÁrAr rZrN)r0r4rVrrrÚinclude_feature_s ÿzDistribution.include_featurecKs@| ¡D]2\}}t|d|dƒ}|r.||ƒq| ||¡qdS)aôAdd items to distribution that are named in keyword arguments For example, 'dist.include(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. Z _include_N)rfr%Ú _include_misc)r0r¾r®r¯Úincluderrrrgjs  zDistribution.includecsfˆd‰|jr&‡‡fdd„|jDƒ|_|jrD‡‡fdd„|jDƒ|_|jrb‡‡fdd„|jDƒ|_dS)z9Remove packages, modules, and extensions in named packager‡cs"g|]}|ˆkr| ˆ¡s|‘qSr©Ú startswithrD©ÚpackageÚpfxrrrñ…s ÿz0Distribution.exclude_package..cs"g|]}|ˆkr| ˆ¡s|‘qSrrhrDrjrrrñ‹s ÿcs&g|]}|jˆkr|j ˆ¡s|‘qSr)r4rirDrjrrrñ‘s ÿN)ÚpackagesÚ py_modulesÚ ext_modules)r0rkrrjrÚexclude_package€s ÿ ÿ ÿzDistribution.exclude_packagecCs2|d}| ¡D]}||ks&| |¡rdSqdS)z.©r‚Úsequencer r%r}r×)r0r4r5ÚoldrrvrÚ _exclude_miscŸs   ÿÿ ÿzDistribution._exclude_misccsžt|tƒstd||fƒ‚zt||ƒ‰Wn tk rHtd|ƒ‚YnXˆdkr`t|||ƒn:tˆtƒsxt|dƒ‚n"‡fdd„|Dƒ}t||ˆ|ƒdS)zAHandle 'include()' for list/tuple attrs without a special handlerz%s: setting must be a list (%r)rrNrscsg|]}|ˆkr|‘qSrrrt©ryrrrñÆsz.Distribution._include_misc..rw)r0r4r5rWrr{rrf²s$  ÿÿ  ÿzDistribution._include_misccKs@| ¡D]2\}}t|d|dƒ}|r.||ƒq| ||¡qdS)aRemove 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. Z _exclude_N)rfr%rz)r0r¾r®r¯Úexcluderrrr|És  zDistribution.excludecCs,t|tƒstd|fƒ‚tt|j|ƒƒdS)Nz.packages: setting must be a list or tuple (%r))r‚rxr rƒrrp)r0rmrrrÚ_exclude_packagesàs  ÿzDistribution._exclude_packagesc Cs¬|jj|_|jj|_|d}| d¡}||krf||\}}||=ddl}| |d¡|dd…<|d}q&t |||¡}| |¡} t | ddƒr¨d|f| |¡d<|dk r¨gS|S)NrÚaliasesTrZcommand_consumes_argumentsú command lineÚargs) Ú __class__rSrr ÚshlexrIrÓÚ_parse_command_optsr^r%) r0rr€r_r~rrr‚ÚnargsÚ cmd_classrrrrƒçs"       z Distribution._parse_command_optsc CsÂi}|j ¡D]®\}}| ¡D]œ\}\}}|dkr4q| dd¡}|dkrž| |¡}|j ¡}| t|diƒ¡| ¡D]\} } | |krv| }d}qªqvtdƒ‚n |dkrªd}||  |i¡|<qq|S) ahReturn 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. rrýrürrNzShouldn't be able to get herer) rrfrÚget_command_objrrMÚupdater%rzrÒ) r0ÚdÚcmdÚoptsrrrZcmdobjr&ÚnegÚposrrrÚget_cmdline_optionss(     z Distribution.get_cmdline_optionsccsv|jpdD] }|Vq |jpdD] }|Vq |jp4dD]:}t|tƒrN|\}}n|j}| d¡rj|dd…}|Vq6dS)z@Yield all packages, modules, and extension names in distributionrÚmoduleNiúÿÿÿ)rmrnror‚r„r4Úendswith)r0ÚpkgrŽÚextr4Z buildinforrrrq)s    z$Distribution.iter_distribution_namesc CsÌddl}tjs|jr t ||¡St|jtj ƒs:t ||¡S|jj   ¡dkrVt ||¡S|jj }|jj }|j dkrtdpvd}|jj}t  |j ¡d|||¡|_zt ||¡W¢St  |j ¡||||¡|_XdS)zÚIf there were any non-global "display-only" options (--help-commands or the metadata display options) on the command line, display the requested info and return true; else return false. rN)rùÚutf8Úwin32Ú rù)rrr]Ú help_commandsrÓÚhandle_display_optionsr‚ÚstdoutrÚ TextIOWrapperrúr¶ÚerrorsrDÚline_bufferingÚdetach)r0Ú option_orderrrúr™Únewlineršrrrr–;s6    ÿÿz#Distribution.handle_display_options)N)N)N)NF)0rûÚ __module__Ú __qualname__Ú__doc__r¡rZ OrderedSetrÇr½r¿rÔrÛrãÚ staticmethodræräròrrr(r*r+r0r5r<r?rFrLr4rXr,r^rarcrNrYrergrprˆrzrfr|r}rƒr�rqr–rrrrrTs^Dü ;  >  /      (c@sFeZdZdZedd„ƒZddd„Zd d „Zd d „Zd d„Z dd„Z dS)rÌaó **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'. cCsd}tj|tdd�dS)NzrFeatures are deprecated and will be removed in a future version. See https://github.com/pypa/setuptools/issues/65.é)Ú stacklevel)rrrr6rrrrÍ—sÿzFeature.warn_deprecatedFTrc Ks’| ¡||_||_||_||_t|ttfƒr4|f}dd„|Dƒ|_dd„|Dƒ}|r^||d<t|tƒrn|f}||_ ||_ |sŽ|sŽ|sŽt dƒ‚dS)NcSsg|]}t|tƒr|‘qSr©r‚r^rðrrrrñ«s z$Feature.__init__..cSsg|]}t|tƒs|‘qSrr¤rðrrrrñ®s rÂzgFeature %s: must define 'require_features', 'remove', or at least one of 'packages', 'py_modules', etc.) rÍrAÚstandardÚ availablerPr‚r^rrÂÚremoveryr ) r0rAr¥r¦rPrÂr§ryZerrrrrÔŸs*ÿ  ÿzFeature.__init__cCs |jo |jS)z+Should this feature be included by default?)r¦r¥rÊrrrrQ½szFeature.include_by_defaultcCs<|jst|jdƒ‚|jf|jŽ|jD]}| |¡q(dS)aEnsure 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. z3 is required, but is not available on this platformN)r¦r rArgryrÂre)r0r~rKrrrrZÁs ÿ zFeature.include_incCs.|jf|jŽ|jr*|jD]}| |¡qdS)a2Ensure 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)r|ryr§rp©r0r~rurrrr[Õs  zFeature.exclude_fromcCs.|jD]"}| |¡std|j||fƒ‚qdS)aç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. zg%s wants to be able to remove %s, but the distribution doesn't contain any packages or modules under %sN)r§rˆr rAr¨rrrrOäs   þÿzFeature.validateN)FTTrr) rûržrŸr r¡rÍrÔrQrZr[rOrrrrrÌ^s8 þ rÌc@seZdZdZdS)rzrClass for warning about deprecations in dist in setuptools. Not ignored by default, unlike DeprecationWarning.N)rûržrŸr rrrrrøsr)JÚ__all__rrr±rArrØZ distutils.logrŠÚdistutils.coreÚ distutils.cmdÚdistutils.distÚdistutils.utilrÚdistutils.debugrÚdistutils.fancy_getoptrr‘Ú collectionsrÚemailrÚdistutils.errorsr r r r Zdistutils.versionr Zsetuptools.externrrrZsetuptools.extern.six.movesrrrr�rZsetuptools.dependsrÚ setuptoolsrZsetuptools.monkeyrZsetuptools.configrrvÚ __import__r r2rLrur„rƒrxr€r†r�r”r“ržr¤r¨r«r­r°r´ÚcorerrÓrÌrrrrrÚsv               6L