
V]c        ;   @@  s  d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l Z e j d  d d f k  p d d  f e j d  k o d d f k  n r e j j d e	 e j d    e j
 d  n  y d  d l m Z Wn e k
 r e Z n Xd d	 l m Z d d
 l m Z d d l m Z m Z d d l m Z m Z m Z m Z d d l m Z d d l m Z d d l m Z d d l m Z e j Z e j  d  Z! d  Z" e j# j$ e j# j% e j# j& e'  e j# j( d   Z) d e* f d     YZ+ d e* f d     YZ, d   Z- d   Z. e/ e/ d  Z0 d e* f d     YZ1 d e* f d     YZ2 d e* f d     YZ3 d  e4 f d!     YZ5 e/ d"  Z6 d#   Z7 e/ e/ d$  Z  e j8 e9 d%   Z: d&   Z; d  d'  Z< e4 d( d  d) d  d* d d+ d  d, e/ d- e/ d. e/ d/ d  d0 d  d1 d2 d3 e/ d4 d  d5 d  d6 i  d7 i  d8 e9 d9 e9 d: e= d; e= d< e/ d= e9 d> e9 d? e/ d@ e/ dA e/ dB e/ dC e/ dD e/ dE e9  Z> d S(F   i    (   t   absolute_importNi   i   i   s8   Sorry, Cython requires Python 2.6+ or 3.3+, found %d.%d
