a oe9@sUdZddlZddlZddlmZddlmZddlmZm Z ddl m Z ddl m Z ddlmZdd lmZmZmZmZmZmZmZmZmZmZmZd d lmZd d lmZerdd l m!Z!ddl"m#Z#eiZ$ee%d<eej&e'fZ(ee)e'fZ*edee(gdfZ+ee'e+fZ,e-e.Z/de)e(ddddZ0de)e(dddZ1de)e(dddZ2de)dddZ3e'e'dddZ4de'ed d!d"Z5d#d$d%d&Z6e'ee'd'd(d)Z7de*e(d*d+d,Z8de)e(d*d-d.Z9dee)e(e'd/d0d1Z:de)d2d3d4Z;de)d2d5d6Zde)d2d9d:Z?e)d;dd?d@ZAe$feee'ee'fdAdBdCZBdDeee'efdEdFdGZCe'e'dHdIdJZDeee'ee'e'fee'dKdLdMZEdee'e=fdNdOdPZFdee=dNdQdRZGdee=dNdSdTZHdUdVZIdWdXZJe8e9ee:dYdZee:d[dZe;e>e?e\}}t|}t||}t|rd||||q2t|||q2dS)Nproject) getcopy_handle_missing_dynamic_unify_entry_pointsitemsjson_compatible_keyPYPROJECT_CORRESPONDENCEcallable _set_config)rrr( project_tablefieldvaluenorm_keyZcorrespr)r)r*r$Fs  r$)rrrc Cs|didi}|sdS|D]^\}}t|}|tvrjtt|}d|d}tdt||gt||}t|||q$t |||dS)Ntool setuptoolsz, The parameter `tool.setuptools.zZ` was long deprecated and has been removed from `pyproject.toml`.  ) r-r1r2TOOL_TABLE_REMOVALSrrjoinTOOL_TABLE_RENAMESr5_copy_command_options) rrr tool_tabler7r8r9Z suggestionmsgr)r)r*r%Ws  r%)rr6cCs^t|dg}tD]@\}}||vs||vs||}|rtj||dt|||<qdS)zJBe temporarily forgiving with ``dynamic`` fields not listed in ``dynamic``dynamicr7r8N)setr-_PREVIOUSLY_DEFINEDr1_MissingDynamicemit_RESET_PREVIOUSLY_DEFINED)rr6rCr7getterr8r)r)r*r/msr/)keyrcCs|ddS)z1As defined in :pep:`566#json-compatible-metadata`-_)lowerreplace)rKr)r)r*r2xsr2)rr7r8cCsVt|jd|d}|r"||n0t|j|s6|tvrFt|j||n t|||dS)NZset_)getattrrhasattrSETUPTOOLS_PATCHESsetattr)rr7r8setterr)r)r*r5}s  r5z text/markdownz text/x-rstz text/plain)z.mdz.rstz.txt)filercCshtj|\}}|sdS|tvr,t|SdddtD}d|d}td|d|dS)N, css"|]\}}|d|dVqdS)z ()Nr).0kvr)r)r* z&_guess_content_type..z3only the following file extensions are recognized: r zUndefined content type for )r!r"splitextrN_CONTENT_TYPESr>r1 ValueError)rUrMextvalidrBr)r)r*_guess_content_types rc)rvalr(cCsddlm}t|tr0|}|||}t|}n,|dp)rrdrrrsr7Z email_fieldZpersonZaddrr)r)r*_peoplesrv)rrdcCst|d|dS)N project_urls)r5)rrdrrr)r)r* _project_urlssrxcCs ddlm}t|d||dS)Nr) SpecifierSetpython_requires)Z&setuptools.extern.packaging.specifiersryr5)rrdrrryr)r)r*_python_requiress r{cCs$t|dgrd}t|||_dS)Ninstall_requireszA`install_requires` overwritten in `pyproject.toml` (dependencies))rPrrHr|)rrdrrrBr)r)r* _dependenciess  r}cCs"t|ddpi}i|||_dS)Nextras_require)rPr~)rrdrrexistingr)r)r*_optional_dependenciessr)r6cCsx|}|d|di}ddd}t|D]*\}}t|}||vr.|||||<q.|rtdd|D|d<dS)N entry-points entry_pointsconsole_scripts gui_scripts)scriptsrcSs(i|] \}}|r|dd|DqS)cSsg|]\}}|d|qS)z = r)rXr)r)r* r]z2_unify_entry_points...r1)rYrtgroupr)r)r* sz'_unify_entry_points..)poplistr1r2)r6r,rZrenamingrKr8r9r)r)r*r0s r0) pyprojectrrc Cs|di}|didi}t|}|j}|didiD]x\}}t|}||t} ||i|D]D\} } t| } t|| f||| <| | vrxt d|d| dqxqFdS)Nr:r;cmdclassZ distutilszCommand option r z is not defined) r-_valid_command_optionsZcommand_optionsr1r2rE setdefaultrk_loggerwarning) rrrrAr valid_optionsZcmd_optscmdrrbrKr8r)r)r*r@s   r@)rrc Csddlm}ddlm}dt|ji}|jdd}dd |D}d d |D}t||D]2\}}| |t } | tt |d gB} | ||<q\|S) Nrrrrglobalzdistutils.commands)rcss|]}t|VqdSN)_load_eprYepr)r)r*r\r]z)_valid_command_options..css|]}|r|VqdSrr)rr)r)r*r\r]Z user_options) Z _importlibrsetuptools.distr_normalise_cmd_optionsZglobal_optionsrrr1r-rErP) rrrrZunloaded_entry_pointsZloaded_entry_pointsrrZ cmd_classZoptsr)r)r*r s    rzmetadata.EntryPoint)rrc Csdz|j|fWSty^}z6|jjd|j}t|d|WYd}~dSd}~00dS)Nz" while trying to load entry-point z: )rtload Exception __class____name__rr)rexrBr)r)r*rs r)rtrcCst|dS)Nz_=)r2strip)rtr)r)r*_normalise_cmd_option_key$sr)descrcCsdd|DS)NcSsh|]}t|dqS)r)r)rYZ fancy_optionr)r)r* )r]z)_normalise_cmd_options..r))rr)r)r*r(sr)rrcs*dt|ddpi}fdd|DS)N)rrrcsi|]\}}|vr||qSr)r)rXignorer)r*r/r]z-_get_previous_entrypoints..)rPr1rr8r)rr*_get_previous_entrypoints,srcCst|ddpi}|dS)NrrrPr-rr)r)r*_get_previous_scripts2srcCst|ddpi}|dS)Nrrrrr)r)r*_get_previous_gui_scripts7srcCsttdd|dS)a8 Similar to ``operator.attrgetter`` but returns None if ``attr`` is not found >>> from types import SimpleNamespace >>> obj = SimpleNamespace(a=42, b=SimpleNamespace(c=13)) >>> _attrgetter("a")(obj) 42 >>> _attrgetter("b.c")(obj) 13 >>> _attrgetter("d")(obj) is None True cSs t||dSr)rP)Zaccxr)r)r*Hr]z_attrgetter..r )rrsplit)attrr)r)r* _attrgetter<s rcsfdd}|S)aL Return the first "truth-y" attribute or None >>> from types import SimpleNamespace >>> obj = SimpleNamespace(a=42, b=SimpleNamespace(c=13)) >>> _some_attrgetter("d", "a", "b.c")(obj) 42 >>> _some_attrgetter("d", "e", "b.c", "a")(obj) 13 >>> _some_attrgetter("d", "e", "f")(obj) is None True cs&fddD}tdd|DdS)Nc3s|]}t|VqdSr)rrYiobjr)r*r\Yr]z5_some_attrgetter.._acessor..css|]}|dur|VqdSrr)rr)r)r*r\Zr])next)rvaluesrrr*_acessorXsz"_some_attrgetter.._acessorr))r1rr)rr*_some_attrgetterKs rZauthor)rsZ maintainer)readmerpauthors maintainersurls dependenciesZoptional_dependenciesZrequires_pythonr3Z script_filesrZnamespace_packagesz Please migrate to implicit native namespaces instead. See https://packaging.python.org/en/latest/guides/packaging-namespace-packages/. >rhZ license_filesZprovides_extrasZ license_filerwz metadata.namezmetadata.versionzmetadata.descriptionzmetadata.long_descriptionrzzmetadata.python_requireszmetadata.licensezmetadata.authorzmetadata.author_emailzmetadata.maintainerzmetadata.maintainer_emailzmetadata.keywordszmetadata.classifierszmetadata.project_urlsr|r~)rtversion descriptionrzrequires-pythonrprrkeywords classifiersrrr gui-scriptsroptional-dependencies) rprrrrrrrrrrrIc@s*eZdZdZdZeeeedddZdS)rGz9`{field}` defined outside of `pyproject.toml` is ignored.a The following seems to be defined outside of `pyproject.toml`: `{field} = {value!r}` According to the spec (see the link below), however, setuptools CANNOT consider this value unless `{field}` is listed as `dynamic`. https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ To prevent this problem, you can list `{field}` under `dynamic` or alternatively remove the `[project]` table from your file and rely entirely on other means of configuration. )r7r8rcCs|jj||dS)NrD)_DETAILSformat)clsr7r8r)r)r*detailssz_MissingDynamic.detailsN) r __module__ __qualname__Z_SUMMARYr classmethodrkr rr)r)r)r*rGsrG)R__doc__Zloggingr!collections.abcrZemail.headerregistryr functoolsrrinspectr itertoolsrtypesrtypingr r r r r rrrrrrerrorsrwarningsrZsetuptools._importlibrrrr__annotations__PathLikerkZ_PathdictZ _DictOrStrZ _CorrespFnZ_CorrespondenceZ getLoggerrrr+r$r%r/r2r5r_rcrorqrvrxr{rr}rr0r@rrrrrrrrrr3r?r=rRrFrIrGr)r)r)r*s      4             &