
    ڏDj              	          d dl Z d dlZd dlZd dlZej                  dd dk  rCej
                  j                  d eej                  dd       z          ej                  d       d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mZ ddlmZ ddlmZmZmZm Z  d Z!djE                  e e!e      e e!e             Z# ejH                  djE                  e#            Z#e jJ                  jM                  e jJ                  jO                  e jJ                  jQ                  e jJ                  jQ                  e)            d            Z* G d d      Z+d Z,d Z-d Z.d Z/d Z0 G d d      Z1 G d d      Z2 G d d e3      Z4d! Z5d)d"Z6d*d#Z7d+d$Z$ejp                  d,d%       Z9ejp                  d&        Z:d' Z;d-d(Z<y).    N   )      z0Sorry, Cython requires Python 3.8+, found %d.%d
   )Errors)EncodedString)PyrexScannerFileSourceDescriptor)
PyrexErrorCompileErrorerrorwarning)ModuleScope)Utils)Options)CompilationOptionsdefault_options)parse_command_line)unicode_start_ch_anyunicode_continuation_ch_anyunicode_start_ch_rangeunicode_continuation_ch_rangec           	          g }t        dt        |       d      D ],  }|j                  dj                  | |   | |dz                   . dj	                  |      S )Nr   r   z{}-{}r    )rangelenappendformatjoin)chrsoutis      XC:\Crop_Prediction\Backend\crop-ai-system\venv\Lib\site-packages\Cython/Compiler/Main.py_make_range_rer$   !   sT    
C1c$i# 7

7>>$q'4!9567773<    z[{0}{1}][{0}{2}{1}{3}]*z{0}(\.{0})*$Includesc                      e Zd ZdZdZ	 	 ddZed        Zed        Z	ed        Z
d Zd dZd Zd	 Zd!d
Zed        Zed        Z	 	 d"dZd#dZd#dZd$dZ	 d%dZd Zd Zd Zd Zd Zd Zd Zd!dZd Z d Z!d Z"d Z#d Z$y)&ContextNc                    ddl m}m} d|j                  i| _        |j                  |       | _        | j                  | j                  d<   || _        t               | _	        || _
        || _        || _        i | _        i | _        i | _        || j!                  |       | j                  j#                  dd      | _        d | _        y )Nr   )BuiltinCythonScope__builtin__cythonlegacy_implicit_noexceptF)r   r*   r+   builtin_scopemodulescreate_cython_scopecython_scopeinclude_directoriessetfuture_directivescompiler_directivescppoptionspxdsutility_pxds	_internedset_language_levelgetr.   gdb_debug_outputwriter)selfr3   r6   r7   language_levelr8   r*   r+   s           r#   __init__zContext.__init__B   s     	+%(=(=>';;DA!%!2!2X#6 !$#6 	%##N3(,(@(@(D(DE_af(g%&*#r%   c                 l     | |j                   |j                  |j                  |j                  |      S )N)r8   )include_pathr6   cplusr@   )clsr8   s     r#   from_optionszContext.from_options]   s2    7'')D)D=='"8"8'K 	Kr%   c                 J    | j                   r| j                   j                  S d S N)r8   shared_c_file_pathr?   s    r#   rI   zContext.shared_c_file_pathb   s    26,,t||..HDHr%   c                 J    | j                   r| j                   j                  S d S rH   )r8   shared_utility_qualified_namerJ   s    r#   rL   z%Context.shared_utility_qualified_namef   s    =A\\t||99StSr%   c                     ddl m}m}m}m}m} t               }|dk(  rd}nt        |      }|dk\  r|j                  |||||g       || _	        || _
        |dk\  r| j                  d   | j                  d<   y y )Nr   )print_functionunicode_literalsabsolute_importdivisiongenerator_stop3strr   r,   builtins)FuturerN   rO   rP   rQ   rR   r4   intupdater@   r5   r0   )r?   levelrN   rO   rP   rQ   rR   r5   s           r#   r<   zContext.set_language_levelj   s{    ggEF?EJEA:$$&6Yacq%rs#!2A:'+||M'BDLL$ r%   c                     t         ||f}	 | j                  |   S # t        $ r Y nw xY wt        |      }|r||_        || j                  |<   |S rH   )r   r;   KeyErrorencoding)r?   valuer[   keys       r#   intern_ustringzContext.intern_ustringx   s[    eX.	>>#&& 		e$%EN#ss    	&&c                     ddl m} t        |t              rj|j                  dk(  r[t        ||t        j                               }t        || j                        }|j                  | |      }|j                  ||      }|S |j                  r\ddl m}	 |	j                  |       }
