3 (\@s dgZddlZddlZddlZddlZddlZddlZddlZddl Zddl Zddl Zddl m Z ddlmZddlmZddlZddlmZddlmZddlmZmZmZdd l mZdd lmZdd lmZdd lm Z dd l!m"Z"m#Z#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*ddl+m,Z,ddl-m.Z.ddl/Z/e0de0dddZ1ddZ2ddZ3ddZ4e5e6fZ7ddZ8d d!Z9d"d#Z:d$d%Z;d&d'Zd,d-Z?d.d/Z@d0d1ZAd2d3ZBd4d5ZCe,ejDjEZFGd6ddeFZEGd7d8d8ZGGd9d:d:e&ZHdS); DistributionN) strtobool)DEBUG)translate_longopt) defaultdict)message_from_file)DistutilsOptionErrorDistutilsPlatformErrorDistutilsSetupError) rfc822_escape) StrictVersion)six) packaging)mapfilter filterfalse)SetuptoolsDeprecationWarning)Require)windows_support) get_unpatched)parse_configurationz&setuptools.extern.packaging.specifiersz#setuptools.extern.packaging.versioncCstjdtt|S)NzDo not call this function)warningswarnDistDeprecationWarningr)clsrk/private/var/folders/pf/wv4htv3x0qs2c2mp0dnn0kchsvlck3/T/pip-install-rm6ck8ia/setuptools/setuptools/dist.py_get_unpatched,s rcCst|dd}|dkr|js |jr*td}n^|jdk sN|jdk sNt|dddk rXtd}n0|jsv|jsv|jsv|j sv|j rtd}ntd}||_ |S)Nmetadata_versionz2.1python_requiresz1.2z1.1z1.0) getattrlong_description_content_typeprovides_extrasr maintainermaintainer_emailprovidesrequires obsoletes classifiers download_urlr)selfmvrrrget_metadata_version1s        r-cs t|fdd}fdd}td|_|d|_|d|_|d|_|d |_d |_|d |_d |_ |d |_ |d |_ dkr|d|_ nd |_ |d|_ |d|_dkr|djd|_|d|_|d|_|jtdkr |d|_|d|_|d|_nd |_d |_d |_d S)z-Reads the metadata values from a file object.cs|}|dkrdS|S)NUNKNOWNr)namevalue)msgrr _read_fieldJsz"read_pkg_file.._read_fieldcsj|d}|gkrdS|S)N)get_all)r/values)r1rr _read_listPs z!read_pkg_file.._read_listzmetadata-versionr/versionsummaryauthorNz author-emailz home-pagelicensez download-url descriptionkeywords,platform classifierz1.1r'r&r()rr rr/r6r:r8r$ author_emailr%urlr9r*long_descriptionsplitr; platformsr)r'r&r()r+filer2r5r)r1r read_pkg_fileFs:                 rEc s"j}tjrfdd}n fdd}|dt||dj|dj|dj|dj|td kr|d j |d j n2d'}x,|D]$\}}t |}|dk r|||qW|dj j r|dj x"jjD]}|dd|qWtj} |d| djj} | rF|d| |td krtx0jD]} |d| q^Wnjdjjdjjdjjdjjdjtdr|d jjr|d!jjrxjD]} |d"| q WdS)(z5Write the PKG-INFO format data to a file object. csjd|j|fdS)Nz%s: %s )writeZ _encode_field)keyr0)rDr+rr write_fieldsz#write_pkg_file..write_fieldcsjd||fdS)Nz%s: %s )rF)rGr0)rDrrrHszMetadata-VersionNameVersionZSummaryz Home-pagez1.2Author Author-emailr8r? Maintainerr$Maintainer-emailr%NZLicensez Download-URLz Project-URLz%s, %s Descriptionr<ZKeywordsPlatform ClassifierRequiresProvides Obsoletesr zRequires-PythonzDescription-Content-TypezProvides-ExtrarKr8rLr?rMr$rNr%)rUrVrWrX)r-r PY2strget_name get_versionget_descriptionget_urlr get_contactget_contact_emailr! get_licenser* project_urlsitemsr get_long_descriptionjoin get_keywords get_platforms _write_listget_classifiers get_requires get_provides get_obsoleteshasattrr r"r#) r+rDr6rHZoptional_fieldsfieldattrZattr_valZ project_url long_descr;r=extrar)rDr+rwrite_pkg_file|s^          rrcCsRy tjjd|}|j stWn,ttttfk rLtd||fYnXdS)Nzx=z4%r must be importable 'module:attrs' string (got %r)) pkg_resources EntryPointparseextrasAssertionError TypeError ValueErrorAttributeErrorr )distror0eprrrcheck_importablesr}cCsHydj||kstWn,ttttfk rBtd||fYnXdS)z*Verify that value is a string list or Nonez%%r must be a list of strings (got %r)N)rerwrxryrzr )r{ror0rrrassert_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)r{ror0Z ns_packagesnspparentsepchildrrr check_nsps     rc Cs@yttjt|jWn"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_extrarcrxryrzr )r{ror0rrr check_extrass rcCs<|jd\}}}|r*tj|r*td|ttj|dS)N:zInvalid environment marker: ) partitionrsinvalid_markerr rparse_requirements)rqreqsr/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}))ror0N)boolr format)r{ror0tmplrrr assert_bools rcCsjy(ttj|t|ttfr&tdWn<ttfk rd}zd}t|j ||dWYdd}~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})roerrorN) rrsr isinstancedictsetrxryr r)r{ror0rrrrrcheck_requirements s rcCsRytjj|Wn<tjjk rL}zd}t|j||dWYdd}~XnXdS)z.Verify that value is a valid version specifierzF{attr!r} must be a string containing valid version specifiers; {error})rorN)r specifiers SpecifierSetInvalidSpecifierr r)r{ror0rrrrrcheck_specifiers rcCs@ytjj|Wn*tk r:}zt|WYdd}~XnXdS)z)Verify that entry_points map is parseableN)rsrt parse_mapryr )r{ror0errrcheck_entry_points&srcCst|tjstddS)Nztest_suite must be a string)rr string_typesr )r{ror0rrrcheck_test_suite.s rc Csdt|trTxH|jD]8\}}t|ts(Py t|Wqtk rJPYqXqWdSt|ddS)z@Verify that value is a dictionary of package names to glob listsNzI must be a dictionary mapping package names to lists of wildcard patterns)rrrcrZiterrxr )r{ror0kvrrrcheck_package_data3s    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)r{ror0pkgnamerrrcheck_packagesEs   rc@sPeZdZdZdeedZdZddZdMddZ dd Z d d Z e d d Z ddZddZdNddZe ddZdOddZdPddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Z 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"rbr#cCsp| sd|ksd|krdStjt|dj}tjjj|}|dk rl|jd rltjt|d|_ ||_ dS)Nr/r6zPKG-INFO) rs safe_namerZlower working_setby_keyget has_metadata safe_version_version _patched_dist)r+attrsrGr{rrrpatch_missing_pkg_infosz#Distribution.patch_missing_pkg_infoc std}|si_|pi}d|ks,d|kr4tjg_i_g_|jdd_j ||jdg_ |jdg_ x$t j dD]}tj|jdqWtjfdd |jDx\jjD]N\}}x6jj|fD]}||kr||}PqW|r|nd}tj||qWtjjtjr>tjjj_jjdk ryHtjjjj}t|} jj| krtj d jj| f| j_Wn0tjj!t"fk rtj d jjYnXj#dS) N package_datafeaturesrequire_featuressrc_rootdependency_linkssetup_requireszdistutils.setup_keywordscs i|]\}}|jkr||qSr)_DISTUTILS_UNSUPPORTED_METADATA).0rr)r+rr sz)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.)$rmrFeaturewarn_deprecatedrr dist_filespoprrrrrsiter_entry_pointsvars setdefaultr/ _Distribution__init__rcrmetadata__dict__setattrrr6numbersNumberrZrrJrrInvalidVersionrx_finalize_requires) r+rZhave_package_datar|optiondefaultsourcer0verZnormalized_versionr)r+rrsR    zDistribution.__init__cCsjt|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`. r Nextras_requirerr) r!r rrkeysrBr#add_convert_extras_requirements"_move_install_requirements_markers)r+rqrrrrs   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!rr_tmp_extras_requirercrsr _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~)rrZ)reqrrrrszDistribution._suffix_forcsdd}tddpf}ttj|}t||}t||}ttt|_x&|D]}j dt|j j |qPWt fddj j D_dS)zv Move requirements in `install_requires` that are using environment markers `extras_require`. cSs|j S)N)r)rrrr is_simple_reqszFDistribution._move_install_requirements_markers..is_simple_reqinstall_requiresNrc3s,|]$\}}|ddtj|DfVqdS)cSsg|] }t|qSr)rZ)rrrrr &szMDistribution._move_install_requirements_markers...N)r _clean_req)rrr)r+rr &szBDistribution._move_install_requirements_markers..)r!rrsrrrrrZrrrrrrcr)r+rZspec_inst_reqsZ inst_reqsZ simple_reqsZ complex_reqsrr)r+rrs     z/Distribution._move_install_requirements_markerscCs d|_|S)zP Given a Requirement, remove environment markers and return it. N)r)r+rrrrr*szDistribution._clean_reqcCsddlm}tjr>tjtjkr>ddddddd d d d d ddg }ng}t|}|dkrZ|j}t rh|j d|}x|D]}t j |dd4}t r|j dj fttjr|jn|j|WdQRXxl|jD]`}|j|}|j|} xF|D]>} | dko| |kr|j|j|| } | jdd} || f| | <qWqW|jqtWd|jkrx|jdjD]\} \} } |jj| } yF| rt|| t|  n(| dkrt|| t| n t|| | Wn,tk r}zt|WYdd}~XnXqVWdS)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)Z(setuptools.extern.six.moves.configparserrr PY3sysr base_prefix frozensetfind_config_filesrannounceioopenrlocals read_filereadfpsectionsoptionsget_option_dict_try_strrreplacercommand_optionsrc negative_optrrryr)r+ filenamesrignore_optionsparserfilenamereaderrropt_dictoptvalsrcaliasr1rrr_parse_config_files1sL             z Distribution._parse_config_filesc Cs,tjr |Sy|jStk 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 )r rencodeUnicodeEncodeError)r rrrros zDistribution._try_strc !Csf|j}|dkr|j|}tr,|jd|x2|jD]$\}\}}tr^|jd|||fydd|jD}Wntk rg}YnXy |j}Wntk ri}YnXyt|t j } ||kr| rt |||t | nL||ko| rt ||t |n,t ||rt |||ntd|||fWq8tk r\} 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_namerrrrcboolean_optionsrzrrr rrrrmrry) r+ command_obj option_dict command_namerrr0 bool_optsneg_opt is_stringr1rrr_set_command_optionss>          z!Distribution._set_command_optionsFcCs(|j|dt||j|d|jdS)zYParses configuration files from various levels and loads configuration. )r)ignore_option_errorsN)rrrr)r+rrrrrparse_config_filess zDistribution.parse_config_filescCstj|}|jr|j|S)z3Process features after parsing command line options)rparse_command_liner_finalize_features)r+resultrrrrs zDistribution.parse_command_linecCsd|jddS)z;Convert feature name to corresponding option attribute nameZwith_rr)r)r+r/rrr_feature_attrnameszDistribution._feature_attrnamecCs<tjjtj||jdd}x|D]}tjj|ddq W|S)zResolve pre-setup requirementsT) installerreplace_conflicting)r)rsrresolverfetch_build_eggr)r+r'Zresolved_distsr{rrrfetch_build_eggss zDistribution.fetch_build_eggscCstj||jr|jxHtjdD]:}t||jd}|dk r$|j|j d|j ||j|q$Wt|ddrdd|j D|_ ng|_ dS)Nzdistutils.setup_keywords)r#convert_2to3_doctestscSsg|]}tjj|qSr)ospathabspath)rprrrrsz1Distribution.finalize_options..) rfinalize_optionsr_set_global_opts_from_featuresrsrr!r/requirer&loadr()r+r|r0rrrr-s  zDistribution.finalize_optionsc 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. ) r)r*recurdirexistsmkdirrZ hide_filerrF)r+Z egg_cache_dirZreadme_txt_filenamefrrrget_egg_cache_dirs      zDistribution.get_egg_cache_dirc Csddlm}|jddgi}|jd}|j|jdd|jdjD|jr|jdd}d|krx|dd |}d |f|d<|j}||d g|d d dd d d d d d }|j |j|S)z Fetch an egg needed for buildingr) easy_install script_argsr7css"|]\}}|dkr||fVqdS) find_links site_dirs index_urloptimize allow_hostsN)r9r:r;r<r:r=r)rrrrrrrsz/Distribution.fetch_build_egg..Nr9rsetupxTF) args install_dirZexclude_scriptsZ always_copyZbuild_directoryeditableupgradeZ multi_versionZ no_reportr) Zsetuptools.command.easy_installr7 __class__rclearupdatercrr6ensure_finalized)r+rr7r{optslinksrAcmdrrrr&s(   zDistribution.fetch_build_eggc Csg}|jj}x|jjD]\}}|j|d|j||jr|j}d}d}|js^||}}d|dd||fd|dd||ff}|j |d||d|<qW||j |_ |_ ||_|_ dS)z;Add --with-X/--without-X options based on optional featuresNz (default)r~zwith-zinclude zwithout-zexclude ) rcopyrrc _set_featurevalidateoptionalr:include_by_defaultextendglobal_optionsZfeature_optionsZfeature_negopt) r+Zgonor/featuredescrZincdefZexcdefnewrrrr.s"     z+Distribution._set_global_opts_from_featurescCsxJ|jjD]<\}}|j|}|s2|dkr |jr |j||j|dq Wx6|jjD](\}}|j|sX|j||j|dqXWdS)z9Add/remove features and resolve dependencies between themNrr)rrcfeature_is_includedrO include_inrL exclude_from)r+r/rSZenabledrrrr -s    zDistribution._finalize_featurescCs`||jkr|j|Stjd|}x:|D]&}|j|jd|j|j|<}|SWtj||SdS)z(Pluggable version of get_command_class()zdistutils.commands)r#N)cmdclassrsrr/r&r0rget_command_class)r+commandZepsr|rYrrrrZ>s    zDistribution.get_command_classcCs>x2tjdD]$}|j|jkr |j}||j|j<q Wtj|S)Nzdistutils.commands)rsrr/rYr%rprint_commands)r+r|rYrrrr\Ks  zDistribution.print_commandscCs>x2tjdD]$}|j|jkr |j}||j|j<q Wtj|S)Nzdistutils.commands)rsrr/rYr%rget_command_list)r+r|rYrrrr]Ss  zDistribution.get_command_listcCst||j||dS)zSet feature's inclusion statusN)rr")r+r/statusrrrrL[szDistribution._set_featurecCst||j|S)zAReturn 1 if feature is included, 0 if excluded, 'None' if unknown)r!r")r+r/rrrrV_sz Distribution.feature_is_includedcCsF|j|dkr&|j|j}t|d|j|j||j|ddS)z)Request inclusion of feature named 'name'rz2 is required, but was excluded or is not availablerN)rVrr:rrWrL)r+r/rTrrrinclude_featurecs   zDistribution.include_featurecKsDx>|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)rcr! _include_misc)r+rrrincluderrrrans  zDistribution.includecsfd|jr&fdd|jD|_|jrDfdd|jD|_|jrbfdd|jD|_dS)z9Remove packages, modules, and extensions in named packagercs$g|]}|kr|j r|qSr) startswith)rr,)packagepfxrrrsz0Distribution.exclude_package..cs$g|]}|kr|j r|qSr)rb)rr,)rcrdrrrscs(g|] }|jkr|jj r|qSr)r/rb)rr,)rcrdrrrsN)packages py_modules ext_modules)r+rcr)rcrdrexclude_packageszDistribution.exclude_packagecCs4|d}x&|jD]}||ks(|j|rdSqWdS)z.)rsequencer r!rzr)r+r/r0oldr)r0r _exclude_miscs  zDistribution._exclude_miscc st|tstd||fyt||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)z %s: No such distribution settingNz4: this setting cannot be changed via include/excludecsg|]}|kr|qSrr)rrj)rlrrrsz.Distribution._include_misc..)rrkr r!rzr)r+r/r0rUr)rlrr`s   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)rcr!rm)r+rrrexcluderrrrns  zDistribution.excludecCs,t|tstd|ftt|j|dS)Nz.packages: setting must be a list or tuple (%r))rrkr rrrh)r+rerrr_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 liner@) rDrQrrshlexrBr_parse_command_optsrZr!) r+rr@r[rprrrqnargs cmd_classrrrrrs"        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 linerrrrNzShouldn't be able to get herer) rrcrget_command_objrrKrFr!rwr) r+drJrHr rr Zcmdobjrnegposrrrget_cmdline_optionss(     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)rerfrgrtupler/endswith)r+pkgrzextr/Z buildinforrrri-s      z$Distribution.iter_distribution_namescCsddl}tjs|jr tj||St|jtj s:tj||S|jj j dkrVtj||S|jj }|jj }|j dkrtdpvd}|jj}tj |jjd||||_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-8utf8win32 )rr)rr rY help_commandsrhandle_display_optionsrstdoutr TextIOWrapperrrerrorsr=line_bufferingdetach)r+ option_orderrrrnewlinerrrrr?s"     z#Distribution.handle_display_options)N)N)N)NF)-r __module__ __qualname____doc__rrrrrrrr staticmethodrrrrrrrrr"r'r-r6r&r.r rZr\r]rLrVr_rarhrrmr`rnrorrryrirrrrrrQsRB ;  >  /     (c@sPeZdZdZeddZdddfffddZdd Zd d Zd d Z 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)rrr)r1rrrrszFeature.warn_deprecatedFTc Ks|j||_||_||_||_t|ttfr4|f}dd|D|_dd|D}|r^||d<t|trn|f}||_ ||_ | r| r| rt ddS)NcSsg|]}t|tr|qSr)rrZ)rrrrrrsz$Feature.__init__..cSsg|]}t|ts|qSr)rrZ)rrrrrrsrzgFeature %s: must define 'require_features', 'remove', or at least one of 'packages', 'py_modules', etc.) rr:standard availablerNrrZrrremovervr ) r+r:rrrNrrrvZerrrrrs$ zFeature.__init__cCs |jo |jS)z+Should this feature be included by default?)rr)r+rrrrOszFeature.include_by_defaultcCs@|jst|jd|jf|jx|jD]}|j|q*WdS)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 r:rarvrr_)r+r{r5rrrrWs   zFeature.include_incCs2|jf|j|jr.x|jD]}|j|qWdS)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)rnrvrrh)r+r{rjrrrrXs  zFeature.exclude_fromcCs2x,|jD]"}|j|std|j||fqWdS)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 r:)r+r{rjrrrrMs  zFeature.validateN) rrrrrrrrOrWrXrMrrrrrbs7 rc@seZdZdZdS)rzrClass for warning about deprecations in dist in setuptools. Not ignored by default, unlike DeprecationWarning.N)rrrrrrrrrsr)I__all__rrrr)rrZ distutils.logrdistutils.core distutils.cmddistutils.distdistutils.utilrdistutils.debugrdistutils.fancy_getoptrr collectionsremailrdistutils.errorsrr r r Zdistutils.versionr Zsetuptools.externr rZsetuptools.extern.six.movesrrrr~rZsetuptools.dependsr setuptoolsrZsetuptools.monkeyrZsetuptools.configrrs __import__rr-rErrr|rrkr}rrrrrrrrrrrcorerrrrrrrrst              6L