a iŽ5hÿaã@sÎdZddlmZddlmZddlmZddlm 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*dd„Z+Gdd„dƒZ,Gdd„de,eƒZ-Gdd„deƒZGdd„deƒZ.dd„Z/dd„Z0dd„Z1d d!„Z2d"d#„Z3d$d%„Z4d&d'„Z5d(d)„Z6d3d+d,„Z7d-d.„Z8d/d0„Z9Gd1d2„d2e*ƒ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Ú EntryPointÚiter_entry_pointsÚ to_filename)Úglob)Ú packaging)ÚSetuptoolsDeprecationWarningcCsÞd}| tjj¡}t tj¡}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) ÚsplitÚosÚpathÚsepÚreÚescapeÚ enumerateÚlenÚcompileÚ MULTILINEÚDOTALL)rZpatZchunksr#Z valid_charÚcÚchunkZ last_chunkÚiZ chunk_lenÚcharZinner_iÚinnerZ char_class©r0ú=/usr/lib/python3/dist-packages/setuptools/command/egg_info.pyÚtranslate_pattern#sV           r2c@s@eZdZdZdZedd„ƒZdd„Zdd„Zdd „Z ee ƒZ dS) Ú InfoCommonNcCst|j ¡ƒS©N)r Ú distributionZget_name©Úselfr0r0r1ÚnamezszInfoCommon.namecCst| |j ¡¡ƒSr4)rÚ _maybe_tagr5Z get_versionr6r0r0r1Útagged_version~szInfoCommon.tagged_versioncCs |jr| |j¡r|S||jS)z egg_info may be called more than once for a distribution, in which case the version string already contains all tags. )ÚvtagsÚendswith©r7Úversionr0r0r1r9sþzInfoCommon._maybe_tagcCs,d}|jr||j7}|jr(|t d¡7}|S)Nrz-%Y%m%d)Ú tag_buildÚtag_dateÚtimeÚstrftimer=r0r0r1Útags‹s  zInfoCommon.tags) Ú__name__Ú __module__Ú __qualname__r?r@Úpropertyr8r:r9rCr;r0r0r0r1r3vs  r3c@sŠeZdZdZgd¢ZdgZddiZdd„Zedd„ƒZ e j d d„ƒZ d d „Z d d „Z ddd„Z dd„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]rJrMcCs"d|_d|_d|_d|_d|_dS)NF)Úegg_baseÚegg_namerHÚ egg_versionÚbroken_egg_infor6r0r0r1Úinitialize_options¥s zegg_info.initialize_optionscCsdSr4r0r6r0r0r1Útag_svn_revision¯szegg_info.tag_svn_revisioncCsdSr4r0)r7Úvaluer0r0r1rT³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. r?rr@)rHN)Ú collectionsÚ OrderedDictrCr Údict)r7ÚfilenamerHr0r0r1Úsave_version_info¸s zegg_info.save_version_infoc CsV|j|_| ¡|_t|jƒ}z6t|tjjƒ}|r4dnd}t t ||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¡|_d|jvr| ¡|j|jj_|jj}|durR|j|j ¡krR|j|_t|jƒ|_ d|j_dS)Nz%s==%sz%s===%sz2Invalid distribution name or version syntax: %s-%srrOú .egg-infoú-)!r8rPr:rQr Ú isinstancerr>ZVersionÚlistr Ú ValueErrorÚ distutilsÚerrorsZDistutilsOptionErrorrOr5Z package_dirÚgetr!ÚcurdirZensure_dirnamerrHr"ÚjoinÚcheck_broken_egg_infoÚmetadataZ _patched_distÚkeyÚlowerZ_versionZ_parsed_version)r7Zparsed_versionZ is_versionÚspecrIÚdirsZpdr0r0r1Úfinalize_optionsÅsB   ÿÿ ÿÿý      zegg_info.finalize_optionsFcCsL|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_filer!r"ÚexistsrÚwarnÚ delete_file)r7ÚwhatrYÚdataÚforcer0r0r1Ú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)r7rprYrqÚfr0r0r1rl s    zegg_info.write_filecCs t d|¡|jst |¡dS)z8Delete `filename` (if not a dry run) after announcing itz deleting %sN)rrvrxr!Úunlink)r7rYr0r0r1ros zegg_info.delete_filecCs’| |j¡t |jd¡|jj}tdƒD]4}|j|d| ¡}|||j tj   |j|j ¡ƒq*tj   |jd¡}tj   |¡r†|  |¡| ¡dS)Nzegg_info.writers)Ú installerznative_libs.txt)ZmkpathrHr!Úutimer5Zfetch_build_eggrZrequireZresolver8r"rdrmroÚ find_sources)r7r~ÚepÚwriterÚnlr0r0r1Úruns     z egg_info.runcCs4tj |jd¡}t|jƒ}||_| ¡|j|_dS)z"Generate SOURCES.txt manifest filez SOURCES.txtN) r!r"rdrHÚmanifest_makerr5Úmanifestr„Úfilelist)r7Zmanifest_filenameZmmr0r0r1r€-s  zegg_info.find_sourcescCsT|jd}|jtjkr&tj |j|¡}tj |¡rPt d||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. ------------------------------------------------------------------------------) rPrOr!rcr"rdrmrrnrHrR)r7Zbeir0r0r1re5s   ûzegg_info.check_broken_egg_infoN)F)rDrErFZ descriptionZ user_optionsZboolean_optionsZ negative_optrSrGrTÚsetterrZrkrsrlror„r€rer0r0r0r1rH•s$ÿ    1  rHc@s|eZdZdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd d„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„ZdS)rc 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‹r0ú )Z_parse_template_liner‰rŠÚglobal_includeÚglobal_excludeÚ functoolsÚpartialÚrecursive_includeÚrecursive_excluder‹rŒÚKeyErrorrÚformatÚ startswithÚ debug_printrdrrn) r7ÚlinerZpatternsÚdirZ dir_patternZ action_mapZlog_mapZprocess_actionZaction_is_recursiveZextra_log_argsZlog_tmplÚpatternr0r0r1Úprocess_template_lineHs`ÿÿôé  ÿÿ  ÿþÿÿ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˜)r7Z predicateÚfoundr-r0r0r1Ú _remove_files•szFileList._remove_filescCs$dd„t|ƒDƒ}| |¡t|ƒS)z#Include files that match 'pattern'.cSsg|]}tj |¡s|‘qSr0©r!r"Úisdir©Ú.0r|r0r0r1Ú ¤óz$FileList.include..©rÚextendÚbool©r7r›r r0r0r1r‰¢s zFileList.includecCst|ƒ}| |j¡S)z#Exclude files that match 'pattern'.)r2r¡Úmatch©r7r›r¬r0r0r1rЍszFileList.excludecCs8tj |d|¡}dd„t|ddDƒ}| |¡t|ƒS)zN Include all files anywhere in 'dir/' that match the pattern. rcSsg|]}tj |¡s|‘qSr0r¢r¤r0r0r1r¦²s ÿz.FileList.recursive_include..T)Ú recursive)r!r"rdrr©rª)r7ršr›Z full_patternr r0r0r1r“­s zFileList.recursive_includecCs ttj |d|¡ƒ}| |j¡S)zM Exclude any file anywhere in 'dir/' that match the pattern. r©r2r!r"rdr¡r¬)r7ršr›r¬r0r0r1r”·szFileList.recursive_excludecCs$dd„t|ƒDƒ}| |¡t|ƒS)zInclude all files from 'dir/'.cSs"g|]}tj |¡D]}|‘qqSr0)r`r‡Úfindall)r¥Z match_dirÚitemr0r0r1r¦Àsþz"FileList.graft..r¨)r7ršr r0r0r1r‹¾s þ zFileList.graftcCsttj |d¡ƒ}| |j¡S)zFilter out files from 'dir/'.rr¯)r7ršr¬r0r0r1rŒÈ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|‘qSr0©r¬r¤r²r0r1r¦Õr§z+FileList.global_include..)Zallfilesr°r2r!r"rdr©rªr«r0r²r1rÍs   zFileList.global_includecCsttj d|¡ƒ}| |j¡S)zD Exclude all files anywhere that match the pattern. rr¯r­r0r0r1rÙszFileList.global_excludecCs8| d¡r|dd…}t|ƒ}| |¡r4|j |¡dS)Nú r)r<rÚ _safe_pathrŸÚappend)r7r±r"r0r0r1rµàs    zFileList.appendcCs|j t|j|ƒ¡dSr4)rŸr©Úfilterr´)r7Úpathsr0r0r1r©è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)r^r¶r´rŸr6r0r0r1Ú_repairëszFileList._repairc Csšd}t |¡}|dur(t d|¡dSt |d¡}|durNt ||d¡dSz"tj |¡shtj |¡rnWdSWn$ty”t ||t   ¡¡Yn0dS)Nz!'%s' not %s encodable -- skippingz''%s' in unexpected encoding -- skippingFrtT) Ú unicode_utilsÚfilesys_decoderrnZ try_encoder!r"rmÚUnicodeEncodeErrorÚsysÚgetfilesystemencoding)r7r"Zenc_warnZu_pathZ utf8_pathr0r0r1r´õs    zFileList._safe_pathN)rDrErFrœr¡r‰rŠr“r”r‹rŒrrrµr©r¸r´r0r0r0r1rEsM     rc@s\eZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd d „Z e dd„ƒZ dd„Z dd„Z dS)r…z MANIFEST.incCsd|_d|_d|_d|_dS)Nr)Z use_defaultsrŒZ manifest_onlyZforce_manifestr6r0r0r1rSsz!manifest_maker.initialize_optionscCsdSr4r0r6r0r0r1rkszmanifest_maker.finalize_optionscCsdtƒ|_tj |j¡s| ¡| ¡tj |j¡r<|  ¡|  ¡|j  ¡|j  ¡| ¡dSr4) rr‡r!r"rmr†Úwrite_manifestÚ add_defaultsÚtemplateZ read_templateÚprune_file_listÚsortZremove_duplicatesr6r0r0r1r„s  zmanifest_maker.runcCst |¡}| tjd¡S)Nú/)r¹rºÚreplacer!r#)r7r"r0r0r1Ú_manifest_normalize%s 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|]}ˆ |¡‘qSr0)rÅr¤r6r0r1r¦1r§z1manifest_maker.write_manifest..zwriting manifest file '%s'N)r‡r¸rŸr†Zexecuterl)r7rŸÚmsgr0r6r1r¾)s  zmanifest_maker.write_manifestcCs| |¡st ||¡dSr4)Ú_should_suppress_warningrrn)r7rÆr0r0r1rn5s zmanifest_maker.warncCs t d|¡S)z; suppress missing-file warnings from sdist zstandard file .*not found)r$r¬)rÆr0r0r1rÇ9sz'manifest_maker._should_suppress_warningcCs”t |¡| ¡|j |j¡|j |j¡ttƒƒ}|rJ|j  |¡nt j   |j¡r`|  ¡t j   d¡rx|j d¡| d¡}|j |j¡dS)Nzsetup.pyrH)rr¿Z check_licenser‡rµrÀr†r^rr©r!r"rmZ read_manifestÚget_finalized_commandr‹rH)r7ZrcfilesZei_cmdr0r0r1r¿@s     zmanifest_maker.add_defaultscCsZ| d¡}|j ¡}|j |j¡|j |¡t tj ¡}|jj d|d|dddS)NÚbuildz(^|z)(RCS|CVS|\.svn)r)Zis_regex) rÈr5Z get_fullnamer‡rŒZ build_baser$r%r!r#Zexclude_pattern)r7rÉZbase_dirr#r0r0r1rÁSs    ÿzmanifest_maker.prune_file_listN)rDrErFrÀrSrkr„rÅr¾rnÚ staticmethodrÇr¿rÁr0r0r0r1r… 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. Ú rtruN)rdrwryrz)rYÚcontentsr|r0r0r1rl]s   rlc CsŠt d|¡|js†|jj}|j|j|_}|j|j|_}z|  |j ¡W|||_|_n|||_|_0t |jddƒ}t   |j |¡dS)Nz writing %sZzip_safe)rrvrxr5rfrQr>rPr8Úwrite_pkg_inforHÚgetattrr Zwrite_safety_flag)ÚcmdÚbasenamerYrfZoldverZoldnameZsafer0r0r1rÍjs  rÍcCstj |¡rt d¡dS)NzsWARNING: 'depends.txt' is not used by setuptools 0.6! Use the install_requires/extras_require setup() args instead.)r!r"rmrrn©rÏrÐrYr0r0r1Úwarn_depends_obsolete}s ÿrÒcCs0t|pdƒ}dd„}t|t|ƒƒ}| |¡dS)Nr0cSs|dS)NrËr0)r™r0r0r1Ú append_crˆsz&_write_requirements..append_cr)rÚmapÚsortedÚ writelines)ÚstreamZreqsÚlinesrÓr0r0r1Ú_write_requirements…s rÙcCsn|j}t ¡}t||jƒ|jp"i}t|ƒD]*}| djfit ƒ¤Ž¡t|||ƒq,|  d||  ¡¡dS)Nz [{extra}] Z requirements) r5ÚioÚStringIOrÙZinstall_requiresÚextras_requirerÕrzr–ÚvarsrsÚgetvalue)rÏrÐrYZdistrqrÜZextrar0r0r1Úwrite_requirementsŽs   rßcCs,t ¡}t||jjƒ| d|| ¡¡dS)Nzsetup-requirements)rÚrÛrÙr5Zsetup_requiresrsrÞ)rÏrÐrYrqr0r0r1Úwrite_setup_requirements™sràcCs:t dd„|j ¡Dƒ¡}| d|d t|ƒ¡d¡dS)NcSsg|]}| dd¡d‘qS)Ú.rr)r )r¥Úkr0r0r1r¦¡sÿz(write_toplevel_names..ztop-level namesrË)rXÚfromkeysr5Ziter_distribution_namesrlrdrÕ)rÏrÐrYZpkgsr0r0r1Úwrite_toplevel_namesŸs þÿräcCst|||dƒdS)NT)Ú write_argrÑr0r0r1Ú overwrite_arg©sræFcCsHtj |¡d}t|j|dƒ}|dur4d |¡d}| ||||¡dS)NrrË)r!r"ÚsplitextrÎr5rdrs)rÏrÐrYrrÚargnamerUr0r0r1rå­s råcCs |jj}t|tƒs|dur |}nl|durŒg}t| ¡ƒD]H\}}t|tƒsnt ||¡}d tt t|  ¡ƒƒ¡}|  d||f¡q8d |¡}|  d||d¡dS)NrËz [%s] %s rz entry pointsT) r5Z entry_pointsr]ÚstrrÕÚitemsrZ parse_grouprdrÔÚvaluesrµrs)rÏrÐrYrrqZsectionrÌr0r0r1Ú write_entriesµs   rìcCs€t dt¡tj d¡r|t d¡J}|D]4}t  d|¡}|r(t |  d¡ƒWdƒSq(Wdƒn1sr0YdS)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) ÚwarningsrnÚEggInfoDeprecationWarningr!r"rmrÚryr$r¬ÚintÚgroup)r|r™r¬r0r0r1Úget_pkg_info_revisionÆsÿ   @rñc@seZdZdZdS)rîz?Deprecated behavior warning for EggInfo, bypassing suppression.N)rDrErFÚ__doc__r0r0r0r1rîÖsrî)F);ròZdistutils.filelistrZ _FileListZdistutils.errorsrZdistutils.utilrr`rr‘r!r$r¼rÚrírArVZ setuptoolsrZsetuptools.command.sdistrrZsetuptools.command.setoptr Zsetuptools.commandr Z pkg_resourcesr r r rrrrrZsetuptools.unicode_utilsr¹Zsetuptools.globrZsetuptools.externrrr2r3rHr…rlrÍrÒrÙrßràrärærårìrñrîr0r0r0r1ÚsV         (    S1IP