|j                  | ||      }|j!                  ||
|	j"                        }|j                  ||      }|S |j                  | ||      }|j                  ||      }|S )Nr   Pipelinepyx)ParseTreeTransforms)before)r   ra   
isinstancer
   
_file_typeCompilationSourceosgetcwdcreate_default_resultobjr8   create_pyx_as_pxd_pipelinerun_pipelinein_utility_coderc   CnameDirectivesTransformcreate_pxd_pipelineinsert_into_pipelineInterpretCompilerDirectives)r?   source_descscopemodule_namera   sourceresult_sinkpipelineresultrc   	transforms              r#   process_pxdzContext.process_pxd   s   k#78[=S=SW\=\&{KMF264<<HK::4MH**8V<F  ((-+DDTJI33D%MH44)*FF 5 HH **8[AF   33D%MH**8[AFr%   c                 ,    t        j                  |      S rH   )r   report_error)r?   excs     r#   nonfatal_errorzContext.nonfatal_error   s    ""3''r%   c                    |j                  d      }|j                         }|D cg c]  }|df }}|dk7  rHd}dD ].  }| j                  ||d d |       }|s| j                  |      } n |j	                  ||f       |S c c}w )N.TrA   F).py.pyx)suffix
source_possource_file_pathsys_path)splitpopsearch_include_directories_is_init_filer   )	r?   qualified_namerelative_importqualified_name_parts	last_partp
is_packager   paths	            r#   _split_qualified_namezContext._split_qualified_name   s    -33C8(,,.	3GHaD	HH
" J) 66"6dUYhwdw 7 y!%!3!3D!9J !''J(?@##  Is   Bc                 L    | r!t         j                  j                  |       dv S dS )N)z__init__.pyxz__init__.pyz__init__.pxdF)rh   r   basename)r   s    r#   r   zContext._is_init_file   s%    \`rww%)XXkfkkr%   c                     |sy t         j                  j                  |      }d|v r8|t         j                  j                  |      d   k(  rt	        | d|z  d       y y y )Nr   r   ^Dotted filenames ('%s') are deprecated. Please use the normal Python package directory layout.r   rX   )rh   r   r   splitextr   )pospxd_pathnamer   pxd_filenames       r#   _check_pxd_filenamezContext._check_pxd_filename   sf    ww''5. ^rww7G7G7UVW7X%XC NP\]deg &Y r%   c           
         d}|rt        d|d|d|d|       d }d }	|r%|r|j                  |      }
n|j                  }
|}d }n|}
t        j	                  |
      st        |xs |ddfd|z        |rn|rt        d       |j                  |      }|sN| j                  |
||       }	| j                  ||	|
       |	r$| j                  |	      }|j                  ||	      }|sA|rt        d
       |r|}
| }| j                  |
|      D ]  \  }}|j                  ||	      } |rt        d|z         |j                  sv|rt        d       |	s|rt        d       | j                  |
||xr |       }	| j                  ||	|
       |rt        d|	z         |	sn|rld|_        | j                  |
d||       }|r |j                  t        j                         rn-t#        |d|
j%                  dt&        j(                        z         |	rd|_        	 |rt        d|	z         |j%                  dt&        j(                        t&        j*                  j-                  |	      d   z   }|	j                  |      s|	}t/        |	|      }| j1                  |||
      \  }}|r||\  }}||f| j2                  |<   |S |S # t
        $ r Y |S w xY w)Nr   z#Context.find_module: module_name = z, from_module = z, pos = z, need_pxd = z'%s' is not a valid module namez...trying relative importr   )
