U âQabâ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|j|j ¡kr>|j|_t|jƒ|_ d|j_dS)Nz%s==%sz%s===%sz2Invalid distribution name or version syntax: %s-%srrPú .egg-infoú-)!r:rQr?rRrÚ isinstancerr>ZVersionÚlistr Ú ValueErrorÚ distutilsÚerrorsZDistutilsOptionErrorrPr7Z package_dirÚgetr#ÚcurdirZensure_dirnamerrIr$ÚjoinÚcheck_broken_egg_infoÚmetadataZ _patched_distÚkeyÚlowerZ_versionZ_parsed_version)r9Zparsed_versionZ is_versionÚspecÚdirsZpdr2r2r3Ú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)r9ÚwhatrZÚdataÚforcer2r2r3Úwrite_or_delete_fileòs   ÿzegg_info.write_or_delete_filecCsDt d||¡tjr| 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ÚinforZPY3ÚencodeÚdry_runÚopenÚwriteÚclose)r9rqrZrrÚfr2r2r3rms   zegg_info.write_filecCs t d|¡|jst |¡dS)z8Delete `filename` (if not a dry run) after announcing itz deleting %sN)rrwryr#Úunlink)r9rZr2r2r3rps 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)ZmkpathrIr#Úutimer7Zfetch_build_eggrZrequireZresolver:r$rernrpÚ find_sources)r9rÚepÚwriterÚnlr2r2r3Úruns     z egg_info.runcCs4tj |jd¡}t|jƒ}||_| ¡|j|_dS)z"Generate SOURCES.txt manifest filez SOURCES.txtN) r#r$rerIÚmanifest_makerr7Úmanifestr…Úfilelist)r9Zmanifest_filenameZmmr2r2r3r*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. ------------------------------------------------------------------------------) rQrPr#rdr$rernrrorIrS)r9Zbeir2r2r3rf2s   ûzegg_info.check_broken_egg_infoN)F)rErFrGÚ descriptionZ user_optionsZboolean_optionsZ negative_optrTrHrUÚsetterr[rlrtrmrpr…rrfr2r2r2r3rI‘s.ûÿ    1 rIc@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_printrer‹rrorÚglobal_includeÚglobal_excludeÚrecursive_includeÚrecursive_excluderŽrr)r9ÚlineÚactionZpatternsÚdirZ dir_patternÚpatternr2r2r3Úprocess_template_lineEs|  ÿ  ÿ   þ   ÿþ   ÿþ   ÿ  ÿÿ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)r9Z predicateÚfoundr/r2r2r3Ú _remove_filesŽszFileList._remove_filescCs$dd„t|ƒDƒ}| |¡t|ƒS)z#Include files that match 'pattern'.cSsg|]}tj |¡s|‘qSr2©r#r$Úisdir©Ú.0r}r2r2r3Ú s z$FileList.include..©rÚextendÚbool©r9r˜rr2r2r3r‹›s zFileList.includecCst|ƒ}| |j¡S)z#Exclude files that match 'pattern'.)r4ržÚmatch©r9r˜r¨r2r2r3r¡szFileList.excludecCs8tj |d|¡}dd„t|ddDƒ}| |¡t|ƒS)zN Include all files anywhere in 'dir/' that match the pattern. rcSsg|]}tj |¡s|‘qSr2rŸr¡r2r2r3r£«s ÿz.FileList.recursive_include..T)Ú recursive)r#r$rerr¥r¦)r9r—r˜Z full_patternrr2r2r3r“¦s zFileList.recursive_includecCs ttj |d|¡ƒ}| |j¡S)zM Exclude any file anywhere in 'dir/' that match the pattern. r©r4r#r$reržr¨)r9r—r˜r¨r2r2r3r”°szFileList.recursive_excludecCs$dd„t|ƒDƒ}| |¡t|ƒS)zInclude all files from 'dir/'.cSs"g|]}tj |¡D]}|‘qqSr2)rarˆÚfindall)r¢Z match_dirÚitemr2r2r3r£¹sþz"FileList.graft..r¤)r9r—rr2r2r3rŽ·s þ zFileList.graftcCsttj |d¡ƒ}| |j¡S)zFilter out files from 'dir/'.rr«)r9r—r¨r2r2r3rÁ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|‘qSr2©r¨r¡r®r2r3r£Îs z+FileList.global_include..)Zallfilesr¬r4r#r$rer¥r¦r§r2r®r3r‘Æs   zFileList.global_includecCsttj d|¡ƒ}| |j¡S)zD Exclude all files anywhere that match the pattern. rr«r©r2r2r3r’ÒszFileList.global_excludecCs8| d¡r|dd…}t|ƒ}| |¡r4|j |¡dS)Nú rš)r<rÚ _safe_pathrœÚappend)r9r­r$r2r2r3r±Ùs    zFileList.appendcCs|j t|j|ƒ¡dSr6)rœr¥Úfilterr°)r9Úpathsr2r2r3r¥á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œr8r2r2r3Ú_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 -- skippingFruT) Ú unicode_utilsÚfilesys_decoderroZ try_encoder#r$rnÚUnicodeEncodeErrorÚsysÚgetfilesystemencoding)r9r$Zenc_warnZu_pathZ utf8_pathr2r2r3r°îs   zFileList._safe_pathN)rErFrGr™ržr‹rr“r”rŽrr‘r’r±r¥r´r°r2r2r2r3rBsI     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_defaultsrZ manifest_onlyZforce_manifestr8r2r2r3rT sz!manifest_maker.initialize_optionscCsdSr6r2r8r2r2r3rlszmanifest_maker.finalize_optionscCsdtƒ|_tj |j¡s| ¡| ¡tj |j¡r<|  ¡|  ¡|j  ¡|j  ¡| ¡dSr6) rrˆr#r$rnr‡Úwrite_manifestÚ add_defaultsÚtemplateZ read_templateÚprune_file_listÚsortZremove_duplicatesr8r2r2r3r…s  zmanifest_maker.runcCst |¡}| tjd¡S)Nú/)rµr¶Úreplacer#r%)r9r$r2r2r3Ú_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|]}ˆ |¡‘qSr2)rÁr¡r8r2r3r£*sz1manifest_maker.write_manifest..zwriting manifest file '%s'N)rˆr´rœr‡Zexecuterm)r9rœÚmsgr2r8r3rº"s  zmanifest_maker.write_manifestcCs| |¡st ||¡dSr6)Ú_should_suppress_warningr ro)r9rÂr2r2r3ro.s zmanifest_maker.warncCs t d|¡S)z; suppress missing-file warnings from sdist zstandard file .*not found)r&r¨)rÂr2r2r3rÃ2sz'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.pyrI)r r»Z check_licenserˆr±r¼r‡r_r r¥r#r$rnZ read_manifestÚget_finalized_commandrŽrI)r9ZrcfilesZei_cmdr2r2r3r»9s     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Är7Z get_fullnamerˆrZ build_baser&r'r#r%Zexclude_pattern)r9rÅZbase_dirr%r2r2r3r½Ls    ÿzmanifest_maker.prune_file_listN)rErFrGr¼rTrlr…rÁrºroÚ staticmethodrÃr»r½r2r2r2r3r†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. Ú rurvN)rerxrzr{)rZÚcontentsr}r2r2r3rmVs   rmc Cs|t d|¡|jsx|jj}|j|j|_}|j|j|_}z|  |j ¡W5|||_|_Xt |jddƒ}t   |j |¡dS)Nz writing %sZzip_safe)rrwryr7rgrRr>rQr:Úwrite_pkg_inforIÚgetattrr Zwrite_safety_flag)ÚcmdÚbasenamerZrgZoldverZoldnameZsafer2r2r3rÉcs 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$rnrro©rËrÌrZr2r2r3Úwarn_depends_obsoletevs ÿrÎcCs,t|pdƒ}dd„}t||ƒ}| |¡dS)Nr2cSs|dS)NrÇr2)r•r2r2r3Ú€óz%_write_requirements..)rrÚ writelines)ÚstreamZreqsÚlinesZ append_crr2r2r3Ú_write_requirements~s  rÔcCsj|j}t ¡}t||jƒ|jp"i}t|ƒD]&}| djft ƒŽ¡t|||ƒq,|  d||  ¡¡dS)Nz [{extra}] Z requirements) r7rÚStringIOrÔZinstall_requiresÚextras_requireÚsortedr{ÚformatÚvarsrtÚgetvalue)rËrÌrZZdistrrrÖZextrar2r2r3Úwrite_requirements…s   rÛcCs,t ¡}t||jjƒ| d|| ¡¡dS)Nzsetup-requirements)ÚiorÕrÔr7Zsetup_requiresrtrÚ)rËrÌrZrrr2r2r3Úwrite_setup_requirementssrÝcCs:t dd„|j ¡Dƒ¡}| d|d t|ƒ¡d¡dS)NcSsg|]}| dd¡d‘qS)Ú.rr)r")r¢Úkr2r2r3r£˜sÿz(write_toplevel_names..ztop-level namesrÇ)rYÚfromkeysr7Ziter_distribution_namesrmrer×)rËrÌrZZpkgsr2r2r3Úwrite_toplevel_names–s þÿrácCst|||dƒdS)NT)Ú write_argrÍr2r2r3Ú overwrite_arg srãFcCsHtj |¡d}t|j|dƒ}|dk r4d |¡d}| ||||¡dS)NrrÇ)r#r$ÚsplitextrÊr7rert)rËrÌrZrsÚargnamerVr2r2r3râ¤s râcCs¤|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)r7Z entry_pointsr^rZ string_typesr×ÚitemsrZ parse_grouprerÚstrÚvaluesr±rt)rËrÌrZr‚rrZsectionrÈr2r2r3Ú write_entries¬s   réc 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) ÚwarningsroÚEggInfoDeprecationWarningr#r$rnrÜrzr&r¨ÚintÚgroup)r}r•r¨r2r2r3Úget_pkg_info_revision½s    *rîc@seZdZdZdS)rëzqClass for warning about deprecations in eggInfo in setupTools. Not ignored by default, unlike DeprecationWarning.N)rErFrGÚ__doc__r2r2r2r3rëÌsrë)F)=rïZdistutils.filelistrZ _FileListZdistutils.errorsrZdistutils.utilrrarr#r&r¸rÜrêrBrWZsetuptools.externrZsetuptools.extern.six.movesrZ setuptoolsrZsetuptools.command.sdistr r Zsetuptools.command.setoptr Zsetuptools.commandr Z pkg_resourcesr rrrrrrrZsetuptools.unicode_utilsrµZsetuptools.globrrrr4r5rIr†rmrÉrÎrÔrÛrÝrárãrârérîrër2r2r2r3ÚsX           (    S2EP