DE r dZddlZddlZddlZddlZddlmZddlmZddlmZddl m Z m Z m Z m Z mZmZmZmZmZmZmZddlmZmZddlmZmZdd lmZmZdd lmZdd l m!Z!d d l"m#Z#e r ddl$m%Z%ddl&m'Z'ee(ej)fZ*e dede ffZ+ e de+fZ,ededZ- d4de*de.fdZ/ddde*ddfdZ0 d5ddde*dee*de1dedf dZ2d e-d!e(fd"Z3d#edde.fd$Z4 d6d%dd&e,ded'fd(Z5d)e(d*e(d+e6fd,Z7Gd-d.ee-Z8Gd/d0e8d1Z9Gd2d3e8dZ:dS)7ze Load setuptools configuration from ``setup.cfg`` files. **API will be made private in the future** N) defaultdict)partialwraps) TYPE_CHECKINGCallableAnyDictGenericIterableListOptionalTupleTypeVarUnion)DistutilsOptionErrorDistutilsFileError) RequirementInvalidRequirement)VersionInvalidVersion) SpecifierSet)SetuptoolsDeprecationWarning)expand Distribution)DistributionMetadatastrTarget)rr)boundFfilepathreturncddlm}|}|r|ng}t||||}t |S)a,Read given configuration file and returns options from it as a dict. :param str|unicode filepath: Path to configuration file to get options from. :param bool find_others: Whether to search for other configuration files which could be on in various places. :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. :rtype: dict rr)setuptools.distrfind_config_files_applyconfiguration_to_dict)r" find_othersignore_option_errorsrdist filenameshandlerss /builddir/build/BUILDROOT/alt-python311-setuptools-65.6.3-2.el9.x86_64/opt/alt/python311/lib/python3.11/site-packages/setuptools/config/setupcfg.pyread_configurationr/(s^(-,,,,, <>>D,7?&&(((RIdHi1EFFH  * **r+rcNt||||S)z`Apply the configuration from a ``setup.cfg`` file into an existing distribution object. )r'_finalize_requires)r+r"s r.apply_configurationr3Ds+ 4 Kr0 other_filesr*) ConfigHandler.c(ddlm}tj|}tj|st d|ztj}tjtj |g||} | ||t||j |}| tj|n#tj|wxYw|S)zHRead configuration from ``filepath`` and applies to the ``dist`` object.r) _Distributionz%Configuration file %s does not exist.)r,)r*)r%r8ospathabspathisfilergetcwdchdirdirnameparse_config_filesparse_configurationcommand_options_finalize_license_files)r+r"r5r*r8current_directoryr,r-s r.r'r'Ms .-----wx((H 7>>( # #U !H8!STTT HRW__X & &'''(+(x(I$(((CCC& $&=Q    $$&&& "####"#### Os "AC99D target_objkeycdjdit}tjt||}t |||}|S)z Given a target object and option key, get that option from the target object, either through a get_{key} method or from an attribute directly. z get_{key}r4)formatlocals functoolsrgetattr)rErF getter_name by_attributegetters r. _get_optionrOjsP %+$00vxx00K$Wj#>>L Zl ; ;F 688Or0r-ctt}|D]1}|jD]'}t|j|}|||j|<(2|S)zReturns configuration data gathered by given handlers as a dict. :param list[ConfigHandler] handlers: Handlers list, usually from parse_configuration() :rtype: dict )rdict set_optionsrOrEsection_prefix)r- config_dicthandleroptionvalues r.r(r(vsk$D))K@@) @ @F 2F;;E:?K. / 7 7 @ r0 distributionrB)ConfigMetadataHandlerConfigOptionsHandlerc Btj|5}t||||}||js |j|_t |j||||j|j}|dddn #1swxYwY||fS)aPerforms additional parsing of configuration options for a distribution. Returns a list of used option handlers. :param Distribution distribution: :param dict command_options: :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. :rtype: list N)rEnsurePackagesDiscoveredrZparse package_dirrYmetadatasrc_root)rXrBr*ensure_discoveredoptionsmetas r.rArAs$  ( 6 6:K&        ' ;'.':L $$  !    $  !    ), =sA1BBBlabel orig_valueparsedcDd|vst|dkrdStjt5d|}t |}|j)d|d|dd}tj|tddddS#1swxYwYdS) amBecause users sometimes misinterpret this configuration: [options.extras_require] foo = bar;python_version<"4" It looks like one requirement with an environment marker but because there is no newline, it's parsed as two requirements with a semicolon as separator. Therefore, if: * input string does not contain a newline AND * parsed result contains two requirements AND * parsing of the two parts from the result (";") leads in a valid Requirement with a valid marker a UserWarning is shown to inform the user about the possible problem.  N;z#One of the parsed requirements in `z*` looks like a valid environment marker: 'rz}' Make sure that the config is correct and check https://setuptools.pypa.io/en/latest/userguide/declarative_config.html#opt-2) len contextlibsuppressrjoinrmarkerwarningswarn UserWarning)rdrerforiginal_requirements_strreqmsgs r.%_warn_accidental_env_marker_misconfigrvs" zS[[A--  / 0 0 , ,$'HHV$4$4!344 : !_e__;A!9___  M#{ + + + , , , , , , , , , , , , , , , , , ,sABBBcReZdZUdZeed< iZeeefed< dede de j fdZ e dZd Zedd Zed Zed ZedZedefdZdefdZedZedZeddZdZdZdZdS)r6z1Handles metadata supplied in configuration files.rSaliasesrErbraci}|j}|D]I\}}||s||dd}|||<J||_||_||_g|_||_ dS)N.) rSitems startswithreplacestripr*rEsectionsrRra) selfrErbr*rarrS section_namesection_optionss r.__init__zConfigHandler.__init__s'),-4]]__ 5 5 )L/**>:: '//CCII#NNL%4H\ " "$8!$  &(!2r0c:td|jjz).Metadata item name to parser function mapping.z!%s must provide .parsers property)NotImplementedError __class____name__)rs r.parserszConfigHandler.parserss#" /$.2I I   r0ct}|j}|j||}t |||}||urt ||rdSd}|j|}|r' ||}n#t$r d}|jsYnwxYw|rdSt |d|zd}|t|||n |||j |dS)NFTzset_%s) tuplerErxgetrKKeyErrorr Exceptionr*setattrrRappend) r option_namerWunknownrE current_value skip_optionparsersetters r. __setitem__zConfigHandler.__setitem__s9''_ l&&{K@@  KAA G # #;'' '   F !!+..   u    " 0    FX %;TBB > J U 3 3 3 3 F5MMM  ,,,,,s8 BBB,ct|tr|Sd|vr|}n||}d|DS)zRepresents value as a list. Value is split either by separator (defaults to comma) or by lines. :param value: :param separator: List items separator character. :rtype: list rhc^g|]*}||+Sr4r).0chunks r. z-ConfigHandler._parse_list..:s-BBB%EKKMMB BBBr0) isinstancelist splitlinessplit)clsrW separators r. _parse_listzConfigHandler._parse_list(s\ eT " " L 5==$$&&EEKK **EBB5BBBBr0cd}i}||D]\}||\}}}||krtd|z|||<]|S)zPRepresents value as a dict. :param value: :rtype: dict =z(Unable to parse option value to dict: %s)r partitionrr)rrWrresultlinerFsepvals r. _parse_dictzConfigHandler._parse_dict<s OOE** . .D NN955MCci*>F#&))++F399;;   r0c2|}|dvS)zQRepresents value as boolean. :param value: :rtype: bool )1trueyes)lowerrrWs r. _parse_boolzConfigHandler._parse_boolOs ,,,r0cfd}|S)zReturns a parser function to make sure field inputs are not files. Parses a value after getting the key so error messages are more informative. :param key: :rtype: callable czd}||r"td|S)Nfile:zCOnly strings are accepted for the {0} field, files are not accepted)r} ValueErrorrH)rWexclude_directiverFs r.rz3ConfigHandler._exclude_files_parser..parseresI '  122  --3VC[[Lr0r4)rrFrs ` r._exclude_files_parserz#ConfigHandler._exclude_files_parserYs#      r0root_dircd}t|ts|S||s|S|t|d}d|dD}t j||S)aORepresents value as a string, allowing including text from nearest files using `file:` directive. Directive is sandboxed and won't reach anything outside directory with setup.py. Examples: file: README.rst, CHANGELOG.md, src/file.txt :param str value: :rtype: str rNc3>K|]}|VdSNr)rr:s r. z,ConfigHandler._parse_file..s*>>dTZZ\\>>>>>>r0r)rrr}rkrr read_files)rrWrinclude_directivespec filepathss r. _parse_filezConfigHandler._parse_fileps$%%% L 122 LS*++--.>>djjoo>>>  H555r0cd}||s|S||d}||jjt j|||S)zRepresents value as a module attribute. Examples: attr: package.attr attr: package.module.attr :param str value: :rtype: str zattr:rz)r}r~updaterar^r read_attr)rrWr^rattr_directive attr_descs r. _parse_attrzConfigHandler._parse_attrsh!// LMM."55  41=>>> ;AAAr0cfd}|S)zReturns parser function to represents value as a list. Parses a value applying given methods one after another. :param parse_methods: :rtype: callable c,|}D] }||}|Srr4)rWrfmethod parse_methodss r.r]z1ConfigHandler._get_parser_compound..parses+F' ( (Mr0r4)rrr]s ` r._get_parser_compoundz"ConfigHandler._get_parser_compounds#      r0cbi}|D]\}\}}|||||<|S)aParses section options into a dictionary. Applies a given parser to each option in a section. :param dict section_options: :param callable values_parser: function with 2 args corresponding to key, value :rtype: dict )r|)rr values_parserrWrF_rs r._parse_section_to_dict_with_keyz-ConfigHandler._parse_section_to_dict_with_keysH,2244 1 1MC!S&sC00E#JJ r0NcDrfdnd}|||S)aParses section options into a dictionary. Optionally applies a given parser to each value. :param dict section_options: :param callable values_parser: function with 1 arg corresponding to option value :rtype: dict c|Srr4)rvrs r.z6ConfigHandler._parse_section_to_dict..s}}Q//r0c|Srr4)rrs r.rz6ConfigHandler._parse_section_to_dict..sUVr0r)rrrrs ` r._parse_section_to_dictz$ConfigHandler._parse_section_to_dicts75BW/////22?FKKKr0c|D]>\}\}}tjt5|||<dddn #1swxYwY?dS)zQParses configuration file section. :param dict section_options: N)r|rlrmr)rrnamerrWs r. parse_sectionzConfigHandler.parse_sections #2"7"7"9"9 # # T:Au$X.. # #"T  # # # # # # # # # # # # # # # # #sAA A c|jD]^\}}d}|rd|z}t|d|zddd}|t d|jd|d||_dS) zTParses configuration file items from one or more related sections. rzz_%szparse_section%sr{__Nz*Unsupported distribution option section: [])rr|rKr~rrS)rrrmethod_postfixsection_parser_methods r.r]zConfigHandler.parses .2]-@-@-B-B 3 3 )L/N 6!&!58?"^3<tj|i|Sr)rprq)argskwargsfuncru warning_classs r.config_handlerz@ConfigHandler._deprecated_config_handler..config_handlers* M#} - - -4((( (r0r)rrrurrs ``` r._deprecated_config_handlerz(ConfigHandler._deprecated_config_handlersB t ) ) ) ) ) )  )r0)rr)r __module__ __qualname____doc__r__annotations__rxr r AllCommandOptionsrr\rpropertyrr classmethodrrrr_Pathrrrrrrr]rr4r0r.r6r6s;; !GT#s(^    33#3 ": 3333.  X $-$-$-LCCC[C&[$--[-[,6%666[62BBBBB([&  [  L L L[ L###3334     r0r6c eZdZdZdddddZdZ dejfd d d ed e d e j de e def fd ZedZdZxZS)rYr_url description classifiers platforms) home_pagesummary classifierplatformFNrErrbr*rar^rclt||||||_||_dSr)superrr^r)rrErbr*rar^rrs r.rzConfigMetadataHandler.__init__s8 W.BDUVVV&  r0c@|j}t|j|j}|j}|j}|||||dt|||||d||ddt||||j |d S)rrz[The requires parameter is deprecated, please use install_requires for runtime dependencies.license license_filezDThe license_file parameter is deprecated, use license_files instead.) rkeywordsprovidesrequires obsoletesrrr license_filesrlong_descriptionversion project_urls) rrrrrrrrr_parse_version)r parse_list parse_file parse_dictexclude_files_parsers r.rzConfigMetadataHandler.parsers s% T- FFF % #9$""77=,  $44ZLL++I66 ;;$$^44-,  (% **&/   r0c d|||j}||kr]|} t|n6#t$r)d}t |jditwxYw|Stj | ||j |jS)zSParses `version` option value. :param value: :rtype: str zCVersion loaded from {value} does not comply with PEP 440: {version}r4) rrrrrrrHrIrr rr^)rrWr tmpls r.r z$ConfigMetadataHandler._parse_versionBs""5$-88 e  mmooG D    ! D D D5+;4;+B+B+B+BCCC  DN~d..ud6F VVWWWs A3A:)rrrrSrx strict_moder9curdirrboolrr\rrQrrrrr  __classcell__rs@r.rYrYsN # GK'+) ! !* !# !# ! ": ! d^ ! ! ! ! ! ! !  X BXXXXXXXr0rYrceZdZdZdddededejffd Ze dZ dZ d e d e fd Z ed Zd ZdZdZdZdZdZdZdZdZxZS)rZrbrErr*racvt|||||j|_i|_dSr)rrr`rr^)rrErbr*rars r.rzConfigOptionsHandler.__init__as= W.BDUVVV"+ +-r0c0||dS)Nrj)r)rrs r._parse_list_semicolonz*ConfigOptionsHandler._parse_list_semicolonlsu444r0c:|||jS)Nr)rr)rrWs r._parse_file_in_rootz(ConfigOptionsHandler._parse_file_in_rootps >>>r0rdrWc|||}t|||d|DS)Nc<g|]}|d|S)#)r})rrs r.rzAConfigOptionsHandler._parse_requirements_list..ys)DDDts/C/CDDDDr0)rrrv)rrdrWrfs r._parse_requirements_listz-ConfigOptionsHandler._parse_requirements_listssL++D,D,DU,K,KLL-eUFCCCEDDDDDr0c|j}|j}|j}|j}||||||||dt t |jd|j|j|j |j |t|dS)rzeThe namespace_packages parameter is deprecated, consider using implicit namespaces instead (PEP 420).install_requires)zip_safeinclude_package_datar^scriptseager_resourcesdependency_linksnamespace_packagesr"setup_requires tests_requirepackages entry_points py_modulespython_requirescmdclass) rrr_parse_cmdclassrrrr r_parse_packagesrr)rr  parse_boolrparse_cmdclasss r.rzConfigOptionsHandler.parsers{s% % % -#$.%!) *"&"A"AH, ## !(-/A!!#8!7, 4$+&-   r0cv|jj}tj||||jSr)rar^rr/rr)rrWr^s r.r0z$ConfigOptionsHandler._parse_cmdclasss1,8 t//66 T]SSSr0c:ddg}|}||vr||S||jdi}|||dk|j|jtj di|S)zTParses `packages` option value. :param value: :rtype: list zfind:zfind_namespace:z packages.findr) namespacesrfill_package_dirr4) rrparse_section_packages__findrrrrr^r find_packages)rrWfind_directives trimmed_value find_kwargss r.r1z$ConfigOptionsHandler._parse_packagess #$56  / /##E** *77 M  or 2 2   %);;]!-    #22k222r0c|||j}gdtfd|D}|d}| |d|d<|S)zParses `packages.find` configuration file section. To be used in conjunction with _parse_packages(). :param dict section_options: )whereincludeexcludec*g|]\}}|v | ||fSr4r4)rkr valid_keyss r.rzEConfigOptionsHandler.parse_section_packages__find..s* N N N1ZAaVr0r>Nr)rrrQr|r)rr section_datar<r>rCs @r.r8z1ConfigOptionsHandler.parse_section_packages__finds22?DDTUU 444  N N N N 2 2 4 4 N N N  ((  #(8K r0cF|||j}||d<dS)z`Parses `entry_points` configuration file section. :param dict section_options: r,N)rrrrrfs r.parse_section_entry_pointsz/ConfigOptionsHandler.parse_section_entry_pointss, ,,_d>NOO%^r0c`|||j}tj|Sr)rrrcanonic_package_data)rr package_datas r._parse_package_dataz(ConfigOptionsHandler._parse_package_datas+22?DDTUU *<888r0c6|||d<dS)z`Parses `package_data` configuration file section. :param dict section_options: rJNrKrrs r.parse_section_package_dataz/ConfigOptionsHandler.parse_section_package_datas" $77HH^r0c6|||d<dS)zhParses `exclude_package_data` configuration file section. :param dict section_options: exclude_package_dataNrMrNs r."parse_section_exclude_package_dataz7ConfigOptionsHandler.parse_section_exclude_package_datas# (,'?'?'P'P #$$$r0cD|fd}|d<dS)zbParses `extras_require` configuration file section. :param dict section_options: c8d|d|S)Nzextras_require[r)r )rBrrs r.rzCConfigOptionsHandler.parse_section_extras_require..s#667M7M7M7MqQQr0extras_requireNrrFs` r.parse_section_extras_requirez1ConfigOptionsHandler.parse_section_extras_requires< 55  Q Q Q Q   "( r0cv|||j}tj||j|d<dS)z^Parses `data_files` configuration file section. :param dict section_options: data_filesN)rrrcanonic_data_filesrrFs r.parse_section_data_filesz-ConfigOptionsHandler.parse_section_data_filess; ,,_d>NOO#6vt}MM\r0)rrrrSrrrr\rrrrrr rrr0r1r8rGrKrOrRrVrZrrs@r.rZrZ]spN ." .# .# . ": . . . . . .55[5???EcE#EEEE  X @TTT3332*&&&999IIIQQQ ( ( (NNNNNNNr0rZ)FF)r4F)F);rr9rlrJrp collectionsrrrtypingrrr r r r r rrrrdistutils.errorsrr(setuptools.extern.packaging.requirementsrr#setuptools.extern.packaging.versionrr&setuptools.extern.packaging.specifiersrsetuptools._deprecation_warningrrzrr%rdistutils.distrrPathLikerSingleCommandOptionsrr rQr/r3rr'rOr(rArrvr6rYrZr4r0r.res'  ######55555555555555555555555555FEEEEEEETTTTTTTTGGGGGGGG??????HHHHHH4,,,,,,333333 c2;E5#445  445 'M!N O O O +++ ++++8n.$&!& $)%  : F     E*>$?D*(( (&( :; ((((V,,#,t,,,,BkkkkkGFOkkk\ XXXXXXXXXXM*@AXXXXXXv]N]N]N]N]N=8]N]N]N]N]Nr0