as_packagez...trying absolute import)r   z...scope = %sz...pxd not loadedz...looking for pxd filez......found %sTr   )r   r   r   z'%s.pxd' not foundr   zContext.find_module: Parsing %sr   )printqualify_namer   module_name_patternmatchr   lookup_submodulefind_pxd_filer   r   find_submoduler   pxd_file_loadedr   endswithr   PACKAGE_FILESr   replacerh   sepr   r   r
   rz   r9   )r?   rt   from_moduler   need_pxdabsolute_fallbackr   debug_find_modulers   r   r   r   namepackage_pathnamerel_pathrr   errrx   pxd_codenodes	pxd_scopes                       r#   find_modulezContext.find_module   s$    [#x9 : !,!9!9+!F "-!;!;#"(N"((8s9{Aq&9@;NP P  1200=E#11.#TcPc1d((lNK!%!3!3L!AJ'66{z6ZE 12 !,E$($>$>~_n$>$o J j,,Tj,IJ/E)*$$ )*$34  $11.#PXPpap]p1q((lNK$*\9:# -1E)'+'F'F&uSbOb (G (d$',<,E,EeFYFY,Zc#7.:P:PQTVXV\V\:]#]^(,%(?,NO*223?"''BRBRS_B`abBccH'00:#/"6|X"NK"&"2"2;~"VKC!	17.]I.;Y-GDIIk* u $ s   B"J< <	K	K	c                 ~    | j                  |d|||      }|$t        j                  r| j                  |||      S |S )N.pxdr   r   r   r   r   )r   r   cimport_from_pyxfind_pyx_file)r?   r   r   r   r   pxds         r#   r   zContext.find_pxd_file  sP     --6cH_o . q;733%%ncH%MM
r%   c                 .    | j                  |d|||      S )Nr   r   )r   )r?   r   r   r   r   s        r#   r   zContext.find_pyx_file(  s*     ..6cH_o / q 	qr%   c                 R    | j                  ||d|      }|st        |d|z         |S )NT)r   includer   z'%s' not found)r   r   )r?   filenamer   r   r   s        r#   find_include_filezContext.find_include_file.  s<     ..dEU / W#'(23r%   c                     | j                   }|r|t        j                  z   }t        |t        gz         }t        |||xs d|||      S )Nr   )r3   sysr   tuplestandard_include_pathr   )r?   r   r   r   r   r   r   include_dirss           r#   r   z"Context.search_include_directories7  sR    //'#((2L\-B,CCD).&,B
GM]_ 	_r%   c                 ,    t        j                  |      S rH   )r   find_root_package_dir)r?   	file_paths     r#   r   zContext.find_root_package_dirA  s    **955r%   c                 @    t        j                  |t        |            S rH   )r   check_package_dirr   )r?   dirpackage_namess      r#   r   zContext.check_package_dirD  s    &&sE-,@AAr%   c                    t         j                  j                  |      syt        j                  |      }t        j
                  ||      ryt        j                  |d      }t         j                  j                  |      rt        j
                  ||      ry| j                  |      D ]S  \  }}|dk(  r| j                  ||      }n|dk(  r| j                  ||      }n9|s<t        j
                  ||      sS y y)Nr   r   cimport)r   r   r   )
rh   r   existsr   modification_timefile_newer_thanreplace_suffixread_dependency_filer   r   )r?   source_pathoutput_pathc_timepxd_pathkindr   dep_paths           r#   c_file_out_of_datezContext.c_file_out_of_dateG  s    ww~~k*((5  f5''V<77>>(#(=(=h(O33K@ 	JD$y --d[-Q"::4R]:^E11(FC	 r%   c                 `    | j                  |      D cg c]  \  }}|dk(  r| c}}S c c}}w )Nr   )r   )r?   r   r   r   s       r#   find_cimported_module_namesz#Context.find_cimported_module_names[  s8    (,(A(A+(N (*$I%  ( 	( (s   *c                 ,    t        j                  |      S rH   )r   is_package_dir)r?   dir_paths     r#   r   zContext.is_package_dir_  s    ##H--r%   c                    t        j                  |d      }t        j                  j	                  |      r@t        |      5 }d |D        D cg c]  }d|v r|j                  dd       }}d d d        |S yc c}w # 1 sw Y   S xY w)Nz.depc              3   <   K   | ]  }|j                           y wrH   )strip).0ls     r#   	<genexpr>z/Context.read_dependency_file.<locals>.<genexpr>g  s     '=a	'=s    r    )r   r   rh   r   r   openr   )r?   r   r   flinechunkss         r#   r   zContext.read_dependency_fileb  s    ''V<77>>(#h ,1'=1'=,#!Tk  ::c1- , ,, M,, Ms   A<A7*A<7A<<Bc                 :    | j                   j                  |d       S rH   )r0   r=   )r?   r   s     r#   r   zContext.lookup_submodulem  s    ||d++r%   c                 h    | j                  |      }|st        |d | |      }|| j                  |<   |S )N)parent_modulecontextr   )r   r   r0   )r?   r   r   rs   s       r#   r   zContext.find_submoduleq  s<    %%d+ $ME!&DLLr%   c                 `   t        |t              st        d      | j                  |_        t	        j
                         }	 |j                         5 }ddlm} t        |||j                  ||       }|j                  |||      }	| j                  j                  r"	 ddlm}
 |