i   (   t
   basestring(   t   Errors(   t   EncodedString(   t   PyrexScannert   FileSourceDescriptor(   t
   PyrexErrort   CompileErrort   errort   warning(   t   ModuleScope(   t   Utils(   t   Options(   t   Versions2   [A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)*$t   Includest   CompilationDatac           B@  s   e  Z RS(    (   t   __name__t
   __module__(    (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyR   ,   s   t   Contextc           B@  s  e  Z d Z d Z e d d d   Z d   Z d d  Z d   Z	 d   Z
 d   Z d d d e d  Z e d  Z d	   Z d
   Z e e d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   c         C@  s   d d l  m } m } i | j d 6|  _ | j |   |  _ |  j |  j d <| |  _ t   |  _	 | |  _
 | |  _ | |  _ i  |  _ i  |  _ | d  k	 r |  j |  n  d  |  _ d  S(   Ni   (   t   Builtint   CythonScopet   __builtin__t   cython(   t    R   R   t   builtin_scopet   modulest   create_cython_scopet   cython_scopet   include_directoriest   sett   future_directivest   compiler_directivest   cppt   optionst   pxdst	   _internedt   Nonet   set_language_levelt   gdb_debug_outputwriter(   t   selfR   R   R    t   language_levelR!   R   R   (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyt   __init__J   s    						c         C@  s   d d l  m } m } m } m } t   } | d k r@ d } n( t |  } | d k rh | j |  n  | d k r | j | | | g  n  | |  _	 | |  _
 | d k r |  j d |  j d <n  d  S(   Ni   (   t   print_functiont   unicode_literalsR    t   divisiont   3stri   R   t   builtins(   t   FutureR*   R+   R    R,   R   t   intt   addt   updateR(   R   R   (   R'   t   levelR*   R+   R    R,   R   (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyR%   b   s    "				c         C@  sa   t  | | f } y |  j | SWn t k
 r1 n Xt  |  } | rP | | _ n  | |  j | <| S(   N(   R   R#   t   KeyErrort   encoding(   R'   t   valueR5   t   key(    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyt   intern_ustringr   s    c         G@  sJ   t  |  | f | } y |  j | SWn t k
 r8 n X| |  j | <| S(   N(   t   typeR#   R4   (   R'   R6   R7   (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyt   intern_value~   s    c   	      C@  s   d d l  m } t | t  r | j d k r t | | t j    } t | |  j	  } | j
 |  |  } | j | |  } n' | j |  | |  } | j | |  } | S(   Ni   (   t   Pipelinet   pyx(   R   R;   t
   isinstanceR   t
   _file_typet   CompilationSourcet   ost   getcwdt   create_default_resultobjR!   t   create_pyx_as_pxd_pipelinet   run_pipelinet   create_pxd_pipeline(	   R'   t   source_desct   scopet   module_nameR;   t   sourcet   result_sinkt   pipelinet   result(    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyt   process_pxd   s    c         C@  s   t  j |  S(   N(   R   t   report_error(   R'   t   exc(    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyt   nonfatal_error   s    i   c         C@  s  d } | r$ d | | | | f GHn  d  } d  } | rf | rN | j |  }	 ql | j }	 | } d  } n | }	 t j |	  s t | p | d d f d |   n  | r | r d GHn  | j |  } | s |  j |	 |  } | r | j |  } q q n  | sN| rd GHn  | r| }	 n  |  } x) |	 j	 d  D] }
 | j |
  } q2Wn  | r`d | GHn  | j
 s| rwd GHn  | s| rd	 GHn  |  j |	 | d
 | } | rd | GHn  | r| rt | _
 |  j |	 d |  } | r| j d  rqt | d |	 j d t j   qn  | rt | _
 y | rBd | GHn  | j d t j  t j j |  d } | j |  s| } n  t | |  } |  j | | |	  \ } } | r|  n  | \ } } | | f |  j | <Wqt k
 rqXqn  | S(   Ni    sP   Context.find_module: module_name = %s, relative_to = %s, pos = %s, need_pxd = %ss   '%s' is not a valid module names   ...trying relative imports   ...trying absolute importt   .s   ...scope = %ss   ...pxd not loadeds   ...looking for pxd filet   sys_paths   ......found %ss   .pys   __init__.pys   '%s.pxd' not founds   Context.find_module: Parsing %si   (   R$   t   qualify_namet   qualified_namet   module_name_patternt   matchR   t   lookup_submodulet   find_pxd_filet   find_submodulet   splitt   pxd_file_loadedt   Truet   search_include_directoriest   endswithR   t   replaceR@   t   sept   patht   splitextR   RM   R"   (   R'   RH   t   relative_tot   post   need_pxdt   absolute_fallbackt   debug_find_moduleRG   t   pxd_pathnameRT   t   namet   package_pathnamet   rel_pathRF   t   errRL   t   pxd_codenodest	   pxd_scope(    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyt   find_module   s    						&	)		
c         C@  s  |  j  | d | d | } | d  k rZ| j d  sB | d k rZt j j t j j t j j t j j t	  t j j
 d    } t j j | d  } |  j j |  z |  j  | d |  } Wd  |  j j   X| rW| } | j d  rt | d	 | d
  qT| d k r.t | d | | f d
  qT| d k rTt | d | d
  qTqWqZn  | d  k rt j r|  j | |  S| S(   Ns   .pxdRR   t   pythont   stdlibt   stdiot   stlR   t
   Deprecateds!   '%s' is deprecated, use 'cpython'i   s!   '%s' is deprecated, use 'libc.%s's$   '%s' is deprecated, use 'libcpp.*.*'(   Rq   Rr   Rs   (   Rq   Rr   (   R]   R$   t
   startswithR@   Ra   t   abspatht   normpatht   joint   dirnamet   __file__t   pardirR   t   appendt   popR	   R   t   cimport_from_pyxt   find_pyx_file(   R'   RT   Rd   RR   t   pxdt   standard_include_patht   deprecated_include_pathRi   (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyRX      s,    	0 c         C@  s   |  j  | d |  S(   Ns   .pyx(   R]   (   R'   RT   Rd   (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyR     s    c         C@  s9   |  j  | d | d t } | s5 t | d |  n  | S(   NR   t   includes   '%s' not found(   R]   R\   R   (   R'   t   filenameRd   Ra   (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyt   find_include_file  s
    	c         C@  sH   |  j  } | r | t j } n  t | t g  } t | | | | |  S(   N(   R   t   sysRa   t   tupleR   R]   (   R'   RT   t   suffixRd   R   RR   t   include_dirs(    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyR]      s    		c         C@  s   t  j |  S(   N(   R   t   find_root_package_dir(   R'   t	   file_path(    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyR   *  s    c         C@  s   t  j | t |   S(   N(   R   t   check_package_dirR   (   R'   t   dirt   package_names(    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyR   -  s    c   	      C@  s  t  j j |  s d St j |  } t j | |  r; d S| g } t j | d  } t  j j |  r~ t j | |  r~ d Sx~ |  j |  D]m \ } } | d k r |  j | |  } n$ | d k r |  j	 | |  } n q | r t j | |  r d Sq Wd S(   Ni   s   .pxdt   cimportR   i    (
   R@   Ra   t   existsR   t   modification_timet   file_newer_thant   replace_suffixt   read_dependency_fileRX   R]   (	   R'   t   source_patht   output_patht   c_timeRd   t   pxd_patht   kindRi   t   dep_path(    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyt   c_file_out_of_date0  s$    	$c         C@  s2   g  |  j  |  D] \ } } | d k r | ^ q S(   NR   (   R   (   R'   R   R   Ri   (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyt   find_cimported_module_namesE  s    c         C@  s   t  j |  S(   N(   R   t   is_package_dir(   R'   t   dir_path(    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyR   I  s    c         C@  s   t  j | d  } t j j |  r t | d  } g  | j   D]0 } d | j   k r@ | j   j d d  ^ q@ } | j	   | Sd Sd  S(   Ns   .dept   rUt    i   (    (
   R   R   R@   Ra   R   t   opent	   readlinest   stripRZ   t   close(   R'   R   R   t   ft   linet   chunks(    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyR   L  s    0
c         C@  s   |  j  j | d   S(   N(   R   t   getR$   (   R'   Ri   (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyRW   X  s    c         C@  sA   |  j  |  } | s= t | d d  d |  } | |  j | <n  | S(   Nt   parent_modulet   context(   RW   R
   R$   R   (   R'   Ri   RG   (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyRY   \  s    	c         C@  s8  t  | t  s t d   n  | j } |  j | _ t j } y t j |   } d d l	 m
 } t | | d | j d | d |  }	 | j |	 | |  }
 |  j j r y d d l m } Wn t k
 r t d	   n X| j |  n  Wd  QXWn% t k
 r} |  j | |   n Xt j | k r4t    n  |
 S(
   Ns$   Only file sources for code supportedi   (   t   Parsingt   source_encodingRG   R   i   (   t   ConcreteSyntaxTreesL   Formal grammar can only be used with compiled Cython with an available pgen.(   R=   R   t   RuntimeErrorR   R    R   t
   num_errorsR   t   open_source_fileR   R   R   R5   t   p_moduleR!   t   formal_grammart   ParserR   t   ImportErrort   UnicodeDecodeErrort   _report_decode_errorR   (   R'   RF   RG   R   t   full_module_namet   source_filenameR   R   R   t   st   treeR   t   e(    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyt   parsee  s.    		c      	   C@  s   | j  d } | j  d } | j  d } d } d } } t j | j d d d d d	 _ }	 xU t |	 d  D]D \ } }
 | t |
  7} | | k rk | | t |
  d } Pqk qk WWd  QXt | | | f d
 | | f  S(   Nii   i    i   t   rR5   s	   iso8859-1t   newlineR   sq   Decoding error, missing or incorrect coding=<encoding-name> at top of source (cannot decode with encoding %r: %s)(   t   argst   ioR   R   t	   enumeratet   lenR   (   R'   RF   RO   t   msgt   positionR5   R   t   columnt   idxR   t   data(    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyR     s    
$c   
      C@  s   t  j j |  \ } } t  j j |  \ } } d | k r@ | S| g } xN |  j |  r t  j j |  \ } }	 | | k r Pn  | j |	  | } qL W| j   d j |  S(   NRQ   (   R@   Ra   RZ   Rb   R   R|   t   reverseRx   (
   R'   Ra   R!   R   R   RH   t   _t   namest   parentt   package_name(    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyt   extract_module_name  s    	

c         C@  sU   t  j   | j r2 t j | j d  } | _ n d  } t  j d | d | j	  d  S(   Ns   .lisRa   t   echo_to_stderr(
   R   t   resett   use_listing_fileR   R   t   main_source_filet   listing_fileR$   t   open_listing_filet   errors_to_stderr(   R'   R!   RL   Ra   (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyt   setup_errors  s    
	c         C@  s   | j  j } t | t  s* t d   n  t j   t j | _ | j d k rX t } n  | r | j	 r y# t
 j | j	 t j | j   Wn t k
 r n Xd  | _	 n  d  S(   Ns$   Only file sources for code supportedi    (   t   compilation_sourceRF   R=   R   R   R   t   close_listing_fileR   R\   t   c_fileR   t   castrate_fileR@   t   statR   t   EnvironmentErrorR$   (   R'   Rl   R!   RL   RF   (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyt   teardown_errors  s    
	#N(   R   R   R$   R   R(   t   FalseR)   R%   R8   R:   RM   RP   R\   Ro   RX   R   R   R]   R   R   R   R   R   R   RW   RY   R   R   R   R   R   (    (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyR   ;   s8   					X!		
															c         C@  s   | j  r d } n d } t j |  |  } | j r t j j | | j  } t j j |  r| t j j | t j j |   S| Sn | Sd  S(   Ns   .cpps   .c(	   t   cplusR   R   t   output_fileR@   Ra   Rx   t   isdirt   basename(   R   t   cwdR!   t   c_suffixt   suggested_file_namet   out_path(    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyt   get_output_filename  s    			c         C@  sU   t    } |  j j | _ |  | _ |  j } t | j |  j |  | _ | j | _ | S(   N(	   t   CompilationResultRF   R   R   R   R   R   R   t   embedded_metadata(   R   R!   RL   RF   (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyRB     s    				c         C@  s  d d l  m } t j j |   d } | j | d  | d  k rR | j   } n  t j   } t j j	 |   } | p | j
 |  |  } t j |  | j r | j d t j  | } | j |  s |  } q n | } t | |  }	 t |	 | |  }  t |  |  }
 | j d  k rt j j |
 j  d d } t j j |  rt j | d d d ( } d	 | j d
  k rt | _ n  Wd  QXqn  | j   d k s| r| j | | |
  } n | j | | |
  } | j | |
  | j | |   \ } } | j  | | |
  |
 S(   Ni   (   R;   RQ   i    s   .htmlR   R5   s   UTF-8u   <!-- Generated by Cythonid   s   .py(!   R   R;   R@   Ra   Rb   t   configure_language_defaultsR$   t   create_contextRA   Rv   R   R   t$   raise_error_if_module_name_forbiddent'   relative_path_in_code_position_commentsR_   R`   R^   R   R?   RB   t   annotateR   R   R   R   t   readR\   t   lowert   create_py_pipelinet   create_pyx_pipelineR   RD   R   (   RI   R!   R   R   R;   t
   source_extR   t   abs_pathRk   RF   RL   t   html_filenamet	   html_fileRK   Rl   t   enddata(    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyRD     s<    	R?   c           B@  s   e  Z d  Z d   Z RS(   sk   
    Contains the data necessary to start up a compilation pipeline for
    a single compilation unit.
    c         C@  s   | |  _  | |  _ | |  _ d  S(   N(   RF   R   R   (   R'   RF   R   R   (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyR)     s    		(   R   R   t   __doc__R)   (    (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyR?     s   t   CompilationOptionsc           B@  s5   e  Z d  Z d d  Z d   Z d   Z d   Z RS(   s   
    See default_options at the end of this module for a list of all possible
    options and CmdLine.usage and CmdLine.parse_command_line() for their
    meaning.
    c   
      K@  s:  g  |  _  | r- t | t  r3 | j } q3 n t } t |  } | j |  t |  t t  } | j d g  | r d t	 |  d k r d n d d j
 |  f } t |   n  t j   } t | d  } t |  t |  } | r0d t	 |  d k rd n d d j
 |  f } t |   n  | | d <| j d	 t  r}| d
 r}d d  l }	 |	 j d  t | d
 <n  d | k rd | k r| d | d <n% | j d  s| j d  | d <n  d | k rd | k r| d | d <n  | d t k r&t j j
 t j   d  | d <n  |  j j |  d  S(   Nt   include_paths3   got unknown compilation option%s, please remove: %si   R   R   s   , R   s$   got unknown compiler directive%s: %st
   np_pythranR   i    s%   C++ mode forced when in Pythran mode!R(   R   t   cachet   compiler(   R   R=   R   t   __dict__t   default_optionst   dictR2   R   t   difference_updateR   Rx   t
   ValueErrorR   t   get_directive_defaultsR   R   t   warningst   warnR\   R@   Ra   R   t   get_cython_cache_dir(
   R'   t   defaultst   kwR!   t   unknown_optionst   messaget   directive_defaultst
   directivest   unknown_directivesR  (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyR)     sH    	
"c         C@  s;   | d k r7 |  j  j d  d  k r7 t |  j  d <q7 n  d  S(   Nt   pyt   binding(   R   R   R$   R\   (   R'   t   source_extension(    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyR   N  s    c         C@  s%   t  |  j |  j |  j |  j d |  S(   NR!   (   R   R   R   R   R(   (   R'   (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyR   S  s    c         @  s  i  } x|  j  j   D]p\ } } | d" k r4 q q | d# k rF q q | d$ k rX q q | d% k rj q q | d& k r| q q | d' k r q q | d( k r q q | d) k r q q | d* k r q q | d+ k r | | | <q | d, k r | | | <q | d- k r| | | <q | d. k r(| | | <q | d g k rR|  j rt d   qq | d g k r||  j rt d    qq | | | <q W  f d!       |  S(/   si   
        Return a string that contains all the options that are relevant for cache invalidation.
        t   show_versionR   t   verboset   quietR   t
   output_dirt
   timestampsR   R   R   t   working_patht   create_extensiont	   build_dirR   t   generate_pxiR   t   annotate_coverage_xmlR   t   evaluate_tree_assertionsR   t   emit_linenumst   c_line_in_tracebackt	   gdb_debugR   R   R(   t   compile_time_envR   t   capi_reexport_cincludess=   capi_reexport_cincludes is not compatible with Cython cachingt   common_utility_include_dirsD   common_utility_include_dir is not compatible with Cython caching yetc         @  sY   t  |  t  rO t g  |  j   D]$ \ } } t |    |  f ^ q  }  n  t |   S(   s   
            Recursively turn item into a string, turning dicts into lists with
            deterministic ordering.
            (   R=   R   t   sortedt   itemst   repr(   t   itemR7   R6   (   t   to_fingerprint(    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyR%    s    @(   R  R   R  R  (   R   R  (   R  (   R   (   R   (   R   (   R  (   R  (   R  (   R   R  R   R  (   R   R  (   R   R  R  R  R   (   R   R(   R  R   (   R   R"  R  t   NotImplementedErrorR   (   R'   R   R7   R6   (    (   R%  s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyt   get_fingerprintW  sJ    			N(   R   R   R   R$   R)   R   R   R'  (    (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyR     s
   /		R   c           B@  s   e  Z d  Z d   Z RS(   sf  
    Results from the Cython 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
    compilation_source CompilationSource
    c         C@  sL   d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  |  _ d  S(   N(	   R$   R   t   h_filet   i_filet   api_fileR   t   object_filet   extension_fileR   (   R'   (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyR)     s    							(   R   R   R   R)   (    (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyR     s   t   CompilationResultSetc           B@  s   e  Z d  Z d Z d   Z RS(   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
    i    c         C@  s    | |  | <|  j  | j  7_  d  S(   N(   R   (   R'   RI   RL   (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyR1     s    
(   R   R   R   R   R1   (    (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyR-    s   c         C@  s   t  |  | |  S(   s   
    compile_single(source, options, full_module_name)

    Compile the given Pyrex implementation file and return a CompilationResult.
    Always compiles a single file; does not perform timestamp checking or
    recursion.
    (   RD   (   RI   R!   R   (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyt   compile_single  s    c         C@  s#  g  |  D] } t  j j |  ^ q }  t   } t   } | j } | j } d } t  j   } x |  D] } | | k rb | d k r | j	   } n  t
 | | |  }	 | j | |	  }
 | s |
 r| r t j j d |  n  t | | d | } | j | |  d } n  | j |  qb qb W| 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.
    s   Compiling %s
R   N(   R@   Ra   Rv   R   R-  R  R  R$   RA   R   R   R   R   t   stderrt   writeRD   R1   (   t   sourcesR!   RI   t	   processedt   resultsR  R  R   R   t   output_filenamet   out_of_dateRL   (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyt   compile_multiple  s*    
%					c         K@  sL   t  d | |  } t |  t  r; | j r; t |  | |  St |  |  Sd S(   s  
    compile(source [, options], [, <option> = <value>]...)

    Compile one or more Pyrex implementation files, with optional timestamp
    checking and recursing on dependencies.  The source argument may be a string
    or a sequence of strings.  If it is a string and no recursion or timestamp
    checking is requested, a CompilationResult is returned, otherwise a
    CompilationResultSet is returned.
    R  N(   R   R=   R   R  R.  R6  (   RI   R!   R   t   kwds(    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyt   compile  s    
c         C@  s  | ro | d } t  | t  s. t d   n  | rS t j j | j  f |  }  qo t j | j  f |  }  n  | } | r | | 7} n  | s | j	 d  } t
 | d   } | d }	 |	 | }
 d | } n  x |  D] } t j j | |  } t j j |  r| S| s t j | |  } | d k	 rt j j | |
  } t j j |  rU| St j j | |	 |  } t j j |  r| Sqq q Wd S(   s$  
    Search the list of include directories for the given file name.

    If a source file position is given, first searches the directory
    containing that file. Returns None if not found, but does not
    report an error.

    The 'include' option will disable package dereferencing.
    i    s$   Only file sources for code supportedRQ   iR)   N(   R=   R   R   R@   Ra   Ry   R   R   R   RZ   R   Rx   R   R   R$   (   t   dirsRT   R   Rd   R   t	   file_desct   dotted_filenameR   R   RH   t   module_filenamet   package_filenameRy   Ra   t   package_dir(    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyR]     s>    


	c           C@  s   t  d d  S(   Nt   command_linei   (   t   main(    (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyt   setuptools_mainG  s    c         C@  s  t  j d } d } |  r> d d l m } | |  \ } } n t t  } | } | j rp t  j j d t	  n  | j
 d k r t j | j
  n  y+ t | |  } | j d k r d } n  Wn9 t t f k
 r } t  j j t |  d  d } n X| rt  j d  n  d  S(   Ni   i    (   t   parse_command_lines   Cython version %s
R   s   
(   R   t   argvt   CmdLineRB  R   R   R  R/  R0  t   versionR  R@   t   chdirR8  R   R   R   t   strt   exit(   R?  R   t   any_failuresRB  R!   R1  RL   R   (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyR@  K  s(    	
R  R   R   R   R   R   R  R  R  R  R   R  R  R  R   R   R  R  R   R  R(   R   R  R  R   R  R  R   R  R   (?   t
   __future__R    R@   t   reR   R   t   version_infoR/  R0  R   RH  R   R   R   RG  R   R   t   StringEncodingR   t   ScanningR   R   R   R   R   R	   t   SymtabR
   R   R   R   RE  R8  RU   R  Ra   Rv   Rx   Ry   Rz   R{   R   t   objectR   R   R   RB   R$   RD   R?   R   R   R   R-  R.  R6  t   cached_functionR   R]   RA  R@  R\   R   (    (    (    s3   lib/python2.7/site-packages/Cython/Compiler/Main.pyt   <module>   s   H!
"	! 		5	$7	