K iGdZddlmZddlZddlZddlmZddlmZddl m Z ddl m Z ddl mZmZmZd d lmZd d lmZmZd d lmZd dlmZd dlmZmZmZer ddl m!Z!ddl"m#Z#ejHe%Z&d!dZ'd"dZ( d# d$dZ) d% d&dZ* d' d(dZ+GddZ,dZ-ed)dZ.Gddej^Z0GddeZ1Gdd eZ2y)*ac Load setuptools configuration from ``pyproject.toml`` files. **PRIVATE MODULE**: API reserved for setuptools internal usage only. To read project metadata, consider using ``build.util.project_wheel_metadata`` (https://pypi.org/project/build/). For simple scenarios, you can also try parsing the file directly with the help of ``tomllib`` or ``tomli``. ) annotationsN)Mapping)contextmanager)partial) TracebackType) TYPE_CHECKINGAnyCallable)StrPath) FileErrorInvalidConfigError)SetuptoolsWarning)expand)_PREVIOUSLY_DEFINED_MissingDynamicapply)Self Distributionctddlm}t|d5}|j|cdddS#1swYyxYw)Nr )tomllibrb) compat.py310ropenload)filepathrfiles e/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/setuptools/config/pyprojecttoml.py load_filer!$s2& h "||D!"""s.7cddlm}|jjd}t |dr|j  |j |S#|j$r}d|j}|jjddk7r4tj|tj|jd|jd }t|d |dd}~wwxYw) Nr)_validate_pyprojectztrove-classifier_disable_downloadzconfiguration error: `projectzinvalid pyproject.toml config: . )r#FORMAT_FUNCTIONSgethasattrr$validateValidationErrorsummarynamestrip_loggerdebugdetails ValueError)configr validatortrove_classifierexr/errors r r-r-+s2 11556HI!45**, :!!&))  $ $:)"**6 77==  * MM' " MM"** %1"''!<E7"WI./T9:sAC&BC!!C&c8t|d||}t|||S)zeApply the configuration from a ``pyproject.toml`` file into an existing distribution object. T)read_configuration_apply)distrignore_option_errorsr6s r apply_configurationr@@s$ $0Dd KF $ ))cDtjj|}tjj|st d|dt |xsi}|j di}|j di}|j di}|r|s|siSd|j divrtjd|vrtjd |r)|j|jd |jn|jd d ||d<||d<d |vrtjd t|5|d|id}t||d d d |r-tjj|} t|| ||S|S#1swY:xYw)aRead given configuration file and returns options from it as a dict. :param str|unicode filepath: Path to configuration file in the ``pyproject.toml`` format. :param bool expand: Whether to expand directives and other computed values (i.e. post-process the given configuration) :param bool ignore_option_errors: Whether to silently ignore options, values of which could not be resolved (e.g. due to exceptions in directives such as file:, attr:, etc.). If False exceptions are propagated as expected. :param Distribution|None: Distribution object to which the configuration refers. If not given a dummy object will be created and discarded after the configuration is read. This is used for auto-discovery of packages and in the case a dynamic configuration (e.g. ``attr`` or ``cmdclass``) is expanded. When ``expand=False`` this object is simply ignored. :rtype: dict zConfiguration file z does not exist.r&tool setuptoolstools distutilsz[tool.distutils])subjectNzinclude-package-dataTz ext-modulesz[tool.setuptools.ext-modules])r&rC)ospathabspathisfiler r!r+_ToolsTypoInMetadataemit_ExperimentalConfigurationinclude_package_data setdefault_ignore_errorsr-dirnameexpand_configuration) rrr?r>asdict project_table tool_tablesetuptools_tablesubsetroot_dirs r r<r<Ls6wwx(H 77>>( #-h\9IJKK x &BFJJy"-MFB'J!~~lB7 -+; vzz'2..!!#j "''0B'C  ))5##$:Ds r rSrSs( 68-A4 H O O QQrAceZdZ d ddZddZddZddZdZdZdZ dd Z dd Z dd Z dd Z dd ZddZddZ ddZd dZd dZd dZy)!r[Nc||_|xstj|_|j di|_|j j dg|_|j dij di|_|jj di|_||_ ||_ tt|_ y)Nr&dynamicrCrD)r6rHgetcwdrYr+ project_cfgr^setuptools_cfg dynamic_cfgr?_distsetstr_referenced_files)selfr6rYr?r>s r __init__z_ConfigExpander.__init__s  /BIIK !::i4''++Ir: $jj488rJ..229bA$8! !$SrAcddlm}|j|jj ddd}|j xs||S)Nrrr0)src_rootr0)setuptools.distrrYr`r+rc)rgrattrss r _ensure_distz_ConfigExpander._ensure_dists;0!]]D4D4D4H4HQU4VWzz0\%00rAc~||vr-t|j5|||||<dddyy#1swYyxYwN)rQr?)rg containerfieldfns r _process_fieldz_ConfigExpander._process_fieldsK I  9 9: 8#%i&6#7 %  8 8  8 8s3<cd|jj|i}tj|Sro)rar+_expandcanonic_package_data)rgrq package_datas r _canonic_package_dataz%_ConfigExpander._canonic_package_datas+**..ub9 ++L99rAc|j|j|jd|j}t||j|j }|5}|j }|j|j||j||ddd|jj|j|jS#1swY:xYw)Nzexclude-package-data) _expand_packagesrxrm_EnsurePackagesDiscoveredr`ra package_dir_expand_data_files_expand_cmdclass_expand_all_dynamicrfupdater6)rgr>ctxensure_discoveredr|s r rz_ConfigExpander.expands  ""$ ""#9:  "'d.>.>@S@ST  8%+77K  # # %  ! !+ .  $ $T; 7  8 %%d&<&<={{ 8 8s %ACC'c|jjd}|t|ttfry|jd}t|t ro|j |d<|jjdi|d<t|j5tjdi||jd<dddyy#1swYyxYw)NpackagesfindrY package-dirfill_package_dir) rar+ isinstancelisttupledictrYrPrQr?ru find_packages)rgrrs r rzz _ConfigExpander._expand_packagess&&**:6  z(T5MB ||F# dD !#}}D '+':':'E'EmUW'XD# $ 9 9: P292G2G2O$2O##J/ P P " P Ps #CCcttj|j}|j |j d|y)N)rYz data-files)rrucanonic_data_filesrYrsra)rg data_filess r r}z"_ConfigExpander._expand_data_filess0W77$--P  D//zJrAc|j}ttj||}|j |j d|y)N)r|rYcmdclass)rYrrurrsra)rgr|rYrs r r~z _ConfigExpander._expand_cmdclasss7==7++xX D//XFrAc d}|jDcic]}||vr||j|||}}|j|j||xsi|j |||j ||j ||j||j||jDcic] \}}| || }}}|jj|ycc}wcc}}w)N)versionreadme entry-pointsscripts gui-scripts classifiers dependenciesoptional-dependencies)rrrroptional_dependencies) r^_obtainr_obtain_entry_points_obtain_version_obtain_readme_obtain_classifiers_obtain_dependencies_obtain_optional_dependenciesitemsr`) rgr>r|specialrqobtained_dynamickvupdatess r rz#_ConfigExpander._expand_all_dynamics   G# 4<<e[9 9    % %dK 8 >B(({;&&t,0062248"&"D"DT"J  %5$:$:$<NDAq 1a4NN (! OsC+< C0C0c`t||}||jsd|d}t|yy)Nz#No configuration found for dynamic z. Some dynamic fields need to be specified via `tool.setuptools.dynamic` others must be specified via the equivalent attribute in `setup.py`.)rr?r)rgr>rqpreviousmsgs r _ensure_previously_setz&_ConfigExpander._ensure_previously_setsL&u-d3  D$=$=5eY?YY  %S) ) %> rAcnddlm}t|j5|j}d|vrF|j j ||dtj|d|cdddSd|vr#tj|d||cdddStd|d|#1swYyxYw)Nr)always_iterablerattrz invalid `z`: ) more_itertoolsrrQr?rYrfrru read_files read_attrr5)rg specifier directiver|rrYs r _expand_directivez!_ConfigExpander._expand_directives 3 D55 6 F}}H"&&--oi>O.PQ)))F*;XF  F F "((6):KR  F Fy 3ymDE E FsA B+3B+B++B4c||jvr#|jd||j||S|j||y)Nztool.setuptools.dynamic.)rbrr)rgr>rqr|s r rz_ConfigExpander._obtain*sS D$$ $))*5'2  '  ##D%0rAcd|jvr4d|jvr&tj|j |d|Sy)Nr)r^rbrurr)rgr>r|s r rz_ConfigExpander._obtain_version4sA  $d6F6F)F?? T9k: rAcd|jvry|j}d|vr)|j|di|djdddS|j |dy)Nr content-typez text/x-rst)textr)r^rbrr+r)rgr>rbs r rz_ConfigExpander._obtain_readme=sj 4<< '&& { " T8R8 +H 5 9 9., W  ##D(3rAcd}tfd|Dsyj|d|}|ytj|did fd }|dd|ddS) N)rrrc3:K|]}|jvywro)r^).0rqrgs r z7_ConfigExpander._obtain_entry_points..Ps=U5DLL(=src|vrDj|}|jvrttj||||<yyro)popr^rrr4)rqgroupvalueexpandedgroupsrgs r _set_scriptsz:_ConfigExpander._obtain_entry_points.._set_scripts[sJ 5) ,,_-D-DUE-RSS"' rArconsole_scriptsr gui_scripts)rqrerre)anyrru entry_points)rgr>r|fieldsrrrrs` @@r rz$_ConfigExpander._obtain_entry_pointsLsp<=f==||D.+> <%%d+/=v.F ( Y 12]M2rAcjd|jvr%|j|di}|r|jSy)Nr)r^r splitlinesrgr>rs r rz#_ConfigExpander._obtain_classifiersgs5 DLL (LL}b9E''))rAc`d|jvr |j|di}|r t|Sy)Nr)r^r_parse_requirements_listrs r rz$_ConfigExpander._obtain_dependenciesns1 T\\ )LL~r:E/66rAc 2d|jvryd|jvrb|jd}t|tsJ|j Dcic]%\}}|t |j d||i'c}}S|j|dycc}}w)Nrz.tool.setuptools.dynamic.optional-dependencies.)r^rbrrrrrr)rgr>optional_dependencies_maprrs r rz-_ConfigExpander._obtain_optional_dependenciesus "$,, 6 "d&6&6 6(,(8(89P(Q %7> >>)B(G(G(I %E9/**HP!   ##D*AB s*BNFN) r6rrYStrPath | Noner?boolr>Distribution | NonereturnNone)rr)rprrqrerrr )z package-data)r|Mapping[str, str])r>rr|r)r>rrqre)rrer|r)r>rrqrer|r)r>rrzdict[str, str] | None)r>rr|rrz dict[str, dict[str, Any]] | None)r>r)__name__ __module__ __qualname__rhrmrsrxrrzr}r~rrrrrrrrrrrrAr r[r[s$(%*$( ,,!,# , " ,  ,"1 8 :" PKG )<*  6G   /@ )6rAr[c|jDcgc]3}|jr!|jjds|5c}Scc}w)N#)rr1 startswith)rlines r rrsI$$&   ::< 7 7 <   s8Ac#K|sdy dy#t$r9}tjd|jjd|Yd}~yd}~wwxYww)Nzignored error: z - ) Exceptionr2r3 __class__r)r?r9s r rQrQsP  H H  (=(='>c"FGGHs*AA A/A A AAcXeZdZ dfd Zdfd Z dfd ZxZS)r{c@t||||_||_yro)superrh _project_cfg_setuptools_cfg)rg distributionr`rars r rhz"_EnsurePackagesDiscovered.__init__s" &'-rAc|j|j}}|jdi}|j|jxsi||_|j j |jj*|jjd|j_|j|jd|_ |j|jd|_ t|9S)zWhen entering the context, the values of ``packages``, ``py_modules`` and ``package_dir`` that are missing in ``dist`` are copied from ``setuptools_cfg``. rr0 py-modulesr)rcrrPrr| set_defaults_ignore_ext_modulesmetadatar0rr+ py_modulesrr __enter__)rgr>cfgr|rs r rz#_EnsurePackagesDiscovered.__enter__sJJ 4 4c&)nn]B&G 4++1r2& --/ ==   %!%!2!2!6!6v!>DMM  ?? "!ggl3DO == GGJ/DMw ""rAc|jjd|jj|jjd|jjt ||||S)zWhen exiting the context, if values of ``packages``, ``py_modules`` and ``package_dir`` are missing in ``setuptools_cfg``, copy from ``dist``. rr)rrPrcrrr__exit__)rgexc_type exc_value tracebackrs r rz"_EnsurePackagesDiscovered.__exit__sY '' DJJ4G4GH '' djj6K6KLw)Y??rA)rrr`rrarrr)rr)rztype[BaseException] | NonerzBaseException | NonerzTracebackType | Nonerr)rrrrhrr __classcell__)rs@r r{r{sc.(.7;.MQ. .#, @, @( @( @  @ @rAr{ceZdZdZy)rNz``{subject}` in `pyproject.toml` is still *experimental* and likely to change in future releases.Nrrr_SUMMARYrrAr rNrNs  3 rArNceZdZdZy)rLzNIgnoring [tools.setuptools] in pyproject.toml, did you mean [tool.setuptools]?NrrrAr rLrLs X rArL)rr rr)r6rrr rr)F)r>rrr r?rrr)TFN) rr rrr?rr>rrzdict[str, Any]r) r6rrYrr?rr>rrr)r?r)3__doc__ __future__rloggingrHcollections.abcr contextlibr functoolsrtypesrtypingrr r _pathr errorsr rwarningsrr)rru_apply_pyprojecttomlrrrr=typing_extensionsrrkr getLoggerrr2r!r-r@r<rSr[rrQEnsurePackagesDiscoveredr{rNrLrrAr r sl # #%//2(WW&, '  H %":0"' *  * * * *!& $ FF FF  F  FV $!& $ R RRR  R  R.ZZzHH*@ @ @*@Z!2,rA