fc@sdZddlmZddlmZmZddlmZddlm Z ddl Z ddl Z ddl Z ddl Z ddlZddlmZddlmZmZmZdd lmZdd lmZdd lmZy#dd lmZmZd ZWn0ek r9ddlm Z mZdZnXdZ!dZ"dZ#defdYZ$e%j&dj'Z(dZ)dZ*dZ+ide,6de-6Z.dZ/dZ0dZ1ddd d!gZ2d"d"e,d#d$Z3dS(%s6setuptools.command.bdist_egg Build .egg distributionsi(tDistutilsSetupError(t remove_treetmkpath(tlog(tCodeTypeN(tsix(tget_build_platformt Distributiontensure_directory(t EntryPoint(tLibrary(tCommand(tget_pathtget_python_versioncCs tdS(Ntpurelib(R (((s@/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyt _get_purelibs(tget_python_libR cCs ttS(N(RtFalse(((s@/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyRscCsEd|kr%tjj|d}n|jdrA|d }n|S(Nt.itmodulei(tostpathtsplitexttendswith(tfilename((s@/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyt strip_module#s   ccsIxBtj|D]1\}}}|j|j|||fVqWdS(sbDo os.walk in a reproducible way, independent of indeterministic filesystem readdir order N(Rtwalktsort(tdirtbasetdirstfiles((s@/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyt sorted_walk+s  cCsBtjdj}t|d}|j||WdQXdS(NsR def __bootstrap__(): global __bootstrap__, __loader__, __file__ import sys, pkg_resources, imp __file__ = pkg_resources.resource_filename(__name__, %r) __loader__ = None; del __bootstrap__, __loader__ imp.load_dynamic(__name__,__file__) __bootstrap__() tw(ttextwraptdedenttlstriptopentwrite(tresourcetpyfilet_stub_templatetf((s@/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyt write_stub5st bdist_eggcBseZdZddddefdd d d d fd d!gZd ddgZdZdZdZ dZ dZ dZ dZ dZdZdZdZRS("screate an "egg" distributions bdist-dir=tbs1temporary directory for creating the distributions plat-name=tps;platform name to embed in generated filenames (default: %s)sexclude-source-filess+remove all .py files from the generated eggs keep-temptks/keep the pseudo-installation tree around after s!creating the distribution archives dist-dir=tds-directory to put final built distributions ins skip-builds2skip rebuilding everything (for testing/debugging)cCsCd|_d|_d|_d|_d|_d|_d|_dS(Ni(tNonet bdist_dirt plat_namet keep_temptdist_dirt skip_buildt egg_outputtexclude_source_files(tself((s@/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.pytinitialize_optionsZs      cCs|jd}|_|j|_|jdkr^|jdj}tjj|d|_n|j dkr|t |_ n|j dd|j dkrt dd|j|jt|jjo|j j}tjj|j|d|_ ndS(Ntegg_infotbdistteggR5s.egg(R5R5(tget_finalized_commandtei_cmdR;R2R1t bdist_baseRRtjoinR3Rtset_undefined_optionsR7Rtegg_namet egg_versionR t distributionthas_ext_modulesR5(R9R?R@tbasename((s@/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.pytfinalize_optionscs !cCs_|j|jd_tjjtjjt}|jj g}|j_ x|D]}t |t rt |dkrtjj |drtjj|d}tjj|}||ks|j|tjr|t |d|df}qqn|jj j|qVWz0tjd|j|jdddddWd||j_ XdS( Ntinstalliiisinstalling package data to %st install_datatforcetroot(R2R>t install_libRRtnormcasetrealpathRREt data_filest isinstancettupletlentisabst startswithtseptappendRtinfot call_commandR1(R9t site_packagestoldtitemROt normalized((s@/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.pytdo_install_data{s ! !'cCs |jgS(N(R7(R9((s@/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyt get_outputsscKsmx!tD]}|j||jqW|jd|j|jd|j|j||}|j||S(s8Invoke reinitialized command `cmdname` with keyword argsR6tdry_run(tINSTALL_DIRECTORY_ATTRSt setdefaultR2R6R`treinitialize_commandt run_command(R9tcmdnametkwtdirnametcmd((s@/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyRYs  c Cs|jdtjd|j|jd}|j}d|_|jjrj|j rj|jdn|j ddd}||_|j \}}g|_ g}xt |D]\}}tjj|\} } tjj|jt| d} |j j| tjd ||jsAttjj|| n|j| |jtjd ||tjj#|rtjd||jstj$|qnt%tjj| d |j&tjj'tjj|j(dr3tj)dn|j*rI|j+nt,|j-| d|j.d|jd|j/|j0st1|jd|jnt2|jdgjdt3|j-fdS(NR;sinstalling library code to %sRIt build_clibRMtwarn_diris.pyscreating stub loader for %st/sEGG-INFOtscriptssinstalling scripts to %stinstall_scriptst install_dirtno_episnative_libs.txts writing %stwts s removing %ss depends.txtsxWARNING: 'depends.txt' will not be used by setuptools 0.6! Use the install_requires/extras_require setup() args instead.tverboseR`tmodet dist_filesR,(4RdRRXR2R>RLR1REthas_c_librariesR6RYtget_ext_outputststubst enumerateRRRRARRWR`R+RGtreplaceRVt byte_compileRPR^RRltcopy_metadata_toRR%R&tclosetisfiletunlinktwrite_safety_flagtzip_safetexistsR;twarnR8t zap_pyfilest make_zipfileR7Rqt gen_headerR4RtgetattrR (R9tinstcmdtold_rootRht all_outputst ext_outputst to_compileR.text_nameRtextR(t archive_rootR;t script_dirt native_libst libs_file((s@/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.pytrunsz                   $    c Cs-tjdxt|jD]\}}}x|D]}tjj||}|jdr}tjd|tj |n|jdr3|}d}t j ||}tjj|tj |j dd} tjd|| fytj| Wntk r nXtj|| q3q3WqWdS( Ns+Removing .py files from temporary directorys.pys Deleting %st __pycache__s#(?P.+)\.(?P[^.]+)\.pyctnames.pycsRenaming file from [%s] to [%s](RRXtwalk_eggR2RRRARtdebugR}tretmatchtpardirtgrouptremovetOSErrortrename( R9RRRRRtpath_oldtpatterntmtpath_new((s@/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyRs*    cCsEt|jdd}|dk r%|Stjdt|j|jS(NRs4zip_safe flag not set; analyzing archive contents...(RRER1RRt analyze_eggR2Rv(R9tsafe((s@/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyR s   c Cs!tj|jjpd}|jdijd}|dkrFdS|j sY|jrotd|fnt j d }|j }dj |j}|jd}t jj|j}d t}|jstt jj|jd |jt|jd} | j|| jnd S( Ntssetuptools.installationt eggsecutableR!sGeggsecutable entry point (%r) cannot have 'extras' or refer to a moduleiRisH#!/bin/sh if [ `basename $0` = "%(basename)s" ] then exec python%(pyver)s -c "import sys, os; sys.path.insert(0, os.path.abspath('$0')); from %(pkg)s import %(base)s; sys.exit(%(full)s())" "$@" else echo $0 is not the correct name for this egg file. echo Please rename it back to %(basename)s and try again. exec false fi R`ta(R t parse_mapREt entry_pointstgetR1tattrstextrasRtsystversiont module_nameRARRRGR7tlocalsR`RRgR%R&R{( R9tepmteptpyvertpkgtfullRRGtheaderR*((s@/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyRs*      "  cCstjj|j}tjj|d}xb|jjjD]Q}|j|r:tjj||t |}t ||j ||q:q:WdS(s*Copy metadata (egg info) to the target_dirRN( RRtnormpathR;RAR?tfilelistRRURSRt copy_file(R9t target_dirt norm_egg_infotprefixRttarget((s@/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyRz:s c Csg}g}id|j6}xt|jD]\}}}xH|D]@}tjj|djtkrB|j|||qBqBWx3|D]+}|||d|tjj||t extensionsRQR tget_ext_fullnameRtget_ext_filenameRGRUR( R9RRtpathsRRRRt build_cmdRtfullname((s@/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyRuFs( " -$(s bdist-dir=R-s1temporary directory for creating the distributionN(sexclude-source-filesNs+remove all .py files from the generated egg(s dist-dir=R0s-directory to put final built distributions in(s skip-buildNs2skip rebuilding everything (for testing/debugging)(t__name__t __module__t descriptionRR1t user_optionstboolean_optionsR:RHR^R_RYRRRRRzRu(((s@/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyR,Cs4       Q   ' s.dll .so .dylib .pydccset|}t|\}}}d|kr=|jdn|||fVx|D] }|VqRWdS(s@Walk an unpacked egg's contents, skipping the metadata directorysEGG-INFON(R tnextR(tegg_dirtwalkerRRRtbdf((s@/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyRfs   c CsxBtjD]4\}}tjjtjj|d|r |Sq WtsRtSt}xt |D]\}}}xn|D]f}|j ds{|j drq{q{|j ds|j dr{t ||||o|}q{q{WqeW|S(NsEGG-INFOs.pys.pyws.pycs.pyo( t safety_flagstitemsRRRRAtcan_scanRtTrueRRt scan_module( RRvtflagtfnRRRRR((s@/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyRqs$  &cCsxtjD]\}}tjj||}tjj|rq|dks^t||krtj|qq |dk r t||kr t |d}|j d|j q q WdS(NRps ( RRRRRARR1tboolR}R%R&R{(RRRRR*((s@/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyR~s szip-safes not-zip-safec Cstjj||}|d |kr)tS|t|djtjd}||r[dp^dtjj|d}tj dkrd}ntj dkrd }nd }t |d }|j |t j |} |jt} tjt| } x<d d gD].} | | kr tjd|| t} q q Wd| krxZdddddddddddg D].} | | krotjd|| t} qoqoWn| S(s;Check whether module possibly uses unsafe-for-zipfile stuffiiRRiiiii itrbt__file__t__path__s%s: module references %stinspectt getsourcet getabsfilet getsourcefiletgetfilegetsourcelinest findsourcet getcommentst getframeinfotgetinnerframestgetouterframeststackttraces"%s: module MAY be using inspect.%s(ii(ii(RRRARRSRxRVRRt version_infoR%treadtmarshaltloadR{tdicttfromkeyst iter_symbolsRRR( RRRRvRRRtskipR*tcodeRtsymbolstbad((s@/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyRs:#*          ccsyx|jD] }|Vq WxY|jD]N}t|tjrC|Vq#t|tr#xt|D] }|Vq_Wq#q#WdS(sBYield names and strings used by `code` and its nested code objectsN(tco_namest co_constsRQRt string_typesRR(RRtconst((s@/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyRs cCsDtjjd r&tjdkr&tStjdtjddS(Ntjavatclis1Unable to analyze compiled code on this platform.sfPlease ask the author to include a 'zip_safe' setting (either True or False) in the package's setup.py(RtplatformRURRR(((s@/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyRs" RMRnRJt install_baseiR!c sddl}ttjj|dtjd|fd}|r\|jn|j}s|j ||d|} x-t D]\} } } || | | qW| j n0x-t D]\} } } |d| | qW|S(sqCreate a zip file from all the files under 'base_dir'. The output zip file will be named 'base_dir' + ".zip". Uses either the "zipfile" Python module (if available) or the InfoZIP "zip" utility (if installed and found on the default search path). If neither tool is available, raises DistutilsExecError. Returns the name of the output zip file. iNR`s#creating '%s' and adding '%s' to itcsx|D]y}tjjtjj||}tjj|r|td}sm|j||ntjd|qqWdS(Nis adding '%s'( RRRRAR|RSR&RR(tzRgtnamesRRR.(tbase_dirR`(s@/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.pytvisits !t compression( tzipfileRRRRgRRXt ZIP_DEFLATEDt ZIP_STOREDtZipFileR R{R1( t zip_filenameRRqR`tcompressRrRRRRRgRR((RR`s@/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.pyRs   (4t__doc__tdistutils.errorsRtdistutils.dir_utilRRt distutilsRttypesRRRRR"Rtsetuptools.externRt pkg_resourcesRRRR tsetuptools.extensionR t setuptoolsR t sysconfigR R Rt ImportErrortdistutils.sysconfigRRR R+R,RRtsplitRRRR~RRRRRRRaR(((s@/usr/lib/python2.7/site-packages/setuptools/command/bdist_egg.pytsL          !    $