Kc@sddlZddlZddlZejd ddfkrZejdIJejdnddlZddlmZddlZddlZddl Z ddl Z ddl Z ddl m Z m Z mZddlmZdd lmZmZmZdd lmZmZmZmZmZmZdd lmZmZmZm Z m!Z!d Z"d Z#ej$d Z%dfdYZ&dfdYZ'dfdYZ(de)fdYZ*dZ+dZ,e-d d dZ$d dZ.e)dd dd dddddddd d e-d!d d"d d#e-d$d d%d Z/ej0d&krsdd'l1m2Z2m3Z3m4Z4de/d|j|s(|Stjj|}||krJ|S|}qdS(N(R3R4R5tis_package_dir(Rt file_pathRDtparent((s7/usr/lib/python2.7/site-packages/Pyrex/Compiler/Main.pyR8s cCsC|}x6|D].}tjj||}|j|r |Sq WdS(N(R3R4R6RG(Rtroot_dirRARDR.((s7/usr/lib/python2.7/site-packages/Pyrex/Compiler/Main.pyR9s  cCs@x9tD]1}tjj||}tjj|rdSqWdS(Ni(RR3R4R6R7(Rtdir_pathRER4((s7/usr/lib/python2.7/site-packages/Pyrex/Compiler/Main.pyRGs cCs0|j||}|s,t|d|n|S(Ns'%s' not found(tsearch_include_directoriesR(RRER(R4((s7/usr/lib/python2.7/site-packages/Pyrex/Compiler/Main.pytfind_include_filescCsu|j}|r5tjj|d}|g|}nx9|D]1}tjj||}tjj|r<|Sq<WdS(Ni(RR3R4R5R6R7R(RRER(R?there_dirRDR4((s7/usr/lib/python2.7/site-packages/Pyrex/Compiler/Main.pyRLs  cCs|jj|dS(N(RtgetR(RR.((s7/usr/lib/python2.7/site-packages/Pyrex/Compiler/Main.pyRscCsA|j|}|s=t|ddd|}||j|t|d}tjj|s%dSt|}t||S(Ns.depi(R R3R4R7R R (Rt source_pathtdep_pathtdep_time((s7/usr/lib/python2.7/site-packages/Pyrex/Compiler/Main.pytdep_file_out_of_dates  c CstrdG|GdGHnt|td}tjj|sLtrHdGHndSt|}t||rytrudGHndS|g}|j|}|j ||}|rt||rtrdGHndSt |d}tjj|strd GHndSx|j |D]\}} |d kr:|j | |}n$|d kr |j | |}nq |r t||r trd G|Gd GHndSq WtrdGHndS(NsChecking whethersis out of dates.cs...yes, c file doesn't existis...yes, newer than c files"...yes, pxd file newer than c files.deps...yes, dep file does not existtcimporttincludes...yes,snewer than c files...no( tdebug_timestampsR RR3R4R7R R RcR R tread_dependency_fileRL( RRdtc_pathtc_timeR(R&tpxd_pathRetkindR.((s7/usr/lib/python2.7/site-packages/Pyrex/Compiler/Main.pytc_file_out_of_datesH    ccs8x1|j|D] \}}|dkr|VqqWdS(NRh(Rk(RRdRoR.((s7/usr/lib/python2.7/site-packages/Pyrex/Compiler/Main.pytfind_cimported_module_names"s ccst|d}tjj|rt|d}xF|jD]8}|jjdd}t|dkr=|Vq=q=W|j ndS(Ns.depRRt ii( R R3R4R7RSt readlineststripR"tlenRV(RRdReRZtlinetchunks((s7/usr/lib/python2.7/site-packages/Pyrex/Compiler/Main.pyRk's c Cso|st}nt}tj}tjj||}|jrpt|d|_t j |jd|j n t j d|j rtjj||j |_n3|jrt|t|_nt|td|_|j|}|ddf}|j|d|dd}t|}t} y/|j||dd} | j|||Wntk rjt} nXt jt j|_|jdkrt} n| r|jry#tj|} t|j| Wntk rnXd|_n|jrk|j rkt!rkt!|jd |j"d |j|_#|j$ rkt%rkt%|j#d |j&d |j"d |j|_'qkn|S( Ns.listecho_to_stderrs.ciiR(R)Rt verbose_flagtcplust extra_objects((tdefault_optionstCompilationResultR3tgetcwdR4R6tuse_listing_fileR t listing_fileRWtopen_listing_fileterrors_to_stderrRt output_filetc_fileRzRR RRcR0RtFalseR$tprocess_implementationRtTruetclose_listing_fileRXtstatR tEnvironmentErrortc_onlyt c_compilet show_versiont object_filetobj_onlytc_linktobjectstextension_file( RtsourcetoptionstresulttcwdR&t initial_post def_scopet imp_scopeterrors_occurredR\tst((s7/usr/lib/python2.7/site-packages/Pyrex/Compiler/Main.pytcompile1s\                     N(t__name__t __module__RRR0R R2R1R8R9RGRMRLRR!R$RcRgRpRqRkR(((s7/usr/lib/python2.7/site-packages/Pyrex/Compiler/Main.pyRs& 5        '  tCompilationOptionscBs eZdZddddZRS(s` Options to the Pyrex compiler: show_version boolean Display version number use_listing_file boolean Generate a .lis file errors_to_stderr boolean Echo errors to stderr when using .lis include_path [string] Directories to search for include files output_file string Name of generated .c file generate_pxi boolean Generate .pxi file for public declarations recursive boolean Recursively find and compile dependencies timestamps boolean Only compile changed source files. If None, defaults to true when recursive is true. verbose boolean Always print source names being compiled quiet boolean Don't print source names in recursive mode Following options are experimental and only used on MacOSX: c_only boolean Stop after generating C file (default) obj_only boolean Stop after compiling to .o file objects [string] Extra .o files to link with cplus boolean Compile as c++ code icKsg|_g|_|r6t|tr<|j}q<nt}|jj||jj||rnd|_n|rd|_ndS(Ni( t include_pathRt isinstanceRt__dict__R|tupdateRR(RtdefaultsRRtkw((s7/usr/lib/python2.7/site-packages/Pyrex/Compiler/Main.pyRs   N(RRt__doc__RR(((s7/usr/lib/python2.7/site-packages/Pyrex/Compiler/Main.pyRlsR}cBseZdZdZRS(s@ Results from the Pyrex compiler: c_file string or None The generated C source file h_file string or None The generated C header file i_file string or None The generated .pxi file api_file string or None The generated C API .h file listing_file string or None File of error messages object_file string or None Result of compiling the C file extension_file string or None Result of linking the object file num_errors integer Number of compilation errors cCsCd|_d|_d|_d|_d|_d|_d|_dS(N(RRth_fileti_filetapi_fileRRR(R((s7/usr/lib/python2.7/site-packages/Pyrex/Compiler/Main.pyRs      (RRRR(((s7/usr/lib/python2.7/site-packages/Pyrex/Compiler/Main.pyR}s tCompilationResultSetcBseZdZdZdZRS(s Results from compiling multiple Pyrex source files. A mapping from source file paths to CompilationResult instances. Also has the following attributes: num_errors integer Total number of compilation errors icCs |||<|j|j7_dS(N(RX(RRR((s7/usr/lib/python2.7/site-packages/Pyrex/Compiler/Main.pytadds (RRRRXR(((s7/usr/lib/python2.7/site-packages/Pyrex/Compiler/Main.pyRscCst|j}|j||S(s compile_single(source, options) Compile the given Pyrex implementation file and return a CompilationResult. Always compiles a single file; does not perform timestamp checking or recursion. (RRR(RRRQ((s7/usr/lib/python2.7/site-packages/Pyrex/Compiler/Main.pytcompile_singlesc Cssg|D]}tjj|^q}t}t}t|j}|j}|j}|dkrm|}n|j p|s|o|j }x|D]}||kr| s|j |r|rt jdI|IJn|j||} |j|| n|j||rkxV|j|D]B} |j| |g} | rP|j| qt jd| IJqWqkqqW|S(s compile_multiple(sources, options) Compiles the given sequence of Pyrex implementation files and returns a CompilationResultSet. Performs timestamp checking and/or recursion if these are specified in the options. t Compilings/Cannot find .pyx file for cimported module '%s'N(R3R4tabspathRRRRt recursivet timestampsRtverbosetquietRptsyststderrRRRqR2tappend( tsourcesRRt processedtresultsRQRRRRR&R4((s7/usr/lib/python2.7/site-packages/Pyrex/Compiler/Main.pytcompile_multiples2%         cKs_td|d|d||}t|trN|j rN|j rNt||St||SdS(s compile(source [, options], [,