fc@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'j(Z(ddl)m*Z*ddlm+Z+dZ,defdYZ-defdYZdefdYZ.dZ/dZ0dZ1dZ2dZ3dZ4dZ5dZ6e7d Z8d!Z9d"Z:dS(#sUsetuptools.command.egg_info Create a distribution's .egg-info directory and contentsi(tFileList(tDistutilsInternalError(t convert_path(tlogN(tsix(tmap(tCommand(tsdist(t walk_revctrl(t edit_config(t bdist_egg(tparse_requirementst safe_namet parse_versiont safe_versiont yield_linest EntryPointtiter_entry_pointst to_filename(tglob(t packagingcCsd}|jtjj}tjtj}d|f}xt|D]\}}|t|dk}|dkr|r|d7}qG|d||f7}qGnd}t|} x|| krA||} | dkr||d7}nJ| d kr||7}n1| d kr!|d} | | krB|| d krB| d} n| | krk|| d krk| d} nx*| | kr|| d kr| d} qnW| | kr|tj| 7}q4||d| !} d} | dd krd } | d} n| tj| 7} |d| f7}| }n|tj| 7}|d7}qW|sG||7}qGqGW|d7}tj|dtj tj BS(s 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. ts[^%s]is**s.*s (?:%s+%s)*it*t?t[t!t]t^s[%s]s\Ztflags( tsplittostpathtseptretescapet enumeratetlentcompilet MULTILINEtDOTALL(RtpattchunksR t valid_chartctchunkt last_chunktit chunk_lentchartinner_itinnert char_class((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyttranslate_pattern$sV                tegg_infocBseZdZddddgZdgZidd 6Zd ZedZej dZdZ dZ e dZ dZdZdZdZdZdZdZRS(s+create a distribution's .egg-info directorys egg-base=tesLdirectory containing .egg-info directories (default: top of the source tree)stag-datetds0Add date stamp (e.g. 20050528) to version numbers tag-build=tbs-Specify explicit tag to add to version numbersno-datetDs"Don't include date stamp [default]cCsLd|_d|_d|_d|_d|_d|_t|_d|_ dS(Ni( tNonetegg_namet egg_versiontegg_baseR5t tag_buildttag_datetFalsetbroken_egg_infotvtags(tself((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pytinitialize_optionss       cCsdS(N((RC((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyttag_svn_revisionscCsdS(N((RCtvalue((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyREscCs@tj}|j|diR?R5N(t collectionst OrderedDictttagsR tdict(RCtfilenameR5((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pytsave_version_infos  cCst|jj|_|j|_|j|_t|j}yKt |t j j }|ridnd}t t||j|jfWn3tk rtjjd|j|jfnX|jdkr|jj}|pijdtj|_n|jdt|jd|_|jtjkrXtjj|j|j|_nd|jkrt|jn|j|jj_ |jj }|dk r|j!|jj"kr|j|_#t|j|_$d|j_ ndS(Ns%s==%ss%s===%ss2Invalid distribution name or version syntax: %s-%sRR=s .egg-infot-(%R t distributiontget_nameR;RIRBttagged_versionR<R t isinstanceRtversiontVersiontlistR t ValueErrort distutilsterrorstDistutilsOptionErrorR=R:t package_dirtgetRtcurdirtensure_dirnameRR5Rtjointcheck_broken_egg_infotmetadatat _patched_disttkeytlowert_versiont_parsed_version(RCtparsed_versiont is_versiontspectdirstpd((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pytfinalize_optionss8!   ! !  $ cCsl|r|j|||nLtjj|rh|dkrX| rXtjd||dS|j|ndS(sWrite `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). s$%s not set in setup(), but %s existsN(t write_fileRRtexistsR:Rtwarnt delete_file(RCtwhatRKtdatatforce((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pytwrite_or_delete_files  cCsdtjd||tjr.|jd}n|js`t|d}|j||jndS(sWrite `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. swriting %s to %ssutf-8twbN( RtinfoRtPY3tencodetdry_runtopentwritetclose(RCRoRKRptf((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyRks   cCs-tjd||js)tj|ndS(s8Delete `filename` (if not a dry run) after announcing its deleting %sN(RRtRwRtunlink(RCRK((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyRns cCsE|jj}|jr4|j|jr4t|St||jS(N(RNt get_versionRBtendswithR(RCRR((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyRPs cCs|j|j|jj}xXtdD]J}|jd||j}|||jtj j |j|jq)Wtj j |jd}tj j |r|j |n|j dS(Nsegg_info.writerst installersnative_libs.txt(tmkpathR5RNtfetch_build_eggRtrequiretresolvetnameRRR]RlRnt find_sources(RCRteptwritertnl((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pytrun s  ,cCsBd}|jr||j7}n|jr>|tjd7}n|S(NRs-%Y%m%d(R>R?ttimetstrftime(RCRR((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyRIs   cCsJtjj|jd}t|j}||_|j|j|_dS(s"Generate SOURCES.txt manifest files SOURCES.txtN( RRR]R5tmanifest_makerRNtmanifestRtfilelist(RCtmanifest_filenametmm((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyR s   cCs|jd}|jtjkr:tjj|j|}ntjj|rtjddddd||j |j |_ ||_ ndS(Ns .egg-infoRMiNs 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. ( R;R=RR[RR]RlRRmR5RA(RCtbei((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyR^(s   (s egg-base=R6sLdirectory containing .egg-info directories (default: top of the source tree)(stag-dateR7s0Add date stamp (e.g. 20050528) to version number(s tag-build=R8s-Specify explicit tag to add to version number(sno-dateR9s"Don't include date stamp [default](t__name__t __module__t descriptiont user_optionstboolean_optionst negative_optRDtpropertyREtsetterRLRjR@RrRkRnRPRRIRR^(((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyR5ws*     /       RcBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZRS(cCs|j|\}}}}|dkrw|jddj|x|D](}|j|sHtjd|qHqHWnx|dkr|jddj|xO|D](}|j|stjd|qqWn|dkr/|jd dj|x|D](}|j|stjd |qqWn|d kr|jd dj|x|D](}|j|s\tjd |q\q\Wnd|dkr|jd|dj|fx5|D].}|j ||stjd||qqWn|dkr[|jd|dj|fx|D].}|j ||s&tjd||q&q&Wn|dkr|jd||j |stjd|qnR|dkr|jd||j |stjd|qnt d|dS(Ntincludesinclude t s%warning: no files found matching '%s'texcludesexclude s9warning: no previously-included files found matching '%s'sglobal-includesglobal-include s>warning: no files found matching '%s' anywhere in distributionsglobal-excludesglobal-exclude sRwarning: no previously-included files matching '%s' found anywhere in distributionsrecursive-includesrecursive-include %s %ss:warning: no files found matching '%s' under directory '%s'srecursive-excludesrecursive-exclude %s %ssNwarning: no previously-included files matching '%s' found under directory '%s'tgraftsgraft s+warning: no directories found matching '%s'tprunesprune s6no previously-included directories found matching '%s's'this cannot happen: invalid action '%s'(t_parse_template_linet debug_printR]RRRmRtglobal_includetglobal_excludetrecursive_includetrecursive_excludeRRR(RCtlinetactiontpatternstdirt dir_patterntpattern((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pytprocess_template_line;sd                         cCsrt}xett|jdddD]D}||j|r&|jd|j||j|=t}q&q&W|S(s Remove all files from the file list that match the predicate. Return True if any matching files were removed iis removing (R@trangeR$tfilesRtTrue(RCt predicatetfoundR.((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyt _remove_filess&  cCsHgt|D]}tjj|s |^q }|j|t|S(s#Include files that match 'pattern'.(RRRtisdirtextendtbool(RCRR{R((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyRs1 cCst|}|j|jS(s#Exclude files that match 'pattern'.(R4Rtmatch(RCRR((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyRs cCsftjj|d|}gt|dtD]}tjj|s+|^q+}|j|t|S(sN Include all files anywhere in 'dir/' that match the pattern. s**t recursive(RRR]RRRRR(RCRRt full_patternR{R((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyRs  cCs.ttjj|d|}|j|jS(sM Exclude any file anywhere in 'dir/' that match the pattern. s**(R4RRR]RR(RCRRR((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyRscCsOgt|D]%}tjj|D] }|^q#q }|j|t|S(sInclude all files from 'dir/'.(RRVRtfindallRR(RCRt match_dirtitemR((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyRs % cCs+ttjj|d}|j|jS(sFilter out files from 'dir/'.s**(R4RRR]RR(RCRR((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyRscCsy|jdkr|jnttjjd|}g|jD]}|j|rA|^qA}|j|t |S(s Include all files anywhere in the current directory that match the pattern. This is very inefficient on large file trees. s**N( tallfilesR:RR4RRR]RRR(RCRRR{R((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyRs  + cCs+ttjjd|}|j|jS(sD Exclude all files anywhere that match the pattern. s**(R4RRR]RR(RCRR((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyRscCsN|jdr|d }nt|}|j|rJ|jj|ndS(Ns i(R~Rt _safe_pathRtappend(RCRR((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyRs   cCs |jjt|j|dS(N(RRtfilterR(RCtpaths((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyRscCs"tt|j|j|_dS(s 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(RTRRR(RC((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyt_repairscCsd}tj|}|dkr6tjd|tStj|d}|dkrktj||dtSy,tjj |stjj |rt SWn*t k rtj||t j nXdS(Ns!'%s' not %s encodable -- skippings''%s' in unexpected encoding -- skippingsutf-8(t unicode_utilstfilesys_decodeR:RRmR@t try_encodeRRRlRtUnicodeEncodeErrortsystgetfilesystemencoding(RCRtenc_warntu_patht utf8_path((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyRs  $ (RRRRRRRRRRRRRRRR(((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyR8s I        RcBseeZdZdZdZdZdZdZdZe dZ dZ d Z RS( s MANIFEST.incCs(d|_d|_d|_d|_dS(Ni(t use_defaultsRt manifest_onlytforce_manifest(RC((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyRDs   cCsdS(N((RC((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyRjscCst|_tjj|js.|jn|jtjj|jrZ|j n|j |jj |jj |jdS(N( RRRRRlRtwrite_manifestt add_defaultsttemplatet read_templatetprune_file_listtsorttremove_duplicates(RC((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyRs       cCs"tj|}|jtjdS(Nt/(RRtreplaceRR (RCR((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyt_manifest_normalizescCsb|jjg|jjD]}|j|^q}d|j}|jt|j|f|dS(so Write the file list in 'self.filelist' to the manifest file named by 'self.manifest'. swriting manifest file '%s'N(RRRRRtexecuteRk(RCR{Rtmsg((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyRs ( cCs&|j|s"tj||ndS(N(t_should_suppress_warningRRm(RCR((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyRm$scCstjd|S(s; suppress missing-file warnings from sdist sstandard file .*not found(R!R(R((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyR(scCstj||jj|j|jj|jtt}|r[|jj|n"t j j |jr}|j n|j d}|jj|jdS(NR5(RRRRRRRTRRRRRlt read_manifesttget_finalized_commandRR5(RCtrcfilestei_cmd((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyR/s  cCsy|jd}|jj}|jj|j|jj|tjtj }|jj d|d|dddS(Ntbuilds(^|s)(RCS|CVS|\.svn)tis_regexi( RRNt get_fullnameRRt build_baseR!R"RR texclude_pattern(RCRtbase_dirR ((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyR;s( RRRRDRjRRRRmt staticmethodRRR(((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyRs     cCsGdj|}|jd}t|d}|j|WdQXdS(s{Create a file with the specified name and write 'contents' (a sequence of strings without line terminators) to it. s sutf-8RsN(R]RvRxRy(RKtcontentsR{((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyRkEscCstjd||js|jj}|j|j|_}|j|j|_}z|j |j Wd|||_|_Xt |jdd}t j|j |ndS(Ns writing %stzip_safe(RRtRwRNR_R<RRR;Rtwrite_pkg_infoR5tgetattrR:R twrite_safety_flag(tcmdtbasenameRKR_toldvertoldnametsafe((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyRRs  cCs&tjj|r"tjdndS(NssWARNING: 'depends.txt' is not used by setuptools 0.6! Use the install_requires/extras_require setup() args instead.(RRRlRRm(RRRK((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pytwarn_depends_obsoleteescCs;t|p d}d}t||}|j|dS(NcSs|dS(Ns ((R((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pytoR((RRt writelines(tstreamtreqstlinest append_cr((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyt_write_requirementsms cCs|j}tj}t||j|jp1i}x>t|D]0}|jdjt t|||qAW|j d||j dS(Ns [{extra}] t requirements( RNRtStringIORtinstall_requirestextras_requiretsortedRytformattvarsRrtgetvalue(RRRKtdistRpRtextra((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pytwrite_requirementsts  cCs<tj}t||jj|jd||jdS(Nssetup-requirements(tioRRRNtsetup_requiresRrR(RRRKRp((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pytwrite_setup_requirementss cCsetjg|jjD]}|jddd^q}|jd|djt|ddS(Nt.iistop-level namess (RJtfromkeysRNtiter_distribution_namesRRkR]R(RRRKtktpkgs((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pytwrite_toplevel_namess2cCst|||tdS(N(t write_argR(RRRK((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyt overwrite_argscCsgtjj|d}t|j|d}|dk rMdj|d}n|j||||dS(Nis (RRtsplitextRRNR:R]Rr(RRRKRqtargnameRF((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyR s  cCs|jj}t|tjs*|dkr3|}n|dk rg}xt|jD]n\}}t|tjstj ||}dj tt t |j }n|jd||fqXWdj |}n|jd||tdS(Ns s [%s] %s Rs entry points(RNt entry_pointsRQRt string_typesR:RtitemsRt parse_groupR]RtstrtvaluesRRrR(RRRKRRptsectionR((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pyt write_entriess   'cCs}tjdttjjdrytjdC}x9|D]1}tj d|}|r;t |j dSq;WWdQXndS(sd Get a -r### off of PKG-INFO Version in case this is an sdist of a subversion revision. s$get_pkg_info_revision is deprecated.sPKG-INFOsVersion:.*-r(\d+)\s*$iNi( twarningsRmtDeprecationWarningRRRlRRxR!Rtinttgroup(R{RR((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pytget_pkg_info_revisions  (;t__doc__tdistutils.filelistRt _FileListtdistutils.errorsRtdistutils.utilRRVRRR!RRRRRGtsetuptools.externRtsetuptools.extern.six.movesRt setuptoolsRtsetuptools.command.sdistRRtsetuptools.command.setoptR tsetuptools.commandR t pkg_resourcesR R R RRRRRtsetuptools.unicode_utilsRtsetuptools.globRRR4R5RRkRRRRRR R R@R RR(((s?/usr/lib/python2.7/site-packages/setuptools/command/egg_info.pytsN         : SI