o Cff@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# valid_charcchunk last_chunki chunk_lencharinner_iinner char_classr7=/usr/lib/python3/dist-packages/setuptools/command/egg_info.pytranslate_pattern#s\      -r9c@s@eZdZdZdZeddZddZddZdd Z ee Z dS) InfoCommonNcCst|jSN)r distributionget_nameselfr7r7r8namezszInfoCommon.namecCst||jSr;)r _maybe_tagr< get_versionr>r7r7r8tagged_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?versionr7r7r8rAszInfoCommon._maybe_tagcCs,d}|jr ||j7}|jr|td7}|S)Nrz-%Y%m%d) tag_buildtag_datetimestrftimerFr7r7r8tagss  zInfoCommon.tags) __name__ __module__ __qualname__rHrIpropertyr@rCrArLrDr7r7r7r8r:vs  r:c@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]rSrVcCs"d|_d|_d|_d|_d|_dS)NF)egg_baseegg_namerQ egg_versionbroken_egg_infor>r7r7r8initialize_optionss  zegg_info.initialize_optionscCdSr;r7r>r7r7r8tag_svn_revisionzegg_info.tag_svn_revisioncCr]r;r7)r?valuer7r7r8r^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. rHrrI)rQN) collections OrderedDictrLr dict)r?filenamerQr7r7r8save_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-%srrX .egg-info-)!r@rYrCrZr isinstancerrGVersionlistr ValueError distutilserrorsDistutilsOptionErrorrXr< package_dirgetr!curdirensure_dirnamerrQr"joincheck_broken_egg_infometadata _patched_distkeylower_version_parsed_version)r?parsed_version is_versionspecrRdirspdr7r7r8finalize_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?whatrddataforcer7r7r8write_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?rrdrfr7r7r8r s    zegg_info.write_filecCs$td||jst|dSdS)z8Delete `filename` (if not a dry run) after announcing itz deleting %sN)rrrr!unlink)r?rdr7r7r8rs 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)mkpathrQr!utimer<fetch_build_eggrrequireresolver@r"rsrr find_sources)r?repwriternlr7r7r8runs      z egg_info.runcCs4tj|jd}t|j}||_||j|_dS)z"Generate SOURCES.txt manifest filez SOURCES.txtN) r!r"rsrQmanifest_makerr<manifestrfilelist)r?manifest_filenamemmr7r7r8r-s   zegg_info.find_sourcescCsX|jd}|jtjkrtj|j|}tj|r*td||j |j |_ ||_ dSdS)NrfaB------------------------------------------------------------------------------ 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. ------------------------------------------------------------------------------) rYrXr!rqr"rsrrrrQr[)r?beir7r7r8rt5s    zegg_info.check_broken_egg_infoNF)rMrNrO description user_optionsboolean_options negative_optr\rPr^setterrerrrrrrrtr7r7r7r8rQs&   1  rQc@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->rrr7 )_parse_template_linerrglobal_includeglobal_exclude functoolspartialrecursive_includerecursive_excluderrKeyErrorrformat startswith debug_printrsrr) r?linerpatternsdir dir_pattern action_maplog_mapprocess_actionaction_is_recursiveextra_log_argslog_tmplpatternr7r7r8process_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? predicatefoundr1r7r7r8 _remove_filesszFileList._remove_filescC$ddt|D}||t|S)z#Include files that match 'pattern'.cSg|] }tj|s|qSr7r!r"isdir.0rr7r7r8 sz$FileList.include..rextendboolr?rrr7r7r8rs zFileList.includecCst|}||jS)z#Exclude files that match 'pattern'.)r9rmatchr?rrr7r7r8rs zFileList.excludecCs8tj|d|}ddt|ddD}||t|S)zN Include all files anywhere in 'dir/' that match the pattern. rcSrr7rrr7r7r8rs  z.FileList.recursive_include..T) recursive)r!r"rsrrr)r?rr full_patternrr7r7r8rs zFileList.recursive_includecCs ttj|d|}||jS)zM Exclude any file anywhere in 'dir/' that match the pattern. rr9r!r"rsrr)r?rrrr7r7r8rs zFileList.recursive_excludecCr)zInclude all files from 'dir/'.cSs"g|] }tj|D]}|q qSr7)rlrfindall)r match_diritemr7r7r8rs z"FileList.graft..r)r?rrr7r7r8rs  zFileList.graftcCsttj|d}||jS)zFilter out files from 'dir/'.rr)r?rrr7r7r8rs 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|qSr7rrrr7r8rsz+FileList.global_include..)allfilesrr9r!r"rsrrrr7rr8rs  zFileList.global_includecCsttjd|}||jS)zD Exclude all files anywhere that match the pattern. rrrr7r7r8rs zFileList.global_excludecCs<|dr |dd}t|}||r|j|dSdS)N r)rEr _safe_pathrappend)r?rr"r7r7r8rs   zFileList.appendcCs|jt|j|dSr;)rrfilterr)r?pathsr7r7r8rszFileList.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)rjrrrr>r7r7r8_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 try_encoder!r"rUnicodeEncodeErrorsysgetfilesystemencoding)r?r"enc_warnu_path utf8_pathr7r7r8rs    zFileList._safe_pathN)rMrNrOrrrrrrrrrrrrrrr7r7r7r8rEsM     rc@sleZdZdZddZddZddZdd Zd d Zd d Z e ddZ ddZ ddZ ddZddZdS)rz MANIFEST.incCsd|_d|_d|_d|_dS)Nr) use_defaultsr manifest_onlyforce_manifestr>r7r7r8r\s z!manifest_maker.initialize_optionscCr]r;r7r>r7r7r8rszmanifest_maker.finalize_optionscCslt|_tj|js||tj|jr| | | |j |j |dSr;)rrr!r"rrwrite_manifest add_defaultstemplate read_templateadd_license_filesprune_file_listsortremove_duplicatesr>r7r7r8rs   zmanifest_maker.runcCst|}|tjdS)N/)rrreplacer!r#)r?r"r7r7r8_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|]}|qSr7)rrr>r7r8r2sz1manifest_maker.write_manifest..zwriting manifest file '%s'N)rrrrexecuter)r?rmsgr7r>r8r*s  zmanifest_maker.write_manifestcCs||s t||dSdSr;)_should_suppress_warningrr)r?rr7r7r8r6s zmanifest_maker.warncCs td|S)z; suppress missing-file warnings from sdist zstandard file .*not found)r$r)rr7r7r8r: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.pyrQ)rrrrrrrjrrr!r"r read_manifestget_finalized_commandrrQ)r?rcfilesei_cmdr7r7r8rAs     zmanifest_maker.add_defaultscCs4|jjjpg}|D]}td|q |j|dS)Nzadding license file '%s')r<ru license_filesrrrr)r?rlfr7r7r8rSs  z manifest_maker.add_license_filescCsZ|d}|j}|j|j|j|ttj }|jj d|d|dddS)Nbuildz(^|z)(RCS|CVS|\.svn)r)is_regex) rr< get_fullnamerr build_baser$r%r!r#exclude_pattern)r?rbase_dirr#r7r7r8rZs     zmanifest_maker.prune_file_listcCs&t|dr |Stdt|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_manifestzCustom 'build_py' does not implement 'get_data_files_without_manifest'. Please extend command classes from setuptools instead of distutils.)hasattrrwarningsrrget_data_files)r?build_pyr7r7r8_safe_data_filescs zmanifest_maker._safe_data_filesN)rMrNrOrr\rrrrr staticmethodrrrrrr7r7r7r8r 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)rsrrr)rdcontentsrr7r7r8rys    "rc Cstd||jsE|jj}|j|j|_}|j|j|_}z| |j W|||_|_n|||_|_wt |jdd}t |j |dSdS)Nz writing %szip_safe)rrrr<rurZrGrYr@write_pkg_inforQgetattrr write_safety_flag)cmdbasenamerdruoldveroldnamesafer7r7r8rs  rcCstj|r tddSdS)NzsWARNING: 'depends.txt' is not used by setuptools 0.6! Use the install_requires/extras_require setup() args instead.)r!r"rrrrrrdr7r7r8warn_depends_obsoletes r!cCs0t|pd}dd}t|t|}||dS)Nr7cSs|dS)Nrr7)rr7r7r8 append_crsz&_write_requirements..append_cr)rmapsorted writelines)streamreqslinesr"r7r7r8_write_requirementss r)cCsn|j}t}t||j|jpi}t|D]}|djdit t|||q| d|| dS)Nz [{extra}] requirementsr7) r<ioStringIOr)install_requiresextras_requirer$rrvarsrgetvalue)rrrddistrr.extrar7r7r8write_requirementss   r3cCs,t}t||jj|d||dS)Nzsetup-requirements)r+r,r)r<setup_requiresrr0)rrrdrr7r7r8write_setup_requirementssr5cCs:tdd|jD}|d|dt|ddS)NcSsg|] }|dddqS).rr)r )rkr7r7r8rsz(write_toplevel_names..ztop-level namesr)rcfromkeysr<iter_distribution_namesrrsr$)rrrdpkgsr7r7r8write_toplevel_namess  r;cCst|||ddS)NT) write_argr r7r7r8 overwrite_argsr=FcCsHtj|d}t|j|d}|durd|d}|||||dS)Nrr)r!r"splitextrr<rsr)rrrdrargnamer`r7r7r8r<s r<cCs|jj}t|ts |dur|}n6|durFg}t|D]$\}}t|ts7t||}dtt t| }| d||fqd|}| d||ddS)Nrz [%s] %s rz entry pointsT) r< entry_pointsrhstrr$itemsr parse_grouprsr#valuesrr)rrrdrrsectionrr7r7r8 write_entriess   rFcCstdttjdr?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) rrEggInfoDeprecationWarningr!r"rr+rr$rintgroup)rrrr7r7r8get_pkg_info_revisions     rJc@seZdZdZdS)rGz?Deprecated behavior warning for EggInfo, bypassing suppression.N)rMrNrO__doc__r7r7r7r8rGsrGr);rKdistutils.filelistr _FileListdistutils.errorsrdistutils.utilrrlrrr!r$rr+rrJra setuptoolsrsetuptools.command.sdistrrsetuptools.command.setoptr setuptools.commandr pkg_resourcesr r r rrrrrsetuptools.unicode_utilsrsetuptools.globrsetuptools.externrrr9r:rQrrrr!r)r3r5r;r=r<rFrJrGr7r7r7r8sX         (    S1Il