o Xaib@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}n0||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_charcchunk last_chunkiZ chunk_lencharZinner_iinner char_classr4/builddir/build/BUILDROOT/alt-python310-setuptools-58.3.0-4.el8.x86_64/opt/alt/python310/lib/python3.10/site-packages/setuptools/command/egg_info.pytranslate_pattern#s\      -r6c@s@eZdZdZdZeddZddZddZdd Z ee Z dS) InfoCommonNcCst|jSN)r distributionget_nameselfr4r4r5namezszInfoCommon.namecCst||jSr8)r _maybe_tagr9 get_versionr;r4r4r5tagged_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<versionr4r4r5r>szInfoCommon._maybe_tagcCs,d}|jr ||j7}|jr|td7}|S)Nrz-%Y%m%d) tag_buildtag_datetimestrftimerCr4r4r5tagss  zInfoCommon.tags) __name__ __module__ __qualname__rErFpropertyr=r@r>rIrAr4r4r4r5r7vs  r7c@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]rPrScCs"d|_d|_d|_d|_d|_dS)NF)egg_baseegg_namerN egg_versionbroken_egg_infor;r4r4r5initialize_optionss  zegg_info.initialize_optionscCdSr8r4r;r4r4r5tag_svn_revisionzegg_info.tag_svn_revisioncCrZr8r4)r<valuer4r4r5r[r\cCs0t}||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. rErrF)rNN) collections OrderedDictrIr dict)r<filenamerNr4r4r5save_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-%srrU .egg-info-)!r=rVr@rWr isinstancerrDVersionlistr ValueError distutilserrorsDistutilsOptionErrorrUr9 package_dirgetr!curdirensure_dirnamerrNr"joincheck_broken_egg_infometadataZ _patched_distkeylower_version_parsed_version)r<parsed_versionZ is_versionspecrOdirspdr4r4r5finalize_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)r<whatradataforcer4r4r5write_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)r<rrarfr4r4r5r| s    zegg_info.write_filecCs$td||jst|dSdS)z8Delete `filename` (if not a dry run) after announcing itz deleting %sN)rrrr!unlink)r<rar4r4r5rs 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)mkpathrNr!utimer9Zfetch_build_eggrrequireresolver=r"rpr}r find_sources)r<repwriternlr4r4r5runs      z egg_info.runcCs4tj|jd}t|j}||_||j|_dS)z"Generate SOURCES.txt manifest filez SOURCES.txtN) r!r"rprNmanifest_makerr9manifestrfilelist)r<Zmanifest_filenamemmr4r4r5r-s   zegg_info.find_sourcescCsX|jd}|jtjkrtj|j|}tj|r*td||j |j |_ ||_ dSdS)NrcaB------------------------------------------------------------------------------ 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. ------------------------------------------------------------------------------) rVrUr!rnr"rpr}rr~rNrX)r<Zbeir4r4r5rq5s    zegg_info.check_broken_egg_infoNF)rJrKrL description user_optionsboolean_options negative_optrYrMr[setterrbr{rr|rrrrqr4r4r4r5rNs&   1  rNc@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->rrr4 )Z_parse_template_linerrglobal_includeglobal_exclude functoolspartialrecursive_includerecursive_excluderrKeyErrorrformat startswith debug_printrprr~) r<linerpatternsdirZ dir_patternZ action_mapZlog_mapZprocess_actionZaction_is_recursiveZextra_log_argsZlog_tmplpatternr4r4r5process_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)r< predicatefoundr0r4r4r5 _remove_filesszFileList._remove_filescC$ddt|D}||t|S)z#Include files that match 'pattern'.cSg|] }tj|s|qSr4r!r"isdir.0rr4r4r5 sz$FileList.include..rextendboolr<rrr4r4r5rs zFileList.includecCst|}||jS)z#Exclude files that match 'pattern'.)r6rmatchr<rrr4r4r5rs zFileList.excludecCs8tj|d|}ddt|ddD}||t|S)zN Include all files anywhere in 'dir/' that match the pattern. rcSrr4rrr4r4r5rs  z.FileList.recursive_include..T) recursive)r!r"rprrr)r<rrZ full_patternrr4r4r5rs zFileList.recursive_includecCs ttj|d|}||jS)zM Exclude any file anywhere in 'dir/' that match the pattern. rr6r!r"rprr)r<rrrr4r4r5rs zFileList.recursive_excludecCr)zInclude all files from 'dir/'.cSs"g|] }tj|D]}|q qSr4)rirfindall)rZ match_diritemr4r4r5rs z"FileList.graft..r)r<rrr4r4r5rs  zFileList.graftcCsttj|d}||jS)zFilter out files from 'dir/'.rr)r<rrr4r4r5rs 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|qSr4rrrr4r5rsz+FileList.global_include..)allfilesrr6r!r"rprrrr4rr5rs  zFileList.global_includecCsttjd|}||jS)zD Exclude all files anywhere that match the pattern. rrrr4r4r5rs zFileList.global_excludecCs<|dr |dd}t|}||r|j|dSdS)N r)rBr _safe_pathrappend)r<rr"r4r4r5rs   zFileList.appendcCs|jt|j|dSr8)rrfilterr)r<pathsr4r4r5rszFileList.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)rgrrrr;r4r4r5_repairszFileList._repairc Csd}t|}|durtd|dSt|d}|dur't||ddSztj|s4tj|r7WdSWdStyLt||t YdSw)Nz!'%s' not %s encodable -- skippingz''%s' in unexpected encoding -- skippingFrT) unicode_utilsfilesys_decoderr~Z try_encoder!r"r}UnicodeEncodeErrorsysgetfilesystemencoding)r<r"Zenc_warnZu_pathZ utf8_pathr4r4r5rs    zFileList._safe_pathN)rJrKrLrrrrrrrrrrrrrrr4r4r4r5rEsM     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_manifestr;r4r4r5rYs z!manifest_maker.initialize_optionscCrZr8r4r;r4r4r5r{szmanifest_maker.finalize_optionscCslt|_tj|js||tj|jr| | | |j |j |dSr8)rrr!r"r}rwrite_manifest add_defaultstemplateZ read_templateadd_license_filesprune_file_listsortZremove_duplicatesr;r4r4r5rs   zmanifest_maker.runcCst|}|tjdS)N/)rrreplacer!r#)r<r"r4r4r5_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|]}|qSr4)rrr;r4r5r2sz1manifest_maker.write_manifest..zwriting manifest file '%s'N)rrrrexecuter|)r<rmsgr4r;r5r*s  zmanifest_maker.write_manifestcCs||s t||dSdSr8)_should_suppress_warningrr~)r<rr4r4r5r~6s zmanifest_maker.warncCs td|S)z; suppress missing-file warnings from sdist zstandard file .*not found)r$r)rr4r4r5r: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.pyrN)rrrrrrrgrrr!r"r}Z read_manifestget_finalized_commandrrN)r<ZrcfilesZei_cmdr4r4r5rAs     zmanifest_maker.add_defaultscCs4|jjjpg}|D]}td|q |j|dS)Nzadding license file '%s')r9rr license_filesrrrr)r<rlfr4r4r5rSs  z manifest_maker.add_license_filescCsZ|d}|j}|j|j|j|ttj }|jj d|d|dddS)Nbuildz(^|z)(RCS|CVS|\.svn)r)Zis_regex) rr9 get_fullnamerr build_baser$r%r!r#Zexclude_pattern)r<rbase_dirr#r4r4r5rZs     zmanifest_maker.prune_file_listN)rJrKrLrrYr{rrrr~ staticmethodrrrrr4r4r4r5r 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.  rrN)rprrr)racontentsrr4r4r5r|ds    "r|c Cstd||jsE|jj}|j|j|_}|j|j|_}z| |j W|||_|_n|||_|_wt |jdd}t |j |dSdS)Nz writing %sZzip_safe)rrrr9rrrWrDrVr=write_pkg_inforNgetattrr Zwrite_safety_flag)cmdbasenamerarrZoldverZoldnamesafer4r4r5rqs  rcCstj|r tddSdS)NzsWARNING: 'depends.txt' is not used by setuptools 0.6! Use the install_requires/extras_require setup() args instead.)r!r"r}rr~rrrar4r4r5warn_depends_obsoletes rcCs,t|pd}dd}t||}||dS)Nr4cSs|dS)Nrr4)rr4r4r5 append_crsz&_write_requirements..append_cr)rmap writelines)streamreqslinesrr4r4r5_write_requirementss  rcCsn|j}t}t||j|jpi}t|D]}|djdit t|||q| d|| dS)Nz [{extra}] requirementsr4) r9ioStringIOrZinstall_requiresextras_requiresortedrrvarsrgetvalue)rrradistrrextrar4r4r5write_requirementss   rcCs,t}t||jj|d||dS)Nzsetup-requirements)rrrr9Zsetup_requiresrr)rrrarr4r4r5write_setup_requirementssr cCs:tdd|jD}|d|dt|ddS)NcSsg|] }|dddqS).rr)r )rkr4r4r5rsz(write_toplevel_names..ztop-level namesr)r`fromkeysr9Ziter_distribution_namesr|rpr)rrrapkgsr4r4r5write_toplevel_namess  rcCst|||ddS)NT) write_argrr4r4r5 overwrite_argsrFcCsHtj|d}t|j|d}|durd|d}|||||dS)Nrr)r!r"splitextrr9rpr)rrrarargnamer]r4r4r5rs rcCs|jj}t|ts |dur|}n6|durFg}t|D]$\}}t|ts7t||}dtt t| }| d||fqd|}| d||ddS)Nrz [%s] %s rz entry pointsT) r9Z entry_pointsrestrritemsr parse_grouprprvaluesrr)rrrarrsectionrr4r4r5 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) warningsr~EggInfoDeprecationWarningr!r"r}rrr$rintgroup)rrrr4r4r5get_pkg_info_revisions     rc@seZdZdZdS)rz?Deprecated behavior warning for EggInfo, bypassing suppression.N)rJrKrL__doc__r4r4r4r5rsrr);rdistutils.filelistrZ _FileListdistutils.errorsrdistutils.utilrrirrr!r$rrrrGr^ setuptoolsrZsetuptools.command.sdistrrZsetuptools.command.setoptr Zsetuptools.commandr pkg_resourcesr r r rrrrrZsetuptools.unicode_utilsrZsetuptools.globrZsetuptools.externrrr6r7rNrr|rrrrr rrrrrrr4r4r4r5sX         (    S1IW