j                  |j"                         d d d        t	        j
                         |kD  r
t)               	S # t         $ r t        d      w xY w# 1 sw Y   DxY w# t$        $ r}| j'                  ||      d }~ww xY w)N$Only file sources for code supportedr   )Parsing)source_encodingrs   r   r   )ConcreteSyntaxTreezLFormal grammar can only be used with compiled Cython with an available pgen.)re   r
   RuntimeErrorr7   r   get_errors_countget_file_objectr   r   r	   r[   p_moduler8   formal_grammarParserr   ImportErrorr   UnicodeDecodeError_report_decode_errorr   )r?   rr   rs   r   full_module_name
num_errorsr   r   streer   es               r#   parsezContext.parsez  s'   +';<EFFHH	,,.
	<,,. F!% K1::).$@''30@A<<..l? '//0D0DEF" ""$z1.  ' l*jl llF F " 	< ++K;;	<sI   D A
DC)#D>D )C>>DD
D 	D-D((D-c                 h   |j                   d   }|j                   d   }|j                   d   }d}dx}}t        |j                  dd      5 }	t        |	d      D ].  \  }}
|t	        |
      z  }||k\  s||t	        |
      z
  z
  dz   } n d d d        t        |||fd|d	|d
      S # 1 sw Y   xY w)Nr   r   r   z	iso8859-1r   )r[   newlinezjDecoding error, missing or incorrect coding=<encoding-name> at top of source (cannot decode with encoding z: ))argsr   r   	enumerater   r   )r?   rr   r}   msgpositionr[   r   columnidxr   datas              r#   r   zContext._report_decode_error  s    hhrl88A;88A;+&&bI 	Q'1o 
ds4y (?%s4y9A=F		 k40PXZ]_` 	`	 	s   &B(3B((B1c                    t         j                  j                  |      \  }}t         j                  j                  |      \  }}d|v r|S |g}| j	                  |      rMt         j                  j                  |      \  }}	||k(  rn%|j                  |	       |}| j	                  |      rM|j                          dj                  |      S Nr   )rh   r   r   r   r   r   reverser   )
r?   r   r8   r   r   rt   _namesparentpackage_names
             r#   extract_module_namezContext.extract_module_name  s     d+X))(3Q+!!#&#%77==#5 FL}LL&C !!#& 	xxr%   c                     t        j                          |j                  r(t        j                  |j
                  d      x}|_        nd }t        j                  ||j                         y )Nz.lis)r   echo_to_stderr)	r   init_threaduse_listing_filer   r   main_source_filelisting_fileopen_listing_fileerrors_to_stderr)r?   r8   rx   r   s       r#   setup_errorszContext.setup_errors  sS    ##).)=)=f>U>UW])^^D6&D  d7;S;STr%   c                    |j                   j                  }t        |t              st	        d      t        j                          t        j                         |_        |j                  dkD  rd}|rS|j                  rF	 t        j                  |j                  t        j                  |j                               d |_	        y y y # t        $ r Y w xY w)Nr   r   T)compilation_sourcerr   re   r
   r   r   close_listing_filer   r   c_filer   castrate_filerh   statr   OSError)r?   r   r8   rx   rr   s        r#   teardown_errorszContext.teardown_errors  s    //;;+';<EFF!!#"335q C6==##FMM277;;O;O3PQ !FM !3  s   ?=C 	CC)FNNrH   )F)NNr   TF)NTNNN)NNFFN)%__name__
