ó q”þfc@s”dZdZddlZddlZddlmZddlmZddlmZm Z ddl m Z ddl m Z d efd „ƒYZdS( sHdistutils.command.build_py Implements the Distutils 'build_py' command.s$Id$iÿÿÿÿN(tglob(tCommand(tDistutilsOptionErrortDistutilsFileError(t convert_path(tlogtbuild_pycBsêeZdZd#d$d&d'd(gZdd gZidd6Zd„Zd„Zd„Z d„Z d„Z d„Z d„Z d„Zd„Zd„Zd„Zd„Zd„Zd„Zdd„Zd„Zd „Zd!„Zd"„ZRS()s5"build" pure Python modules (copy to build directory)s build-lib=tdsdirectory to "build" (copy) totcompiletcscompile .py to .pycs no-compiles!don't compile .py files [default]s optimize=tOslalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0]tforcetfs2forcibly build everything (ignore file timestamps)cCsLd|_d|_d|_d|_d|_d|_d|_d|_dS(Ni( tNonet build_libt py_modulestpackaget package_datat package_dirRtoptimizeR (tself((s2/usr/lib64/python2.7/distutils/command/build_py.pytinitialize_options!s       cCsò|jdddƒ|jj|_|jj|_|jj|_i|_|jjrŽx6|jjjƒD]\}}t|ƒ|j|X|jd|ƒtjj|ŒSq>W|jjdƒ}|dk râ|jd|ƒn|røtjj|ŒSdSdS(s½Return the directory, relative to the top of the source distribution, where package 'package' should be found (at least according to the 'package_dir' option, if any).R+R9iiÿÿÿÿN( R/RR-R"R.tKeyErrortinsertR:R (RRR"ttailtpdir((s2/usr/lib64/python2.7/distutils/command/build_py.pyR,s(      cCs¥|dkrYtjj|ƒs1td|ƒ‚ntjj|ƒsYtd|ƒ‚qYn|r¡tjj|dƒ}tjj|ƒrŠ|Stjdd|ƒndS(NR9s%package directory '%s' does not exists>supposed package directory '%s' exists, but is not a directorys __init__.pys!package init file '%s' not found s(or not a regular file)( R-R"texistsRtisdirR.tisfileRtwarnR (RRRtinit_py((s2/usr/lib64/python2.7/distutils/command/build_py.pyt check_package·s  cCs1tjj|ƒs)tjd||ƒtStSdS(Ns!file %s (for module %s) not found(R-R"RNRROREtTrue(Rtmodulet module_file((s2/usr/lib64/python2.7/distutils/command/build_py.pyt check_moduleÒsc CsÈ|j||ƒttjj|dƒƒ}g}tjj|jjƒ}xx|D]p}tjj|ƒ}||kr¯tjjtjj |ƒƒd}|j |||fƒqP|j d|ƒqPW|S(Ns*.pyis excluding %s( RQRR-R"R.tabspathRt script_nametsplitexttbasenameR2t debug_print( RRRt module_filestmodulest setup_scriptR tabs_fRS((s2/usr/lib64/python2.7/distutils/command/build_py.pytfind_package_modulesÙs  "c Cs!i}g}x|jD]}|jdƒ}dj|dd!ƒ}|d}y||\}}Wn&tk r‡|j|ƒ}d}nX|sÒ|j||ƒ} |df||<| rÒ|j|d| fƒqÒntjj||dƒ} |j || ƒsqn|j||| fƒqW|S(sÈFinds individually-specified Python modules, ie. those listed by module name in 'self.py_modules'. Returns a list of tuples (package, module_base, filename): 'package' is a tuple of the path through package-space to the module; 'module_base' is the bare (no packages, no dots) module name, and 'filename' is the path to the ".py" file (relative to the distribution root) that implements the module. R+iiÿÿÿÿit__init__s.py( RR/R.RHR,RQR2R-R"RU( RRR\RSR"Rt module_baseRtcheckedRPRT((s2/usr/lib64/python2.7/distutils/command/build_py.pyt find_modulesès*   cCswg}|jr%|j|jƒƒn|jrsxB|jD]4}|j|ƒ}|j||ƒ}|j|ƒq8Wn|S(s4Compute the list of all modules that will be built, whether they are specified one-module-at-a-time ('self.py_modules') or by whole packages ('self.packages'). Return a list of tuples (package, module, module_file), just like 'find_modules()' and 'find_package_modules()' do.(RR;RcRR,R_(RR\RRtm((s2/usr/lib64/python2.7/distutils/command/build_py.pytfind_all_moduless  cCs!g|jƒD]}|d^q S(Niÿÿÿÿ(Re(RRS((s2/usr/lib64/python2.7/distutils/command/build_py.pytget_source_files,scCs.|gt|ƒ|dg}tjj|ŒS(Ns.py(tlistR-R"R.(RR5RRSt outfile_path((s2/usr/lib64/python2.7/distutils/command/build_py.pytget_module_outfile/sic Csõ|jƒ}g}x”|D]Œ\}}}|jdƒ}|j|j||ƒ}|j|ƒ|r|jr|j|dƒn|jdkr¥|j|dƒq¥qqW|g|jD]4\}}} } | D]}tj j | |ƒ^qÌq¶7}|S(NR+R ito( ReR/RiRR2RRRR-R"R.( RR$R\toutputsRRSRTRFR4R5R8((s2/usr/lib64/python2.7/distutils/command/build_py.pyR)3s    )cCs’t|tƒr!|jdƒ}n$t|ttfƒsEtdƒ‚n|j|j||ƒ}tj j |ƒ}|j |ƒ|j ||ddƒS(NR+s:'package' must be a string (dot-separated), list, or tupleRAi( RtstrR/Rgttuplet TypeErrorRiRR-R"RCRBRD(RRSRTRtoutfiletdir((s2/usr/lib64/python2.7/distutils/command/build_py.pyt build_moduleHs  cCs=|jƒ}x*|D]"\}}}|j|||ƒqWdS(N(RcRq(RR\RRSRT((s2/usr/lib64/python2.7/distutils/command/build_py.pyR%Ws cCsfx_|jD]T}|j|ƒ}|j||ƒ}x*|D]"\}}}|j|||ƒq8Wq WdS(N(RR,R_Rq(RRRR\tpackage_RSRT((s2/usr/lib64/python2.7/distutils/command/build_py.pyR&as  c CsËtjr|jdƒdSddlm}|j}|dtjkrV|tj}n|jrŠ||ddd|j d|d|j ƒn|j dkrÇ||d|j d|j d|d|j ƒndS( Ns%byte-compiling is disabled, skipping.iÿÿÿÿ(R(RiR tprefixtdry_run( tsystdont_write_bytecodeROtdistutils.utilR(RR-tsepRR RtR(RR=R(Rs((s2/usr/lib64/python2.7/distutils/command/build_py.pyR(vs    (s build-lib=Rsdirectory to "build" (copy) to(scompileR scompile .py to .pycN(s no-compileNs!don't compile .py files [default](s optimize=R slalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0](sforceR s2forcibly build everything (ignore file timestamps)(t__name__t __module__t descriptionR t user_optionstboolean_optionst negative_optRR#R*RR1R'R,RQRUR_RcReRfRiR)RqR%R&R((((s2/usr/lib64/python2.7/distutils/command/build_py.pyRs8       (    4      (t__doc__t __revision__R-RuRtdistutils.coreRtdistutils.errorsRRRwRt distutilsRR(((s2/usr/lib64/python2.7/distutils/command/build_py.pyts