gc@sddlZddlZddlZddlmZddlmZddl m Z yrddlm Z ddl m Z ddlmZmZddlZdefd YZd e fd YZ Wn$ek rd dd YZ nXd ee fdYZdZdS(iN(tbuild_py(t convert_path(tglob(t Mixin2to3(tlog(tRefactoringTooltget_fixers_from_packagetDistutilsRefactoringToolcBs#eZdZdZdZRS(cOstj||dS(N(Rterror(tselftmsgtargstkw((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pyt log_error scGstj||dS(N(Rtinfo(R R R ((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pyt log_messagescGstj||dS(N(Rtdebug(R R R ((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pyt log_debugs(t__name__t __module__R RR(((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pyR s  RcBs&eZedZdZdZRS(cCs|jjtk rdS|s dStjddj||j|j|rtj rt |j }|j |dtdtqnt j||dS(NsFixing t twritet doctests_only(t distributiontuse_2to3tTrueRRtjoint_Mixin2to3__build_fixer_namest_Mixin2to3__exclude_fixerst setuptoolstrun_2to3_on_doctestsRt fixer_namestrefactort _Mixin2to3trun_2to3(R tfilestdocteststr((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pyR"s   cCs|jr dSg|_x'tjD]}|jjt|q W|jjdk rx-|jjD]}|jjt|q_WndS(N(RRtlib2to3_fixer_packagestextendRRtuse_2to3_fixerstNone(R tp((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pyt__build_fixer_names(s  cCsqt|dg}|jjdk r:|j|jjnx0|D](}||jkrA|jj|qAqAWdS(Ntexclude_fixers(tgetattrRtuse_2to3_exclude_fixersR)R'Rtremove(R texcluded_fixerst fixer_name((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pyt__exclude_fixers1s  (RRtFalseR"RR(((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pyRs  cBseZedZRS(cCsdS(N((R R#R$((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pyR";s(RRRR"(((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pyR:sRcBseZdZdZdZdZdZdZdZdZ dZ d Z e j d kr{d d Znd ZdZdZdZRS(sXEnhanced 'build_py' command that includes data files with packages The data files are specified via a 'package_data' argument to 'setup()'. See 'setuptools.dist.Distribution' for more details. Also, this version of the 'build_py' command allows you to specify both 'py_modules' and 'packages' in the same setup operation. cCsctj||jj|_|jjp+i|_d|jkrM|jd=ng|_g|_dS(Nt data_files(t _build_pytfinalize_optionsRt package_datatexclude_package_datat__dict__t_build_py__updated_filest_build_py__doctests_2to3(R ((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pyR6Hs   cCs|j r|j rdS|jr.|jn|jrN|j|jn|j|jt|j|jt|j|j t|j t j |dddS(s?Build modules, packages, and copy data files to build directoryNtinclude_bytecodei( t py_modulestpackagest build_modulestbuild_packagestbuild_package_dataR"R:R3RR;t byte_compileR5t get_outputs(R ((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pytrunPs     cCs3|dkr#|j|_}|Stj||S(NR4(t_get_data_filesR4R5t __getattr__(R tattrR#((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pyRFds cCsAtj||||\}}|r7|jj|n||fS(N(R5t build_moduleR:tappend(R tmodulet module_filetpackagetoutfiletcopied((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pyRHiscCs|jg}x|jpdD]}|j|}tjj|jg|jd}t|}|ry|d7}ng|j ||D]}||^q}|j ||||fq W|S(s?Generate list of '(package,src_dir,build_dir,filenames)' tuplest.i(( tanalyze_manifestR>tget_package_dirtostpathRt build_libtsplittlentfind_data_filesRI(R tdataRLtsrc_dirt build_dirtplentfilet filenames((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pyREos %  )cCs|jjdg|jj|g}|jj|g}x6|D].}|jttjj|t|qEW|j |||S(s6Return filenames for package's data files in 'src_dir't( R7tgettmanifest_filesR'RRRRSRRtexclude_data_files(R RLRYtglobsR#tpattern((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pyRWs  ,c Csd}x|jD]\}}}}x|D]}tjj||}|jtjj|tjj||}|j||\} } tjj|}| r)||j j kr)|j j | q)q)WqWdS(s$Copy data files into build directoryN( R)R4RRRSRtmkpathtdirnamet copy_filetabspathRtconvert_2to3_doctestsR;RI( R tlastdirRLRYRZR]tfilenamettargettsrcfiletoutfRN((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pyRAs c Cs\i|_}|jjsdSi}x0|jp2dD]}||t|j|tassert_relativeRQt run_commandtget_finalized_commandtfilelistR#RRRSRUR)Rtendswitht setdefaultRI( R tmftsrc_dirsRLtei_cmdRStdtftprevtoldftdf((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pyRPs(   ! cCsdS(N((R ((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pytget_data_filesss2.4icCsRtj||g|jD]4\}}}}|D]}tjj||^q/qS(sjReturn complete list of files copied to the build directory This includes both '.py' files and data files, as well as '.pyc' and '.pyo' files if 'include_bytecode' is true. (This method is needed for the 'install_lib' command to do its job properly, and to generate a correct installation manifest.) (R5RCR4RRRSR(R R<RLRYRZR]Rj((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pyRCscCsy|j|SWntk r"nXtj|||}||j|<| sY|jj r]|Sx;|jjD])}||ks|j|drjPqjqjW|St|d}dj|j krddl m }|j d|n|j |S(s8Check namespace packages' __init__ for declare_namespaceROtrbUtdeclare_namespacei(RsWARNING: %s is a namespace package, but its __init__.py does not declare_namespace(); setuptools 0.7 will REQUIRE this! (See the setuptools manual under "Namespace Packages" for details.) (tpackages_checkedtKeyErrorR5t check_packageRtnamespace_packagest startswithtopentencodetreadt distutilsRtwarntclose(R RLt package_dirtinit_pytpkgRzR((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pyRs(    cCsi|_tj|dS(N(RR5tinitialize_options(R ((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pyRs cCsAtj||}|jjdk r=tjj|jj|S|S(N(R5RQRtsrc_rootR)RRRSR(R RLtres((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pyRQsc Cs|jjdg|jj|g}g}x<|D]4}|jtj|tjj|t|q5Wt j |}i}g|D]6}||kr||kr|j |dr|^qS(s6Filter filenames for package's data files in 'src_dir'R^i( R8R_R'tfnmatchtfilterRRRSRRtdicttfromkeysRu( R RLRYR#RbtbadRctseenRz((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pyRas &(RRt__doc__R6RDRFRHRERWRARPR~tsystversionRCRRRQRa(((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pyR?s            cCs:tjj|s|Sddlm}|d|dS(Ni(tDistutilsSetupErrorsError: setup script specifies an absolute path: %s setup() arguments must *always* be /-separated paths relative to the setup.py directory, *never* absolute paths. (RRRStisabstdistutils.errorsR(RSR((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pyRps ((tos.pathRRRRtdistutils.command.build_pyRR5tdistutils.utilRRRR!RRtlib2to3.refactorRRRRt ImportErrorRp(((s?/usr/lib/python2.7/site-packages/setuptools/command/build_py.pyts$  #