a 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/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)clsr\/workspaces/shunt/resources/test-fastapi/venv/lib/python3.9/site-packages/setuptools/dist.py_get_unpatched-s r cCst|dd}|dur|js |jr*td}nd|jdusT|jdusTt|dddusT|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!)selfmvrrrget_metadata_version2s*      r2cs t|fdd}fdd}td|_|d|_|d|_|d|_|d |_d |_|d |_d |_ |d |_ |d |_ dvr|d|_ nd |_ |d|_ |d|_dvr|dd|_|d|_|d|_|jtdkr |d|_|d|_|d|_nd |_d |_d |_d S)z-Reads the metadata values from a file object.cs|}|dkrdS|S)NUNKNOWNr)namevaluemsgrr _read_fieldLsz"read_pkg_file.._read_fieldcs|d}|gkrdS|SN)get_all)r4valuesr6rr _read_listRs z!read_pkg_file.._read_listzmetadata-versionr4versionsummaryauthorNz author-emailz home-pagelicensez download-url descriptionkeywords,platform classifierr$r,r+r-)rr r!r4r=rAr?r( author_emailr)urlr@r/long_descriptionsplitrB platformsr.r,r+r-)r0filer8r<rr6r read_pkg_fileHs:                 rLc s}tjrfdd}n fdd}|dt||d|d|d|d|td kr|d  |d  n.d }|D]$\}}t |}|d ur|||q|d j r|dj jD]}|dd|qt} |d| d} | r:|d| |td krdD]} |d| qPndddddtdr|djjr|djjrtjD]} |d| qd S)z5Write the PKG-INFO format data to a file object. csd||fdSNz%s: %s )writeZ _encode_fieldkeyr5rKr0rr write_fieldsz#write_pkg_file..write_fieldcsd||fdSrM)rNrO)rKrrrRszMetadata-VersionNameVersionZSummaryz Home-pager#Author Author-email))rUr?)rVrF)Z Maintainerr()zMaintainer-emailr)NZLicensez Download-URLz Project-URLz%s, %s DescriptionrCZKeywordsPlatform ClassifierRequiresProvides Obsoletesr"zRequires-PythonzDescription-Content-TypezProvides-Extra)r2rPY2strget_name get_versionget_descriptionget_urlr get_contactget_contact_emailr% get_licenser/r*itemsr get_long_descriptionjoin get_keywords get_platforms _write_listget_classifiers get_requires get_provides get_obsoleteshasattrr"r&r'sorted) r0rKr=rRZoptional_fieldsfieldattrZattr_val project_url long_descrBrDextrarrQrwrite_pkg_file~sZ            rwc CsNztjd|}|jrJWn*ttttfyHtd||fYn0dS)Nzx=z4%r must be importable 'module:attrs' string (got %r)) pkg_resources EntryPointparseextras TypeError ValueErrorAttributeErrorAssertionErrorr )distrsr5eprrrcheck_importablesrc CsXz(t|ttfsJd||ks&JWn*ttttfyRtd||fYn0dS)z"Verify that value is a string listz%%r must be a list of strings (got %r)N) isinstancelisttuplerhr|r}r~rr rrsr5rrrassert_string_lists rcCsd|}t||||D]J}||s2tdd||d\}}}|r||vrtjd||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)rhas_contents_forr rpartition distutilslogr)rrsr5Z ns_packagesnspparentsepchildrrr check_nsps   rc Cs>zttt|Wn tttfy8tdYn0dS)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 itertoolsstarmap _check_extrarfr|r}r~r rrrr check_extrass rcCs<|d\}}}|r*t|r*td|tt|dS)N:zInvalid environment marker: ) partitionrxinvalid_markerr rparse_requirements)rvreqsr4rmarkerrrrrs rcCs&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}))rsr5N)boolr format)rrsr5tmplrrr assert_bool s rc Cslz(tt|t|ttfr&tdWn>ttfyf}z"d}t|j ||dWYd}~n d}~00dS)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}rserrorN) rrxrrdictsetr|r}r rrrsr5rrrrrcheck_requirementss rc CsTztj|Wn>tjjyN}z"d}t|j||dWYd}~n d}~00dS)z.Verify that value is a valid version specifierzF{attr!r} must be a string containing valid version specifiers; {error}rN)r specifiers SpecifierSetInvalidSpecifierr rrrrrcheck_specifier s rc CsBztj|Wn,ty<}zt|WYd}~n d}~00dS)z)Verify that entry_points map is parseableN)rxry parse_mapr}r )rrsr5errrcheck_entry_points,srcCst|tjstddS)Nztest_suite must be a string)rr string_typesr rrrrcheck_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)rrr rrfrrr)rrsr5kvrrrcheck_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)rematchrrr)rrsr5pkgnamerrrcheck_packagesHs  rc@sfeZdZdZdeejejdZdZddZ dQddZ dd Z d d Z e d d ZddZddZdRddZe ddZdSddZdTddZddZddZdd 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-dMdNZ.dOdPZ/dS)UraDistribution 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|vsd|vrdStt|d}tjj|}|durh|dshtt|d|_ ||_ dS)Nr4r=zPKG-INFO) rx safe_namer^lower working_setby_keyget has_metadata safe_version_version _patched_dist)r0attrsrPrrrrpatch_missing_pkg_infosz#Distribution.patch_missing_pkg_infoc std}|si_|pi}d|vs,d|vr4tg_i_g_|dd_ ||dg_ |dg_ t dD]}t|jdqtfdd |DjD]L\}}jj|fD]}||vr||}qq|r|nd}tj||qtjjtjr4tjjj_jjdurzHtjjj}t|} jj| krt d jj| f| j_Wn.tjj!t"fyt d jjYn0#dS) N package_datafeaturesrequire_featuressrc_rootdependency_linkssetup_requiresdistutils.setup_keywordscs i|]\}}|jvr||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.)$rprFeaturewarn_deprecatedrr dist_filespoprrrrrxiter_entry_pointsvars setdefaultr4 _Distribution__init__rfrmetadata__dict__setattrrr=numbersNumberr^rrTrrInvalidVersionr|_finalize_requires) r0rZhave_package_dataroptiondefaultsourcer5verZnormalized_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_requirerr) r%r"rrkeysrIr'add_convert_extras_requirements"_move_install_requirements_markers)r0rvrrrrs   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%rr_tmp_extras_requirerfrxr _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. rr)rr^reqrrrr 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 Sr9rrrrr is_simple_reqszFDistribution._move_install_requirements_markers..is_simple_reqinstall_requiresNrrc3s,|]$\}}|ddtj|DfVqdS)cSsg|] }t|qSr)r^rrrrr *zMDistribution._move_install_requirements_markers...N)r _clean_reqrrrr )szBDistribution._move_install_requirements_markers..)r%rrxrrrrr^rrrrrrfr)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}tjs(tjtjkr(gd}ng}t|}|durD|}t rR| d|}|D]}t j |ddB}t r| dj fittjr|jn|j|Wdn1s0Y|D]\}||}||} |D]>} | d kr| |vr|||| } | d d } || f| | <qq|q\d |jvr|jd D]\} \} } |j| } zF| r~t|| t|  n(| d vrt|| t| n t|| | Wn.ty}zt|WYd}~n d}~00qJdS)z Adapted from distutils.dist.Distribution.parse_config_files, this method provides the same functionality in subtly-improved ways. r) ConfigParser) z install-basezinstall-platbasez install-libzinstall-platlibzinstall-purelibzinstall-headerszinstall-scriptsz install-dataprefixz exec-prefixhomeuserrootNz"Distribution.parse_config_files():utf-8)encodingz reading {filename}__name__-_global)verbosedry_run)Z(setuptools.extern.six.moves.configparserrrr]sysr base_prefix frozensetfind_config_filesrannounceioopenrlocalsreadfp read_filesectionsoptionsget_option_dict_try_strrreplacercommand_optionsrf negative_optrrr}r )r0 filenamesrignore_optionsparserfilenamereaderrropt_dictoptvalsrcaliasr7rrr_parse_config_files5sF   4        z Distribution._parse_config_filescCs,tjs |Sz |WSty&Yn0|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]encodeUnicodeEncodeError)rrrrrss   zDistribution._try_strc Cs\|}|dur||}tr,|d||D] \}\}}trZ|d|||fzdd|jD}Wntyg}Yn0z |j}Wntyi}Yn0z~t|t j } ||vr| rt |||t | nJ||vr| rt ||t |n,t ||rt |||ntd|||fWq4tyT} zt| WYd} ~ q4d} ~ 00q4dS)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')get_command_namerrrrfboolean_optionsr~rrrrrrrpr r}) r0 command_obj option_dict command_namerrr5 bool_optsneg_opt is_stringr7rrr_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)r0rr,rrrparse_config_filess  zDistribution.parse_config_filescCst|}|jr||S)z3Process features after parsing command line options)rparse_command_liner_finalize_features)r0resultrrrr.s zDistribution.parse_command_linecCsd|ddS)z;Convert feature name to corresponding option attribute nameZwith_rrrr0r4rrr_feature_attrnameszDistribution._feature_attrnamecCs8tjjt||jdd}|D]}tjj|ddq|S)zResolve pre-setup requirementsT) installerreplace_conflictingr1)rxrresolverfetch_build_eggr)r0r,Zresolved_distsrrrrfetch_build_eggsszDistribution.fetch_build_eggscCs>d}dd}tddt|}t||dD] }||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|ddS)Norderr)r%)hookrrrby_ordersz/Distribution.finalize_options..by_ordercSs|Sr9)load)rrrrrz/Distribution.finalize_options..)rPN)rrxrrq)r0groupr;epsrrrrfinalize_optionss zDistribution.finalize_optionscCsJtdD]:}t||jd}|dur |j|jd|||j|q dS)Nrr4)rxrr%r4requirer7r<)r0rr5rrr_finalize_setup_keywordss z%Distribution._finalize_setup_keywordscCs*t|ddr dd|jD|_ng|_dS)Nconvert_2to3_doctestscSsg|]}tj|qSr)ospathabspathrprrrrsz8Distribution._finalize_2to3_doctests..)r%rDrrrr_finalize_2to3_doctestss   z$Distribution._finalize_2to3_doctestscCstjtjd}tj|st|t|tj|d}t|d.}| d| d| dWdn1s|0Y|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. ) rErFrhcurdirexistsmkdirrZ hide_filer rN)r0Z egg_cache_dirZreadme_txt_filenamefrrrget_egg_cache_dirs      (zDistribution.get_egg_cache_dircCsddlm}|||S)z Fetch an egg needed for buildingr)r7)Zsetuptools.installerr7)r0rr7rrrr7s zDistribution.fetch_build_eggc Cs|js dSg}|j}|jD]\}}||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)rzwith-zinclude zwithout-zexclude ) rrcopyrf _set_featurevalidateoptionalrAinclude_by_defaultextendglobal_optionsZfeature_optionsZfeature_negopt) r0Zgonor4featuredescrZincdefZexcdefnewrrr_finalize_feature_opts s(     z#Distribution._finalize_feature_optscCs|jD]<\}}||}|s0|dur |r ||||dq |jD](\}}||sR||||dqRdS)z9Add/remove features and resolve dependencies between themNrr)rrffeature_is_includedrU include_inrR exclude_from)r0r4rYZenabledrrrr/)s    zDistribution._finalize_featurescCs\||jvr|j|Std|}|D]*}|j|jd||j|<}|St||S)z(Pluggable version of get_command_class()distutils.commandsrAN)cmdclassrxrrBr7r<rget_command_class)r0commandr?rrarrrrb:s   zDistribution.get_command_classcCs:tdD]$}|j|jvr |}||j|j<q t|SNr`)rxrr4rar6rprint_commandsr0rrarrrreGs  zDistribution.print_commandscCs:tdD]$}|j|jvr |}||j|j<q t|Srd)rxrr4rar6rget_command_listrfrrrrgOs  zDistribution.get_command_listcCst||||dS)zSet feature's inclusion statusN)rr3)r0r4statusrrrrRWszDistribution._set_featurecCst|||S)zAReturn 1 if feature is included, 0 if excluded, 'None' if unknown)r%r3r2rrrr][sz 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)r]rrAr r^rR)r0r4rZrrrinclude_feature_s 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)rfr% _include_misc)r0rrrincluderrrrkjs  zDistribution.includecsfd|jr&fdd|jD|_|jrDfdd|jD|_|jrbfdd|jD|_dS)z9Remove packages, modules, and extensions in named packagercs"g|]}|kr|s|qSr startswithrHpackagepfxrrrsz0Distribution.exclude_package..cs"g|]}|kr|s|qSrrlrHrnrrrscs&g|]}|jkr|js|qSr)r4rmrHrnrrrsN)packages py_modules ext_modules)r0rorrnrexclude_packages   zDistribution.exclude_packagecCs2|d}|D]}||ks&||rdSqdS)z.rsequencer r%r~r)r0r4r5oldrrzr _exclude_miscs     zDistribution._exclude_misccst|tstd||fzt||WntyFtd|Yn0dur^t|||n:ttsvt|dn"fdd|D}t|||dS)zAHandle 'include()' for list/tuple attrs without a special handlerz%s: setting must be a list (%r)rvNrwcsg|]}|vr|qSrrrxr}rrrrz.Distribution._include_misc..r{)r0r4r5r[rrrrjs$     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%r~)r0rrrexcluderrrrs  zDistribution.excludecCs,t|tstd|ftt|j|dS)Nz.packages: setting must be a list or tuple (%r))rr|r rrrt)r0rqrrr_exclude_packagess  zDistribution._exclude_packagesc Cs|jj|_|jj|_|d}|d}||vrf||\}}||=ddl}||d|dd<|d}q&t|||}||} t | ddrd|f||d<|durgS|S)NraliasesTrZcommand_consumes_arguments command lineargs) __class__rWrrshlexrIr_parse_command_optsrbr%) r0rrrcrrrrnargs cmd_classrrrrs"       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. rrrrrNzShouldn't be able to get herer) rrfrget_command_objrrQupdater%rr) r0dcmdoptsrrrZcmdobjr)negposrrrget_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)rqrrrsrrr4endswith)r0pkgrextr4Z buildinforrrru)s    z$Distribution.iter_distribution_namesc Csddl}tjs|jr t||St|jtj s:t||S|jj dvrVt||S|jj }|jj }|j dkrtdpvd}|jj}t |jd||||_z(t||Wt |j|||||_St |j|||||_0dS)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)rutf8win32 r)rrr] help_commandsrhandle_display_optionsrstdoutr  TextIOWrapperrrerrorsrDline_bufferingdetach)r0 option_orderrrrnewlinerrrrr;s2     z#Distribution.handle_display_options)N)N)N)NF)0r __module__ __qualname____doc__rrZ OrderedSetrrrrrr staticmethodrrrrrr+r-r.r3r8r@rCrJrPr7r\r/rbrergrRr]rirkrtrr~rjrrrrrurrrrrrTs^D ;  >  /      (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)rrrr6rrrrszFeature.warn_deprecatedFTrc Ks|||_||_||_||_t|ttfr4|f}dd|D|_dd|D}|r^||d<t|trn|f}||_ ||_ |s|s|st ddS)NcSsg|]}t|tr|qSrrr^rrrrrsz$Feature.__init__..cSsg|]}t|ts|qSrrrrrrrrrzgFeature %s: must define 'require_features', 'remove', or at least one of 'packages', 'py_modules', etc.) rrAstandard availablerTrr^rrremover{r ) r0rArrrTrrr{Zerrrrrs*  zFeature.__init__cCs |jo |jS)z+Should this feature be included by default?)rrrrrrrUszFeature.include_by_defaultcCs@|jst|jd|jfi|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)rr rArkr{rri)r0rrOrrrr^s  zFeature.include_incCs2|jfi|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)rr{rrtr0rryrrrr_s  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)rrr rArrrrrSs   zFeature.validateN)FTTrr) rrrrrrrrUr^r_rSrrrrr^s8  rc@seZdZdZdS)rzrClass for warning about deprecations in dist in setuptools. Not ignored by default, unlike DeprecationWarning.N)rrrrrrrrrsr)J__all__r rrrErrZ distutils.logrdistutils.core distutils.cmddistutils.distdistutils.utilrdistutils.debugrdistutils.fancy_getoptrr collectionsremailrdistutils.errorsr r r r Zdistutils.versionr Zsetuptools.externrrrZsetuptools.extern.six.movesrrrrrZsetuptools.dependsr setuptoolsrZsetuptools.monkeyrZsetuptools.configrrx __import__r r2rLrwrrr|rrrrrrrrrrrrcorerrrrrrrrsv               6L