3 ]@sdgZddlZddlZddlZddlZddlZddlZddlZddl Zddl Z ddl m Z ddl mZmZmZddlmZddlmZddlmZddlmZdd lmZmZmZdd lmZdd lmZdd l m!Z!dd l"m#Z#ddl$Z$ddl%m&Z&e'de'dddZ(ddZ)ddZ*ddZ+e,e-fZ.ddZ/ddZ0ddZ1d d!Z2d"d#Z3d$d%Z4d&d'Z5d(d)Z6d*d+Z7d,d-Z8d.d/Z9d0d1Z:e!ej;j<Z=Gd2dde&e=ZdS)5 DistributionN) defaultdict)DistutilsOptionErrorDistutilsPlatformErrorDistutilsSetupError) rfc822_escape) StrictVersion)six) packaging)mapfilter filterfalse)Require)windows_support) get_unpatched)parse_configuration)Distribution_parse_config_filesz&setuptools.extern.packaging.specifiersz#setuptools.extern.packaging.versioncCstjdtt|S)NzDo not call this function)warningswarnDeprecationWarningr)clsr5/tmp/pip-build-8jg9gmni/setuptools/setuptools/dist.py_get_unpatched#s rcCsn|js |jrtdS|jdk s8|jdk s8t|dddk r@tdS|js^|js^|js^|j s^|j rftdStdS)Nz2.1python_requiresz1.2z1.1z1.0) long_description_content_typeprovides_extrasr maintainermaintainer_emailgetattrprovidesrequires obsoletes classifiers download_url)Zdist_mdrrrget_metadata_version(s    r&c CsTt|}|jd||jd|j|jd|j|jd|j|jd|j|tdkr|jd|j|jd|jnJd'}xD|D]<\}}t ||}t j r|j |}|dk r|jd||fqW|jd|j |jr|jd|jx"|jjD]}|jd|qWt|j}|jd|dj|j} | rd|jd| |tdkrx4|jD]} |jd| q|Wn|j|d|j|j|d|j|j|d|j|j|d|j|j|d|jt|dr |jd |j|jr$|jd!|j|jrPx"t|jD]} |jd"| q8WdS)(z5Write the PKG-INFO format data to a file object. zMetadata-Version: %s z Name: %s z Version: %s z Summary: %s zHome-page: %s z1.2z Author: %s zAuthor-email: %s Authorauthor Author-email author_email MaintainerrMaintainer-emailrNz%s: %s z License: %s zDownload-URL: %s zProject-URL: %s, %s zDescription: %s ,z Keywords: %s z Platform: %s Platform ClassifierRequiresProvides ObsoletesrzRequires-Python: %s zDescription-Content-Type: %s zProvides-Extra: %s r'r(r)r*r+rr,r)r3r4r5r6) r&writeget_name get_versionget_descriptionget_urlr get_contactget_contact_emailr r PY2Z _encode_field get_licenser% project_urlsitemsrget_long_descriptionjoin get_keywords get_platforms _write_listget_classifiers get_requires get_provides get_obsoleteshasattrrrrsorted) selffileversionZoptional_fieldsfieldattrZattr_valZ project_url long_desckeywordsplatformextrarrrwrite_pkg_file7s\      rVc Cs2ttjj|dddd}|j|WdQRXdS)z3Write the PKG-INFO file into the release tree. zPKG-INFOwzUTF-8)encodingN)openospathrCrV)rMbase_dirpkg_inforrrwrite_pkg_infos r^cCsRy tjjd|}|j stWn,ttttfk rLtd||fYnXdS)Nzx=z4%r must be importable 'module:attrs' string (got %r)) pkg_resources EntryPointparseextrasAssertionError TypeError ValueErrorAttributeErrorr)distrQvalueeprrrcheck_importablesrjcCsHydj||kstWn,ttttfk rBtd||fYnXdS)z*Verify that value is a string list or Nonez%%r must be a list of strings (got %r)N)rCrcrdrerfr)rgrQrhrrrassert_string_lists rlcCsh|}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)rlhas_contents_forr rpartition distutilslogr)rgrQrhZ ns_packagesnspparentsepchildrrr check_nsps     rvc 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_extrarArdrerfr)rgrQrhrrr check_extrass r{cCs<|jd\}}}|r*tj|r*td|ttj|dS)N:zInvalid environment marker: ) partitionr_invalid_markerrrwparse_requirements)rUreqsnamertmarkerrrrrzs rzcCs&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}))rQrhN)boolrformat)rgrQrhtmplrrr 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})rQerrorN) rwr_r isinstancedictsetrdrerr)rgrQrhrrrrrcheck_requirementss 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})rQrN)r specifiers SpecifierSetInvalidSpecifierrr)rgrQrhrrrrrcheck_specifiers rcCs@ytjj|Wn*tk r:}zt|WYdd}~XnXdS)z)Verify that entry_points map is parseableN)r_r` parse_maprer)rgrQrherrrcheck_entry_pointssrcCst|tjstddS)Nztest_suite must be a string)rr string_typesr)rgrQrhrrrcheck_test_suites 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)rrrAstriterrdr)rgrQrhkvrrrcheck_package_datas    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)rematchrprqr)rgrQrhpkgnamerrrcheck_packagess   rc@s$eZdZdZdZddZdFddZddZd d Ze d d Z d dZ ddZ dGddZ ddZddZddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Z d:d;Z!dd?Z#d@dAZ$dBdCZ%dDdEZ&dS)HraDistribution 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. NcCsp| sd|ksd|krdStjt|dj}tjjj|}|dk rl|jd rltjt|d|_ ||_ dS)NrrOzPKG-INFO) r_ safe_namerlower working_setby_keyget has_metadata safe_version_version _patched_dist)rMattrskeyrgrrrpatch_missing_pkg_infoVsz#Distribution.patch_missing_pkg_infoc Cst|d}|si|_|pi}d|ks,d|kr4tjg|_i|_g|_|jdd|_|j ||j di|_ |jdg|_ |jdg|_ x$tjdD]}t|j|jdqWtj||t|jd|j |j_ |j d |j_t|jd t|j_t|jjtjrt|jj|j_|jjdk ryHtjj |jj}t|}|jj|krft!j"d |jj|f||j_Wn0tjj#t$fk rt!j"d |jjYnX|j%dS) N package_datafeaturesrequire_featuressrc_rootr@dependency_linkssetup_requireszdistutils.setup_keywordsrrzNormalizing '%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.)&rKrFeaturewarn_deprecatedrr dist_filespoprrrr@rrr_iter_entry_pointsvars setdefaultr _Distribution__init__r metadatarrrrrOnumbersNumberrr VersionrrInvalidVersionrd_finalize_requires)rMrZhave_package_datariverZnormalized_versionrrrrcsP      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`. rNextras_requirer|r) r rrrkeyssplitradd_convert_extras_requirements"_move_install_requirements_markers)rMrUrrrrs   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 rrw_tmp_extras_requirerAr_r _suffix_forappend)rMZ spec_ext_reqssectionrrsuffixrrrrs   z)Distribution._convert_extras_requirementscCs|jrdt|jSdS)ze For a requirement, return the 'extras_require' suffix for that requirement. r|rk)rr)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_requiresNr|c3s,|]$\}}|ddtj|DfVqdS)cSsg|] }t|qSr)r).0rrrr szMDistribution._move_install_requirements_markers...N)r _clean_req)rrr)rMrr szBDistribution._move_install_requirements_markers..)r rwr_rr r r rrrrrrrAr)rMrZspec_inst_reqsZ inst_reqsZ simple_reqsZ complex_reqsrr)rMrrs     z/Distribution._move_install_requirements_markerscCs d|_|S)zP Given a Requirement, remove environment markers and return it. N)r)rMrrrrrszDistribution._clean_reqFcCs*tj||dt||j|d|jdS)zYParses configuration files from various levels and loads configuration. ) filenames)ignore_option_errorsN)rparse_config_filesrcommand_optionsr)rMrrrrrrszDistribution.parse_config_filescCstj|}|jr|j|S)z3Process features after parsing command line options)rparse_command_liner_finalize_features)rMresultrrrrs zDistribution.parse_command_linecCsd|jddS)z;Convert feature name to corresponding option attribute nameZwith_-_)replace)rMrrrr_feature_attrnameszDistribution._feature_attrnamecCs<tjjtj||jdd}x|D]}tjj|ddq W|S)zResolve pre-setup requirementsT) installerreplace_conflicting)r)r_rresolverfetch_build_eggr)rMr"Zresolved_distsrgrrrfetch_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)rconvert_2to3_doctestscSsg|]}tjj|qSr)rZr[abspath)rprrrrsz1Distribution.finalize_options..) rfinalize_optionsr_set_global_opts_from_featuresr_rr rrequirerloadr)rMrirhrrrrs  zDistribution.finalize_optionsc Csvtjjtjd}tjj|srtj|tj|tjj|d}t|d$}|j d|j d|j dWdQRX|S)Nz.eggsz README.txtrWzcThis 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. ) rZr[rCcurdirexistsmkdirrZ hide_filerYr7)rMZ 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_argsrcss"|]\}}|dkr||fVqdS) find_links site_dirs index_urloptimize allow_hostsN)rrrrrrr)rrrrrrr0sz/Distribution.fetch_build_egg..NrrsetupxTF) args install_dirZexclude_scriptsZ always_copyZbuild_directoryeditableupgradeZ multi_versionZ no_reportuser) Zsetuptools.command.easy_installr __class__get_option_dictclearupdaterArrensure_finalized)rMrrrgoptslinksrcmdrrrr)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)rkzwith-zinclude zwithout-zexclude ) negative_optcopyrrA _set_featurevalidateoptional descriptioninclude_by_defaultextendglobal_optionsZfeature_optionsZfeature_negopt) rMZgonorfeaturedescrZincdefZexcdefnewrrrrFs"     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)rrAfeature_is_includedr  include_inr exclude_from)rMrrZenabledrrrras    zDistribution._finalize_featurescCs`||jkr|j|Stjd|}x:|D]&}|j|jd|j|j|<}|SWtj||SdS)z(Pluggable version of get_command_class()zdistutils.commands)rN)cmdclassr_rrrrrget_command_class)rMcommandZepsrirrrrrrs    zDistribution.get_command_classcCs>x2tjdD]$}|j|jkr |j}||j|j<q Wtj|S)Nzdistutils.commands)r_rrrrrprint_commands)rMrirrrrrs  zDistribution.print_commandscCs>x2tjdD]$}|j|jkr |j}||j|j<q Wtj|S)Nzdistutils.commands)r_rrrrrget_command_list)rMrirrrrrs  zDistribution.get_command_listcCst||j||dS)zSet feature's inclusion statusN)setattrr)rMrstatusrrrrszDistribution._set_featurecCst||j|S)zAReturn 1 if feature is included, 0 if excluded, 'None' if unknown)r r)rMrrrrrsz 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)rrr rrr)rMrrrrrinclude_features   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.exclude(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)rAr _include_misc)rMrrrincluderrrrs  zDistribution.includecsfd|jr&fdd|jD|_|jrDfdd|jD|_|jrbfdd|jD|_dS)z9Remove packages, modules, and extensions in named packagermcs$g|]}|kr|j r|qSr) startswith)rr)packagepfxrrrsz0Distribution.exclude_package..cs$g|]}|kr|j r|qSr)r)rr)r r!rrrscs(g|] }|jkr|jj r|qSr)rr)rr)r r!rrrsN)packages py_modules ext_modules)rMr r)r r!rexclude_packageszDistribution.exclude_packagecCs4|d}x&|jD]}||ks(|j|rdSqWdS)z.)rsequencerr rfr)rMrrholdr)rhr _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)rr')r)rrrsz.Distribution._include_misc..)rr(rr rfr)rMrrhrr)r)rrs   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)rAr r*)rMrrrexcluderrrr+s  zDistribution.excludecCs,t|tstd|ftt|j|dS)Nz.packages: setting must be a list or tuple (%r))rr(rrwr r%)rMr"rrr_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) rr rrshlexrr_parse_command_optsrr ) rMparserrrr-srcaliasr.nargs cmd_classrrrr/s"        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) rrArget_command_objrrrr rcr) rMdrroptr1valZcmdobjneg_optnegposrrrget_cmdline_options9s(     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)r"r#r$rtuplerendswith)rMpkgr=extrZ buildinforrrr&as      z$Distribution.iter_distribution_namescCsddl}tjs|jr tj||Sddl}t|j|j sBtj||S|jj j dkr^tj||S|jj }|jj }|j dkr|dp~d}|jj}|j |jjd||||_z tj||S|j |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 )rCrD)sysr r> help_commandsrhandle_display_optionsiorstdout TextIOWrapperrXrerrorsrTline_bufferingdetach)rM option_orderrGrJrXrMnewlinerNrrrrIss$     z#Distribution.handle_display_options)N)NF)'__name__ __module__ __qualname____doc__rrrrr staticmethodrrrrrrrrrrrrrrrrrrrr%rnr*rr+r,r/r<r&rIrrrrrsFB 7      (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)msgrrrrszFeature.warn_deprecatedFTc Ks|j||_||_||_||_t|ttfr4|f}dd|D|_dd|D}|r^||d<t|trn|f}||_ ||_ | r| r| rt ddS)NcSsg|]}t|tr|qSr)rr)rrrrrrsz$Feature.__init__..cSsg|]}t|ts|qSr)rr)rrrrrrsrzgFeature %s: must define 'require_features', 'remove', or at least one of 'packages', 'py_modules', etc.) rr standard availabler rrrrremoverbr) rMr rZr[r rr\rbZerrrrrs$ zFeature.__init__cCs |jo |jS)z+Should this feature be included by default?)r[rZ)rMrrrr szFeature.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)r[rr rrbrr)rMrgrrrrrs   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)r+rbr\r%)rMrgr'rrrrs  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)r\rnrr )rMrgr'rrrrs  zFeature.validateN) rRrSrTrUrVrrr rrrrrrrrs7 r)?__all__rrZrrZ distutils.logrpdistutils.core distutils.cmddistutils.distrx collectionsrZdistutils.errorsrrrdistutils.utilrZdistutils.versionrZsetuptools.externr r Zsetuptools.extern.six.movesr r r Zsetuptools.dependsr setuptoolsrZsetuptools.monkeyrZsetuptools.configrr_Z py36compatr __import__rr&rVr^r?rwr(rjrlrvr{rzrrrrrrrcorerrrrrrrsb          H