ϪdZddlmZddlZddlZddlmZddlmZddl m Z m Z m Z ddl mZdd lmZmZdd lmZd d lmZd d lmZmZd dlmZe r ddlmZddlmZej e!Z"d.dZ#d/dZ$ d0d1dZ% d2d3dZ& d4d5d#Z'Gd$d%Z(d&Z)ed6d'Z*Gd(d)ej+Z,Gd*d+eZ-Gd,d-eZ.dS)7ac 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)contextmanager)partial) TYPE_CHECKINGCallableMapping)StrPath) FileErrorInvalidConfigError)SetuptoolsWarning)expand)_PREVIOUSLY_DEFINED_MissingDynamic)apply Distribution)Selffilepathr returndictcddlm}t|d5}||cdddS#1swxYwYdS)Nr )tomllibrb) compat.py310ropenload)rrfiles /srv/buildsys-work-dir/castor/build_node/builder-2/WGSG1/unpkd_srcs/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/setuptools/config/pyprojecttoml.py load_filer!"s&&&&&& h  "||D!!""""""""""""""""""s 9==configboolcddlm}|jd}t |dr| ||S#|j$r}d|j}|j ddkr9t |t |j d|j d }t|d |dd}~wwxYw) Nr)_validate_pyprojectztrove-classifier_disable_downloadzconfiguration error: `projectzinvalid pyproject.toml config: . )r%FORMAT_FUNCTIONSgethasattrr&validateValidationErrorsummarynamestrip_loggerdebugdetails ValueError)r"r validatortrove_classifierexr1errors r r/r/)s 222222 1556HII!455-**,,, :!!&)))  $:::6"*66 7==   * * MM' " " " MM"* % % %<"'<<<E..W..//T9:sA C+%BC&&C+FdistrcHt|d||}t|||S)zeApply the configuration from a ``pyproject.toml`` file into an existing distribution object. T)read_configuration_apply)r<rignore_option_errorsr"s r apply_configurationrA>s* $0Dd K KF $ ) ))TDistribution | Nonec~tj|}tj|st d|dt |pi}|di}|di}|di}|r|s|siSd|divrtd|vrtd |r-t|d d | d |j n| d d ||d<||d<t|5|d|id}t||d d d n #1swxYwY|r1tj|} t!|| ||S|S)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])subjectinclude_package_dataNzinclude-package-dataT)r(rE)ospathabspathisfiler r!r-_ToolsTypoInMetadataemit_ExperimentalConfigurationgetattr setdefaultrJ_ignore_errorsr/dirnameexpand_configuration) rrr@r<asdict project_table tool_tablesetuptools_tablesubsetroot_dirs r r>r>Js!6wx((H 7>>( # #LJhJJJKKK x &BFJJy"--MFB''J!~~lB77 -+; vzz'2....!!###j  "''0B'CCC  B4d;;G##$:D@STT  8%+7K  # # % % %  ! !+ . . .  $ $T; 7 7 7  8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 %%d&<==={s/ACC Cc|jd}|t|ttfrdS|d}t|t rp|j|d<|jdi|d<t|j 5tj di||jd<ddddS#1swxYwYdSdS)Npackagesfindr\ package-dirfill_package_dir) rer- isinstancelisttuplerr\rSrTr@rz find_packages)rjrrs r rz _ConfigExpander._expand_packagess8&**:66  z(T5MBB  F||F## dD ! ! P#}D '+':'E'EmUW'X'XD# $ 9:: P P292G2O2O$2O2O#J/ P P P P P P P P P P P P P P P P P P P Ps!CC C c~ttj|j}||jd|dS)N)r\z data-files)rrzcanonic_data_filesr\rwre)rj data_filess r rz"_ConfigExpander._expand_data_filess:W7$-PPP  D/zJJJJJrBrMapping[str, str]c|j}ttj||}||jd|dS)N)rr\cmdclass)r\rrzrrwre)rjrr\rs r rz _ConfigExpander._expand_cmdclasssA=7+xXXX D/XFFFFFrBc dfdjD}|pid|D}j |dS)N)versionreadme entry-pointsscripts gui-scripts classifiers dependenciesoptional-dependenciescHi|]}|v||Sr)_obtain).0rrr<rrjspecials r z7_ConfigExpander._expand_all_dynamic..s@   G## 4<<e[99###rB)rrrroptional_dependenciesci|] \}}||| Srvr)rkvs r rz7_ConfigExpander._expand_all_dynamic.. sNNNDAq 1a rB) rbr_obtain_entry_points_obtain_version_obtain_readme_obtain_classifiers_obtain_dependencies_obtain_optional_dependenciesitemsrd)rjr<robtained_dynamicupdatesrs``` @r rz#_ConfigExpander._expand_all_dynamics               % %dK 8 8 >B(({;;&&t,,006622488"&"D"DT"J"J    ON$4$:$:$<$<NNN (((((rBcpt||}||jsd|d}t|dSdS)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 )rjr<rrpreviousmsgs r _ensure_previously_setz&_ConfigExpander._ensure_previously_set s_&u-d33  D$= YeYYY  %S)) )    rB specifiercddlm}t|j5|j}d|vrP|j||dtj|d|cdddSd|vr(tj |d||cdddStd|d|#1swxYwYdS)Nr)always_iterablerattrz invalid `z`: ) setuptools.extern.more_itertoolsrrTr@r\rirrz read_files read_attrr7)rjr directiverrr\s r _expand_directivez!_ConfigExpander._expand_directives] EDDDDD D5 6 6 F F}H""&--ooi>O.P.PQQQ))F*;XFF  F F F F F F F F ""(6):KRR  F F F F F F F FDDDyDDEE E F F F F F F F FtsAB87B8#B88B<?B<c||jvr%|d||j||S|||dS)Nztool.setuptools.dynamic.)rfrr)rjr<rrrs r rz_ConfigExpander._obtain%s^ D$ $ $))2522 '  ##D%000trBc|d|jvr2d|jvr)tj||d|SdS)Nr)rbrfrzrr)rjr<rs r rz_ConfigExpander._obtain_version/sA  $ $d6F)F)F?4<<i#M#MNN NtrBdict[str, str] | Nonecd|jvrdS|j}d|vr4||di|ddddS||ddS)Nr content-typez text/x-rst)textr)rbrfrr-r)rjr<rfs r rz_ConfigExpander._obtain_readme5s~ 4< ' '4& { " " T8R88 +H 5 9 9., W W  ##D(333trBdict[str, dict] | Nonecd}tfd|DsdS|d|}|dStj|did fd }|dd |d d S) N)rrrc3*K|] }|jvVdSrv)rb)rrrrjs r z7_ConfigExpander._obtain_entry_points..Gs*==U5DL(======rBrrrrsgroupc|vrG|}|jvr"ttj||||<dSdSrv)poprbr rr6)rrrvalueexpandedgroupsrjs r _set_scriptsz:_ConfigExpander._obtain_entry_points.._set_scriptsQsY 5)) ,,,_-DUE-R-RSSS"' rBrconsole_scriptsr gui_scripts)rrrsrrs)anyrrz entry_points)rjr<rfieldsrrrrs` @@r rz$_ConfigExpander._obtain_entry_pointsCs<====f===== 4||D.+>> <4%d++"F+ ( ( ( ( ( ( ( (  Y 1222 ]M222rBcrd|jvr-||di}|r|SdS)Nr)rbr splitlinesrjr<rs r rz#_ConfigExpander._obtain_classifiers]sC DL ( (LL}b99E *'')))trBchd|jvr(||di}|rt|SdS)Nr)rbr_parse_requirements_listrs r rz$_ConfigExpander._obtain_dependenciesds? T\ ) )LL~r::E 7/666trBcdjvrdSdjvrDjd}t|tsJfd|DS|ddS)Nrc fi|]-\}}|td||i.S)z.tool.setuptools.dynamic.optional-dependencies.)rr)rrrrjs r rzA_ConfigExpander._obtain_optional_dependencies..qs`   %E9/**PPP!   rB)rbrfrrrr)rjr<optional_dependencies_maps` r rz-_ConfigExpander._obtain_optional_dependenciesks "$, 6 64 "d&6 6 6(,(89P(Q %7>> > >>    )B(G(G(I(I     ##D*ABBBtrBNFN)r"rr\r]r@r#r<rC)rr)rqrrrrsrtr)rx)rr)r<rrr)r<rrrrs)rrsrr)r<rrrrsrr)r<rrr)r<rrrrr)r<r)__name__ __module__ __qualname__rkrprwr}rrrrrrrrrrrrrrrrBr r_r_s$(%*$( 11111"1111 8888 ::::" P P PKKKGGGG ))))<****        4rBr_c>d|DS)Ncg|]?}||d=|@S)#)r3 startswith)rlines r z,_parse_requirements_list..sV     ::<< !% 7 7 < <     rB)r)rs r rrs/  $$&&   rBc#K|sdVdS dVdS#t$r5}td|jjd|Yd}~dSd}~wwxYw)Nzignored error: z - ) Exceptionr4r5 __class__r)r@r:s r rTrTs  H  HHH F (=FF"FFGGGGGGGGGHs A*A  Ac6eZdZd fd Zd fd Zfd ZxZS) r distributionrrdrrecft|||_||_dSrv)superrk _project_cfg_setuptools_cfg)rjrrdrers r rkz"_EnsurePackagesDiscovered.__init__s3 &&&'-rBrrc|j|j}}|di}||jpi||_|j|jj$|j d|j_|j | d|_ |j | d|_ tS)zWhen entering the context, the values of ``packages``, ``py_modules`` and ``package_dir`` that are missing in ``dist`` are copied from ``setuptools_cfg``. rNr2 py-modulesr)rgrrSrr set_defaults_ignore_ext_modulesmetadatar2rr- py_modulesrr __enter__)rjr<cfgrrs r rz#_EnsurePackagesDiscovered.__enter__sJ 4c&)nn]B&G&G 4+1r222& --/// =  %!%!2!6!6v!>!>DM  ? "!ggl33DO = GGJ//DMww  """rBc|jd|jj|jd|jjt |||S)zWhen exiting the context, if values of ``packages``, ``py_modules`` and ``package_dir`` are missing in ``setuptools_cfg``, copy from ``dist``. rr)rrSrgrrr__exit__)rjexc_type exc_value tracebackrs r rz"_EnsurePackagesDiscovered.__exit__s] '' DJ4GHHH '' dj6KLLLww)Y???rB)rrrdrrer)rr)rrrrkrr __classcell__)rs@r rrs}......######,@@@@@@@@@rBrceZdZdZdS)rQz``{subject}` in `pyproject.toml` is still *experimental* and likely to change in future releases.Nrrr_SUMMARYrrBr rQrQs 3 HHrBrQceZdZdZdS)rOzNIgnoring [tools.setuptools] in pyproject.toml, did you mean [tool.setuptools]?NrrrBr rOrOsX HHrBrO)rr rr)r"rrr rr#)F)r<rrr rr)TFN)rr r<rCr) r"rr\r]r@r#r<rCrr)r@r#)/__doc__ __future__rloggingrK contextlibr functoolsrtypingrrr_pathr errorsr r warningsr r+rrz_apply_pyprojecttomlrrrr?rnrtyping_extensionsr getLoggerrr4r!r/rAr>rVr_rrTEnsurePackagesDiscoveredrrQrOrrBr rs  #""""" %%%%%%333333333322222222((((((FFFFFFFF111111',,,,,,&&&&&& ' H % %""""::::0 * * * * *  $ CCCCCP $!& $ RRRRR.UUUUUUUUpHHHH%@%@%@%@%@ @%@%@%@P!2,rB