__module____qualname__r2   r@   rA   classmethodrF   propertyrI   rL   r<   r^   rz   r~   r   staticmethodr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r   r  r   r(  r   r%   r#   r(   r(   3   s    LNEJ.2+6 K K I I T TC
(($& l l g g MN<AZxq rv_6B((.	,8`$"U!r%   r(   c                 |   |j                   rd}nd}t        j                  | |      }|j                  rt        j
                  j                  ||j                        }t        j
                  j                  |      r=t        j
                  j                  |t        j
                  j                  |            S |S |S )Nz.cppz.c)	rD   r   r   output_filerh   r   r   isdirr   )source_filenamecwdr8   c_suffixsuggested_file_nameout_paths         r#   get_output_filenamer8    s    }}..I77<<W%8%8977=="77<<"''*:*:;N*OPPO""r%   c                     t               }| j                  j                  |_        | |_        | j                  }t        |j                  | j                  |      |_        |j                  |_        |S rH   )	CompilationResultrr   r   r  r"  r8  r4  r$  embedded_metadata)r"  r8   rx   rr   s       r#   rj   rj     sc     F0<<EEF 2F$00K'(<(<*..9FM&88FMr%   c                    t        j                         }t         j                  j                  |       }|xs |j	                  | |      }t        |      }t        j                  |       |j                  r7|j                  dt         j                        |z   }|j                  |      s| }n|}t        ||      }t        |||      S r  )rh   ri   r   abspathr  r   r   $raise_error_if_module_name_forbidden'relative_path_in_code_position_commentsr   r   r   r
   rg   )	ru   
source_extr   r8   r   r4  abs_pathr   rr   s	            r#   setup_source_objectrB    s    
))+Cwwv&H'W7+F+Fvw+W$%56	../?@66#++C8:E  *H&x:K[*:C@@r%   c                 |   t        j                         }t        | ||      }|j                  ||      }|rc|j	                  ||       t         j
                  j                  |       d   }	|j                  |	dd         t        | |	|||      } t        | |      S t        | |||      }
|r|j                  |||
       |
S )Nr   )rh   ri   r8  lookup_cacheload_from_cacher   r   configure_language_defaultsrB  rj   rl   store_to_cache)ru   r8   r   r   cachefingerprintr4  output_filenamecachedr@  rx   s              r#   run_cached_pipelinerL    s    
))+C)&#w?O=Fov6WW%%f-a0
++JqrN;$VZ9I7T[\'88&'+;WEF_k6BMr%   c                    ddl m} |j                  r"t        j                  j                  d| z         t        j                  j                  |       d   }t        j                  j                  |       }|j                  |dd         t        | ||||      } t        | |      }|j                  ~t        j                  j                  |j                        d   dz   }t        j                  j                  |      r0t!        |d      5 }	d|	j#                  d	      v rd
|_        d d d        |j%                         dk(  s|s|j'                  |||      }
n|j)                  |||      }
|j+                  ||       d| j,                  v r|dt        j                  j                  t        j                  j/                  |            d   v r;t1        | j2                  ddfdt        j                  j/                  |      z  d       t5        j6                  d|j                  t4        j8                  j:                        r'|j<                  st1        | j2                  ddfdd       |j?                  |
|       \  }}|jA                  |||       |^|jB                  rRddl"m#}  ||      jI                  |jJ                        }tM        jN                  |j                  |jJ                  |       |S # 1 sw Y   xY w)Nr   r`   zCompiling %s
r   z.htmlzUTF-8)r[   z<!-- Generated by Cythond   Tr   r   r   r   z[.]c(pp|[+][+]|xx)$z:Filename implies a c++ file but Cython is not in c++ mode.r   create_dependency_tree)(r   ra   verboser   stderrwriterh   r   r   r=  rF  rB  rj   annotater$  r   r   readlowercreate_py_pipelinecreate_pyx_pipeliner   r   r   r   rr   research	RegexFlag
IGNORECASEr7   rl   r(  depfileBuild.DependenciesrP  all_dependenciesr  r   write_depfile)ru   r8   r   r   ra   r@  rA  rx   html_filename	html_filerw   r   enddatarP  dependenciess                  r#   rl   rl     sw   

)F23!!&)!,Jwwv&H''
127 5EwPWXF%fg6F((7:WD77>>-(mg6 ,)-1DD'+G$,
 U"*..wH//&I&)
f%%%#1A1A"''BRBRS[B\1]^_1`*`##Q*JLNGGL\L\]eLfgno	q 
yy&r||7N7NOX_XcXc##Q*L	 ((6:LCC&1
{w?-g6GGH_H_`FMM6+B+BLQM7, ,s   K11K;c                       e Zd ZdZd Zy)rg   zk
    Contains the data necessary to start up a compilation pipeline for
    a single compilation unit.
    c                 .    || _         || _        || _        y rH   )rr   r   r4  )r?   rr   r   r4  s       r#   rA   zCompilationSource.__init__K  s    & 0r%   N)r*  r+  r,  __doc__rA   r   r%   r#   rg   rg   F  s    r%   rg   c                   :    e 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y)r:  af  
    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
    Nr   c                     | j                   | j                  | j                  | j                  fD cg c]  }|r| c}S c c}w rH   )r$  h_filei_fileapi_file)r?   source_files     r#   get_generated_source_filesz,CompilationResult.get_generated_source_filesj  sA    ,0KKdkkSWS`S`+a
' 
 	
 
s   ?)r*  r+  r,  rg  r$  rj  rk  rl  r  object_fileextension_filer  r   rn  r   r%   r#   r:  r:  Q  s<     FFFHLKNJ
r%   r:  c                       e Zd ZdZdZd Zy)CompilationResultSetz
    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
    r   c                 L    || |<   | xj                   |j                   z  c_         y rH   )r   )r?   ru   rx   s      r#   addzCompilationResultSet.add|  s    V6,,,r%   N)r*  r+  r,  rg  r   rt  r   r%   r#   rr  rr  q  s     J-r%   rr  c           	          ddl m} ddlm} t        j                  |      } ||      }| j                  ||j                  |      | ||j                  rdnd|j                              S )Nr   rO  )FingerprintFlagszc++c)
np_pythran)
r^  rP  Build.Cacherv  r(   rF   transitive_fingerprintr_  rD   rx  )rH  ru   r8   rP  rv  r   rd  s          r#   get_fingerprintr{    sc    ;.""7+G)'2L''L11&97 C"-- r%   c                     |t         j                  |      }|r!|xs t        || |      }t        | |||||      S t	        | |||      S )a  
    compile_single(source, options, full_module_name, cache, context, fingerprint)

    Compile the given Pyrex implementation file and return a CompilationResult.
    Always compiles a single file; does not perform timestamp checking or
    recursion.
    )r(   rF   r{  rL  rl   )ru   r8   r   rH  r   rI  s         r#   compile_singler}    sX     &&w/!L_UFG%L"674DguVabbFG-=wGGr%   c                 L   t        |       dkD  r|j                  rt        d      | D cg c]!  }t        j                  j                  |      # } }t               }t               }|j                  }d}t        j                         }| D ]  }||vst        |||      }	|t        j                  |      }|j                  ||	      }
|r|
r.t        |||j                  ||      }|j                  ||       d}|j                  |        |r|j!                          |S c c}w )z
    compile_multiple(sources, options, cache)

    Compiles the given sequence of Pyrex implementation files and returns
    a CompilationResultSet. Performs timestamp checking, caching and/or recursion
    if these are specified in the options.
    r   z>Full module name can only be set for single source compilationN)r   rH  r   )r   rt   r   rh   r   r=  r4   rr  
timestampsri   r8  r(   rF   r   r}  rt  cleanup_cache)sourcesr8   rH  ru   	processedresultsr  r   r4  rJ  out_of_daterx   s               r#   compile_multipler    s    7|aG// ; < 	< 6==6rwwv&=G=I"$G##JG
))+C ""1&#wGO!..w7!44V_MK;''J]J]ejt{|FF+ MM&!" N+ >s   &D!c                    t        dd|i|}d}|j                  rr|j                  st        j                  r,|j                  rJt
        j                  j                  d       n*ddlm	} |j                  du rdn|j                  } ||      }t        | t              r|j                  st        | |||      S | g} t        | ||      S )a  
    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.
    defaultsNz/Cache is ignored when annotations are enabled.
r   )CacheTr   )r   rH  rT  r   rQ  r   rR  rS  ry  r  re   strr  r}  r  )ru   r8   r   kwdsrH  r  
cache_paths          r#   compiler    s     !<G<t<G E}}w//

  !ST+!($!6GMMJ*%E&#!!!&'3CUKKFGU33r%   c                    |r.|s,|d   }t        |t              st        d      |j                  }|r?|r$t        j
                  j                  |      f| z   } nt        j                  |      f| z   } |}|r||z  }| D ]E  }t        j
                  j                  ||      }	t        j
                  j                  |	      sC|	c S  |s|j                  d      }
t        |
dd       }|
d   }g }| D ]E  }t        j                  ||      \  }}||r|j                  |       3t        |||      }	|	sC|	c S  |D ]  }t        |||      }	|	s|	c S  y)a)  
    Search the list of include directories for the given file name.

    If a source file path or 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.
    r   r   r   Nr  )re   r
   r   r   rh   r   dirnamer   r   r   r   r   r   r   r   search_module_in_dir)dirsr   r   r   r   r   	file_descdotted_filenamer  r   r  r   rt   namespace_dirspackage_diris_namespaces                   r#   r   r     ss    #F	)%9:EFF$--GGOO$457$>D//0@ACdJD %O6! ww||G_577>>$K $$S)eCRj)Bi  	 G(-(?(?(W%K&"))+6+KfMK	  * 	K'[&ID	
 r%   c                     t        j                  | ||      }|s7|r5t        j                  t        j                  j	                  | |      d|      }|S )NrA   )r   find_versioned_filerh   r   r   )r  rt   r   r   s       r#   r  r  #  sI     $$[+vFD F((k;)OQ[]cdKr%   c                      t        d      S )Nr   )command_line)mainr   r%   r#   setuptools_mainr  5  s    q!!r%   c                 (   t         j                  dd  }d}| r	 t        |      \  }}nt        t              }|}j                  rt        j                          |j                  dk7  rt        j                   |j                         	 |j"                  rddlm}  ||       y t)        |      }|j*                  dkD  rd}|rt        j                  d       y y # t        $ rf}t	        dj                  t         j                  d   |j                        t         j                         t        j                  d       Y d }~
d }~ww xY w# t,        t.        f$ r7}t         j                  j1                  t3        |      dz          d}Y d }~d }~ww xY w)	Nr   r   z#{}: No such file or directory: '{}')filer   r   )generate_shared_module
)r   argvr   FileNotFoundErrorr   r   r   rR  exitr   r   show_versionr   print_versionworking_pathrh   chdirrI   Build.SharedModuler  r  r   r'  r   rS  r  )r  r	  any_failuresr8   r  r  r  rx   s           r#   r  r  9  sB   88AB<DL	1$7GW
 %_5R
%%&%%C"7+'*q L  3 ! 	7>>sxx{AJJW^a^h^hiHHQKK	, Z  

Q$'s6   C E #E 	E"AEEF-FF)NNNrH   r)  )r   NFN)r   )=rh   rY  r   ioversion_inforR  rS  r   r  r   r   StringEncodingr   Scanningr	   r
   r   r   r   r   Symtabr   r   r   r   r   CmdLiner   Lexiconr   r   r   r   r$   r   r   r  r   r=  r   r  __file__r   r(   r8  rj   rB  rL  rl   rg   r:  dictrr  r{  r}  r  cached_functionr   r  r  r  r   r%   r#   <module>r     s   
 	 
 	BQ& JJH5QTQaQabdcdQeKffgCHHQK  ) 8 < <    8 'M M 066.)?@013  !bjj!7!78K!LM  GGLL!:;ZHJ [! [!|# A$(+h 
 
@-4 - H&"J4B 7 7t  "" r%   