:Qgc dZddlZddlZddlZddlmZddlmZddlmZddlm Z m Z m Z m Z m Z mZmZmZmZmZmZmZddlmZmZdd lmZdd lmZmZdd lmZdd l m!Z!m"Z"dd l#m$Z$ddl%m&Z&e r ddl'm(Z(ddl)m*Z*ee+ej,fZ-e dede ffZ. e de.fZ/ededZ0 d:de-de1fdZ2ddde-ddfdZ3 d;ddde-dee-de4ded f d!Z5d"e0d#e+fd$Z6d%ed de1fd&Z7 dGd8d9e$Z?dS)=a< Load setuptools configuration from ``setup.cfg`` files. **API will be made private in the future** 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 ``configparser``. N) defaultdict)partialwraps) TYPE_CHECKINGCallableAnyDictGenericIterableListOptionalSetTupleTypeVarUnion) FileError OptionError)default_environment)InvalidRequirement Requirement) SpecifierSet)InvalidVersionVersion)SetuptoolsDeprecationWarning)expand)DistributionMetadata DistributionstrTarget)r!r)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.distr!find_config_files_applyconfiguration_to_dict)r% find_othersignore_option_errorsr!dist filenameshandlerss z/builddir/build/BUILD/imunify360-venv-2.5.0/opt/imunify360/venv/lib/python3.11/site-packages/setuptools/config/setupcfg.pyread_configurationr28s^$-,,,,, <>>D,7?&&(((RIdHi1EFFH  * **r.r!cNt||||S)z`Apply the configuration from a ``setup.cfg`` file into an existing distribution object. )r*_finalize_requires)r.r%s r1apply_configurationr6Rs+ 4 Kr3 other_filesr-) ConfigHandler.c*ddlm}tj|}tj|st d|dtj}tjtj |g||} | ||t||j |}| tj|n#tj|wxYw|S)zHRead configuration from ``filepath`` and applies to the ``dist`` object.r) _DistributionzConfiguration file z does not exist.)r/)r-)r(r;ospathabspathisfilergetcwdchdirdirnameparse_config_filesparse_configurationcommand_options_finalize_license_files)r.r%r8r-r;current_directoryr/r0s r1r*r*[s.-----wx((H 7>>( # #JHhHHHIII HRW__X & &'''(+(x(I$(((CCC& $&=Q    $$&&& "####"#### Os #AC::D target_objkeycxd|}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. get_) functoolsrgetattr)rHrI getter_name by_attributegetters r1 _get_optionrQys? ,,K$Wj#>>L Zl ; ;F 688Or3r0ctt}|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_optionsrQrHsection_prefix)r0 config_dicthandleroptionvalues r1r+r+sk$D))K@@) @ @F 2F;;E:?K. / 7 7 @ r3 distributionrE)ConfigMetadataHandlerConfigOptionsHandlerc tj|5}t||||}||js |j|_t |j||||j|j}||j |j|jdddn #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) rEnsurePackagesDiscoveredr\parse package_dirr[metadatasrc_root_referenced_filesupdate)rZrEr-ensure_discoveredoptionsmetas r1rDrDs$  ( 6 6 :K&        ' ;'.':L $$  !    $  !    &--  %t'=   +               2 =sBB77B;>B;label orig_valueparsedcd|vstdkrdSt} td}|j|vr$t |ddSdS#t$rX}tfd|Dr2t |d}t||Yd}~dSd}~wwxYw)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.  rNr)fieldreqc3NK|]}d|V dS)rN startswith).0markerrjs r1 z8_warn_accidental_env_marker_misconfig..s5BBvay##F++BBBBBBr3) len marker_envkeysrname_AmbiguousMarkeremitranymessage)rhrirjmarkersrnexmsgs ` r1%_warn_accidental_env_marker_misconfigrs" zS[[A--ll!!G2&)$$ 8w    ! !6!9 ! = = = = =   222 BBBB'BBB B B 2"**F1I*FFC$S))r 1 2 2 2 2 2 22sAB C" A CC"c^eZdZUdZeed< iZeeefed< dede de j fdZ e de fdZed Zd Ze dd Ze d Ze dZe dZdefdZdefdZe dZe dZe ddZdZdZdZdS)r9z1Handles metadata supplied in configuration files.rUaliasesrHrfrec||_||_t|||_g|_||_t|_dSN) r-rHrS_section_optionssectionsrTresetrc)selfrHrfr-res r1__init__zConfigHandler.__init__sV%9!$T227;;<< &(!2+.55  r3c#K|D]?\}}||j\}}}|r&|d|fV@dS)N.)items partitionrUlstrip)clsrf full_namerYpreseprxs r1rzConfigHandler._section_optionsss '  * * Iu&001CDDNCd ++c""E) ) ) ) )  * *r3c:td|jjz).Metadata item name to parser function mapping.z!%s must provide .parsers property)NotImplementedError __class____name__)rs r1parserszConfigHandler.parserss#" /$.2I I   r3c|j}|j||} t||}n#t$rt |wxYw|rdS |j|d|}n#tf|jz$rYdSwxYwtj |j |}t|d|z|}|||j |dS)Nc|Srr7)xs r1z+ConfigHandler.__setitem__..%sQr3zset_%s)rHrgetrMAttributeErrorKeyErrorr Exceptionr-rLr __setattr__rTappend)r option_namerYrH current_valuerj simple_settersetters r1 __setitem__zConfigHandler.__setitem__s_ l&&{K@@  (#J <z-ConfigHandler._parse_list..As-BBB%EKKMMB BBBr3) isinstancelist splitlinessplit)rrY separators r1 _parse_listzConfigHandler._parse_list/s\ eT " " L 5==$$&&EEKK **EBB5BBBBr3cd}i}||D]\}||\}}}||krtd||||<]|S)zPRepresents value as a dict. :param value: :rtype: dict =z&Unable to parse option value to dict: )rrrr)rrYrresultlinerIrvals r1 _parse_dictzConfigHandler._parse_dictCs OOE** . .D NN955MCci!"R5"R"RSSS"%))++F399;;   r3c2|}|dvS)zQRepresents value as boolean. :param value: :rtype: bool )1trueyes)lowerrrYs r1 _parse_boolzConfigHandler._parse_boolTs ,,,r3cfd}|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)rq ValueErrorformat)rYexclude_directiverIs r1parserz3ConfigHandler._exclude_files_parser..parserjsI '  122  --3VC[[Lr3r7)rrIrs ` r1_exclude_files_parserz#ConfigHandler._exclude_files_parser^s#      r3root_dirc,d}t|ts|S||s|S|t|d}d|dD}|j|tj||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 rNc6g|]}|Sr7r)rrr=s r1rz-ConfigHandler._parse_file..s >>>dTZZ\\>>>r3r) rr"rqrurrcrdr read_files)rrYrinclude_directivespec filepathss r1 _parse_filezConfigHandler._parse_fileus$%%% L 122 LS*++--.>>djjoo>>>  %%i000 H555r3cd}||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:)rqreplacerdrer`r read_attr)rrYr`rattr_directive attr_descs r1 _parse_attrzConfigHandler._parse_attrsh!// LMM."55  41=>>> ;AAAr3cfd}|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] }||}|Srr7)rYrjmethod parse_methodss r1r_z1ConfigHandler._get_parser_compound..parses+F' ( (Mr3r7)rrr_s ` r1_get_parser_compoundz"ConfigHandler._get_parser_compounds#      r3cbi}|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)rsection_options values_parserrYrI_rs r1_parse_section_to_dict_with_keyz-ConfigHandler._parse_section_to_dict_with_keysH,2244 1 1MC!S&sC00E#JJ r3NcDrfdnd}|||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|Srr7)rvrs r1rz6ConfigHandler._parse_section_to_dict..s}}Q//r3c|Srr7)rrs r1rz6ConfigHandler._parse_section_to_dict..sUVr3r)rrrrs ` r1_parse_section_to_dictz$ConfigHandler._parse_section_to_dicts75BW/////22?FKKKr3c|D]>\}\}}tjt5|||<dddn #1swxYwY?dS)zQParses configuration file section. :param dict section_options: N)r contextlibsuppressr)rrrxrrYs r1 parse_sectionzConfigHandler.parse_sections !0 5 5 7 7 # # D*1e$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. rz_%szparse_section%sr__Nz*Unsupported distribution option section: [])rrrMrrrU)r section_namermethod_postfixsection_parser_methods r1r_zConfigHandler.parses .2]-@-@-B-B 3 3 )L/N 6!&!58?"^3<+>>.:>>> " !/ 2 2 2 2% 3 3r3c Dtfd}|S)zthis function will wrap around parameters that are deprecated :param msg: deprecation message :param func: function to be wrapped around cfddtjdfi|i|S)N stacklevelrz Deprecated config in `setup.cfg`) setdefault_DeprecatedConfigrz)argskwargsfunckwrs r1config_handlerz@ConfigHandler._deprecated_config_handler..config_handlersH MM, * * *  "#Es Q Qb Q Q Q4((( (r3r)rrrrrs ``` r1_deprecated_config_handlerz(ConfigHandler._deprecated_config_handlersB t ) ) ) ) ) )  ) r3)rr)r __module__ __qualname____doc__r"__annotations__rr r#AllCommandOptionsrr^r classmethodrpropertyrrrrrr_Pathrrrrrrr_rr7r3r1r9r9s;; !GT#s(^      # ":     "*'8***[*  X ---4CCC[C&[ --[-[,6566664BBBBB([&  [  L L L[ L###3332     r3r9c eZdZdZdddddZdZ dejfd d d ed e d e j de e def fd ZedZdZxZS)r[raurl description classifiers platforms) home_pagesummary classifierplatformFNrHrrfr-rer`rclt||||||_||_dSr)superrr`r)rrHrfr-rer`rrs r1rzConfigMetadataHandler.__init__s8 W.BDUVVV&  r3c |j}t|j|j}|j}|j}||||||||d||||j|d S)rrlicense) r keywordsprovides obsoletesr r license_filesrlong_descriptionversion project_urls)rrrrrrr_parse_version)r parse_list parse_file parse_dictexclude_files_parsers r1rzConfigMetadataHandler.parsers#s% T- FFF % #9$""#44ZLL++I66'% **&   r3c>|||j}||krJ|} t|n##t$rt d|d|wxYw|St j|||j |jS)zSParses `version` option value. :param value: :rtype: str zVersion loaded from z does not comply with PEP 440: ) rrrrrrrrrr`)rrYrs r1rz$ConfigMetadataHandler._parse_version9s""5$-88 e  mmooG     !   !6566,366  N~d..ud6F VVWWWs A A')rrrrUr strict_moder<curdirrboolrr^rrSrrrrr __classcell__rs@r1r[r[sN # GK'+) ! !* !# !# ! ": ! d^ ! ! ! ! ! ! !  X *XXXXXXXr3r[rceZdZdZdddededejffd Ze dZ dZ d e d e fd Z ed Zd ZdZdZdZdZdZdZdZdZxZS)r\rfrHr!r-recvt|||||j|_i|_dSr)rrrbrr`)rrHrfr-rers r1rzConfigOptionsHandler.__init__Vs= W.BDUVVV"+ +-r3c0||dS)N;)r)rrs r1_parse_list_semicolonz*ConfigOptionsHandler._parse_list_semicolonasu444r3c:|||jS)Nr)rr)rrYs r1_parse_file_in_rootz(ConfigOptionsHandler._parse_file_in_rootes >>>r3rhrYc|||}t|||d|DS)Nc<g|]}|d|S)#rp)rrrs r1rzAConfigOptionsHandler._parse_requirements_list..ns)DDDts/C/CDDDDr3)r*r,r)rrhrYrjs r1_parse_requirements_listz-ConfigOptionsHandler._parse_requirements_listhsL++D,D,DU,K,KLL-eUFCCCEDDDDDr3c|j}|j}|j}|j}||||||||dt |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_packagesr2setup_requires tests_requirepackages entry_points py_modulespython_requirescmdclass) rrr_parse_cmdclassrrr0r*_parse_packagesr,r)rr parse_boolrparse_cmdclasss r1rzConfigOptionsHandler.parsersps% % % -#$.%!) *"&"A"AH## !(-/A!!#8!7, 4$+&-   r3cv|jj}tj||||jSr)rer`rr?rr)rrYr`s r1r@z$ConfigOptionsHandler._parse_cmdclasss1,8 t//66 T]SSSr3c: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_dirr7) rrparse_section_packages__findrrrdrr`r find_packages)rrYfind_directives trimmed_value find_kwargss r1rAz$ConfigOptionsHandler._parse_packagess #$56  / /##E** *77 M  or 2 2   %);;]!-    #22k222r3c|||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 | ||fSr7r7)rrkr valid_keyss r1rzEConfigOptionsHandler.parse_section_packages__find..s* N N N1ZAaVr3rNNr)rrrSrr)rr section_datarLrNrSs @r1rHz1ConfigOptionsHandler.parse_section_packages__finds22?DDTUU 444  N N N N 2 2 4 4 N N N  ((  #(8K r3cF|||j}||d<dS)z`Parses `entry_points` configuration file section. :param dict section_options: r<N)rrrrrjs r1parse_section_entry_pointsz/ConfigOptionsHandler.parse_section_entry_pointss, ,,_d>NOO%^r3c`|||j}tj|Sr)rrrcanonic_package_data)rr package_datas r1_parse_package_dataz(ConfigOptionsHandler._parse_package_datas+22?DDTUU *<888r3c6|||d<dS)z`Parses `package_data` configuration file section. :param dict section_options: rZNr[rrs r1parse_section_package_dataz/ConfigOptionsHandler.parse_section_package_datas" $77HH^r3c6|||d<dS)zhParses `exclude_package_data` configuration file section. :param dict section_options: exclude_package_dataNr]r^s r1"parse_section_exclude_package_dataz7ConfigOptionsHandler.parse_section_exclude_package_datas# (,'?'?'P'P #$$$r3cD|fd}|d<dS)zbParses `extras_require` configuration file section. :param dict section_options: c8d|d|S)Nzextras_require[r)r0)rRrrs r1rzCConfigOptionsHandler.parse_section_extras_require..s#667M7M7M7MqQQr3extras_requireNrrVs` r1parse_section_extras_requirez1ConfigOptionsHandler.parse_section_extras_requires< 55  Q Q Q Q   "( r3cv|||j}tj||j|d<dS)z^Parses `data_files` configuration file section. :param dict section_options: data_filesN)rrrcanonic_data_filesrrVs r1parse_section_data_filesz-ConfigOptionsHandler.parse_section_data_filess; ,,_d>NOO#6vt}MM\r3)rrrrUrr#rr^rrr*r,r"r0rrr@rArHrWr[r_rbrfrjr$r%s@r1r\r\SspN ." .# .# . ": . . . . . .55[5???EcE#EEEE  X @TTT3332*&&&999IIIQQQ ( ( (NNNNNNNr3r\c0eZdZdZdZdZedZdS)ryzAmbiguous requirement marker.z One of the parsed requirements in `{field}` looks like a valid environment marker: {req!r} Please make sure that the configuration file is correct. You can use dangling lines to avoid this problem. z'userguide/declarative_config.html#opt-2c \d|j}||j|j||S)Nz%https://setuptools.pypa.io/en/latest/)see_url format_args) _SEE_DOCS_format_SUMMARY_DETAILS)rrdocss r1r|z_AmbiguousMarker.messages0Fs}FF{{3<tQS{TTTr3N)rrrrqrrrorr|r7r3r1ryrysG.HH:IUU[UUUr3ryceZdZdZdS)rz!userguide/declarative_config.htmlN)rrrror7r3r1rrs3IIIr3r)FF)r7F)F)@rrrLr< collectionsrrrtypingrrr r r r r rrrrrerrorsrrextern.packaging.markersrrvextern.packaging.requirementsrrextern.packaging.specifiersrextern.packaging.versionrrwarningsrrrdistutils.distrr(r!r"PathLikerSingleCommandOptionsrr#rSr2r6r#r*rQr+rDrrr9r[r\ryrr7r3r1rs   ######                            ,+++++++HHHHHHKKKKKKKK666666>>>>>>>>333333-333333,,,,,, c2;E5#445  445 'M!N O O O>C+++ ++++4n.$&!&  %    < F     E*>$?D*++ +&+ :; ++++\22#2t2222@^^^^^GFO^^^B JXJXJXJXJXM*@AJXJXJXZ\N\N\N\N\N=8\N\N\N~UUUUU3UUU(44444444444r3