3 e@sdgZddlZddlZddlZddlZddlZddlZddlZddl Zddl Zddl Zddl Zddl mZddlmZddlmZddlmZddlZddlZddlmZmZmZddlmZdd lmZdd lm Z m!Z!dd l m"Z"dd l#m$Z$dd l#m%Z%ddl&m'Z'ddl(m)Z)ddl*Z*ddl+Z*ddl*m,Z,ddl-m.Z.ddl/m0Z0ddl1Z1ddl2m3Z3erpddl4m5Z5e6de6dddZ7ddZ8e9e9dddZ:de9ee9d d!d"Z;de9ee9d d#d$Zd*d+Z?d,d-Z@d.d/ZAeBeCfZDd0d1ZEd2d3ZFd4d5ZGd6d7ZHd8d9ZId:d;ZJdd?ZLd@dAZMdBdCZNdDdEZOdFdGZPdHdIZQe.ejRjSZTGdJddeTZSGdKdLdLe)ZUdS)M DistributionN) strtobool)DEBUG)translate_longopt)iglob)ListOptional TYPE_CHECKING) defaultdict)message_from_file)DistutilsOptionErrorDistutilsSetupError) rfc822_escape) packaging) ordered_set)unique_everseen)SetuptoolsDeprecationWarning)windows_support) get_unpatched)parse_configuration)version)Messagez&setuptools.extern.packaging.specifiersz#setuptools.extern.packaging.versioncCstjdtt|S)NzDo not call this function)warningswarnDistDeprecationWarningr)clsr5/tmp/pip-build-vlmub77e/setuptools/setuptools/dist.py_get_unpatched2s rcCs(t|dd}|dkr$tjd}||_|S)Nmetadata_versionz2.1)getattrrVersionr )selfmvrrrget_metadata_version7s   r%)contentreturncCsJ|j}t|dkr |djSdj|djtjdj|ddfS)zFReverse RFC-822 escaping by removing leading whitespaces from content.rr N) splitlineslenlstripjointextwrapdedent)r&linesrrrrfc822_unescape?s  r0r)msgfieldr'cCs||}|dkrdS|S)zRead Message header field.UNKNOWNNr)r1r2valuerrr_read_field_from_msgGsr5cCst||}|dkr|St|S)z4Read Message header field and apply rfc822_unescape.N)r5r0)r1r2r4rrr_read_field_unescaped_from_msgOs r6cCs|j|d}|gkrdS|S)z9Read Message header field and return all results as list.N)get_all)r1r2valuesrrr_read_list_from_msgWs r9)r1r'cCs|jj}|dkrdS|S)Nr3) get_payloadstrip)r1r4rrr_read_payload_from_msg_s r<cCs\t|}tj|d|_t|d|_t|d|_t|d|_t|d|_d|_t|d|_ d|_ t|d|_ t |d |_ d |krt|d |_nd|_t |d |_|jdkr|jtjd krt||_t|d|_d |krt|d jd|_t|d|_t|d|_|jtjdkr:t|d|_t|d|_t|d|_nd|_d|_d|_t|d|_dS)z-Reads the metadata values from a file object.zmetadata-versionnamersummaryauthorNz author-emailz home-pagelicensez download-url descriptionz2.1keywords,platform classifierz1.1requiresprovides obsoletesz license-file)r rr"r r5r=rAr? maintainer author_emailmaintainer_emailurlr6r@ download_urllong_descriptionr<splitrBr9 platforms classifiersrFrGrH license_files)r#filer1rrr read_pkg_filefs>               rTcCs(d|kr$tjd|jjdd}|S)zF Quick and dirty validation for Summary pypa/setuptools#1390. r(z1newlines not allowed and will break in the futurer)rrr;rO)valrrr single_lines rVc s|j}fdd}|dt||d|j|d|j|dt|j|d|jd&}x.|D]&\}}t||d}|dk rh|||qhWt|j }|d||j r|d|j x |j j D]} |dd| qWdj |j} | r|d| x|jD]} |d| qW|jd|j|jd|j|jd|j|jd|jt|drx|d|j|jr|d|j|jrx|jD]} |d| qW|jd |jpgjd!|jdS)'z0Write the PKG-INFO format data to a file object.csjd||fdS)Nz%s: %s )write)keyr4)rSrr write_fieldsz#write_pkg_file..write_fieldzMetadata-VersionNamer"ZSummaryz Home-pageAuthorr? Author-emailrJ MaintainerrIMaintainer-emailrKNZLicensez Download-URLz Project-URLz%s, %srCZKeywordsPlatform ClassifierRequiresProvides Obsoletespython_requireszRequires-PythonzDescription-Content-TypezProvides-Extraz License-Filez %s r[r?r\rJr]rIr^rK)rerfrgrh)r%strget_name get_versionrVget_descriptionget_urlr!r get_licenserM project_urlsitemsr, get_keywords get_platforms _write_listget_classifiers get_requires get_provides get_obsoleteshasattrrdlong_description_content_typeprovides_extrasrRrWget_long_description) r#rSrrYZoptional_fieldsr2attrZattr_valr@Z project_urlrBrDextrar)rSrwrite_pkg_filesN          r~cCsby tjjd|}|j stWn<ttttfk r\}ztd||f|WYdd}~XnXdS)Nzx=z4%r must be importable 'module:attrs' string (got %r)) pkg_resources EntryPointparseextrasAssertionError TypeError ValueErrorAttributeErrorr )distr|r4eperrrcheck_importables rcCsjy(t|ttfstdj||ks&tWn<ttttfk rd}ztd||f|WYdd}~XnXdS)z"Verify that value is a string listz%%r must be a list of strings (got %r)N) isinstancelisttuplerr,rrrr )rr|r4rrrrassert_string_lists rcCsh|}t|||xR|D]J}|j|s4tdd||jd\}}}|r||krtjjd||qWdS)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)rr|r4Z ns_packagesnspparentsepchildrrr check_nsps     rcCsPyttjt|jWn2tttfk rJ}ztd|WYdd}~XnXdS)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_extrarprrrr )rr|r4rrrr check_extrass rcCs<|jd\}}}|r*tj|r*td|ttj|dS)N:zInvalid environment marker: ) partitionrinvalid_markerr rparse_requirements)r}reqsr=rmarkerrrrrs 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}))r|r4N)boolr format)rr|r4tmplrrr assert_bool#s rcCs,|stj|dtdSt|ddS)Nz is ignored.z is invalid.)rrrr )rr|r4rrrinvalid_unless_false*srcCsly(ttj|t|ttfr&tdWn>ttfk rf}zd}t|j ||d|WYdd}~XnXdS)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})r|errorN) rrrrdictsetrrr r)rr|r4rrrrrcheck_requirements1s rcCsXytjj|WnBtjjtfk rR}zd}t|j||d|WYdd}~XnXdS)z.Verify that value is a valid version specifierzF{attr!r} must be a string containing valid version specifiers; {error})r|rN)r specifiers SpecifierSetInvalidSpecifierrr r)rr|r4rrrrrcheck_specifier?s rcCsBytjj|Wn,tk r<}zt||WYdd}~XnXdS)z)Verify that entry_points map is parseableN)rr parse_maprr )rr|r4rrrrcheck_entry_pointsJsrcCst|tstddS)Nztest_suite must be a string)rrir )rr|r4rrrcheck_test_suiteRs rcCs^t|tstdj|x@|jD]4\}}t|tsDtdj||t|dj||q"WdS)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 rrprir)rr|r4kvrrrcheck_package_dataWs  rcCs,x&|D]}tjd|stjjd|qWdS)Nz \w+(\.\w+)*z[WARNING: %r not a valid package name; please use only .-separated package names in setup.py)rematchrrr)rr|r4pkgnamerrrcheck_packagesfs   rc@s~eZdZdZddeejdddddZdZdd Z dUd d Z d d Z e ddZ e ddZddZddZe ddZddZddZddZe ddZdVd d!Zd"d#Zd$d%Zd&d'ZdWd(d)ZdXd+d,Zd-d.Zd/d0Ze d1d2Zd3d4Zd5d6Z d7d8Z!d9d:Z"d;d<Z#d=d>Z$d?d@Z%dAdBZ&dCdDZ'dEdFZ(dGdHZ)dIdJZ*dKdLZ+dMdNZ,dOdPZ-dQdRZ.dSdTZ/dS)YraG Distribution with support for 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. '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. cCsdS)NrrrrrszDistribution.cCsdS)NrrrrrrscCsdS)Nrrrrrrs)ryrorz license_filerRNcCsp| sd|ksd|krdStjt|dj}tjjj|}|dk rl|jd rltjt|d|_ ||_ dS)Nr=rzPKG-INFO) r safe_namerilower working_setby_keyget has_metadata safe_version_version _patched_dist)r#attrsrXrrrrpatch_missing_pkg_infosz#Distribution.patch_missing_pkg_infocstd}|si_|pi}g_|jdd_j||jdg_|jdg_x$tj dD]}t j |j dqbWt jfdd|jDj|jjjjj_jdS)N package_datasrc_rootdependency_linkssetup_requireszdistutils.setup_keywordscs i|]\}}|jkr||qSr)_DISTUTILS_UNSUPPORTED_METADATA).0rr)r#rr sz)Distribution.__init__..)rxr dist_filespoprrrrriter_entry_pointsvars setdefaultr= _Distribution__init__rp_set_metadata_defaults_normalize_version_validate_versionmetadatar_finalize_requires)r#rZhave_package_datarr)r#rrs&    zDistribution.__init__cCs8x2|jjD]$\}}t|jj||j||q WdS)z Fill-in missing metadata fields not supported by distutils. Some fields may have been set by other tools (e.g. pbr). Those fields (vars(self.metadata)) take precedence to supplied attrs. N)rrprrrr)r#roptiondefaultrrrrsz#Distribution._set_metadata_defaultscCsPt|tjs|dkr|Sttjj|}||krLd}tj|j ft |S|S)Nz)Normalizing '{version}' to '{normalized}') r setuptoolssicrirrr"rrrlocals)r normalizedrrrrrszDistribution._normalize_versionc Csbt|tjrt|}|dk r^ytjj|Wn0tjjtfk r\t j d|t j |SX|S)NzThe 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.) rnumbersNumberrirrr"InvalidVersionrrrrr)rrrrrs  zDistribution._validate_versioncCsjt|ddr|j|j_t|ddrVx2|jjD]$}|jdd}|r.|jjj|q.W|j|j dS)z Set `metadata.python_requires` and fix environment markers in `install_requires` and `extras_require`. rdNextras_requirerr) r!rdrrkeysrOrzadd_convert_extras_requirements"_move_install_requirements_markers)r#r}rrrrs   zDistribution._finalize_requirescCspt|ddpi}tt|_xP|jD]D\}}|j|x0tj|D]"}|j|}|j||j|qBWq$WdS)z Convert requirements in `extras_require` of the form `"extra": ["barbazquux; {marker}"]` to `"extra:{marker}": ["barbazquux"]`. rN) r!r r_tmp_extras_requirerprr _suffix_forappend)r#Z spec_ext_reqssectionrrsuffixrrrrs   z)Distribution._convert_extras_requirementscCs|jrdt|jSdS)ze For a requirement, return the 'extras_require' suffix for that requirement. rr)rri)reqrrrr'szDistribution._suffix_forcsdd}tddpf}ttj|}t||}tj||}ttt|_ x&|D]}j dt|j j |qRWt fddj jD_dS)zv Move requirements in `install_requires` that are using environment markers `extras_require`. cSs|j S)N)r)rrrr is_simple_req9szFDistribution._move_install_requirements_markers..is_simple_reqinstall_requiresNrc3s,|]$\}}|ddtj|DfVqdS)cSsg|] }t|qSr)ri)rrrrr EszMDistribution._move_install_requirements_markers...N)map _clean_req)rrr)r#rr EszBDistribution._move_install_requirements_markers..)r!rrrfilterr filterfalserrirrrrrrpr)r#rZspec_inst_reqsZ inst_reqsZ simple_reqsZ complex_reqsrr)r#rr/s     z/Distribution._move_install_requirements_markerscCs d|_|S)zP Given a Requirement, remove environment markers and return it. N)r)r#rrrrrIszDistribution._clean_reqcCs`|jj}|r|ng}|jj}|r2||kr2|j||dkrF|dkrFd}tt|j||j_dS)z>> list(Distribution._expand_patterns(['LICENSE'])) ['LICENSE'] >>> list(Distribution._expand_patterns(['setup.cfg', 'LIC*'])) ['setup.cfg', 'LICENSE'] css<|]4}tt|D]"}|jd rtjj|r|VqqdS)~N)sortedrendswithospathisfile)rpatternrrrrrlsz0Distribution._expand_patterns..r)rrrrrcs zDistribution._expand_patternscCsddlm}tjtjkrgnddddddd d d d d ddg }t|}|dkrR|j}tr`|jd|}t |_ x|D]}t j |dd(}tr|jdj ft|j|WdQRXxt|jD]h}|j|}|j|} xN|D]F} | dks| |krq|j|| } |j| |} |j| |} || f| | <qWqW|jqrWd|jkrDdSx|jdjD]\} \} } |jj| } | r~t|  } n| dkrt| } yt|| p| | Wn.tk r}zt||WYdd}~XnXqTWdS)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():zutf-8)encodingz reading {filename}__name__globalverbosedry_run)rr) configparserrsysr base_prefix frozensetfind_config_filesrannounceri optionxformioopenrr read_filesectionsoptionsget_option_dictrwarn_dash_deprecationmake_option_lowercasercommand_optionsrp negative_optrsetattrrr )r# filenamesrignore_optionsparserfilenamereaderrropt_dictoptrUsrcaliasrrrr_parse_config_filesssd              z Distribution._parse_config_filescCsf|dkr |S|jdd}tjj|j}|jd rH|dkrH||krH|Sd|krbtjd||f|S) Noptions.extras_requireoptions.data_files-_rrzrUsage of dash-separated '%s' will not be supported in future versions. Please use the underscore name '%s' instead)r,r-)replacercommand__all___setuptools_commands startswithrr)r#r(rZunderscore_optcommandsrrrrs   z"Distribution.warn_dash_deprecationc Cs4ytjd}t|jdStjk r.gSXdS)Nrzdistutils.commands)rget_distributionr get_entry_mapDistributionNotFound)r#rrrrr3s  z!Distribution._setuptools_commandscCs4|dks|jr|S|j}tjd|||f|S)NrzlUsage of uppercase key '%s' in '%s' will be deprecated in future versions. Please use lowercase '%s' instead)islowerrrr)r#r(rZ lowercase_optrrrrsz"Distribution.make_option_lowercasec !Csd|j}|dkr|j|}tr,|jd|x0|jD]"\}\}}tr^|jd|||fydd|jD}Wntk rg}YnXy |j}Wntk ri}YnXy|t|t } ||kr| rt |||t | nJ||kr| rt ||t |n,t ||rt |||nt d|||fWq8tk rZ} zt | | WYdd} ~ Xq8Xq8WdS)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|qSr)r)rorrrrsz5Distribution._set_command_options..z1error in %s: command '%s' has no such option '%s')get_command_namerrrrpboolean_optionsrr rrir!rrxr r) r# command_obj option_dict command_namersourcer4 bool_optsneg_opt is_stringrrrr_set_command_optionss:         z!Distribution._set_command_optionsFcCs0|j|dt||j|d|j|jdS)zYParses configuration files from various levels and loads configuration. )r")ignore_option_errorsN)r+rrrr)r#r"rErrrparse_config_filess  zDistribution.parse_config_filescCs<tjjtj||jdd}x|D]}tjj|ddq W|S)zResolve pre-setup requirementsT) installerreplace_conflicting)r0)rrresolverfetch_build_eggr)r#rFZresolved_distsrrrrfetch_build_eggs*s zDistribution.fetch_build_eggscCsTd}dd}tj|}tj|j|}tdd|}xt||dD] }||q@WdS)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_order>sz/Distribution.finalize_options..by_ordercSs|jS)N)load)rrrrrCsz/Distribution.finalize_options..)rXN)rrrr_removedrr)r#grouprNZdefinedfilteredZloadedrrrrfinalize_options5s zDistribution.finalize_optionscCsdh}|j|kS)z When removing an entry point, if metadata is loaded from an older version of Setuptools, that removed entry point will attempt to be loaded and will fail. See #2765 for more details. Z 2to3_doctests)r=)rremovedrrrrPGs zDistribution._removedcCsNxHtjdD]:}t||jd}|dk r |j|jd|j||j|q WdS)Nzdistutils.setup_keywords)rG)rrr!r=requirerJrO)r#rr4rrr_finalize_setup_keywordsUs z%Distribution._finalize_setup_keywordsc Csvtjjtjd}tjj|srtj|tj|tjj|d}t|d$}|j d|j d|j dWdQRX|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. ) rrr,curdirexistsmkdirrZ hide_filerrW)r#Z egg_cache_dirZreadme_txt_filenamefrrrget_egg_cache_dir\s    zDistribution.get_egg_cache_dircCsddlm}|||S)z Fetch an egg needed for buildingr)rJ)Zsetuptools.installerrJ)r#rrJrrrrJos zDistribution.fetch_build_eggcCs`||jkr|j|Stjd|}x:|D]&}|j|jd|j|j|<}|SWtj||SdS)z(Pluggable version of get_command_class()zdistutils.commands)rGN)cmdclassrrrUrJrOrget_command_class)r#r1Zepsrr]rrrr^us    zDistribution.get_command_classcCs>x2tjdD]$}|j|jkr |j}||j|j<q Wtj|S)Nzdistutils.commands)rrr=r]rIrprint_commands)r#rr]rrrr_s  zDistribution.print_commandscCs>x2tjdD]$}|j|jkr |j}||j|j<q Wtj|S)Nzdistutils.commands)rrr=r]rIrget_command_list)r#rr]rrrr`s  zDistribution.get_command_listcKsDx>|jD]2\}}t|d|d}|r0||q |j||q WdS)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)rpr! _include_misc)r#rrrincluderrrrbs  zDistribution.includecsfd|jr&fdd|jD|_|jrDfdd|jD|_|jrbfdd|jD|_dS)z9Remove packages, modules, and extensions in named packagercs$g|]}|kr|j r|qSr)r4)rp)packagepfxrrrsz0Distribution.exclude_package..cs$g|]}|kr|j r|qSr)r4)rrc)rdrerrrscs(g|] }|jkr|jj r|qSr)r=r4)rrc)rdrerrrsN)packages py_modules ext_modules)r#rdr)rdrerexclude_packages zDistribution.exclude_packagecCs4|d}x&|jD]}||ks(|j|rdSqWdS)z.)rsequencer r!rr!)r#r=r4oldrr)r4r _exclude_miscs   zDistribution._exclude_misccst|tstd||fyt||Wn0tk rX}ztd||WYdd}~XnXdkrpt|||n:ttst|dn"fdd|D}t|||dS)zAHandle 'include()' for list/tuple attrs without a special handlerz%s: setting must be a list (%r)z %s: No such distribution settingNz4: this setting cannot be changed via include/excludecsg|]}|kr|qSrr)rrk)rmrrrsz.Distribution._include_misc..)rrlr r!rr!)r#r=r4rnewr)rmrras    zDistribution._include_misccKsDx>|jD]2\}}t|d|d}|r0||q |j||q WdS)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)rpr!rn)r#rrrexcluderrrrps  zDistribution.excludecCs,t|tstd|ftt|j|dS)Nz.packages: setting must be a list or tuple (%r))rrlr rrri)r#rfrrr_exclude_packagess  zDistribution._exclude_packagesc Cs|jj|_|jj|_|d}|jd}xB||krh||\}}||=ddl}|j|d|dd<|d}q(Wtj|||}|j|} t | ddrd|f|j|d<|dk rgS|S)NraliasesTrZcommand_consumes_argumentsz command lineargs) __class__global_optionsr rshlexrOr_parse_command_optsr^r!) r#r$rsr1rrr)r*rvnargs cmd_classrrrrws"        z Distribution._parse_command_optsc Csi}x|jjD]\}}x|jD]\}\}}|dkr8q"|jdd}|dkr|j|}|jj}|jt|dix<|jD]\} } | |kr|| }d}Pq|Wtdn |dkrd}||j |i|<q"WqW|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. z command liner/r.rr NzShouldn't be able to get herer) rrpr0get_command_objr copyupdater!rr) r#dcmdoptsr(r)rUZcmdobjrBnegposrrrget_cmdline_options#s(     z Distribution.get_cmdline_optionsccsx|jp fD] }|Vq Wx|jp$fD] }|Vq&WxH|jp>fD]:}t|trX|\}}n|j}|jdrt|dd}|Vq@WdS)z@Yield all packages, modules, and extension names in distributionmoduleNi)rfrgrhrrr=r)r#pkgrextr=Z buildinforrrrjKs      z$Distribution.iter_distribution_namescCsddl}|jrtj||St|jtjs4tj||S|jjj dkrPtj||S|jj}|jj }|j dkrndppd}|jj }tj|jj d||||_z tj||Stj|jj |||||_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. rNutf-8utf8win32r()rr)r help_commandsrhandle_display_optionsrstdoutr TextIOWrapperr rerrorsrDline_bufferingdetach)r# option_orderrr rnewlinerrrrr]s"    z#Distribution.handle_display_options)N)N)N)NF)0r  __module__ __qualname____doc__rrZ OrderedSetrrrrr staticmethodrrrrrrrrrr+rr3rrDrFrKrSrPrVr\rJr^r_r`rbrirrnrarprqrwrrjrrrrrrssZ2      O .     (c@seZdZdZdS)rzrClass for warning about deprecations in dist in setuptools. Not ignored by default, unlike DeprecationWarning.N)r rrrrrrrrsr)Vr2rrrrrrZ distutils.logrdistutils.core distutils.cmddistutils.distdistutils.commanddistutils.utilrdistutils.debugrdistutils.fancy_getoptrglobrrr-Ztypingrrr collectionsr emailr Zdistutils.errorsr r rZsetuptools.externrrZ setuptools.extern.more_itertoolsrrrrZsetuptools.commandrZsetuptools.monkeyrZsetuptools.configrrZsetuptools.extern.packagingr email.messager __import__rr%rir0r5r6r9r<rTrVr~rrrlrrrrrrrrrrrrrcorerrrrrrrs                0 >