o )ab@sdZddlmZddlmZddlmZddlm Z ddlZddlZddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZddlmZddlmZdd lmZdd lmZdd lmZdd lmZmZmZmZm Z m!Z!m"Z"m#Z#ddl$m%Z%dd l&m'Z'ddl(m)Z)ddlm*Z*ddZ+GdddZ,Gddde,eZ-GdddeZGdddeZ.ddZ/ddZ0ddZ1d d!Z2d"d#Z3d$d%Z4d&d'Z5d(d)Z6d3d+d,Z7d-d.Z8d/d0Z9Gd1d2d2e*Z:dS)4zUsetuptools.command.egg_info Create a distribution's .egg-info directory and contents)FileList)DistutilsInternalError) convert_path)logN)Command)sdist) walk_revctrl) edit_config) bdist_egg)parse_requirements safe_name parse_version safe_version yield_lines EntryPointiter_entry_points to_filename)glob) packaging)SetuptoolsDeprecationWarningcCsd}|tjj}ttj}d|f}t|D]\}}|t|dk}|dkr8|r/|d7}n|d||f7}qd}t|} || kr||} | dkrQ||d7}n| d krZ||7}nx| d kr|d} | | krp|| d krp| d} | | kr~|| d kr~| d} | | kr|| d kr| d} | | kr|| d ks| | kr|t| 7}q||d| } d} | dd krd } | dd} | t| 7} |d| f7}| }n|t| 7}|d7}|| ksB|s||7}q|d7}tj|tj tj BdS)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]**z.*z (?:%s+%s)*r*?[!]^Nz[%s]z\Z)flags) splitospathsepreescape enumeratelencompile MULTILINEDOTALL)rpatchunksr#Z valid_charcchunkZ last_chunkiZ chunk_lencharZinner_iinnerZ char_classr2N/opt/alt/python310/lib/python3.10/site-packages/setuptools/command/egg_info.pytranslate_pattern#s\      -r4c@s@eZdZdZdZeddZddZddZdd Z ee Z dS) InfoCommonNcCst|jSN)r distributionZget_nameselfr2r2r3namezszInfoCommon.namecCst||jSr6)r _maybe_tagr7Z get_versionr8r2r2r3tagged_version~szInfoCommon.tagged_versioncCs |jr ||jr |S||jS)z egg_info may be called more than once for a distribution, in which case the version string already contains all tags. )vtagsendswithr9versionr2r2r3r;szInfoCommon._maybe_tagcCs,d}|jr ||j7}|jr|td7}|S)Nrz-%Y%m%d) tag_buildtag_datetimestrftimer?r2r2r3tagss  zInfoCommon.tags) __name__ __module__ __qualname__rArBpropertyr:r<r;rEr=r2r2r2r3r5vs  r5c@seZdZdZgdZdgZddiZddZeddZ e j d dZ d d Z d d Z dddZ ddZddZddZddZddZdS)egg_infoz+create a distribution's .egg-info directory))z egg-base=ezLdirectory containing .egg-info directories (default: top of the source tree))tag-datedz0Add date stamp (e.g. 20050528) to version number)z tag-build=bz-Specify explicit tag to add to version number)no-dateDz"Don't include date stamp [default]rLrOcCs"d|_d|_d|_d|_d|_dS)NF)egg_baseegg_namerJ egg_versionbroken_egg_infor8r2r2r3initialize_optionss  zegg_info.initialize_optionscCdSr6r2r8r2r2r3tag_svn_revisionzegg_info.tag_svn_revisioncCrVr6r2)r9valuer2r2r3rWrXcCs0t}||d<d|d<t|t|ddS)z Materialize the value of date into the build tag. Install build keys in a deterministic order to avoid arbitrary reordering on subsequent builds. rArrB)rJN) collections OrderedDictrEr dict)r9filenamerJr2r2r3save_version_infos zegg_info.save_version_infoc CsL|j|_||_t|j}zt|tjj}|rdnd}t t ||j|jfWnt yB}z t j d|j|jf|d}~ww|jdurV|jj}|pOidtj|_|dt|jd|_|jtjkrstj|j|j|_d|jvr|||j|jj_|jj}|dur|j|jkr|j|_t|j|_ d|j_dSdSdS)Nz%s==%sz%s===%sz2Invalid distribution name or version syntax: %s-%srrQ .egg-info-)!r:rRr<rSr isinstancerr@ZVersionlistr ValueError distutilserrorsZDistutilsOptionErrorrQr7Z package_dirgetr!curdirZensure_dirnamerrJr"joincheck_broken_egg_infometadataZ _patched_distkeylowerZ_versionZ_parsed_version)r9Zparsed_versionZ is_versionspecrKdirsZpdr2r2r3finalize_optionssH           zegg_info.finalize_optionsFcCsR|r ||||dStj|r'|dur |s td||dS||dSdS)aWrite `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_filer!r"existsrwarn delete_file)r9whatr]dataforcer2r2r3write_or_delete_files   zegg_info.write_or_delete_filecCsBtd|||d}|jst|d}|||dSdS)zWrite `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 %sutf-8wbN)rinfoencodedry_runopenwriteclose)r9rtr]rufr2r2r3rp s    zegg_info.write_filecCs$td||jst|dSdS)z8Delete `filename` (if not a dry run) after announcing itz deleting %sN)rrzr|r!unlink)r9r]r2r2r3rss zegg_info.delete_filecCs||jt|jd|jj}tdD]}|j|d|}|||j tj |j|j qtj |jd}tj |rC| ||dS)Nzegg_info.writers) installerznative_libs.txt)ZmkpathrJr!utimer7Zfetch_build_eggrZrequireresolver:r"rhrqrs find_sources)r9repwriternlr2r2r3runs      z egg_info.runcCs4tj|jd}t|j}||_||j|_dS)z"Generate SOURCES.txt manifest filez SOURCES.txtN) r!r"rhrJmanifest_makerr7manifestrfilelist)r9Zmanifest_filenameZmmr2r2r3r-s   zegg_info.find_sourcescCsX|jd}|jtjkrtj|j|}tj|r*td||j |j |_ ||_ dSdS)Nr_aB------------------------------------------------------------------------------ Note: Your current .egg-info directory has a '-' in its name; this will not work correctly with "setup.py develop". Please rename %s to %s to correct this problem. ------------------------------------------------------------------------------) rRrQr!rgr"rhrqrrrrJrT)r9Zbeir2r2r3ri5s    zegg_info.check_broken_egg_infoNF)rFrGrH descriptionZ user_optionsZboolean_optionsZ negative_optrUrIrWsetterr^rorwrprsrrrir2r2r2r3rJs&   1  rJc@s|eZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZdS)rc Cs||\}}}}|j|j|j|jt|j|t|j||j |j d}dddddddd d}z||}Wnt yDt d j |d w|d } |d vrQ|g}| rV|fnd} ||} |d|g| rg|gng||D]} || stj| | g| RqpdS)N)includeexcludezglobal-includezglobal-excludezrecursive-includezrecursive-excludegraftprunez%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->rrr2 )Z_parse_template_linerrglobal_includeglobal_exclude functoolspartialrecursive_includerecursive_excluderrKeyErrorrformat startswith debug_printrhrrr) r9linerpatternsdirZ dir_patternZ action_mapZlog_mapZprocess_actionZaction_is_recursiveZextra_log_argsZlog_tmplpatternr2r2r3process_template_lineHsf    zFileList.process_template_linecCsRd}tt|jdddD]}||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 Frz removing T)ranger'filesr)r9Z predicatefoundr/r2r2r3 _remove_filesszFileList._remove_filescC$ddt|D}||t|S)z#Include files that match 'pattern'.cSg|] }tj|s|qSr2r!r"isdir.0rr2r2r3 sz$FileList.include..rextendboolr9rrr2r2r3rs zFileList.includecCst|}||jS)z#Exclude files that match 'pattern'.)r4rmatchr9rrr2r2r3rs zFileList.excludecCs8tj|d|}ddt|ddD}||t|S)zN Include all files anywhere in 'dir/' that match the pattern. rcSrr2rrr2r2r3rs  z.FileList.recursive_include..T) recursive)r!r"rhrrr)r9rrZ full_patternrr2r2r3rs zFileList.recursive_includecCs ttj|d|}||jS)zM Exclude any file anywhere in 'dir/' that match the pattern. rr4r!r"rhrr)r9rrrr2r2r3rs zFileList.recursive_excludecCr)zInclude all files from 'dir/'.cSs"g|] }tj|D]}|q qSr2)rdrfindall)rZ match_diritemr2r2r3rs z"FileList.graft..r)r9rrr2r2r3rs  zFileList.graftcCsttj|d}||jS)zFilter out files from 'dir/'.rr)r9rrr2r2r3rs zFileList.prunecsJ|jdur |ttjd|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|qSr2rrrr2r3rsz+FileList.global_include..)Zallfilesrr4r!r"rhrrrr2rr3rs  zFileList.global_includecCsttjd|}||jS)zD Exclude all files anywhere that match the pattern. rrrr2r2r3rs zFileList.global_excludecCs<|dr |dd}t|}||r|j|dSdS)N r)r>r _safe_pathrappend)r9rr"r2r2r3rs   zFileList.appendcCs|jt|j|dSr6)rrfilterr)r9pathsr2r2r3rszFileList.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)rbrrrr8r2r2r3_repairszFileList._repairc Csd}t|}|durtd|dSt|d}|dur't||ddSztj|s4tj|r7WdSWdStyLt||t YdSw)Nz!'%s' not %s encodable -- skippingz''%s' in unexpected encoding -- skippingFrxT) unicode_utilsfilesys_decoderrrZ try_encoder!r"rqUnicodeEncodeErrorsysgetfilesystemencoding)r9r"Zenc_warnZu_pathZ utf8_pathr2r2r3rs    zFileList._safe_pathN)rFrGrHrrrrrrrrrrrrrrr2r2r2r3rEsM     rc@sdeZdZdZddZddZddZdd Zd d Zd d Z e ddZ ddZ ddZ ddZdS)rz MANIFEST.incCsd|_d|_d|_d|_dS)Nr)Z use_defaultsrZ manifest_onlyZforce_manifestr8r2r2r3rUs z!manifest_maker.initialize_optionscCrVr6r2r8r2r2r3roszmanifest_maker.finalize_optionscCslt|_tj|js||tj|jr| | | |j |j |dSr6)rrr!r"rqrwrite_manifest add_defaultstemplateZ read_templateadd_license_filesprune_file_listsortZremove_duplicatesr8r2r2r3rs   zmanifest_maker.runcCst|}|tjdS)N/)rrreplacer!r#)r9r"r2r2r3_manifest_normalize&s z"manifest_maker._manifest_normalizecsBjfddjjD}dj}tj|f|dS)zo Write the file list in 'self.filelist' to the manifest file named by 'self.manifest'. csg|]}|qSr2)rrr8r2r3r2sz1manifest_maker.write_manifest..zwriting manifest file '%s'N)rrrrZexecuterp)r9rmsgr2r8r3r*s  zmanifest_maker.write_manifestcCs||s t||dSdSr6)_should_suppress_warningrrr)r9rr2r2r3rr6s zmanifest_maker.warncCs td|S)z; suppress missing-file warnings from sdist zstandard file .*not found)r$r)rr2r2r3r:s z'manifest_maker._should_suppress_warningcCst||j|j|j|jtt}|r!|j|n t j |jr,| t j dr8|jd| d}|j|jdS)Nzsetup.pyrJ)rrrrrrrbrrr!r"rqZ read_manifestget_finalized_commandrrJ)r9ZrcfilesZei_cmdr2r2r3rAs     zmanifest_maker.add_defaultscCs4|jjjpg}|D]}td|q |j|dS)Nzadding license file '%s')r7rj license_filesrrzrr)r9rZlfr2r2r3rSs  z manifest_maker.add_license_filescCsZ|d}|j}|j|j|j|ttj }|jj d|d|dddS)Nbuildz(^|z)(RCS|CVS|\.svn)r)Zis_regex) rr7Z get_fullnamerrZ build_baser$r%r!r#Zexclude_pattern)r9rZbase_dirr#r2r2r3rZs     zmanifest_maker.prune_file_listN)rFrGrHrrUrorrrrr staticmethodrrrrr2r2r2r3r s    rcCsNd|}|d}t|d}||WddS1s wYdS)z{Create a file with the specified name and write 'contents' (a sequence of strings without line terminators) to it.  rxryN)rhr{r}r~)r]contentsrr2r2r3rpds    "rpc Cstd||jsE|jj}|j|j|_}|j|j|_}z| |j W|||_|_n|||_|_wt |jdd}t |j |dSdS)Nz writing %sZzip_safe)rrzr|r7rjrSr@rRr:write_pkg_inforJgetattrr Zwrite_safety_flag)cmdbasenamer]rjZoldverZoldnamesafer2r2r3rqs  rcCstj|r tddSdS)NzsWARNING: 'depends.txt' is not used by setuptools 0.6! Use the install_requires/extras_require setup() args instead.)r!r"rqrrrrrr]r2r2r3warn_depends_obsoletes rcCs,t|pd}dd}t||}||dS)Nr2cSs|dS)Nrr2)rr2r2r3 append_crsz&_write_requirements..append_cr)rmap writelines)streamZreqslinesrr2r2r3_write_requirementss  rcCsn|j}t}t||j|jpi}t|D]}|djdit t|||q| d|| dS)Nz [{extra}] Z requirementsr2) r7ioStringIOrZinstall_requiresextras_requiresortedr~rvarsrwgetvalue)rrr]ZdistrurZextrar2r2r3write_requirementss   rcCs,t}t||jj|d||dS)Nzsetup-requirements)rrrr7Zsetup_requiresrwr)rrr]rur2r2r3write_setup_requirementssrcCs:tdd|jD}|d|dt|ddS)NcSsg|] }|dddqS).rr)r )rkr2r2r3rsz(write_toplevel_names..ztop-level namesr)r\fromkeysr7Ziter_distribution_namesrprhr)rrr]Zpkgsr2r2r3write_toplevel_namess  rcCst|||ddS)NT) write_argrr2r2r3 overwrite_argsrFcCsHtj|d}t|j|d}|durd|d}|||||dS)Nrr)r!r"splitextrr7rhrw)rrr]rvargnamerYr2r2r3rs rcCs|jj}t|ts |dur|}n6|durFg}t|D]$\}}t|ts7t||}dtt t| }| d||fqd|}| d||ddS)Nrz [%s] %s rz entry pointsT) r7Z entry_pointsrastrritemsrZ parse_grouprhrvaluesrrw)rrr]rruZsectionrr2r2r3 write_entriess   rcCstdttjdr?td&}|D]}t d|}|r.t | dWdSqWddS1s:wYdS)zd Get a -r### off of PKG-INFO Version in case this is an sdist of a subversion revision. z$get_pkg_info_revision is deprecated.zPKG-INFOzVersion:.*-r(\d+)\s*$rNr) warningsrrEggInfoDeprecationWarningr!r"rqrr}r$rintgroup)rrrr2r2r3get_pkg_info_revisions     rc@seZdZdZdS)rz?Deprecated behavior warning for EggInfo, bypassing suppression.N)rFrGrH__doc__r2r2r2r3rsrr);rZdistutils.filelistrZ _FileListZdistutils.errorsrZdistutils.utilrrdrrr!r$rrrrCrZZ setuptoolsrZsetuptools.command.sdistrrZsetuptools.command.setoptr Zsetuptools.commandr Z pkg_resourcesr r r rrrrrZsetuptools.unicode_utilsrZsetuptools.globrZsetuptools.externrrr4r5rJrrprrrrrrrrrrrr2r2r2r3sX         (    S1IW