a „oe�gã@sÀdZddlmZddlmZddlmZddlm Z ddlZddlZddl Z ddl Z ddl Z ddl Z ddlZddlZddlmZdd lmZmZd d lmZdd lmZdd lmZddlmZddlmZddlmZddlm Z ddl!m"Z"ddl#m$Z$ddl%m&Z&dj'e j(ŽZ)dd„Z*Gdd„dƒZ+Gdd„de+eƒZ,Gdd„deƒZGdd„deƒZ-dd „Z.d!d"„Z/d#d$„Z0ej1Z1ej2Z2d%d&„Z3d'd(„Z4d2d*d+„Z5d,d-„Z6d3d.d/„Z7Gd0d1„d1e&ƒZ8dS)4zUsetuptools.command.egg_info Create a distribution's .egg-info directory and contentsé)ÚFileList)ÚDistutilsInternalError)Ú convert_path)ÚlogNé)Úmetadata)Ú _entry_pointsÚ_normalizationé)Ú _requirestxt)ÚCommand)Úsdist)Ú walk_revctrl)Ú edit_config)Ú bdist_egg)Úglob)Ú packaging)ÚSetuptoolsDeprecationWarningz{}.{}cCsÞd}| tjj¡}t tj¡}d|f}t|ƒD�]Œ\}}|t|ƒdk}|dkrr|r`|d7}q0|d||f7}q0d}t|ƒ} || k�r²||} | dkr¨||d7}�n| d krº||7}nî| d k�rš|d} | | krè|| d krè| d} | | k�r|| d k�r| d} | | k�r,|| d k�r,| d} �q| | k�rF|t | ¡7}nR||d| …} d} | dd k�rxd } | dd…} | t | ¡7} |d| f7}| }n|t | ¡7}|d7}q~|s0||7}q0|d7}tj|tj tj Bd�S)zö Translate a file path glob like '*.txt' in to a regular expression. This differs from fnmatch.translate which allows wildcards to match directory separators. It also knows about '**/' which matches any number of directories. Úz[^%s]r ú**z.*z (?:%s+%s)*rÚ*ú?ú[ú!ú]ú^Nz[%s]z\Z)Úflags) ÚsplitÚosÚpathÚsepÚreÚescapeÚ enumerateÚlenÚcompileÚ MULTILINEÚDOTALL)rÚpatÚchunksr Z valid_charÚcÚchunkZ last_chunkÚiZ chunk_lenÚcharZinner_iÚinnerZ char_class©r/úr/r/r0r=�szInfoCommon._already_tagged)r@c CsLzt d|j›�¡dd…WStjjyFt |j dd¡¡YS0dS)NÚ0r ú Ú.)r r:r<rr?ZInvalidVersionr4Úreplacer6r/r/r0rB”szInfoCommon._safe_tagscCs,d}|jr||j7}|jr(|t d¡7}|S)Nrz%Y%m%d)Ú tag_buildÚtag_dateÚtimeÚstrftimer>r/r/r0Útagsœs  zInfoCommon.tags)Ú__name__Ú __module__Ú __qualname__rGrHÚpropertyr8r;r9ÚstrÚboolr=rBrKr<r/r/r/r0r2xs  r2c@s�eZdZdZgd¢ZdgZddiZdd„Zedd„ƒZ e j d d„ƒZ d d „Z d d „Z e dfdd„Zddd„Zdd„Zdd„Zdd„Zdd„ZdS)Úegg_infoz+create a distribution's .egg-info directory))z egg-base=ÚezLdirectory containing .egg-info directories (default: top of the source tree))útag-dateÚdz0Add date stamp (e.g. 20050528) to version number)z tag-build=Úbz-Specify explicit tag to add to version number)úno-dateÚDz"Don't include date stamp [default]rTrWcCs"d|_d|_d|_d|_d|_dS)NF)Úegg_baseÚegg_namerRÚ egg_versionÚignore_egg_info_in_manifestr6r/r/r0Úinitialize_options»s zegg_info.initialize_optionscCsdSr3r/r6r/r/r0Útag_svn_revisionÅszegg_info.tag_svn_revisioncCsdSr3r/)r7Úvaluer/r/r0r^ÉscCs0t ¡}| ¡|d<d|d<t|t|d�ƒdS)z³ Materialize the value of date into the build tag. Install build keys in a deterministic order to avoid arbitrary reordering on subsequent builds. rGrrH)rRN)Ú collectionsÚ OrderedDictrKrÚdict)r7ÚfilenamerRr/r/r0Úsave_version_infoÏs zegg_info.save_version_infoc Csd|j|_| ¡|_tj |j¡}z6t|tjjƒ}|r8dnd}tj  ||j|jf¡Wn>t y”}z&t j   d|j|jf¡|‚WYd}~n d}~00|jdur¼|jj}|p®i dtj¡|_| d¡t |j¡d|_|jtjkrøtj |j|j¡|_|j|jj_|jj}t|ddƒ�p$t|ddƒ}|du�r`||j ¡k�r`|j|_tj |j¡|_d|j_dS) Nz%s==%sz%s===%sz2Invalid distribution name or version syntax: %s-%srrYú .egg-infoÚkeyr8) r8rZr;r[rr?ZVersionÚ isinstanceZ requirementsZ RequirementÚ ValueErrorÚ distutilsÚerrorsZDistutilsOptionErrorrYr5Z package_dirÚgetrÚcurdirZensure_dirnamer Úfilename_componentrRrÚjoinrZ _patched_distÚgetattrÚlowerZ_versionZ_parsed_version)r7Zparsed_versionZ is_versionÚspecrSÚdirsÚpdrfr/r/r0Úfinalize_optionsÜs:   ÿÿý    zegg_info.finalize_optionsNcCst|j|j||ƒS)ú0Compute filename of the output egg. Private API.)Ú _egg_basenamerZr[)r7Ú py_versionÚplatformr/r/r0Ú_get_egg_basenameszegg_info._get_egg_basenameFcCsL|r| |||¡n4tj |¡rH|dur>|s>t d||¡dS| |¡dS)a¹Write `data` to `filename` or delete if empty If `data` is non-empty, this routine is the same as ``write_file()``. If `data` is empty but not ``None``, this is the same as calling ``delete_file(filename)`. If `data` is ``None``, then this is a no-op unless `filename` exists, in which case a warning is issued about the orphaned file (if `force` is false), or deleted (if `force` is true). Nz$%s not set in setup(), but %s exists)Ú write_filerrÚexistsrÚwarnÚ delete_file)r7ÚwhatrcÚdataÚforcer/r/r0Úwrite_or_delete_file s   zegg_info.write_or_delete_filecCs>t d||¡| d¡}|js:t|dƒ}| |¡| ¡dS)zªWrite `data` to `filename` (if not a dry run) after announcing it `what` is used in a log message to identify what is being written to the file. zwriting %s to %súutf-8ÚwbN)rÚinfoÚencodeÚdry_runÚopenÚwriteÚclose)r7r~rcrÚfr/r/r0rzs    zegg_info.write_filecCs t d|¡|jst |¡dS)z8Delete `filename` (if not a dry run) after announcing itz deleting %sN)rr„r†rÚunlink)r7rcr/r/r0r}+s zegg_info.delete_filec CsÈ| |j¡zt |jd¡Wn@ty^}z(d|j›d�}tj |¡|‚WYd}~n d}~00tj dd�D](}|  ¡}|||j tj   |j|j ¡ƒqltj   |jd¡}tj  |¡r¼| |¡| ¡dS)Nz'Cannot update time stamp of directory 'ú'zegg_info.writers)Úgroupznative_libs.txt)ZmkpathrRrÚutimeÚOSErrorrirjZDistutilsFileErrorrÚ entry_pointsÚloadr8rrnr{r}Ú find_sources)r7rSÚmsgZepÚwriterÚnlr/r/r0Úrun1s $  z egg_info.runcCs<tj |jd¡}t|jƒ}|j|_||_|  ¡|j |_ dS)z"Generate SOURCES.txt manifest filez SOURCES.txtN) rrrnrRÚmanifest_makerr5r\Úignore_egg_info_dirÚmanifestr–Úfilelist)r7Zmanifest_filenameZmmr/r/r0r’Cs  zegg_info.find_sources)F)rLrMrNÚ descriptionZ user_optionsZboolean_optionsZ negative_optr]rOr^ÚsetterrdrtÚPY_MAJORryr�rzr}r–r’r/r/r/r0rR§s$ ÿ    ,  rRcsŽeZdZd!‡fdd„ Zdd„Zdd„Zd d „Zd d „Zd d„Zdd„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd „Z‡ZS)"rNFcstƒ ||¡||_dSr3)ÚsuperÚ__init__r˜)r7r|Ú debug_printr˜©Ú __class__r/r0rŸPszFileList.__init__c Cs | |¡\}}}}|j|j|j|jt |j|¡t |j|¡|j |j dœ}dddddddd dœ}z ||}Wn"t yŒt d j |d �ƒ‚Yn0| d ¡} |d vr¦|g}| r°|fnd} ||} | d |g| rÒ|gng|¡¡|D] } || ƒsätj| | g| ¢RŽqädS)N)ÚincludeÚexcludezglobal-includezglobal-excludezrecursive-includezrecursive-excludeÚgraftÚprunez%warning: no files found matching '%s'z9warning: no previously-included files found matching '%s'z>warning: no files found matching '%s' anywhere in distributionzRwarning: no previously-included files matching '%s' found anywhere in distributionz:warning: no files found matching '%s' under directory '%s'zNwarning: no previously-included files matching '%s' found under directory '%s'z+warning: no directories found matching '%s'z6no previously-included directories found matching '%s'z/this cannot happen: invalid action '{action!s}')Úactionz recursive->r¥r¦r/rD)Z_parse_template_liner£r¤Úglobal_includeÚglobal_excludeÚ functoolsÚpartialÚrecursive_includeÚrecursive_excluder¥r¦ÚKeyErrorrÚformatÚ startswithr rnrr|) r7Úliner§ÚpatternsÚdirZ dir_patternZ action_mapZlog_mapZprocess_actionZaction_is_recursiveZextra_log_argsZlog_tmplÚpatternr/r/r0Úprocess_template_lineTsXþþòî   ÿ  ÿÿzFileList.process_template_linecCsRd}tt|jƒdddƒD]2}||j|ƒr| d|j|¡|j|=d}q|S)z† Remove all files from the file list that match the predicate. Return True if any matching files were removed Fr éÿÿÿÿz removing T)Úranger$Úfilesr )r7Ú predicateÚfoundr,r/r/r0Ú _remove_files›szFileList._remove_filescCs$dd„t|ƒDƒ}| |¡t|ƒS)z#Include files that match 'pattern'.cSsg|]}tj |¡s|‘qSr/©rrÚisdir©Ú.0rŠr/r/r0Ú ªóz$FileList.include..©rÚextendrQ©r7r´rºr/r/r0r£¨s zFileList.includecCst|ƒ}| |j¡S)z#Exclude files that match 'pattern'.)r1r»Úmatch©r7r´rÅr/r/r0r¤®szFileList.excludecCs8tj |d|¡}dd„t|dd�Dƒ}| |¡t|ƒS)zN Include all files anywhere in 'dir/' that match the pattern. rcSsg|]}tj |¡s|‘qSr/r¼r¾r/r/r0rÀ¸rÁz.FileList.recursive_include..T)Ú recursive)rrrnrrÃrQ)r7r³r´Z full_patternrºr/r/r0r¬³s zFileList.recursive_includecCs ttj |d|¡ƒ}| |j¡S)zM Exclude any file anywhere in 'dir/' that match the pattern. r©r1rrrnr»rÅ)r7r³r´rÅr/r/r0r­¼szFileList.recursive_excludecCs$dd„t|ƒDƒ}| |¡t|ƒS)zInclude all files from 'dir/'.cSs"g|]}tj |¡D]}|‘qqSr/)riršÚfindall)r¿Z match_dirÚitemr/r/r0rÀÅsþz"FileList.graft..rÂ)r7r³rºr/r/r0r¥Ãs þ zFileList.graftcCsttj |d¡ƒ}| |j¡S)zFilter out files from 'dir/'.rrÈ)r7r³rÅr/r/r0r¦ÍszFileList.prunecsJ|jdur| ¡ttj d|¡ƒ‰‡fdd„|jDƒ}| |¡t|ƒS)z“ Include all files anywhere in the current directory that match the pattern. This is very inefficient on large file trees. Nrcsg|]}ˆ |¡r|‘qSr/©rÅr¾rËr/r0rÀÚrÁz+FileList.global_include..)ZallfilesrÉr1rrrnrÃrQrÄr/rËr0r¨Òs   zFileList.global_includecCsttj d|¡ƒ}| |j¡S)zD Exclude all files anywhere that match the pattern. rrÈrÆr/r/r0r©ÞszFileList.global_excludecCs8| d¡r|dd…}t|ƒ}| |¡r4|j |¡dS)Nú r¶)rArÚ _safe_pathr¸Úappend)r7rÊrr/r/r0rÎås    zFileList.appendcCs|j t|j|ƒ¡dSr3)r¸rÃÚfilterrÍ)r7Úpathsr/r/r0rÃíszFileList.extendcCstt|j|jƒƒ|_dS)zÜ Replace self.files with only safe paths Because some owners of FileList manipulate the underlying ``files`` attribute directly, this method must be called to repair those paths. N)ÚlistrÏrÍr¸r6r/r/r0Ú_repairðszFileList._repairc Csºd}t |¡}|dur(t d|¡dSt |d¡}|durNt ||d¡dSzBd|vp^d|v}|jrp|rpWdStj |¡sˆtj |¡rŽWdSWn$t y´t ||t   ¡¡Yn0dS)Nz!'%s' not %s encodable -- skippingz''%s' in unexpected encoding -- skippingFr‚res .egg-infoT) Ú unicode_utilsÚfilesys_decoderr|Z try_encoder˜rrr{ÚUnicodeEncodeErrorÚsysÚgetfilesystemencoding)r7rZenc_warnZu_pathZ utf8_pathZ is_egg_infor/r/r0rÍús"     zFileList._safe_path)NNF)rLrMrNrŸrµr»r£r¤r¬r­r¥r¦r¨r©rÎrÃrÒrÍÚ __classcell__r/r/r¡r0rMsG     rc@steZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd d „Z e dd„ƒZ dd„Z dd„Z dd„Zdd„Zdd„ZdS)r—z MANIFEST.incCs"d|_d|_d|_d|_d|_dS)Nr F)Z use_defaultsr¦Z manifest_onlyZforce_manifestr˜r6r/r/r0r]s z!manifest_maker.initialize_optionscCsdSr3r/r6r/r/r0rt szmanifest_maker.finalize_optionscCszt|jd�|_tj |j¡s$| ¡| ¡tj |j ¡rB|  ¡|  ¡|  ¡|  ¡|j ¡|j ¡| ¡dS)N)r˜)rr˜ršrrr{r™Úwrite_manifestÚ add_defaultsÚtemplateZ read_templateÚadd_license_filesÚ_add_referenced_filesÚprune_file_listÚsortZremove_duplicatesr6r/r/r0r–#s  zmanifest_maker.runcCst |¡}| tjd¡S)Nú/)rÓrÔrFrr )r7rr/r/r0Ú_manifest_normalize1s z"manifest_maker._manifest_normalizecsBˆj ¡‡fdd„ˆjjDƒ}dˆj}ˆ tˆj|f|¡dS)zo Write the file list in 'self.filelist' to the manifest file named by 'self.manifest'. csg|]}ˆ |¡‘qSr/)rár¾r6r/r0rÀ=rÁz1manifest_maker.write_manifest..zwriting manifest file '%s'N)ršrÒr¸r™Zexecuterz)r7r¸r“r/r6r0rÙ5s  zmanifest_maker.write_manifestcCs| |¡st ||¡dSr3)Ú_should_suppress_warningr r|)r7r“r/r/r0r|As zmanifest_maker.warncCs t d|¡S)z; suppress missing-file warnings from sdist zstandard file .*not found)r!rÅ)r“r/r/r0râEsz'manifest_maker._should_suppress_warningcCsŒt |¡|j |j¡|j |j¡ttƒƒ}|rB|j |¡nt j   |j¡rX|  ¡t j   d¡rp|j d¡|  d¡}|j |j¡dS)Nzsetup.pyrR)r rÚršrÎrÛr™rÑrrÃrrr{Z read_manifestÚget_finalized_commandr¥rR)r7ZrcfilesZei_cmdr/r/r0rÚLs     zmanifest_maker.add_defaultscCs4|jjjp g}|D]}t d|¡q|j |¡dS)Nzadding license file '%s')r5rÚ license_filesrr„ršrÃ)r7räZlfr/r/r0rÜ^sz manifest_maker.add_license_filescCs4t|jdgƒ}|D]}t d|¡q|j |¡dS)zGAdd files referenced by the config (e.g. `file:` directive) to filelistZ_referenced_filesz%adding file referenced by config '%s'N)ror5rÚdebugršrÃ)r7Z referencedZrfr/r/r0rÝdsz$manifest_maker._add_referenced_filescCsZ| d¡}|j ¡}|j |j¡|j |¡t tj ¡}|jj d|d|dd�dS)NÚbuildz(^|z)(RCS|CVS|\.svn)r )Zis_regex) rãr5Z get_fullnameršr¦Z build_baser!r"rr Zexclude_pattern)r7ræÚbase_dirr r/r/r0rÞls    ÿzmanifest_maker.prune_file_listcCs*t|dƒr| ¡Stjdddd�| ¡S)a0 The parent class implementation of this method (``sdist``) will try to include data files, which might cause recursion problems when ``include_package_data=True``. Therefore, avoid triggering any attempt of analyzing/building the manifest again. Úget_data_files_without_manifestz@`build_py` command does not inherit from setuptools' `build_py`.z± Custom 'build_py' does not implement 'get_data_files_without_manifest'. Please extend command classes from setuptools instead of distutils. z!https://peps.python.org/pep-0632/)Zsee_url)ÚhasattrrèrÚemitZget_data_files)r7Zbuild_pyr/r/r0Ú_safe_data_filesvs ú zmanifest_maker._safe_data_filesN)rLrMrNrÛr]rtr–rárÙr|Ú staticmethodrârÚrÜrÝrÞrër/r/r/r0r—s   r—cCsLd |¡}| d¡}t|dƒ�}| |¡Wdƒn1s>0YdS)z{Create a file with the specified name and write 'contents' (a sequence of strings without line terminators) to it. Ú r‚rƒN)rnr…r‡rˆ)rcÚcontentsrŠr/r/r0rz�s   rzc CsŠt d|¡|js†|jj}|j|j|_}|j|j|_}z|  |j ¡W|||_|_n|||_|_0t |jddƒ}t   |j |¡dS)Nz writing %sZzip_safe)rr„r†r5rr[r?rZr8Úwrite_pkg_inforRrorZwrite_safety_flag)ÚcmdÚbasenamercrZoldverZoldnameÚsafer/r/r0rïœs  rïcCsdS)aj Unused: left to avoid errors when updating (from source) from <= 67.8. Old installations have a .dist-info directory with the entry-point ``depends.txt = setuptools.command.egg_info:warn_depends_obsolete``. This may trigger errors when running the first egg_info in build_meta. TODO: Remove this function in a version sufficiently > 68. Nr/©rðrñrcr/r/r0Úwarn_depends_obsolete¯srôcCs:t dd„|j ¡Dƒ¡}| d|d t|ƒ¡d¡dS)NcSsg|]}| dd¡d‘qS)rEr r)r)r¿Úkr/r/r0rÀÀrÁz(write_toplevel_names..ztop-level namesrí)rbÚfromkeysr5Ziter_distribution_namesrzrnÚsorted)rðrñrcZpkgsr/r/r0Úwrite_toplevel_names¾sÿrøcCst|||dƒdS)NT)Ú write_argrór/r/r0Ú overwrite_argÅsrúFcCsHtj |¡d}t|j|dƒ}|dur4d |¡d}| ||||¡dS)Nrrí)rrÚsplitextror5rnr�)rðrñrcr€Úargnamer_r/r/r0rùÉs rùcCs,t |jj¡}t |¡}| d||d¡dS)Nz entry pointsT)rr‘r5r�Zrenderr�)rðrñrcZepsZdefnr/r/r0Ú write_entriesÑs rýcCsBt |¡}t |¡}|›d|›d|p&t›�}|r>|d|›�7}|S)ruú-z-py)r rmr�)rZr[rwrxr8r?Zeggr/r/r0rv×s   rvc@seZdZdZdS)ÚEggInfoDeprecationWarningz?Deprecated behavior warning for EggInfo, bypassing suppression.N)rLrMrNÚ__doc__r/r/r/r0rÿásrÿ)F)NN)9rZdistutils.filelistrZ _FileListZdistutils.errorsrZdistutils.utilrrirrªrr!rÖrIr`Z _importlibrrrr r Z setuptoolsr Zsetuptools.command.sdistr rZsetuptools.command.setoptrZsetuptools.commandrZsetuptools.unicode_utilsrÓZsetuptools.globrZsetuptools.externrÚwarningsrr¯Ú version_infor�r1r2rRr—rzrïrôZwrite_requirementsZwrite_setup_requirementsrørúrùrýrvrÿr/r/r/r0ÚsV                S/'Jy