U Qab@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/ddl0Z0e1de1dddZ2ddZ3ddZ4ddZ5e6e7fZ8dd Z9d!d"Z:d#d$Z;d%d&Zd+d,Z?d-d.Z@d/d0ZAd1d2ZBd3d4ZCd5d6ZDe-ejEjFZGGd7ddeGZFGd8d9d9ZHGd:d;d;e'ZIdS)< DistributionN) strtobool)DEBUGtranslate_longopt) defaultdict)message_from_file)DistutilsOptionErrorDistutilsPlatformErrorDistutilsSetupError) rfc822_escape) StrictVersion)six) packaging) ordered_set)mapfilter filterfalse)SetuptoolsDeprecationWarning)Require)windows_support) get_unpatched)parse_configurationz&setuptools.extern.packaging.specifiersz#setuptools.extern.packaging.versioncCstdtt|S)NzDo not call this function)warningswarnDistDeprecationWarningr)clsr3/usr/lib/python3.8/site-packages/setuptools/dist.py_get_unpatched-s r cCst|dd}|dkr|js |jr*td}nd|jdk sT|jdk sTt|dddk sT|jr^td}n0|js||js||j s||j s||j rtd}ntd}||_ |S)Nmetadata_versionz2.1python_requires1.21.1z1.0) getattrlong_description_content_typeprovides_extrasr maintainermaintainer_email project_urlsprovidesrequires obsoletes classifiers download_urlr!)selfZmvrrrget_metadata_version2s*      r1cs t|fdd}fdd}td|_|d|_|d|_|d|_|d |_d |_|d |_d |_ |d |_ |d |_ dkr|d|_ nd |_ |d|_ |d|_dkr|dd|_|d|_|d|_|jtdkr |d|_|d|_|d|_nd |_d |_d |_d S)z-Reads the metadata values from a file object.cs|}|dkrdS|S)NZUNKNOWNr)namevaluemsgrr _read_fieldLsz"read_pkg_file.._read_fieldcs|d}|gkrdS|SN)Zget_all)r2valuesr4rr _read_listRs z!read_pkg_file.._read_listzmetadata-versionr2versionZsummaryauthorNz author-emailz home-pagelicensez download-url descriptionkeywords,platformZ classifierr$r,r+r-)rr r!r2r:r=r;r( author_emailr)Zurlr<r/Zlong_descriptionsplitr>Z platformsr.r,r+r-)r0filer6r9rr4r read_pkg_fileHs:                 rDc s}tjrfdd}n fdd}|dt||d|d|d|d|td kr|d  |d  n.d }|D]$\}}t |}|d k r|||q|d j r|dj jD]}|dd|qt} |d| d} | r:|d| |td krdD]} |d| qPndddddtdr|djjr|djjr jD]} |d| qd S)z5Write the PKG-INFO format data to a file object. csd||fdSNz%s: %s )writeZ _encode_fieldkeyr3rCr0rr write_fieldsz#write_pkg_file..write_fieldcsd||fdSrE)rFrG)rCrrrJszMetadata-VersionNameVersionZSummaryz Home-pager#Author Author-email))rMr;)rNrA)Z Maintainerr()zMaintainer-emailr)NZLicensez Download-URLz Project-URLz%s, %sZ Descriptionr?ZKeywordsZPlatformZ ClassifierZRequiresZProvidesZ Obsoletesr"zRequires-PythonzDescription-Content-TypezProvides-Extra)r1rPY2strZget_nameZ get_versionZget_descriptionZget_urlr Z get_contactZget_contact_emailr%Z get_licenser/r*itemsr Zget_long_descriptionjoinZ get_keywordsZ get_platformsZ _write_listZget_classifiersZ get_requiresZ get_providesZ get_obsoleteshasattrr"r&r') r0rCr:rJZoptional_fieldsZfieldattrZattr_valZ project_urlZ long_descr>r@extrarrIrwrite_pkg_file~sZ             rVc CsFztjd|}Wn,ttttfk r@td||fYnXdS)Nzx=z4%r must be importable 'module:attrs' string (got %r)) pkg_resources EntryPointparse TypeError ValueErrorAttributeErrorAssertionErrorr )distrTr3eprrrcheck_importablesr`c Cs6zWn,ttttfk r0td||fYnXdS)z"Verify that value is a string listz%%r must be a list of strings (got %r)N)rZr[r\r]r r^rTr3rrrassert_string_lists  rbcCsd|}t||||D]J}||s2tdd||d\}}}|r||krtjd||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)rbhas_contents_forr rpartition distutilslogr)r^rTr3Z ns_packagesZnspparentsepZchildrrr check_nsps    rjc Cs@zttt|Wn"tttfk r:tdYnXdS)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) list itertoolsstarmap _check_extrarQrZr[r\r rarrr check_extrass rocCs<|d\}}}|r*t|r*td|tt|dS)N:zInvalid environment marker: ) partitionrWZinvalid_markerr rkparse_requirements)rUZreqsr2rimarkerrrrrns rncCs&t||kr"d}t|j||ddS)z)Verify that value is True, False, 0, or 1z0{attr!r} must be a boolean value (got {value!r}))rTr3N)boolr format)r^rTr3tmplrrr assert_bool s rwc Csjz(tt|t|ttfr&tdWn<ttfk rd}zd}t|j ||dW5d}~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}rTerrorN) rkrWrr isinstancedictsetrZr[r rur^rTr3ryrvrrrcheck_requirementss r~c CsRztj|Wn<tjjk rL}zd}t|j||dW5d}~XYnXdS)z.Verify that value is a valid version specifierzF{attr!r} must be a string containing valid version specifiers; {error}rxN)rZ specifiersZ SpecifierSetZInvalidSpecifierr rur}rrrcheck_specifier s rc Cs@ztj|Wn*tk r:}z t|W5d}~XYnXdS)z)Verify that entry_points map is parseableN)rWrXZ parse_mapr[r )r^rTr3errrcheck_entry_points,srcCst|tjstddS)Nztest_suite must be a string)rzr string_typesr rarrrcheck_test_suite4s rcCs\t|tstd||D]6\}}t|tjsDtd||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)rzr{r rurQrrrb)r^rTr3kvrrrcheck_package_data9s  rcCs(|D]}td|stjd|qdS)Nz \w+(\.\w+)*z[WARNING: %r not a valid package name; please use only .-separated package names in setup.py)rematchrfrgr)r^rTr3Zpkgnamerrrcheck_packagesHs  rc@sReZdZdZdeejdZdZddZ dMddZ dd Z d d Z e d d ZddZddZdNddZe ddZdOddZdPddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Z d3d4Z!d5d6Z"d7d8Z#d9d:Z$d;d<Z%d=d>Z&d?d@Z'dAdBZ(dCdDZ)dEdFZ*dGdHZ+dIdJZ,dKdLZ-dS)QraDistribution 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'cCsl|rd|ksd|krdStt|d}tjj|}|dk rh|dshtt|d|_ ||_ dS)Nr2r:zPKG-INFO) rWZ safe_namerPlower working_setZby_keygetZ has_metadataZ safe_versionZ_version _patched_dist)r0attrsrHr^rrrpatch_missing_pkg_infosz#Distribution.patch_missing_pkg_infoc std}|si_|pi}d|ks,d|kr4tg_i_g_|dd_ ||dg_ |dg_ t dD]}t|jdqtfdd |DjD]L\}}jj|fD]}||kr||}qq|r|nd}tj||qtjjtjr4tjjj_jjdk rzHtjjj}t|} jj| krt d jj| f| j_Wn0tjj!t"fk rt d jjYnX#dS) N package_datafeaturesrequire_featuressrc_rootdependency_linkssetup_requiresdistutils.setup_keywordscs i|]\}}|jkr||qSr)_DISTUTILS_UNSUPPORTED_METADATA.0rrr0rr s z)Distribution.__init__..zNormalizing '%s' to '%s'zThe 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.)$rSrFeaturewarn_deprecatedrrZ dist_filespoprrrrrWiter_entry_pointsvars setdefaultr2 _Distribution__init__rQrmetadata__dict__setattrrzr:numbersNumberrPrrLrrZInvalidVersionrZ_finalize_requires) r0rZhave_package_datar_optiondefaultsourcer3ZverZnormalized_versionrrrrs\    zDistribution.__init__cCsft|ddr|j|j_t|ddrR|jD]$}|dd}|r,|jj|q,|| dS)z Set `metadata.python_requires` and fix environment markers in `install_requires` and `extras_require`. r"Nextras_requirerpr) r%r"rrkeysrBr'add_convert_extras_requirements"_move_install_requirements_markers)r0rUrrrrs   zDistribution._finalize_requirescCsht|ddpi}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"]`. rN) r%rrk_tmp_extras_requirerQrWrr _suffix_forappend)r0Z spec_ext_reqssectionrrsuffixrrrrs   z)Distribution._convert_extras_requirementscCs|jrdt|jSdS)ze For a requirement, return the 'extras_require' suffix for that requirement. rp)rsrPreqrrrr szDistribution._suffix_forcsdd}tddpd}tt|}t||}t||}ttt|_|D]}j dt|j  |qNt fddj D_dS) zv Move requirements in `install_requires` that are using environment markers `extras_require`. cSs|j Sr7rsrrrr is_simple_reqszFDistribution._move_install_requirements_markers..is_simple_reqinstall_requiresNrrpc3s,|]$\}}|ddtj|DfVqdS)cSsg|] }t|qSr)rPrrrrr )szMDistribution._move_install_requirements_markers...N)r _clean_reqrrrr (szBDistribution._move_install_requirements_markers..)r%rkrWrrrrrrPrrrsrr{rQr)r0rZspec_inst_reqsZ inst_reqsZ simple_reqsZ complex_reqsrrrrrs    z/Distribution._move_install_requirements_markerscCs d|_|S)zP Given a Requirement, remove environment markers and return it. Nr)r0rrrrr-szDistribution._clean_reqc Csddlm}tjr>tjtjkr>ddddddd d d d d ddg }ng}t|}|dkrZ|}t rh| d|}|D]}t j |dd4}t r| dj fttjr|jn|j|W5QRX|D]\}||}||} |D]>} | dkr| |kr|||| } | dd} || f| | <qq|qrd|jkr|jdD]\} \} } |j| } zF| r|t|| t|  n(| dkrt|| t| n t|| | Wn,tk r}z t|W5d}~XYnXqHdS)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-dataprefixz exec-prefixhomeuserrootNz"Distribution.parse_config_files():utf-8)encodingz reading {filename}__name__-_global)verboseZdry_run)Z(setuptools.extern.six.moves.configparserrrPY3sysr base_prefix frozensetZfind_config_filesrannounceioopenrulocalsZ read_fileZreadfpZsectionsoptionsget_option_dict_try_strrreplacercommand_optionsrQ negative_optrrr[r )r0 filenamesrZignore_optionsparserfilenamereaderrrZopt_dictoptvalsrcaliasr5rrr_parse_config_files4s`           z Distribution._parse_config_filescCs.tjr |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 )rrencodeUnicodeEncodeError)rrrrrrs  zDistribution._try_strc Cs^|}|dkr||}tr,|d||D]"\}\}}trZ|d|||fzdd|jD}Wntk rg}YnXz |j}Wntk ri}YnXz~t|t j } ||kr| rt |||t | nJ||kr| rt ||t |n,t ||rt |||ntd|||fWq4tk 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)rorrrrsz5Distribution._set_command_options..z1error in %s: command '%s' has no such option '%s')Zget_command_namerrrrQZboolean_optionsr\rrzrrrrrSr r[) r0Z command_objZ option_dictZ command_namerrr3Z bool_optsneg_optZ is_stringr5rrr_set_command_optionssF           z!Distribution._set_command_optionsFcCs(|j|dt||j|d|dS)zYParses configuration files from various levels and loads configuration. )r)ignore_option_errorsN)rrrr)r0rrrrrparse_config_filess  zDistribution.parse_config_filescCst|}|jr||S)z3Process features after parsing command line options)rparse_command_liner_finalize_features)r0resultrrrrs zDistribution.parse_command_linecCsd|ddS)z;Convert feature name to corresponding option attribute nameZwith_rrrr0r2rrr_feature_attrnameszDistribution._feature_attrnamecCs8tjjt||jdd}|D]}tjj|ddq|S)zResolve pre-setup requirementsT) installerZreplace_conflictingr)rWrresolverrfetch_build_eggr)r0r,Zresolved_distsr^rrrfetch_build_eggsszDistribution.fetch_build_eggscCst||jr|tdD]:}t||jd}|dk r"|j|j d| ||j|q"t|ddr~dd|j D|_ ng|_ dS)Nrrconvert_2to3_doctestscSsg|]}tj|qSr)ospathabspathrprrrrsz1Distribution.finalize_options..) rfinalize_optionsr_set_global_opts_from_featuresrWrr%r2requirerloadr)r0r_r3rrrrs   zDistribution.finalize_optionsc Csvtjtjd}tj|srt|t|tj|d}t|d$}| d| d| dW5QRX|S)Nz.eggsz README.txtwzcThis 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. ) rrrRcurdirexistsmkdirrZ hide_filerrF)r0Z egg_cache_dirZreadme_txt_filenamefrrrget_egg_cache_dirs      zDistribution.get_egg_cache_dirc Csddlm}|ddgi}|d}||dd|dD|jr|jdd}d|krx|dd |}d |f|d<|}||d g|d d dd d d d d d }| ||S)z Fetch an egg needed for buildingr) easy_installZ script_argsrcss"|]\}}|dkr||fVqdS)) find_links site_dirsZ index_urloptimizer Z allow_hostsNrrrrrrsz/Distribution.fetch_build_egg..NrrZsetupxTF) args install_dirZexclude_scriptsZ always_copyZbuild_directoryZeditableZupgradeZ multi_versionZ no_reportr) Zsetuptools.command.easy_installr __class__rclearupdaterQrrZensure_finalized)r0rrr^optsZlinksr cmdrrrrs8     zDistribution.fetch_build_eggc Csg}|j}|jD]\}}||d|||jr|j}d}d}|s\||}}d|dd||fd|dd||ff}| |d||d|<q||j |_ |_ ||_|_ dS)z;Add --with-X/--without-X options based on optional featuresNz (default)rzwith-zinclude zwithout-zexclude ) rcopyrrQ _set_featurevalidateoptionalr=include_by_defaultextendglobal_optionsZfeature_optionsZfeature_negopt) r0ZgoZnor2featuredescrZincdefZexcdefnewrrrrs$     z+Distribution._set_global_opts_from_featurescCs|jD]<\}}||}|s0|dkr |r ||||dq |jD](\}}||sR||||dqRdS)z9Add/remove features and resolve dependencies between themNrr)rrQfeature_is_includedr include_inr exclude_from)r0r2rZenabledrrrr0s    zDistribution._finalize_featurescCs\||jkr|j|Std|}|D]*}|j|jd||j|<}|St||S)z(Pluggable version of get_command_class()distutils.commandsrN)cmdclassrWrrrrrget_command_class)r0commandZepsr_r!rrrr"As   zDistribution.get_command_classcCs:tdD]$}|j|jkr |}||j|j<q t|SNr )rWrr2r!rrprint_commandsr0r_r!rrrr%Ns  zDistribution.print_commandscCs:tdD]$}|j|jkr |}||j|j<q t|Sr$)rWrr2r!rrget_command_listr&rrrr'Vs  zDistribution.get_command_listcCst||||dS)zSet feature's inclusion statusN)rr)r0r2Zstatusrrrr^szDistribution._set_featurecCst|||S)zAReturn 1 if feature is included, 0 if excluded, 'None' if unknown)r%rrrrrrbsz Distribution.feature_is_includedcCsF||dkr&|j|j}t|d|j||||ddS)z)Request inclusion of feature named 'name'rz2 is required, but was excluded or is not availablerN)rrr=r rr)r0r2rrrrinclude_featurefs zDistribution.include_featurecKs@|D]2\}}t|d|d}|r.||q|||qdS)aAdd 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)rQr% _include_misc)r0rrrincluderrrr*qs  zDistribution.includecsfd|jr&fdd|jD|_|jrDfdd|jD|_|jrbfdd|jD|_dS)z9Remove packages, modules, and extensions in named packagerccs"g|]}|kr|s|qSr startswithrpackagepfxrrrs z0Distribution.exclude_package..cs"g|]}|kr|s|qSrr+rr-rrrs cs&g|]}|jkr|js|qSr)r2r,rr-rrrs N)packages py_modules ext_modules)r0r.rr-rexclude_packages   zDistribution.exclude_packagecCs2|d}|D]}||ks&||rdSqdS)z.rzsequencer r%r\r)r0r2r3oldrr9r _exclude_miscs    zDistribution._exclude_misccst|tstd||fzt||Wn tk rHtd|YnXdkr`t|||n:ttsxt|dn"fdd|D}t|||dS)zAHandle 'include()' for list/tuple attrs without a special handlerz%s: setting must be a list (%r)r5Nr6csg|]}|kr|qSrrr7r<rrrsz.Distribution._include_misc..r:)r0r2r3rrr>rr)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)rQr%r=)r0rrrexcluderrrr?s  zDistribution.excludecCs,t|tstd|ftt|j|dS)Nz.packages: setting must be a list or tuple (%r))rzr;r rkrr3)r0r0rrr_exclude_packagess  zDistribution._exclude_packagesc Cs|jj|_|jj|_|d}|d}||krf||\}}||=ddl}||d|dd<|d}q&t|||}||} t | ddrd|f||d<|dk rgS|S)NraliasesTrZcommand_consumes_arguments command liner ) rrrrshlexrBr_parse_command_optsr"r%) r0rr r#rArrrCnargsZ cmd_classrrrrDs"       z Distribution._parse_command_optsc Csi}|jD]\}}|D]\}\}}|dkr4q|dd}|dkr||}|j}|t|di|D]\} } | |krv| }d}qqvtdn |dkrd}|| |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. rBrrrrNzShouldn't be able to get herer) rrQrZget_command_objrrrr%r]r) r0drrrrrZcmdobjrnegposrrrget_cmdline_optionss(     z Distribution.get_cmdline_optionsccsv|jpdD] }|Vq |jpdD] }|Vq |jp4dD]:}t|trN|\}}n|j}|drj|dd}|Vq6dS)z@Yield all packages, modules, and extension names in distributionrmoduleNi)r0r1r2rztupler2endswith)r0ZpkgrJZextr2Z buildinforrrr40s    z$Distribution.iter_distribution_namesc Csddl}tjs|jr t||St|jtj s:t||S|jj dkrVt||S|jj }|jj }|j dkrtdpvd}|jj}t |jd||||_zt||WSt |j|||||_XdS)zIf 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)rutf8Zwin32 r)rrrOZ help_commandsrhandle_display_optionsrzstdoutr TextIOWrapperrrerrorsr@line_bufferingdetach)r0Z option_orderrrrRnewlinerSrrrrOBs6    z#Distribution.handle_display_options)N)N)N)NF).r __module__ __qualname____doc__r{rZ OrderedSetrrrrrr staticmethodrrrrrrrrrrrrrrrr"r%r'rrr(r*r3rdr=r)r?r@rDrIr4rOrrrrrTsXD ;  >  /     (c@sFeZdZdZeddZdddZd d Zd d Zd dZ ddZ dS)ra **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|tdddS)NzrFeatures are deprecated and will be removed in a future version. See https://github.com/pypa/setuptools/issues/65.) stacklevel)rrrr4rrrrszFeature.warn_deprecatedFTrc Ks|||_||_||_||_t|ttfr4|f}dd|D|_dd|D}|r^||d<t|trn|f}||_ ||_ |s|s|st ddS)NcSsg|]}t|tr|qSrrzrPrrrrrs z$Feature.__init__..cSsg|]}t|ts|qSrr\rrrrrs rzgFeature %s: must define 'require_features', 'remove', or at least one of 'packages', 'py_modules', etc.) rr=standard availablerrzrPrrremoveextrasr ) r0r=r]r^rrr_r`Zerrrrrs*  zFeature.__init__cCs |jo |jS)z+Should this feature be included by default?)r^r]rrrrrszFeature.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 r=r*r`rr()r0r^rrrrrs  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?r`r_r3r0r^r8rrrrs  zFeature.exclude_fromcCs.|jD]"}||std|j||fqdS)aVerify 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_rdr r=rarrrrs   zFeature.validateN)FTTrr) rrVrWrXrYrrrrrrrrrrres8  rc@seZdZdZdS)rzrClass for warning about deprecations in dist in setuptools. Not ignored by default, unlike DeprecationWarning.N)rrVrWrXrrrrrsr)J__all__rrrrrrZ distutils.logrfZdistutils.coreZ distutils.cmdZdistutils.distZdistutils.utilrZdistutils.debugrZdistutils.fancy_getoptrrl collectionsrZemailrZdistutils.errorsr r r r Zdistutils.versionr Zsetuptools.externrrrZsetuptools.extern.six.movesrrrrrZsetuptools.dependsrZ setuptoolsrZsetuptools.monkeyrZsetuptools.configrrW __import__r r1rDrVrKrkr;r`rbrjrornrwr~rrrrrZcorerrrrrrrrsv               6L