a [dga@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}|dkrr|r`|d7}q0|d||f7}q0d}t|} || kr||} | dkr||d7}n| d kr||7}n| d kr|d} | | kr|| d kr| d} | | kr|| d kr| d} | | kr,|| d kr,| d} q| | krF|t| 7}nR||d| } d} | dd krxd } | dd} | t| 7} |d| f7}| }n|t| 7}|d7}q~|s0||7}q0|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_classr2E/usr/local/lib/python3.9/site-packages/setuptools/command/egg_info.pytranslate_pattern#sV           r4c@s@eZdZdZdZeddZddZddZdd Z ee Z dS) InfoCommonNcCst|jSN)r distributionget_nameselfr2r2r3namezszInfoCommon.namecCst||jSr6)r _maybe_tagr7Z get_versionr9r2r2r3tagged_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. )vtagsendswithr:versionr2r2r3r<szInfoCommon._maybe_tagcCs,d}|jr||j7}|jr(|td7}|S)Nrz-%Y%m%d) tag_buildtag_datetimestrftimer@r2r2r3tagss  zInfoCommon.tags) __name__ __module__ __qualname__rBrCpropertyr;r=r<rFr>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]rMrPcCs"d|_d|_d|_d|_d|_dS)NF)egg_baseegg_namerK egg_versionbroken_egg_infor9r2r2r3initialize_optionss zegg_info.initialize_optionscCsdSr6r2r9r2r2r3tag_svn_revisionszegg_info.tag_svn_revisioncCsdSr6r2)r:valuer2r2r3rWscCs0t}||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. rBrrC)rKN) collections OrderedDictrFr dict)r:filenamerKr2r2r3save_version_infos zegg_info.save_version_infoc CsV|j|_||_t|j}z6t|tjj}|r4dnd}t t ||j|jfWn>t y}z&t j d|j|jf|WYd}~n d}~00|jdur|jj}|pidtj|_|dt|jd|_|jtjkrtj|j|j|_d|jvr||j|jj_|jj}|durR|j|jkrR|j|_t|j|_ d|j_dS)Nz%s==%sz%s===%sz2Invalid distribution name or version syntax: %s-%srrR .egg-info-)!r;rSr=rTr isinstancerrAZVersionlistr ValueError distutilserrorsZDistutilsOptionErrorrRr7Z package_dirgetr!curdirZensure_dirnamerrKr"joincheck_broken_egg_infometadataZ _patched_distkeylowerZ_versionZ_parsed_version)r:Zparsed_versionZ is_versionspecrLdirspdr2r2r3finalize_optionssB          zegg_info.finalize_optionsFcCsL|r||||n4tj|rH|dur>|s>td||dS||dS)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)r:whatr\dataforcer2r2r3write_or_delete_files   zegg_info.write_or_delete_filecCs>td|||d}|js:t|d}|||dS)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)r:rtr\rufr2r2r3rp s    zegg_info.write_filecCs td||jst|dS)z8Delete `filename` (if not a dry run) after announcing itz deleting %sN)rrzr|r!unlink)r:r\r2r2r3rss zegg_info.delete_filecCs||jt|jd|jj}tdD]4}|j|d|}|||j tj |j|j q*tj |jd}tj |r| ||dS)Nzegg_info.writers) installerznative_libs.txt)ZmkpathrKr!utimer7Zfetch_build_eggrZrequireresolver;r"rgrqrs find_sources)r:repwriternlr2r2r3runs     z egg_info.runcCs4tj|jd}t|j}||_||j|_dS)z"Generate SOURCES.txt manifest filez SOURCES.txtN) r!r"rgrKmanifest_makerr7manifestrfilelist)r:Zmanifest_filenameZmmr2r2r3r-s  zegg_info.find_sourcescCsT|jd}|jtjkr&tj|j|}tj|rPtd||j |j |_ ||_ dS)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. ------------------------------------------------------------------------------) rSrRr!rfr"rgrqrrrrKrU)r:Zbeir2r2r3rh5s   zegg_info.check_broken_egg_infoN)F)rGrHrI descriptionZ user_optionsZboolean_optionsZ negative_optrVrJrWsetterr]rorwrprsrrrhr2r2r2r3rKs$    1  rKc@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 ||}Wn"t yt d j |d Yn0|d } |d vr|g}| r|fnd} ||} |d|g| r|gng||D] } || stj| | g| RqdS)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_printrgrrr) r:linerpatternsdirZ dir_patternZ action_mapZlog_mapZprocess_actionZaction_is_recursiveZextra_log_argsZlog_tmplpatternr2r2r3process_template_lineHs`    zFileList.process_template_linecCsRd}tt|jdddD]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 Frz removing T)ranger'filesr)r: predicatefoundr/r2r2r3 _remove_filesszFileList._remove_filescCs$ddt|D}||t|S)z#Include files that match 'pattern'.cSsg|]}tj|s|qSr2r!r"isdir.0rr2r2r3 z$FileList.include..rextendboolr:rrr2r2r3rs zFileList.includecCst|}||jS)z#Exclude files that match 'pattern'.)r4rmatchr:rrr2r2r3rszFileList.excludecCs8tj|d|}ddt|ddD}||t|S)zN Include all files anywhere in 'dir/' that match the pattern. rcSsg|]}tj|s|qSr2rrr2r2r3rs z.FileList.recursive_include..T) recursive)r!r"rgrrr)r:rrZ full_patternrr2r2r3rs zFileList.recursive_includecCs ttj|d|}||jS)zM Exclude any file anywhere in 'dir/' that match the pattern. rr4r!r"rgrr)r:rrrr2r2r3rszFileList.recursive_excludecCs$ddt|D}||t|S)zInclude all files from 'dir/'.cSs"g|]}tj|D]}|qqSr2)rcrfindall)rZ match_diritemr2r2r3rsz"FileList.graft..r)r:rrr2r2r3rs  zFileList.graftcCsttj|d}||jS)zFilter out files from 'dir/'.rr)r:rrr2r2r3rszFileList.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|qSr2rrrr2r3rrz+FileList.global_include..)Zallfilesrr4r!r"rgrrrr2rr3rs   zFileList.global_includecCsttjd|}||jS)zD Exclude all files anywhere that match the pattern. rrrr2r2r3rszFileList.global_excludecCs8|dr|dd}t|}||r4|j|dS)N r)r?r _safe_pathrappend)r:rr"r2r2r3rs    zFileList.appendcCs|jt|j|dSr6)rrfilterr)r:pathsr2r2r3rszFileList.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)rarrrr9r2r2r3_repairszFileList._repairc Csd}t|}|dur(td|dSt|d}|durNt||ddSz"tj|shtj|rnWdSWn$tyt||t Yn0dS)Nz!'%s' not %s encodable -- skippingz''%s' in unexpected encoding -- skippingFrxT) unicode_utilsfilesys_decoderrrZ try_encoder!r"rqUnicodeEncodeErrorsysgetfilesystemencoding)r:r"Zenc_warnZu_pathZ utf8_pathr2r2r3rs    zFileList._safe_pathN)rGrHrIrrrrrrrrrrrrrrr2r2r2r3rEsM     rc@s\eZdZdZddZddZddZdd Zd d Zd d Z e ddZ ddZ ddZ dS)rz MANIFEST.incCsd|_d|_d|_d|_dS)Nr)Z use_defaultsrZ manifest_onlyZforce_manifestr9r2r2r3rVsz!manifest_maker.initialize_optionscCsdSr6r2r9r2r2r3roszmanifest_maker.finalize_optionscCsdt|_tj|js||tj|jr<| | |j |j |dSr6) rrr!r"rqrwrite_manifest add_defaultstemplateZ read_templateprune_file_listsortZremove_duplicatesr9r2r2r3rs  zmanifest_maker.runcCst|}|tjdS)N/)rrreplacer!r#)r:r"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)rrr9r2r3r1rz1manifest_maker.write_manifest..zwriting manifest file '%s'N)rrrrZexecuterp)r:rmsgr2r9r3r)s  zmanifest_maker.write_manifestcCs||st||dSr6)_should_suppress_warningrrr)r:rr2r2r3rr5s zmanifest_maker.warncCs td|S)z; suppress missing-file warnings from sdist zstandard file .*not found)r$r)rr2r2r3r9sz'manifest_maker._should_suppress_warningcCst|||j|j|j|jtt}|rJ|j |nt j |jr`| t j drx|jd|d}|j|jdS)Nzsetup.pyrK)rrZ check_licenserrrrrarrr!r"rqZ read_manifestget_finalized_commandrrK)r:ZrcfilesZei_cmdr2r2r3r@s     zmanifest_maker.add_defaultscCsZ|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)r:rbase_dirr#r2r2r3rSs    zmanifest_maker.prune_file_listN)rGrHrIrrVrorrrrr staticmethodrrrr2r2r2r3r s   rcCsLd|}|d}t|d}||Wdn1s>0YdS)z{Create a file with the specified name and write 'contents' (a sequence of strings without line terminators) to it.  rxryN)rgr{r}r~)r\contentsrr2r2r3rp]s   rpc Cstd||js|jj}|j|j|_}|j|j|_}z| |j W|||_|_n|||_|_0t |jdd}t |j |dS)Nz writing %sZzip_safe)rrzr|r7rirTrArSr;write_pkg_inforKgetattrr Zwrite_safety_flag)cmdbasenamer\riZoldverZoldnamesafer2r2r3rjs  rcCstj|rtddS)NzsWARNING: 'depends.txt' is not used by setuptools 0.6! Use the install_requires/extras_require setup() args instead.)r!r"rqrrrrrr\r2r2r3warn_depends_obsolete}s 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|jp"i}t|D]*}|djfit t|||q,| d|| dS)Nz [{extra}] Z requirements) r7ioStringIOrZinstall_requiresextras_requiresortedr~rvarsrwgetvalue)rrr\distrurextrar2r2r3write_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_namesrprgr)rrr\Zpkgsr2r2r3write_toplevel_namess rcCst|||ddS)NT) write_argrr2r2r3 overwrite_argsrFcCsHtj|d}t|j|d}|dur4d|d}|||||dS)Nrr)r!r"splitextrr7rgrw)rrr\rvargnamerXr2r2r3rs rcCs|jj}t|ts|dur |}nl|durg}t|D]H\}}t|tsnt||}dtt t| }| d||fq8d|}| d||ddS)Nrz [%s] %s rz entry pointsT) r7Z entry_pointsr`strritemsrZ parse_grouprgrvaluesrrw)rrr\rrusectionrr2r2r3 write_entriess   rcCstdttjdr|tdJ}|D]4}t d|}|r(t | dWdSq(Wdn1sr0YdS)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)rGrHrI__doc__r2r2r2r3rsr)F);rZdistutils.filelistrZ _FileListZdistutils.errorsrZdistutils.utilrrcrrr!r$rrrrDrYZ setuptoolsrZsetuptools.command.sdistrrZsetuptools.command.setoptr Zsetuptools.commandr Z pkg_resourcesr r r rrrrrZsetuptools.unicode_utilsrZsetuptools.globrZsetuptools.externrrr4r5rKrrprrrrrrrrrrrr2r2r2r3sV         (    S1IP