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/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ú3/usr/lib/python3.8/site-packages/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!)ÚselfZmvrrrÚget_metadata_version2s*    ÿþý ÿÿ r1cs 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)NZUNKNOWNr)ÚnameÚvalue©ÚmsgrrÚ _read_fieldLsz"read_pkg_file.._read_fieldcsˆ |d¡}|gkrdS|S©N)Zget_all)r2Úvaluesr4rrÚ _read_listRs z!read_pkg_file.._read_listzmetadata-versionr2ÚversionZsummaryÚauthorNz author-emailz home-pageÚlicensez download-urlÚ descriptionÚkeywordsú,ÚplatformZ classifierr$r,r+r-)rr r!r2r:r=r;r(Ú author_emailr)Zurlr<r/Zlong_descriptionÚsplitr>Z platformsr.r,r+r-)r0Úfiler6r9rr4rÚ read_pkg_fileHs:                 rDc 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©Úkeyr3©rCr0rrÚ write_field„sz#write_pkg_file..write_fieldcsˆ d||f¡dSrE)rFrG)rCrrrJ‡szMetadata-VersionÚNameÚVersionZSummaryz 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)r1rÚPY2ÚstrZget_nameZ get_versionZget_descriptionZget_urlr Z get_contactZget_contact_emailr%Z get_licenser/r*Úitemsr Zget_long_descriptionÚjoinZ get_keywordsZ get_platformsZ _write_listZget_classifiersZ get_requiresZ get_providesZ get_obsoletesÚhasattrr"r&r') r0rCr:rJZoptional_fieldsZfieldÚattrZattr_valZ project_urlZ long_descr>r@ÚextrarrIrÚwrite_pkg_file~sZ            þ rVc CsFztj d|¡}Wn,ttttfk r@td||fƒ‚YnXdS)Nzx=z4%r must be importable 'module:attrs' string (got %r))Ú pkg_resourcesÚ EntryPointÚparseÚ TypeErrorÚ ValueErrorÚAttributeErrorÚAssertionErrorr )ÚdistrTr3ÚeprrrÚcheck_importableÍsÿÿr`c Cs6zWn,ttttfk r0td||fƒ‚YnXdS)z"Verify that value is a string listz%%r must be a list of strings (got %r)N)rZr[r\r]r ©r^rTr3rrrÚassert_string_listØs  ÿrbcCsd|}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)rbÚhas_contents_forr Ú rpartitionÚ distutilsÚlogr)r^rTr3Z ns_packagesZnspÚparentÚsepZchildrrrÚ check_nspæs   ÿÿ þrjc 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) ÚlistÚ itertoolsÚstarmapÚ _check_extrarQrZr[r\r rarrrÚ check_extrasøs ÿrocCs<| d¡\}}}|r*t |¡r*td|ƒ‚tt |¡ƒdS)Nú:zInvalid environment marker: )Ú partitionrWZinvalid_markerr rkÚparse_requirements)rUZreqsr2riÚmarkerrrrrns rncCs&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}))rTr3N)Úboolr Úformat)r^rTr3ÚtmplrrrÚ assert_bool s rwc 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}©rTÚerrorN) rkrWrrÚ isinstanceÚdictÚsetrZr[r ru©r^rTr3ryrvrrrÚ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}rxN)rZ specifiersZ SpecifierSetZInvalidSpecifierr rur}rrrÚcheck_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^rTr3ÚerrrÚcheck_entry_points,sr�cCst|tjƒstdƒ‚dS)Nztest_suite must be a string)rzrÚ string_typesr rarrrÚ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)rzr{r rurQrr‚rb)r^rTr3Ú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Úmatchrfrgr)r^rTr3ZpkgnamerrrÚcheck_packagesHs  þr‰c@sReZdZdZdeejdœZdZdd„Z dMdd„Z dd „Z d d „Z e d d „ƒZdd„Zdd„ZdNdd„Ze dd„ƒZdOdd„ZdPdd„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-dS)Qra�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'cCsl|rd|ksd|krdSt t|dƒ¡ ¡}tjj |¡}|dk rh| d¡sht t|dƒ¡|_ ||_ dS)Nr2r:zPKG-INFO) rWZ safe_namerPÚlowerÚ working_setZby_keyÚgetZ has_metadataZ safe_versionZ_versionÚ _patched_dist)r0ÚattrsrHr^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.)$rSr�ÚFeatureÚwarn_deprecatedr’r‘Z dist_filesÚpopr“r�r”r•rWÚiter_entry_pointsÚvarsÚ setdefaultr2Ú _DistributionÚ__init__rQr—ÚmetadataÚ__dict__Úsetattrrzr:ÚnumbersÚNumberrPrrLrrZInvalidVersionrZÚ_finalize_requires) r0rŽZhave_package_datar_ÚoptionÚdefaultÚsourcer3ZverZnormalized_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_requirerpr) r%r"r¤r­ÚkeysrBr'ÚaddÚ_convert_extras_requirementsÚ"_move_install_requirements_markers)r0rUrrrr©è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%rrkÚ_tmp_extras_requirerQrWrrÚ _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. rpÚ)rsrP©Ú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 Sr7©rsr¹rrrÚ is_simple_reqszFDistribution._move_install_requirements_markers..is_simple_reqÚinstall_requiresNrrpc3s,|]$\}}|dd„tˆj|ƒDƒfVqdS)cSsg|] }t|ƒ‘qSr)rP©r™r¶rrrÚ )szMDistribution._move_install_requirements_markers...N)rÚ _clean_reqr˜ršrrÚ (sÿzBDistribution._move_install_requirements_markers..)r%rkrWrrrrrrPr½r²rsr´r{rQr­)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}tjr>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)ÚverboseZdry_run)Z(setuptools.extern.six.moves.configparserrÂrÚPY3ÚsysrÃÚ base_prefixÚ frozensetZfind_config_filesrÚannounceÚioÚopenruÚlocalsZ read_fileZreadfpZsectionsÚoptionsÚget_option_dictÚ_try_strrŒÚreplacer£Úcommand_optionsrQÚ negative_optr¦rr[r )r0Ú filenamesrÂZignore_optionsÚparserÚfilenameÚreaderrµrÖZopt_dictÚoptÚvalÚsrcÚaliasr5rrrÚ_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 )rrÎÚencodeÚUnicodeEncodeError)rárrrrØrs  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')Zget_command_namer×rrÒrQZboolean_optionsr\rÛrzrr‚r¦rrSr r[) r0Z command_objZ option_dictZ command_namerªr¬r3Z bool_optsÚneg_optZ is_stringr5rrrÚ_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)rärrÚr©)r0rÜrê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Ù©r0r2rrrÚ_feature_attrnameÇszDistribution._feature_attrnamecCs8tjjt |¡|jdd�}|D]}tjj|dd�q|S)zResolve pre-setup requirementsT)Ú installerZreplace_conflictingrï)rWr‹ÚresolverrÚfetch_build_eggr¯)r0r,Zresolved_distsr^rrrÚfetch_build_eggsËsýzDistribution.fetch_build_eggscCsˆt |¡|jr| ¡t d¡D]:}t||jdƒ}|dk r"|j|j d�|  ¡||j|ƒq"t|ddƒr~dd„|j Dƒ|_ ng|_ dS)Nr–©ròÚconvert_2to3_doctestscSsg|]}tj |¡‘qSr)ÚosÚpathÚabspath©r™Úprrrr¿âsÿz1Distribution.finalize_options..) r¢Úfinalize_optionsr‘Ú_set_global_opts_from_featuresrWrŸr%r2ÚrequirerôÚloadr÷)r0r_r3rrrrýÖs  þ zDistribution.finalize_optionsc 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. ) rørùrRÚcurdirÚexistsÚmkdirrZ hide_filerÔrF)r0Z egg_cache_dirZreadme_txt_filenameÚfrrrÚget_egg_cache_dirés      zDistribution.get_egg_cache_dirc Cs¾ddlm}| ddgi¡}| d¡}| ¡| dd„| d¡ ¡Dƒ¡|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_urlÚoptimizer Z allow_hostsNrr˜rrrrÁþsþz/Distribution.fetch_build_egg..NrrZsetupÚxTF) ÚargsÚ install_dirZexclude_scriptsZ always_copyZbuild_directoryZeditableZupgradeZ multi_versionZ no_reportrÅ) Zsetuptools.command.easy_installrÚ __class__r×ÚclearÚupdaterQr”rZensure_finalized)r0rºrr^ÚoptsZlinksr Úcmdrrrrôøs8    þ üzDistribution.fetch_build_eggc CsÆg}|j ¡}|j ¡D]Š\}}| |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)r¸zwith-zinclude zwithout-zexclude ) rÛÚcopyr‘rQÚ _set_featureÚvalidateÚoptionalr=Úinclude_by_defaultÚextendÚglobal_optionsZfeature_optionsZfeature_negopt) r0ZgoZnor2ÚfeatureÚdescrZincdefZexcdefÚnewrrrrþs$    þ z+Distribution._set_global_opts_from_featurescCs€|j ¡D]<\}}| |¡}|s0|dkr | ¡r | |¡| |d¡q |j ¡D](\}}| |¡sR| |¡| |d¡qRdS)z9Add/remove features and resolve dependencies between themNrr)r‘rQÚfeature_is_includedrÚ include_inrÚ exclude_from)r0r2rZenabledrrrrí0s    zDistribution._finalize_featurescCs\||jkr|j|St d|¡}|D]*}|j|jd�| ¡|j|<}|St ||¡S)z(Pluggable version of get_command_class()údistutils.commandsröN)ÚcmdclassrWrŸrÿrôrr¢Úget_command_class)r0ÚcommandZepsr_r!rrrr"As   zDistribution.get_command_classcCs:t d¡D]$}|j|jkr | ¡}||j|j<q t |¡S©Nr )rWrŸr2r!rór¢Úprint_commands©r0r_r!rrrr%Ns  zDistribution.print_commandscCs:t d¡D]$}|j|jkr | ¡}||j|j<q t |¡Sr$)rWrŸr2r!rór¢Úget_command_listr&rrrr'Vs  zDistribution.get_command_listcCst|| |¡|ƒdS)zSet feature's inclusion statusN)r¦rñ)r0r2Zstatusrrrr^szDistribution._set_featurecCst|| |¡ƒS)zAReturn 1 if feature is included, 0 if excluded, 'None' if unknown)r%rñrðrrrrbsz 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)rr‘r=r rr)r0r2rrrrÚinclude_featurefs ÿ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)rQr%Ú _include_misc)r0rŽr„r…Úincluderrrr*qs  zDistribution.includecsfˆd‰|jr&‡‡fdd„|jDƒ|_|jrD‡‡fdd„|jDƒ|_|jrb‡‡fdd„|jDƒ|_dS)z9Remove packages, modules, and extensions in named packagerccs"g|]}|ˆkr| ˆ¡s|‘qSr©Ú startswithrû©ÚpackageÚpfxrrr¿Œs ÿz0Distribution.exclude_package..cs"g|]}|ˆkr| ˆ¡s|‘qSrr+rûr-rrr¿’s ÿcs&g|]}|jˆkr|j ˆ¡s|‘qSr)r2r,rûr-rrr¿˜s ÿN)ÚpackagesÚ py_modulesÚ ext_modules)r0r.rr-rÚexclude_package‡s ÿ ÿ ÿzDistribution.exclude_packagecCs2|d}| ¡D]}||ks&| |¡rdSqdS)z.©rzÚsequencer r%r\r¦)r0r2r3Úoldrr9rÚ _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)r5Nr6csg|]}|ˆkr|‘qSrrr7©r<rrr¿Ísz.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=)r0rŽr„r…Úexcluderrrr?Ðs  zDistribution.excludecCs,t|tƒstd|fƒ‚tt|j|ƒƒdS)Nz.packages: setting must be a list or tuple (%r))rzr;r rkrr3)r0r0rrrÚ_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 liner ) rrrÛr×ÚshlexrBr¢Ú_parse_command_optsr"r%) r0rÝr r#rArârãrCÚnargsZ cmd_classrrrrDî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. rBrËrÊrrÛNzShouldn't be able to get herer) rÚrQrÙZget_command_objrÛrrr%r]r¡) r0ÚdrrràrâráZcmdobjrèÚ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úÿÿÿ)r0r1r2rzÚtupler2Úendswith)r0ZpkgrJZextr2Z buildinforrrr40s    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ÇÚutf8Zwin32Ú rÇ)rÏrrOZ help_commandsr¢Úhandle_display_optionsrzÚstdoutrÓÚ TextIOWrapperrÈrŠÚerrorsr@Úline_bufferingÚdetach)r0Z option_orderrÏrÈrRÚnewlinerSrrrrOBs6    ÿÿz#Distribution.handle_display_options)N)N)N)NF).rÉÚ __module__Ú __qualname__Ú__doc__r{rZ OrderedSetr—r�r�r£r©r°Ú staticmethodr³r±rÀrärØrérërìrñrõrýrrôrþrír"r%r'rrr(r*r3rdr=r)r?r@rDrIr4rOrrrrrTsXDý ;  >  /     (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)rrrr4rrrr�ž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©rzrPr¾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�r=ÚstandardÚ availablerrzrPrr’ÚremoveÚextrasr ) r0r=r]r^rr’r_r`Zerrrrr£¦s*ÿ  ÿzFeature.__init__cCs |jo |jS)z+Should this feature be included by default?)r^r]ršrrrrÄ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 r=r*r`r’r()r0r^rrrrrÈ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?r`r_r3©r0r^r8rrrrÜ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_rdr r=rarrrrës   þÿzFeature.validateN)FTTrr) rÉrVrWrXrYr�r£rrrrrrrrrœes8 þ rœc@seZdZdZdS)rzrClass for warning about deprecations in dist in setuptools. Not ignored by default, unlike DeprecationWarning.N)rÉrVrWrXrrrrrÿsr)JÚ__all__rÓrÏr‡rørr§Z distutils.logrfZdistutils.coreZ distutils.cmdZdistutils.distZdistutils.utilrZdistutils.debugrZdistutils.fancy_getoptrrlÚ collectionsrZemailrZdistutils.errorsr r r r Zdistutils.versionr Zsetuptools.externrrrZsetuptools.extern.six.movesrrrr¸rZsetuptools.dependsrZ setuptoolsrZsetuptools.monkeyrZsetuptools.configrrWÚ __import__r r1rDrVrKrkr;r`rbrjrornrwr~rr�rƒr†r‰Zcorerr¢rœrrrrrÚsv               6L