mò &U²Ic@sƒdZdZdkZdkZdkZdkTdklZdklZdk Tdk l Z dk l Z defd „ƒYZdS( sHdistutils.command.build_py Implements the Distutils 'build_py' command.s4$Id: build_py.py 37828 2004-11-10 22:23:15Z loewis $N(t*(sglob(sCommand(s convert_path(slogtbuild_pycBsìtZdZd$d%d&d'd(gZdd gZhddR.RR/t module_filestmodulestabspathRt script_namet setup_scriptRtabs_ftsplitexttbasenameRYR8t debug_print( R R RRR\R_R[R`RY((Rtfind_package_modulesès "c Cs/h} g}x|iD]}ti|dƒ}ti|dd!dƒ}|d}y| |\} }Wn(t j o|i|ƒ} d}nX|pG|i|| ƒ}| df| |<|o|i|d|fƒqÞntii| |dƒ}|i||ƒpqn|i|||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.pyN(RR\R R RYRJR0RR/R t module_baseRtcheckedRNR,RWRSR8R.RXRZ( R RgR RSR\RYRfRRXRR((Rt find_modulesøs.   cCs{g}|io|i|iƒƒn|ioFxC|iD]4}|i|ƒ}|i ||ƒ}|i|ƒq;Wn|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.N( R\R R R@RhRR R,RRdtm(R RiRR\R ((Rtfind_all_modules1s   cCs8|iƒ}g}x|D]}|i|dƒqW|S(Niÿÿÿÿ(R RjR\R7RYR8(R R\RYR7((Rtget_source_filesFs  cCs1|gt|ƒ|dg}ttii|ƒS(Ns.py( R1tlistR RYt outfile_pathRKR.RR/(R R1R RYRm((Rtget_module_outfilePsic Cs|iƒ}g}x|D]•\}}} ti|dƒ}|i |i ||ƒ}|i |ƒ|oH|io|i |dƒn|idjo|i |dƒq®qqW|g}|iD]5\}} }} | D]}|tii||ƒqÙqÃ~7}|S(NR*Rito(R RjR\toutputsR RYRXRJR0RnR RDR8R#RRR4RR-R1R7R.RR/( R R#R RpR\R1RYRDR4R-RXR7((RR(Us   PcCsœt|ƒtjoti|dƒ}n't|ƒttfjo td‚n|i |i ||ƒ}t ii|ƒ}|i|ƒ|i||ddƒS(NR*s:'package' must be a string (dot-separated), list, or tupleRBi(RR t StringTypeRJR0tListTypet TupleTypet TypeErrorR RnR RYtoutfileR.RRGtdirRFRHRX(R RYRXR RuRv((Rt build_moduleks  cCs=|iƒ}x*|D]"\}}}|i|||ƒqWdS(N(R RhR\R RYRXRw(R R\RXRYR ((RR${s cCsfx_|iD]T}|i|ƒ}|i||ƒ}x*|D]"\}}}|i |||ƒq8Wq WdS(N( R RR R,RRdR\tpackage_RYRXRw(R R R\RYRxRXR((RR%‰s  c Cs´dkl}|i}|dtijo|ti}n|io,||ddd|i d|d|i ƒn|i djo/||d|i d|i d|d|i ƒndS(N(s byte_compileiÿÿÿÿRiRtprefixtdry_run( tdistutils.utilR'R R RyR.tsepRR<RRzR(R R<R'Ry((RR'¢s     (s build-lib=Rsdirectory to "build" (copy) to(scompileRscompile .py to .pyc(s no-compileNs!don't compile .py files [default](s optimize=Rslalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0](sforceRs2forcibly build everything (ignore file timestamps)(t__name__t __module__t descriptionRt user_optionstboolean_optionst negative_optRR"R)RR5R&R,RWRZRdRhRjRkRnR(RwR$R%R'(((RRs.   !  +   9      (t__doc__t __revision__tsysRJR.ttypesR>tdistutils.coretCommandtdistutils.errorsR{Rt distutilsRUR( RR„RJRR>R…RˆR.RU((Rt?s