bgGdZddlmZddlZddlZddlmZddlmZddl m Z ddl m Z ddl mZmZmZd d lmZd d lmZmZd d lmZd dlmZd dlmZmZmZer ddl m!Z!ddl"m#Z#ej$e%Z&d1dZ'd2dZ( d3d4dZ) d5d6d#Z* d7d8d&Z+Gd'd(Z,d)Z-ed9d*Z.Gd+d,ej/Z0Gd-d.eZ1Gd/d0eZ2dS):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 Distributionfilepathr returndictcddlm}t|d5}||cdddS#1swxYwYdS)Nr )tomllibrb) compat.py310ropenload)rrfiles V/opt/cloudlinux/venv/lib64/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_classifierexr3errors r"r1r1+s 222222 1556HII!455-**,,, :!!&)))  $:::6"*66 7==   * * MM' " " " MM"* % % %<"'<<<E..W..//T9:sA C+%BC&&C+Fdistrignore_option_errorscHt|d||}t|||S)zeApply the configuration from a ``pyproject.toml`` file into an existing distribution object. T)read_configuration_apply)r>rr?r$s r"apply_configurationrC@s* $0Dd K KF $ ) ))TrDistribution | Nonedict[str, Any]ctj|}tj|st d|dt |pi}|di}|di}|di}|r|s|siSd|divrtd|vrtd |r#|j | d |j n| d d ||d<||d<d |vrtd 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])subjectNzinclude-package-dataTz ext-modulesz[tool.setuptools.ext-modules])r*rH)ospathabspathisfiler r#r/_ToolsTypoInMetadataemit_ExperimentalConfigurationinclude_package_data setdefault_ignore_errorsr1dirnameexpand_configuration) rrr?r>asdict project_table tool_tablesetuptools_tablesubsetroot_dirs r"rArALs;6wx((H 7>>( # #LJhJJJKKK x &BFJJy"--MFB''J!~~lB77 -+; vzz'2....!!###j  "''0B'CCC  B)5##$:Ds r"rXrXs%( 68-A4 H H O O Q QQrDceZdZ d+d,d Zd-dZd.dZd/dZdZdZdZ d0dZ d1dZ d2dZ d3d!Z d4d"Zd1d#Zd5d%Zd6d'Zd7d(Zd7d)Zd7d*ZdS)8raNFr$rr^r_r?r%r>rErNonec||_|ptj|_|di|_|jdg|_|didi|_|jdi|_||_ ||_ t|_ dS)Nr*dynamicrHrI) r$rMgetcwdr^r/ project_cfgresetuptools_cfg dynamic_cfgr?_distset_referenced_files)selfr$r^r?r>s r"__init__z_ConfigExpander.__init__s  /BIKK !::i44'++Ir:: $jj4488rJJ.229bAA$8! +.55rDrcxddlm}|j|jddd}|jp ||S)Nrrr4)src_rootr4)setuptools.distrr^rgr/rj)rmrattrss r" _ensure_distz_ConfigExpander._ensure_distsN000000!]D4D4H4HQU4V4VWWz0\\%000rD containerfieldstrfnr c||vrCt|j5|||||<ddddS#1swxYwYdSdSN)rVr?)rmrtrurws r"_process_fieldz_ConfigExpander._process_fields I   9:: 8 8#%2i&6#7#7 %  8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8  s ;?? package-datac`|j|i}tj|Sry)rhr/_expandcanonic_package_data)rmru package_datas r"_canonic_package_dataz%_ConfigExpander._canonic_package_datas+*..ub99 +L999rDc|||d|}t||j|j}|5}|j}|||| ||dddn #1swxYwY|j |j |j S)Nzexclude-package-data) _expand_packagesrrs_EnsurePackagesDiscoveredrgrh package_dir_expand_data_files_expand_cmdclass_expand_all_dynamicrlupdater$)rmr>ctxensure_discoveredrs r"rz_ConfigExpander.expands&  ""$$$ ""#9:::  ""'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) rhr/ isinstancelisttuplerr^rUrVr?r} find_packages)rmrrs 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)rr}canonic_data_filesr^rzrh)rm data_filess r"rz"_ConfigExpander._expand_data_filess:W7$-PPP  D/zJJJJJrDrMapping[str, str]c|j}ttj||}||jd|dS)N)rr^cmdclass)r^rr}rrzrh)rmrr^rs r"rz _ConfigExpander._expand_cmdclasssA=7+xXXX D/XFFFFFrDc dfdjD}|pid|D}j |dS)N)versionreadme entry-pointsscripts gui-scripts classifiers dependenciesoptional-dependenciescHi|]}|v||Sr)_obtain).0rur>rrmspecials r" z7_ConfigExpander._expand_all_dynamic..s@   G## 4<<e[99###rD)rrrroptional_dependenciesci|] \}}||| Sryr)rkvs r"rz7_ConfigExpander._expand_all_dynamic..sNNNDAq 1a rD) rer_obtain_entry_points_obtain_version_obtain_readme_obtain_classifiers_obtain_dependencies_obtain_optional_dependenciesitemsrg)rmr>robtained_dynamicupdatesrs``` @r"rz#_ConfigExpander._expand_all_dynamics               % %dK 8 8 >B(({;;&&t,,006622488"&"D"DT"J"J    ON$4$:$:$<$<NNN (((((rDcpt||}||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)rmr>rupreviousmsgs r"_ensure_previously_setz&_ConfigExpander._ensure_previously_sets_&u-d33  D$= YeYYY  %S)) )    rD specifiercddlm}t|j5|j}d|vrP|j||dtj|d|cdddSd|vr(tj |d||cdddStd|d|#1swxYwYdS)Nr)always_iterabler!attrz invalid `z`: ) more_itertoolsrrVr?r^rlrr} read_files read_attrr9)rmr directiverrr^s r"_expand_directivez!_ConfigExpander._expand_directives\ 322222 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.)rirr)rmr>rurs r"rz_ConfigExpander._obtain*s^ D$ $ $))2522 '  ##D%000trDc|d|jvr2d|jvr)tj||d|SdS)Nr)rerir}rr)rmr>rs r"rz_ConfigExpander._obtain_version4sJ  $ $d6F)F)F? T9k:: trDdict[str, str] | Nonecd|jvrdS|j}d|vr4||di|ddddS||ddS)Nr content-typez text/x-rst)textr)rerirr/r)rmr>ris r"rz_ConfigExpander._obtain_readme=s 4< ' '4& { " " T8R88 +H 5 9 9., W W  ##D(333trD dict[str, dict[str, Any]] | Nonecd}tfd|DsdS|d|}|dStj|did fd }|dd |d d S) N)rrrc3*K|] }|jvVdSry)re)rrurms r" z7_ConfigExpander._obtain_entry_points..Ps*==U5DL(======rDrrurvgroupc|vrG|}|jvr"ttj||||<dSdSry)poprerrr8)rurvalueexpandedgroupsrms r" _set_scriptsz:_ConfigExpander._obtain_entry_points.._set_scripts[sY 5)) ,,,_-DUE-R-RSSS"' rDrconsole_scriptsr gui_scripts)rurvrrv)anyrr} entry_points)rmr>rfieldsrrrrs` @@r"rz$_ConfigExpander._obtain_entry_pointsLs<====f===== 4||D.+>> <4%d++/=v.F ( ( ( ( ( ( ( (  Y 1222 ]M222rDcrd|jvr-||di}|r|SdS)Nr)rer splitlinesrmr>rs r"rz#_ConfigExpander._obtain_classifiersgsC DL ( (LL}b99E *'')))trDchd|jvr(||di}|rt|SdS)Nr)rer_parse_requirements_listrs r"rz$_ConfigExpander._obtain_dependenciesns? T\ ) )LL~r::E 7/666trDcdjvrdSdjvrDjd}t|tsJfd|DS|ddS)Nrc fi|]-\}}|td||i.S)z.tool.setuptools.dynamic.optional-dependencies.)rr)rrrrms r"rzA_ConfigExpander._obtain_optional_dependencies..{s`   %E9/**PPP!   rD)rerirrrr)rmr>optional_dependencies_maps` r"rz-_ConfigExpander._obtain_optional_dependenciesus "$, 6 64 "d&6 6 6(,(89P(Q %7>> > >>    )B(G(G(I(I     ##D*ABBBtrDNFN) r$rr^r_r?r%r>rErrc)rr)rtrrurvrwr )r{)rr)r>rrr)r>rrurv)rrvrr)r>rrurvrr)r>rrr)r>rrrrr)r>r)__name__ __module__ __qualname__rnrsrzrrrrrrrrrrrrrrrrrDr"raras$(%*$( 11111"1111 8888 ::::" P P PKKKGGGG ))))<****        6rDrac>d|DS)Ncg|]?}||d=|@S)#)r5 startswith)rlines r" z,_parse_requirements_list..sV     ::<< !% 7 7 < <     rD)r)rs r"rrs/  $$&&   rDc#K|sdVdS dVdS#t$r5}td|jjd|Yd}~dSd}~wwxYw)Nzignored error: z - ) Exceptionr6r7 __class__r)r?r<s r"rVrVs  H  HHH F (=FF"FFGGGGGGGGGHs A*A  Ac8eZdZdfd Zdfd Zdfd ZxZS)r distributionrrgrrhrrccft|||_||_dSry)superrn _project_cfg_setuptools_cfg)rmrrgrhrs r"rnz"_EnsurePackagesDiscovered.__init__s3 &&&'-rDrc|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``. rNr4 py-modulesr)rjrrUrr set_defaults_ignore_ext_modulesmetadatar4rr/ py_modulesrr __enter__)rmr>cfgrrs r"rz#_EnsurePackagesDiscovered.__enter__sJ 4c&)nn]B&G&G 4+1r222& --/// =  %!%!2!6!6v!>!>DM  ? "!ggl33DO = GGJ//DMww  """rDexc_typetype[BaseException] | None exc_valueBaseException | None tracebackTracebackType | Nonec|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)rrUrjrrr__exit__)rmrrrrs r"rz"_EnsurePackagesDiscovered.__exit__s] '' DJ4GHHH '' dj6KLLLww)Y???rD)rrrgrrhrrrc)rr)rrrrrrrrc)rrrrnrr __classcell__)rs@r"rrs......######, @ @ @ @ @ @ @ @ @ @rDrceZdZdZdS)rSz``{subject}` in `pyproject.toml` is still *experimental* and likely to change in future releases.Nrrr_SUMMARYrrDr"rSrSs 3 HHrDrSceZdZdZdS)rQzNIgnoring [tools.setuptools] in pyproject.toml, did you mean [tool.setuptools]?NrrrDr"rQrQsX HHrDrQ)rr rr)r$rrr rr%)F)r>rrr r?r%rr)TFN) rr rr%r?r%r>rErrFr) r$rr^r_r?r%r>rErr)r?r%)3__doc__ __future__rloggingrMcollections.abcr contextlibr functoolsrtypesrtypingrr r _pathr errorsr rwarningsrr-rr}_apply_pyprojecttomlrrrrBtyping_extensionsrrqr getLoggerrr6r#r1rCrArXrarrVEnsurePackagesDiscoveredrrSrQrrDr"rs  #""""" ######%%%%%%//////////22222222((((((WWWWWWWWWW-&&&&&&,,,,,, ' H % %""""::::0"' * * * * *!& $ FFFFFV $!& $ RRRRR.ZZZZZZZZzHHHH*@*@*@*@*@ @*@*@*@Z!2,rD