U lÏ aÌcã@sÞdZddlmZddlmZddlmZddlm Z ddlZddlZddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&ddl'm(Z(ddl)m*Z*ddlm+Z+ddlm,Z,dd„Z-Gdd„dƒZ.Gdd„de.eƒZ/Gdd„deƒZGdd„deƒZ0dd„Z1dd„Z2d d!„Z3d"d#„Z4d$d%„Z5d&d'„Z6d(d)„Z7d*d+„Z8d5d-d.„Z9d/d0„Z:d1d2„Z;Gd3d4„d4e,ƒZÚversionr6r6r7Útagged_version€s zInfoCommon.tagged_versioncCs,d}|jr||j7}|jr(|t d¡7}|S)Nrz-%Y%m%d)Ú tag_buildÚtag_dateÚtimeÚstrftimerCr6r6r7Útagsˆs  zInfoCommon.tags) Ú__name__Ú __module__Ú __qualname__rFrGÚpropertyr?rErJrAr6r6r6r7r9xs r9c@sŽeZdZdZddddgZdgZddiZdd „Zed d „ƒZ e j d d „ƒZ d d„Z dd„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]rQrTcCs"d|_d|_d|_d|_d|_dS)NF)Úegg_baseÚegg_namerOÚ egg_versionÚbroken_egg_infor=r6r6r7Úinitialize_options¢s zegg_info.initialize_optionscCsdSr:r6r=r6r6r7Útag_svn_revision¬szegg_info.tag_svn_revisioncCsdSr:r6)r>Úvaluer6r6r7r[°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. rFrrG)rON)Ú collectionsÚ OrderedDictrJr Údict)r>ÚfilenamerOr6r6r7Úsave_version_infoµs zegg_info.save_version_infocCsB|j|_| ¡|_t|jƒ}z6t|tjjƒ}|r4dnd}t t ||j|jfƒƒWn,t k r~t j  d|j|jf¡‚YnX|jdkr¦|jj}|p˜i dtj¡|_| d¡t|jƒd|_|jtjkràtj |j|j¡|_d|jkrò| ¡|j|jj_|jj}|dk r>|j|j ¡kr>|j|_t|jƒ|_ d|j_dS)Nz%s==%sz%s===%sz2Invalid distribution name or version syntax: %s-%srrVú .egg-infoú-)!r?rWrErXrÚ isinstancerrDÚVersionÚlistr Ú ValueErrorÚ distutilsÚerrorsÚDistutilsOptionErrorrVr;Ú package_dirÚgetr#ÚcurdirÚensure_dirnamerrOr$ÚjoinÚcheck_broken_egg_infoÚmetadataZ _patched_distÚkeyÚlowerÚ_versionÚ_parsed_version)r>Úparsed_versionZ is_versionÚspecÚdirsÚpdr6r6r7Úfinalize_optionsÂs>   ÿÿ ÿÿ       zegg_info.finalize_optionsFcCsL|r| |||¡n4tj |¡rH|dkr>|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)r>Úwhatr`ÚdataÚforcer6r6r7Úwrite_or_delete_fileós   ÿzegg_info.write_or_delete_filecCsDt d||¡tjs| 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ÚinforÚPY2ÚencodeÚdry_runÚopenÚwriteÚclose)r>rr`r€Úfr6r6r7r{s   zegg_info.write_filecCs t d|¡|jst |¡dS)z8Delete `filename` (if not a dry run) after announcing itz deleting %sN)rr…rˆr#Úunlink)r>r`r6r6r7r~s 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)ÚmkpathrOr#Úutimer;Zfetch_build_eggrÚrequireÚresolver?r$ror|r~Ú find_sources)r>rŽÚepÚwriterÚnlr6r6r7Úruns     z egg_info.runcCs4tj |jd¡}t|jƒ}||_| ¡|j|_dS)z"Generate SOURCES.txt manifest filez SOURCES.txtN) r#r$rorOÚmanifest_makerr;Úmanifestr—Úfilelist)r>Zmanifest_filenameÚmmr6r6r7r“+s  zegg_info.find_sourcescCsT|jd}|jtjkr&tj |j|¡}tj |¡rPt d||j ¡|j |_ ||_ dS)NrbaB------------------------------------------------------------------------------ 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. ------------------------------------------------------------------------------) rWrVr#rmr$ror|rr}rOrY)r>Zbeir6r6r7rp3s   ûzegg_info.check_broken_egg_infoN)F)rKrLrMÚ descriptionÚ user_optionsÚboolean_optionsÚ negative_optrZrNr[Úsetterrarzr‚r{r~r—r“rpr6r6r6r7rO’s.ûÿ    1 rOc@s|eZdZdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd d„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„ZdS)rcCs | |¡\}}}}|dkrR| dd |¡¡|D]}| |¡s2t d|¡q2nÊ|dkr’| dd |¡¡|D]}| |¡srt d|¡qrnŠ|dkrÒ| d d |¡¡|D]}| |¡s²t d |¡q²nJ|d kr| d d |¡¡|D]}| |¡sôt d |¡qôn|dkr`| d|d |¡f¡|D]"}|  ||¡s:t d||¡q:n¼|dkr¬| d|d |¡f¡|D]"}|  ||¡s†t d||¡q†np|dkrÞ| d|¡|  |¡st d|¡n>|dkr| d|¡|  |¡st d|¡n t d|ƒ‚dS)NÚincludezinclude ú z%warning: no files found matching '%s'Úexcludezexclude z9warning: no previously-included files found matching '%s'zglobal-includezglobal-include z>warning: no files found matching '%s' anywhere in distributionzglobal-excludezglobal-exclude zRwarning: no previously-included files matching '%s' found anywhere in distributionzrecursive-includezrecursive-include %s %sz:warning: no files found matching '%s' under directory '%s'zrecursive-excludezrecursive-exclude %s %szNwarning: no previously-included files matching '%s' found under directory '%s'Úgraftzgraft z+warning: no directories found matching '%s'Úprunezprune z6no previously-included directories found matching '%s'z'this cannot happen: invalid action '%s')Z_parse_template_lineÚ debug_printror¡rr}r£Úglobal_includeÚglobal_excludeÚrecursive_includeÚrecursive_excluder¤r¥r)r>ÚlineÚactionÚpatternsÚdirZ dir_patternÚpatternr6r6r7Úprocess_template_lineFs|  ÿ  ÿ   þ   ÿþ   ÿþ   ÿ  ÿÿ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¦)r>Ú predicateÚfoundr2r6r6r7Ú _remove_filesszFileList._remove_filescCs$dd„t|ƒDƒ}| |¡t|ƒS)z#Include files that match 'pattern'.cSsg|]}tj |¡s|‘qSr6©r#r$Úisdir©Ú.0rŒr6r6r7Ú žs z$FileList.include..©rÚextendÚbool©r>r¯rµr6r6r7r¡œs zFileList.includecCst|ƒ}| |j¡S)z#Exclude files that match 'pattern'.)r8r¶Úmatch©r>r¯rÀr6r6r7r£¢szFileList.excludecCs8tj |d|¡}dd„t|ddDƒ}| |¡t|ƒS)zN Include all files anywhere in 'dir/' that match the pattern. rcSsg|]}tj |¡s|‘qSr6r·r¹r6r6r7r»¬s ÿz.FileList.recursive_include..T)Ú recursive)r#r$rorr½r¾)r>r®r¯Z full_patternrµr6r6r7r©§s zFileList.recursive_includecCs ttj |d|¡ƒ}| |j¡S)zM Exclude any file anywhere in 'dir/' that match the pattern. r©r8r#r$ror¶rÀ)r>r®r¯rÀr6r6r7rª±szFileList.recursive_excludecCs$dd„t|ƒDƒ}| |¡t|ƒS)zInclude all files from 'dir/'.cSs"g|]}tj |¡D]}|‘qqSr6)rhršÚfindall)rºZ match_dirÚitemr6r6r7r»ºsþz"FileList.graft..r¼)r>r®rµr6r6r7r¤¸s þ zFileList.graftcCsttj |d¡ƒ}| |j¡S)zFilter out files from 'dir/'.rrÃ)r>r®rÀr6r6r7r¥ÂszFileList.prunecsJ|jdkr| ¡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|‘qSr6©rÀr¹rÆr6r7r»Ïs z+FileList.global_include..)ÚallfilesrÄr8r#r$ror½r¾r¿r6rÆr7r§Çs   zFileList.global_includecCsttj d|¡ƒ}| |j¡S)zD Exclude all files anywhere that match the pattern. rrÃrÁr6r6r7r¨ÓszFileList.global_excludecCs8| d¡r|dd…}t|ƒ}| |¡r4|j |¡dS)Nú r±)rBrÚ _safe_pathr³Úappend)r>rÅr$r6r6r7rÊÚs    zFileList.appendcCs|j t|j|ƒ¡dSr:)r³r½ÚfilterrÉ)r>Úpathsr6r6r7r½â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)rfrËrÉr³r=r6r6r7Ú_repairåszFileList._repairc Csœd}t |¡}|dkr(t d|¡dSt |d¡}|dkrNt ||d¡dSz"tj |¡shtj |¡rnWdSWn&tk r–t ||t   ¡¡YnXdS)Nz!'%s' not %s encodable -- skippingz''%s' in unexpected encoding -- skippingFrƒT) Ú unicode_utilsÚfilesys_decoderr}Z try_encoder#r$r|ÚUnicodeEncodeErrorÚsysÚgetfilesystemencoding)r>r$Zenc_warnZu_pathZ utf8_pathr6r6r7rÉïs   zFileList._safe_pathN)rKrLrMr°r¶r¡r£r©rªr¤r¥r§r¨rÊr½rÍrÉr6r6r6r7rCsI     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_manifestr=r6r6r7rZ sz!manifest_maker.initialize_optionscCsdSr:r6r=r6r6r7rzszmanifest_maker.finalize_optionscCsdtƒ|_tj |j¡s| ¡| ¡tj |j¡r<|  ¡|  ¡|j  ¡|j  ¡| ¡dSr:) rršr#r$r|r™Úwrite_manifestÚ add_defaultsÚtemplateZ read_templateÚprune_file_listÚsortZremove_duplicatesr=r6r6r7r—s  zmanifest_maker.runcCst |¡}| tjd¡S)Nú/)rÎrÏÚreplacer#r%)r>r$r6r6r7Ú_manifest_normalizes 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|]}ˆ |¡‘qSr6)rÚr¹r=r6r7r»+sz1manifest_maker.write_manifest..zwriting manifest file '%s'N)ršrÍr³r™Úexecuter{)r>r³Úmsgr6r=r7rÓ#s  zmanifest_maker.write_manifestcCs| |¡st ||¡dSr:)Ú_should_suppress_warningr r})r>rÜr6r6r7r}/s zmanifest_maker.warncCs t d|¡S)z; suppress missing-file warnings from sdist zstandard file .*not found)r&rÀ)rÜr6r6r7rÝ3sz'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.pyrO)r rÔZ check_licenseršrÊrÕr™rfr r½r#r$r|Z read_manifestÚget_finalized_commandr¤rO)r>ZrcfilesZei_cmdr6r6r7rÔ: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Þr;Ú get_fullnameršr¥Ú build_baser&r'r#r%Zexclude_pattern)r>rßÚbase_dirr%r6r6r7rÖMs    ÿzmanifest_maker.prune_file_listN)rKrLrMrÕrZrzr—rÚrÓr}Ú staticmethodrÝrÔrÖr6r6r6r7r˜s   r˜c Cs8d |¡}| d¡}t|dƒ}| |¡W5QRXdS)z{Create a file with the specified name and write 'contents' (a sequence of strings without line terminators) to it. Ú rƒr„N)ror‡r‰rŠ)r`ÚcontentsrŒr6r6r7r{Ws   r{c Cs|t d|¡|jsx|jj}|j|j|_}|j|j|_}z|  |j ¡W5|||_|_Xt |jddƒ}t   |j |¡dS)Nz writing %sZzip_safe)rr…rˆr;rqrXrDrWr?Úwrite_pkg_inforOÚgetattrr Zwrite_safety_flag)ÚcmdÚbasenamer`rqZoldverZoldnameÚsafer6r6r7ræds 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$r|rr}©rèrér`r6r6r7Úwarn_depends_obsoletews ÿrìcCs,t|pdƒ}dd„}t||ƒ}| |¡dS)Nr6cSs|dS)Nrär6)r«r6r6r7Ú append_cr‚sz&_write_requirements..append_cr)rrÚ writelines)ÚstreamÚreqsÚlinesrír6r6r7Ú_write_requirementss  ròcCsj|j}t ¡}t||jƒ|jp"i}t|ƒD]&}| djft ƒŽ¡t|||ƒq,|  d||  ¡¡dS)Nz [{extra}] Ú requirements) r;rÚStringIOròZinstall_requiresÚextras_requireÚsortedrŠÚformatÚvarsr‚Úgetvalue)rèrér`Údistr€rõÚextrar6r6r7Úwrite_requirementsˆs   rücCs,t ¡}t||jjƒ| d|| ¡¡dS)Nzsetup-requirements)Úiorôròr;Zsetup_requiresr‚rù)rèrér`r€r6r6r7Úwrite_setup_requirements“srþcCs:t dd„|j ¡Dƒ¡}| d|d t|ƒ¡d¡dS)NcSsg|]}| dd¡d‘qS)Ú.rr)r")rºÚkr6r6r7r»›sÿz(write_toplevel_names..ztop-level namesrä)r_Úfromkeysr;Ziter_distribution_namesr{rorö)rèrér`Úpkgsr6r6r7Úwrite_toplevel_names™s þÿrcCst|||dƒdS)NT)Ú write_argrër6r6r7Ú overwrite_arg£srFcCsHtj |¡d}t|j|dƒ}|dk r4d |¡d}| ||||¡dS)Nrrä)r#r$Úsplitextrçr;ror‚)rèrér`rÚargnamer\r6r6r7r§s rcCs¤|jj}t|tjƒs|dkr"|}nn|dk rg}t| ¡ƒD]J\}}t|tjƒsrt ||¡}d  tt t |  ¡ƒƒ¡}|  d||f¡q:d  |¡}| d||d¡dS)Nräz [%s] %s rz entry pointsT)r;Ú entry_pointsrdrÚ string_typesröÚitemsrÚ parse_grouprorÚstrÚvaluesrÊr‚)rèrér`r”r€Úsectionrår6r6r7Ú write_entries¯s   rc Csjt dt¡tj d¡rft d¡>}|D]2}t  d|¡}|r(t |  d¡ƒW5QR£Sq(W5QRXdS)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*$rr) Úwarningsr}ÚEggInfoDeprecationWarningr#r$r|rýr‰r&rÀÚintÚgroup)rŒr«rÀr6r6r7Úget_pkg_info_revisionÀsÿ   *rc@seZdZdZdS)rz?Deprecated behavior warning for EggInfo, bypassing suppression.N)rKrLrMÚ__doc__r6r6r6r7rÐsr)F)=rÚdistutils.filelistrZ _FileListÚdistutils.errorsrÚdistutils.utilrrhrr#r&rÑrýrrHr]Zsetuptools.externrZsetuptools.extern.six.movesrÚ setuptoolsrZsetuptools.command.sdistr r Zsetuptools.command.setoptr Zsetuptools.commandr Ú pkg_resourcesr rrrrrrrZsetuptools.unicode_utilsrÎZsetuptools.globrrrr8r9rOr˜r{rærìròrürþrrrrrrr6r6r6r7ÚsX           (    S2EP