el% :dZddlZddlZddlZddlmZddlmZddlm Z m Z m Z m Z m Z mZddlmZmZddlmZdd lmZdd lmZmZe rdd lmZeeejfZeje Z!d ed e"fdZ#de"d ed e$fdZ% d'ddd ed dfdZ& d(d ede dfdZ'de"de"de dd e$fdZ( d)de"de ede$de dd e"f dZ)GddZ*dZ+ede$fd Z,Gd!d"ej-Z.Gd#d$e/Z0Gd%d&e/Z1dS)*z Load setuptools configuration from ``pyproject.toml`` files. **PRIVATE MODULE**: API reserved for setuptools internal usage only. N)contextmanager)partial) TYPE_CHECKINGCallableDictOptionalMappingUnion) FileError OptionError)expand)apply)_PREVIOUSLY_DEFINED_WouldIgnoreField Distributionfilepathreturncddlm}t|d5}||cdddS#1swxYwYdS)Nr)tomlirb)setuptools.externropenload)rrfiles /builddir/build/BUILDROOT/alt-python311-setuptools-65.6.3-2.el9.x86_64/opt/alt/python311/lib/python3.11/site-packages/setuptools/config/pyprojecttoml.py load_filers'''''' h   zz$                  s 9==configcddlm}|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)rr validatortrove_classifierexr-errors rr+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)r8rignore_option_errorsrs rapply_configurationr=6s* $0Dd K KF $ ) ))Tctj|}tj|st d|dt |pi}|di}|di}|di}|r|s|siS|rd}tj|t| } |r,t|d| d |j n| d d ||d<||d< |d|id } t| |n]#t$rP} t!|| |ricYd} ~ S|r+t"d | jjd | nYd} ~ nd} ~ wwxYw|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 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 setuptoolszDSupport for `[tool.setuptools]` in `pyproject.toml` is still *beta*.include_package_dataNzinclude-package-dataT)r$r@ignored error:  - )ospathabspathisfiler rr)warningswarn_BetaConfigurationcopygetattr setdefaultrBr+ Exception_skip_bad_configr0r1 __class____name__dirnameexpand_configuration) rrr<r8asdict project_table tool_tablesetuptools_tablemsgorig_setuptools_tablesubsetr6root_dirs rr:r:Bs46wx((H 7>>( # #LJhJJJKKK x &BFJJy"--MFB''J!~~lB77 -+; /T c-... -1133 B455A##$:Drequires-pythonr.versionpython_requires) stacklevelT) metadatar.rainstall_requiressetkeysrIrJ _InvalidFilemessage)r]r^r8 given_configpopular_subsets rrPrPs  | " M ! )  ! )uu{''))**LNNNN~%%  l**,,lqIIIIt 5r>r\r<cJt||||S)aGiven a configuration with unresolved fields (e.g. dynamic, cmdclass, ...) find their final values. :param dict config: Dict containing the configuration for the distribution :param str root_dir: Top-level directory for the distribution/project (the same directory where ``pyproject.toml`` is place) :param bool ignore_option_errors: see :func:`read_configuration` :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. Used in the case a dynamic configuration (e.g. ``attr`` or ``cmdclass``). :rtype: dict )_ConfigExpanderr)rr\r<r8s rrTrTs%( 68-A4 H H O O Q QQr>c eZdZ d!dedeedededfdZd"d Zd ed e d e fdZ d#dZ dZ dZdZdee e ffdZdddee e ffdZddd e fdZde dee e ffdZddd e dee e ffdZdddee e ffdZddd eee e ffdZdddee e fd eee effdZd$dZd$dZd$d ZdS)%rnNFrr\r<r8rcx||_|ptj|_|di|_|jdg|_|didi|_|jdi|_||_ ||_ dS)Nr$dynamicr@rA) rrEgetcwdr\r)r]rqr^ dynamic_cfgr<_dist)selfrr\r<r8s r__init__z_ConfigExpander.__init__s  /BIKK !::i44'++Ir:: $jj4488rJJ.229bAA$8! r>rcxddlm}|j|jddd}|jp ||S)Nrrr.)src_rootr.)setuptools.distrr\r]r)rt)rurattrss r _ensure_distz_ConfigExpander._ensure_distsN000000!]D4D4H4HQU4V4VWWz0\\%000r> containerfieldfnc||vrCt|j5|||||<ddddS#1swxYwYdSdSN)_ignore_errorsr<)rur|r}r~s 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|Sr)r^r)_expandcanonic_package_data)rur} package_datas r_canonic_package_dataz%_ConfigExpander._canonic_package_datas+*..ub99 +L999r>c|||d|}t||j|j}|5}|j}|||| ||dddn #1swxYwY|j S)Nzexclude-package-data) _expand_packagesrr{_EnsurePackagesDiscoveredr]r^ package_dir_expand_data_files_expand_cmdclass_expand_all_dynamicr)rur8ctxensure_discoveredrs rrz_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 {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) r^r) isinstancelisttupledictr\rNrr<r find_packages)rurrs rrz _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)rrcanonic_data_filesr\rr^)ru data_filess rrz"_ConfigExpander._expand_data_filess:W7$-PPP  D/zJJJJJr>rc|j}ttj||}||jd|dS)N)rr\cmdclass)r\rrrrr^)rurr\rs rrz _ConfigExpander._expand_cmdclasssA=7+xXXX D/XFFFFFr>c dfdjD}|pid|D}j |dS)N)rareadme entry-pointsscripts gui-scripts classifiers dependenciesoptional-dependenciescHi|]}|v||Sr)_obtain).0r}r8rruspecials r z7_ConfigExpander._expand_all_dynamic..s@   G## 4<<e[99###r>)rarrroptional_dependenciesci|] \}}||| Srr)rkvs rrz7_ConfigExpander._expand_all_dynamic..&sNNNDAq 1a r>) rqupdate_obtain_entry_points_obtain_version_obtain_readme_obtain_classifiers_obtain_dependencies_obtain_optional_dependenciesitemsr])rur8robtained_dynamicupdatesrs``` @rrz#_ConfigExpander._expand_all_dynamic s               % %dK 8 8 >B(({;;&&t,,006622488"&"D"DT"J"J    ON$4$:$:$<$<NNN (((((r>cpt||}||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 )rur8r}previousrYs r_ensure_previously_setz&_ConfigExpander._ensure_previously_set)s_&u-d33  D$= YeYYY  c"" "    r> specifierc,t|j5|j}d|vr'tj|d|cdddSd|vr(tj|d||cdddSt d|d|#1swxYwYdS)Nrattrz invalid `z`: )rr<r\r read_files read_attrr3)rur directiverr\s r_expand_directivez!_ConfigExpander._expand_directive3s$D5 6 6 F F}H""))F*;XFF F F F F F F F F""(6):KRR  F F F F F F F F DDDyDDEE E  F F F F F F F Fts&B B 4B  B B c||jvr%|d||j||S|||dS)Nztool.setuptools.dynamic.)rsrr)rur8r}rs rrz_ConfigExpander._obtain?s^ D$ $ $))2522 '  ##D%000tr>c|d|jvr2d|jvr)tj||d|SdS)Nra)rqrsrrar)rur8rs rrz_ConfigExpander._obtain_versionIsA  $ $d6F)F)F?4<<i#M#MNN Ntr>cd|jvrdS|j}d|vr4||di|ddddS||ddS)Nr content-typez text/x-rst)textr)rqrsrr)r)rur8rss rrz_ConfigExpander._obtain_readmeOs~ 4< ' '4& { " " T8R88 +H 5 9 9., W W  ##D(333tr>c d}tfd|DsdS|d|}|dStj|didtdtffd }|dd|d d S) N)rrrc3*K|] }|jvVdSr)rq)rr}rus r z7_ConfigExpander._obtain_entry_points..as*==U5DL(======r>rr}groupc|vrT|}|jvr/tj||}t j|t||<dSdSr)poprqrrjrIrJ)r}rvaluerYexpandedgroupsrus r _set_scriptsz:_ConfigExpander._obtain_entry_points.._set_scriptskse 5)) ,,+3E5AACM#'8999#(r>rconsole_scriptsr gui_scripts)anyrr entry_pointsstr)rur8rfieldsrrrrs` @@rrz$_ConfigExpander._obtain_entry_points]s<====f===== 4||D.+>> <4%d++"F+ ( (C ( ( ( ( ( ( ( (  Y 1222 ]M222r>crd|jvr-||di}|r|SdS)Nr)rqr splitlinesrur8rs rrz#_ConfigExpander._obtain_classifierszsC DL ( (LL}b99E *'')))tr>chd|jvr(||di}|rt|SdS)Nr)rqr_parse_requirements_listrs rrz$_ConfigExpander._obtain_dependenciess? T\ ) )LL~r::E 7/666tr>cdjvrdSdjvrDjd}t|tsJfd|DS|ddS)Nrc fi|]-\}}|td||i.S)z.tool.setuptools.dynamic.optional-dependencies.)rr)rrrrus rrzA_ConfigExpander._obtain_optional_dependencies..s_ %E9 /0F0FLULL11r>)rqrsrrrr)rur8optional_dependencies_maps` rrz-_ConfigExpander._obtain_optional_dependenciess "$, 6 64 "d&6 6 6(,(89P(Q %7>> > > > )B(G(G(I(I   ##D*ABBBtr>NFN)rr)r)r8r)rR __module__ __qualname__rr_Pathboolrvr{rrrrrrrr rrrrrrrrrrrrrr>rrnrns%)%*)- 5/#  ~&  1111 88S8h8888 :::: P P PKKKGGCH,=GGGG ))WSRUXEV))))<#>######  6=c3h6G    N3WSRUXEVNcAR > htCH~6N    "18c1B $sDy/ ":r>rnc>d|DS)Ncg|]?}||d=|@S)#)r/ startswith)rlines r z,_parse_requirements_list..sV     ::<< !% 7 7 < <     r>)r)rs rrrs/  $$&&   r>c#K|sdVdS dVdS#t$r5}td|jjd|Yd}~dSd}~wwxYw)NrCrD)rOr0r1rQrR)r<r6s rrrs  H  HHH F (=FF"FFGGGGGGGGGHs A*A  Ac@eZdZdddedeffd ZfdZfdZxZS)r distributionrr]r^cft|||_||_dSr)superrv _project_cfg_setuptools_cfg)rurr]r^rQs rrvz"_EnsurePackagesDiscovered.__init__s3 &&&'-r>c|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``. rNr. py-modulesr)rtrrNrr set_defaults_ignore_ext_modulesrer.rr) py_modulesrr __enter__)rur8cfgrrQs rrz#_EnsurePackagesDiscovered.__enter__sJ 4c&)nn]B&G&G 4+1r222& --/// =  %!%!2!6!6v!>!>DM  ? "!ggl33DO = GGJ//DMww  """r>c|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)rrNrtrrr__exit__)ruexc_type exc_value tracebackrQs rrz"_EnsurePackagesDiscovered.__exit__s] '' DJ4GHHH '' dj6KLLLww)Y???r>)rRrrrrvrr __classcell__)rQs@rrrs.*.9=.OS......#####,@@@@@@@@@r>rceZdZdZdS)rKzJExplicitly inform users that some `pyproject.toml` configuration is *beta*N)rRrr__doc__rr>rrKrKsTTTTr>rKc(eZdZdZedZdS)riaThe given `pyproject.toml` file is invalid and would be ignored. !! ############################ # Invalid `pyproject.toml` # ############################ Any configurations in `pyproject.toml` will be ignored. Please note that future releases of setuptools will halt the build process if an invalid file is given. To prevent setuptools from considering `pyproject.toml` please DO NOT include the `[project]` or `[tool.setuptools]` tables in your file. !! c.ddlm}||jS)Nr)cleandoc)inspectrr)clsrs rrjz_InvalidFile.messages&$$$$$$x $$$r>N)rRrrr classmethodrjrr>rriris9  %%[%%%r>ri)F)TFNr)2rloggingrErI contextlibr functoolsrtypingrrrrr r setuptools.errorsr r r'rr_apply_pyprojecttomlrr;rrryrrPathLiker getLoggerrRr0rrrr+r=r:rPrTrnrrEnsurePackagesDiscoveredr UserWarningrKrirr>rrs~  %%%%%%JJJJJJJJJJJJJJJJ44444444111111HHHHHHHH-,,,,,, c2; ' H % %  $    :T:U:t::::0 * *  * * * * * * %) LLL > " LLLL^'+3;N3K @!%!&%) RR RuoRR > " R  RRRR.QQQQQQQQhHHHHH%@%@%@%@%@ @%@%@%@PUUUUUUUU%%%%%;%%%%%r>