a [dgV@sddlZddlZddlZddlZddlZddlZddlZddlmZddlm Z ddlm Z ddl Z ddl m Z mZddlmZmZddlmZGdd d Ze jd d Zdd dZddZddZdddZGdddZGdddeZGdddeZdS)N) defaultdict)partialwraps)DistutilsOptionErrorDistutilsFileError) LegacyVersionparse) SpecifierSetc@seZdZddZddZdS) StaticModulecCs`tj|}t|j}|}Wdn1s40Yt|}t| t |` dSN) importlibutil find_specopenoriginreadastr varsupdatelocalsself)rnamespecZstrmsrcmoduler;/usr/local/lib/python3.9/site-packages/setuptools/config.py__init__s   & zStaticModule.__init__c s^ztfdd|jjDWStyX}z$tdjfit|WYd}~n d}~00dS)Nc3sH|]@}t|tjr|jD](}t|tjr|jkrt|jVqqdSr ) isinstancerZAssigntargetsNameidZ literal_evalvalue).0Z statementtargetattrrr !s   z+StaticModule.__getattr__..z#{self.name} has no attribute {attr})nextrbody ExceptionAttributeErrorformatr)rr'err&r __getattr__s  zStaticModule.__getattr__N)__name__ __module__ __qualname__rr/rrrrr sr c cs8z$tjd|dVWtj|ntj|0dS)Nr)syspathinsertremove)r4rrr patch_path.sr7Fc Csddlm}m}tj|}tj|s4td|t}t tj |zT|}|rb| ng}||vrx| ||j ||dt||j|d}Wt |n t |0t|S)Nr) Distribution _Distributionz%Configuration file %s does not exist.) filenames)ignore_option_errors)Zsetuptools.distr8r9osr4abspathisfilergetcwdchdirdirnameZfind_config_filesappendZparse_config_filesparse_configurationcommand_optionsconfiguration_to_dict) filepathZ find_othersr;r8r9Zcurrent_directorydistr:handlersrrrread_configuration:s(   rIcCs2djfit}tt||}t|||}|S)Nz get_{key})r-r functoolsrgetattr) target_objkeyZ getter_nameZ by_attributegetterrrr _get_optionis rOcCs<tt}|D]*}|jD]}t|j|}|||j|<qq |Sr )rdict set_optionsrOrLsection_prefix)rHZ config_dicthandleroptionr#rrrrEus   rEcCs6t|||}|t|j|||j}|||fSr )ConfigOptionsHandlerr ConfigMetadataHandlermetadata package_dir)Z distributionrDr;optionsmetarrrrCsrCc@seZdZdZiZd$ddZeddZddZe d%d d Z e d d Z e ddZ e ddZ e ddZeddZeddZe d&ddZe ddZe d'ddZddZd d!Zd"d#ZdS)( ConfigHandlerNFcCs^i}|j}|D].\}}||s&q||dd}|||<q||_||_||_g|_dS)N.) rRitems startswithreplacestripr;rLsectionsrQ)rrLrYr;rbrR section_namesection_optionsrrrrs  zConfigHandler.__init__cCstd|jjdS)Nz!%s must provide .parsers property)NotImplementedError __class__r0)rrrrparserss zConfigHandler.parsersc Cst}|j}|j||}t|||}||ur6t||r>dSd}|j|}|r~z ||}Wnty|d}|jsxYn0|rdSt|d|d}|durt |||n|||j |dS)NFTzset_%s) tuplerLaliasesgetrKKeyErrorrgr+r;setattrrQrB) rZ option_namer#unknownrLZ current_valueZ skip_optionparsersetterrrr __setitem__s0    zConfigHandler.__setitem__,cCs8t|tr|Sd|vr |}n ||}dd|DS)N cSsg|]}|r|qSr)ra)r$chunkrrr z-ConfigHandler._parse_list..)rlist splitlinessplit)clsr# separatorrrr _parse_lists   zConfigHandler._parse_listcCsPd}i}||D]8}||\}}}||kr:td||||<q|S)N=z(Unable to parse option value to dict: %s)r{ partitionrra)ryr#rzresultlinerMsepvalrrr _parse_dictszConfigHandler._parse_dictcCs|}|dvS)N)1trueZyes)lower)ryr#rrr _parse_boolszConfigHandler._parse_boolcsfdd}|S)Ncs d}||rtd|S)Nfile:zCOnly strings are accepted for the {0} field, files are not accepted)r_ ValueErrorr-)r#Zexclude_directiverMrrrn)s z3ConfigHandler._exclude_files_parser..parserr)ryrMrnrrr_exclude_files_parsers z#ConfigHandler._exclude_files_parsercs\d}t|ts|S||s |S|t|d}dd|dD}dfdd|DS)Nrcss|]}tj|VqdSr )r<r4r=rar$r4rrrr(Iruz,ConfigHandler._parse_file..rqrrc3s.|]&}|stj|r|VqdS)TN) _assert_localr<r4r> _read_filerryrrr(Js  )rstrr_lenrxjoin)ryr#Zinclude_directiverZ filepathsrrr _parse_file2s  zConfigHandler._parse_filecCs|tstd|dS)Nz#`file:` directive can not access %s)r_r<r?r)rFrrrrQszConfigHandler._assert_localcCs:tj|dd}|WdS1s,0YdS)Nzutf-8)encoding)iorr)rFfrrrrWszConfigHandler._read_filec Cs4d}||s|S||dd}|}d|}|p@d}t}|r|d|vr||d}|dd} t | dkrtj t| d}| d}q|}nd|vrtj t|d}t |Nzt t ||WWdStyt|} Yn0Wdn1s 0Yt | |S)Nzattr:r\r]rr/)r_r`rarxpoprr<r?rsplitrr4r7rKr r+r import_module) ryr#rXZattr_directiveZ attrs_pathZ attr_name module_name parent_pathZ custom_pathpartsrrrr _parse_attr\s0         0zConfigHandler._parse_attrcsfdd}|S)Ncs|}D] }||}q|Sr r)r#parsedmethod parse_methodsrrr s z1ConfigHandler._get_parser_compound..parser)ryrr rrr_get_parser_compounds z"ConfigHandler._get_parser_compoundcCs6i}|pdd}|D]\}\}}||||<q|S)NcSs|Sr r)rrrrruz6ConfigHandler._parse_section_to_dict..)r^)ryrdZ values_parserr#rM_rrrr_parse_section_to_dicts  z$ConfigHandler._parse_section_to_dictc Cs:|D],\}\}}z |||<Wqty2Yq0qdSr )r^rk)rrdrrr#rrr parse_sections   zConfigHandler.parse_sectioncCsb|jD]R\}}d}|r"d|}t|d|ddd}|durTtd|j|f||q dS)Nr\z_%szparse_section%sr]__z0Unsupported distribution option section: [%s.%s])rbr^rKr`rrR)rrcrdZmethod_postfixZsection_parser_methodrrrr s zConfigHandler.parsecstfdd}|S)Ncst|i|Sr )warningswarn)argskwargsfuncmsg warning_classrrconfig_handlers z@ConfigHandler._deprecated_config_handler..config_handlerr)rrrrrrrr_deprecated_config_handlersz(ConfigHandler._deprecated_config_handler)F)rq)N)N)r0r1r2rRrirpropertyrgrp classmethodr{rrrr staticmethodrrrrrrr rrrrrr[s:  &        -   r[csHeZdZdZdddddZdZdfd d Zed d Zd dZ Z S)rVrWurl description classifiers platforms)Z home_pageZsummaryZ classifierplatformFNcstt||||||_dSr )superrVrrX)rrLrYr;rXrfrrrszConfigMetadataHandler.__init__c CsN|j}|j}|j}|j}|||||dt|||||d||||j|d S)Nz[The requires parameter is deprecated, please use install_requires for runtime dependencies.license) rkeywordsZprovidesZrequiresZ obsoletesrrZ license_filesrZlong_descriptionversionZ project_urls)r{rrrrDeprecationWarningr_parse_version)r parse_listZ parse_file parse_dictZexclude_files_parserrrrrgs* zConfigMetadataHandler.parserscCs||}||krF|}tt|trBd}t|jfit|S|||j }t |rb|}t|t st |drd tt |}nd|}|S)NzCVersion loaded from {value} does not comply with PEP 440: {version}__iter__r]z%s)rrarr rrr-rrrXcallablerhasattrrmap)rr#rZtmplrrrrs    z$ConfigMetadataHandler._parse_version)FN) r0r1r2rRriZ strict_moderrrgr __classcell__rrrrrVs rVc@sdeZdZdZeddZddZddZdd Zd d Z d d Z ddZ ddZ ddZ ddZdS)rUrYcCsV|j}t|jdd}|j}|j}|j}|||||||||||||||j|j|t|dS)N;rz)Zzip_safeZuse_2to3Zinclude_package_datarXZuse_2to3_fixersZuse_2to3_exclude_fixersZconvert_2to3_doctestsZscriptsZeager_resourcesZdependency_linksZnamespace_packagesZinstall_requiresZsetup_requiresZ tests_requireZpackages entry_pointsZ py_modulesZpython_requiresZcmdclass)r{rrr_parse_cmdclass_parse_packagesrr )rrZparse_list_semicolonZ parse_boolrZparse_cmdclassrrrrg:s2zConfigOptionsHandler.parserscs$ddfdd||DS)NcSs8|d}||dd}|d|}t|}t||S)Nr]r)rfind __import__rK)Zqualified_class_nameidx class_nameZpkg_namerrrr resolve_classZs   z;ConfigOptionsHandler._parse_cmdclass..resolve_classcsi|]\}}||qSrrr$kvrrr csz8ConfigOptionsHandler._parse_cmdclass..)rr^)rr#rrrrYs  z$ConfigOptionsHandler._parse_cmdclasscCsnddg}|}||vr"||S||dk}||jdi}|rTddlm}n ddlm}|fi|S)Nzfind:zfind_namespace:rz packages.findr)find_namespace_packages) find_packages)rar{parse_section_packages__findrbrjZ setuptoolsrr)rr#Zfind_directivesZ trimmed_valueZfindns find_kwargsrrrrrhs    z$ConfigOptionsHandler._parse_packagescsR|||j}gdtfdd|D}|d}|durN|d|d<|S)N)whereZincludeZexcludecs$g|]\}}|vr|r||fqSrrrZ valid_keysrrrtruzEConfigOptionsHandler.parse_section_packages__find..rr)rr{rPr^rj)rrdZ section_datarrrrrrs  z1ConfigOptionsHandler.parse_section_packages__findcCs|||j}||d<dS)Nr)rr{rrdrrrrparse_section_entry_pointssz/ConfigOptionsHandler.parse_section_entry_pointscCs.|||j}|d}|r*||d<|d=|S)N*r\)rr{rj)rrdrrootrrr_parse_package_datas  z(ConfigOptionsHandler._parse_package_datacCs|||d<dS)NZ package_datarrrdrrrparse_section_package_datasz/ConfigOptionsHandler.parse_section_package_datacCs|||d<dS)NZexclude_package_datarrrrr"parse_section_exclude_package_datasz7ConfigOptionsHandler.parse_section_exclude_package_datacCs"t|jdd}||||d<dS)NrrZextras_require)rr{r)rrdrrrrparse_section_extras_requiresz1ConfigOptionsHandler.parse_section_extras_requirecCs(|||j}dd|D|d<dS)NcSsg|]\}}||fqSrrrrrrrtruzAConfigOptionsHandler.parse_section_data_files..Z data_files)rr{r^rrrrparse_section_data_filessz-ConfigOptionsHandler.parse_section_data_filesN)r0r1r2rRrrgrrrrrrrrrrrrrrU6s   rU)FF)F)rrr<r3rrJr collectionsrrr contextlibZdistutils.errorsrrZ#setuptools.extern.packaging.versionrr Z&setuptools.extern.packaging.specifiersr r contextmanagerr7rIrOrErCr[rVrUrrrrs6     /  @V