
    G/Phy                     h   d Z ddlZddlZddlZddlZddl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 ddlmZ ddlmZmZmZmZmZ dd	lmZ dd	lmZ d
 Z G d dej                  Z ej        dej                   j!        Z" ej        dej                   j!        Z# ej        dej                   j!        Z$ ej        dej                   j%        Z& ej        dej                   j%        Z'd Z(d Z)d Z* ej        dej                   j!        Z+ ej        dej                   j!        Z,d Z-dS )z Build swig and f2py sources.
    N)	build_ext)newer_groupnewer)get_platform)DistutilsErrorDistutilsSetupError)log)fortran_ext_match
appendpath	is_stringis_sequenceget_cmd)process_filec                    t          j        d          }t          |d          5 }t          | d          5 }|D ]}|                    |          }|rY|                    |                    d|                    d          z  ||                    d                                        r|                    |           	 ddd           n# 1 swxY w Y   ddd           dS # 1 swxY w Y   dS )zPSubstitute any occurrence of @foo@ by d['foo'] from source file into
    target.z@([a-zA-Z_]+)@rwz@%s@   N)recompileopensearchwritereplacegroup)targetsourcedvarfsftlms           a/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/numpy/distutils/command/build_src.py
subst_varsr$      sc    *%
&
&C	fc		  b&# 	 "    JJqMM  HHQYYv

':AaggajjMJJKKKKHHQKKKK 	  	  	  	  	  	  	  	  	  	  	  	  	  	  	                                    s5   C&BCC&C	C&C	C&&C*-C*c                       e Zd ZdZg dZg dZg 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g fdZd Zd Zd Zd Zd ZdS )	build_srcz1build sources from SWIG, F2PY files or a function)
)z
build-src=r   zdirectory to "build" sources to)z
f2py-opts=Nz!list of f2py command line options)zswig=Nzpath to the SWIG executable)z
swig-opts=Nz!list of SWIG command line options)zswig-cppNzAmake SWIG create C++ files (default is autodetected from sources))z
f2pyflags=Nz3additional flags to f2py (use --f2py-opts= instead))z
swigflags=Nz3additional flags to swig (use --swig-opts= instead))forcefz2forcibly build everything (ignore file timestamps))inplaceiziignore build-lib and put compiled extensions into the source directory alongside your pure Python modules)verbose-cfgNzJchange logging level from WARN to INFO which will show all compiler output)r'   r)   r+   c                     d | _         d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _        d | _	        d | _
        d | _        d | _        d | _        d | _        d | _        d | _        d S N)
extensionspackage
py_modulespy_modules_dictr&   	build_lib
build_baser'   r)   package_dir	f2pyflags	f2py_opts	swigflags	swig_optsswig_cppswigverbose_cfgselfs    r#   initialize_optionszbuild_src.initialize_options?   s    #
	    c                    |                      dddd           | j        | j        j        | _        | j        j        | _        | j        j        pg | _        | j        j        pg | _        | j        j        pg | _        | j	        Y dj
        t                      gt          j        d d         R  }t          j                            | j        d|z             | _	        i | _        | j        r/| j        rt+          j        d           n| j        | _        d | _        | j        g | _        nt/          j        | j                  | _        | j        r/| j        rt+          j        d	           n| j        | _        d | _        | j        g | _        nt/          j        | j                  | _        |                     d
          }| j        |j        | _        | j        |j        | _        dD ]}d|                    dd          z   }t?          ||d           }|rTt?          | |          rt+          j        d|z             Vt+          j         d|d|d           tC          | ||           d S )Nbuild)r3   r3   )r2   r2   )r'   r'   z	.{}-{}.{}   srcz0ignoring --f2pyflags as --f2py-opts already usedz0ignoring --swigflags as --swig-opts already usedr   )r:   swig_optz--_-z-both build_src and build_ext define %s optionzusing "=z" option from build_ext command)"set_undefined_optionsr/   distributionext_packageext_modulesr.   	librariesr0   
data_filesr&   formatr   sysversion_infoospathjoinr3   r1   r5   r6   r	   warnshlexsplitr7   r8   get_finalized_commandr)   r9   r   getattrinfosetattr)r=   plat_specifierr   covs         r#   finalize_optionszbuild_src.finalize_optionsR   sx   ""7#?#=#5	7 	7 	7 <,8DL+7*4:+6<"+6<">!/[/VAQRTSTRTAUVVVNW\\$/5;OPPDN  "> 	"~ 0KLLLL!%!DN>!DNN"[88DN> 	"~ 0KLLLL!%!DN>!DNN"[88DN ..{;;	<$,DL= %.DM% 	( 	(AQYYsC(((A	1d++A (4## (HLPQRSSSSHHaaaQRQRQRSTTTD!Q'''	( 	(r?   c                 v    t          j        d           | j        s	| j        sd S |                                  d S )Nr&   )r	   rY   r.   rL   build_sourcesr<   s    r#   runzbuild_src.run   sB     	4> 	Fr?   c                 r   | j         r|                     d          j        | _        |                                  | j        D ]} | j        |  | j        r9|                     | j                   | j        D ]}|                     |           | 	                                 | 
                                 d S )Nbuild_py)r)   rW   get_package_dirbuild_py_modules_sourcesrL   build_library_sourcesr.   check_extensions_listbuild_extension_sourcesbuild_data_files_sourcesbuild_npy_pkg_config)r=   libname_infoexts      r#   ra   zbuild_src.build_sources   s    < 	L//
;;K   	%%''' N 	6 	6L&D&555? 	2&&t777 2 2,,S1111%%'''!!#####r?   c                    | j         sd S t          j        d           ddlm} g }| j         D ]}t          |t                    r|                    |           .t          |t                    rT|\  }}| j	        rF| 
                    d                    |                    t          j                                      }n%t          j                            | j        |          }d |D             }d |D             }|D ]}|j        j        dk    r ||          }	n
 |            }	|	rt          |	t&                    r|                    |	           Ut          |	t                    r|                    |	           t+          t-          |	                     |||f          }
|                    ||
f           t+          t-          |                    || j         d d <   d S )Nzbuilding data_files sourcesr   )get_data_files.c                 2    g | ]}t          |d           |S __call__hasattr.0r(   s     r#   
<listcomp>z6build_src.build_data_files_sources.<locals>.<listcomp>   s'    DDDqWQ
-C-CDDDDr?   c                 2    g | ]}t          |d           |S rr   rt   rv   s     r#   rx   z6build_src.build_data_files_sources.<locals>.<listcomp>   s'    HHHqJ1G1GHHHHr?   r   )rM   r	   rY   numpy.distutils.misc_utilro   
isinstancestrappendtupler)   re   rS   rV   rQ   seprR   r&   __code__co_argcountlistextend	TypeErrorrepr)r=   ro   new_data_filesdatar   files	build_dirfuncsr(   s	filenamess              r#   rj   z"build_src.build_data_files_sources   s    	F.///<<<<<<O 	, 	,D$$$ ,%%d++++D%(( ,5< @ $ 4 4SXXaggbfoo5N5N O OII "T^Q ? ?IDDEDDDHHEHHH 5 5Az-q00AiLLACC}%a.. 5!LLOOOO'3// 5!LLOOOO"+DGG"4"44 % +NAu:66	%%q)n5555T

++++r?   c                    |\  }}}t           j                            |          }|                                D ]
\  }}|||<   | j        dk    r!t           j                            ||          }	n&t           j                            | j        ||          }	t           j                            t           j                            |          d                   }
t           j                            |	|
          }t           j        	                    |	          st          j
        |	           t          |||           t           j                            ||          }||fS )Nr   r   )rQ   rR   dirnameitemsr)   rS   r&   basenamesplitextexistsmakedirsr$   )r=   rY   gdtemplateinstall_dir
subst_dicttemplate_dirkr^   generated_dir	generatedgenerated_pathfull_install_dirs                r#   _build_npy_pkg_configzbuild_src._build_npy_pkg_config   s#   ,0)+zwx00HHJJ 	 	DAqJqMM<1GLL{CCMMGLL! !MG$$RW%5%5h%?%?%BCC	mY??w~~m,, 	'K&&&>8Z888 7<<kBB//r?   c                 z   t          j        d           t          j        t          d                    }|j        dk    s|                                 d}| j        dk    rd}d}nt          |d          r	|j        }d}|r| j	        j
                                        D ]\  }}| j	        j        |         }t          j                            t          j                            |          |          }d|i}|D ]=}	|                     |	|          \  }
}| j	        j                            |
|gf           >d S d S )	Nz(build_src: building npy-pkg config filesinstallr   Frp   Tinstall_libbaseprefix)r	   rY   copyr   	finalizedr_   r)   ru   r   rI   installed_pkg_configr   r4   rQ   rR   rS   abspathr   rM   r}   )r=   install_cmd
build_npkg
top_prefixpkginfospkg_pathr   r   rY   r   r   s               r#   rk   zbuild_src.build_npy_pkg_config   se   ;<<< i	 2 233$))((***
<1JJJ["344 	$4JJ 	&"/DJJLL & &
U,8=bgooj&A&A8LLv&! & &D-1-G-Ga-P-P*K%077"9% & & & &&	& 	&& &r?   c           	         | j         sd S t          j        d           g }| j         D ]}t          |          rt	          |          dk    r|\  }}}| j        r|                     |          }nIt          j        	                    | j
        t          j        j	        |                    d                     }t          |d          r.t          j        	                    ||dz             } ||          }||||fg}|| j        vr
g | j        |<   | j        |xx         |z  cc<   |                    |           || j         d d <   d S )Nzbuilding py_modules sources   rp   rs   .py)r0   r	   rY   r   lenr)   re   rQ   rR   rS   r&   rV   ru   r1   r}   )r=   new_py_modulesr   r/   module_baser   r   moduless           r#   rf   z"build_src.build_py_modules_sources   so    	F.///o 	. 	.F6"" .s6{{A~~/5,f< P $ 4 4W = =II "T^-/W\7==;M;M-N!P !PI6:.. ,W\\)[55HIIF#VF^^F>#[&9:$"66646D(1$W---8----%%f----+r?   c                 V   t          |                    dg                     }|sd S t          j        d|z             |                     |||f          }|                     |||f          }|                     |          \  }}|rt          j        d| j        |           ||d<   d S )Nsourceszbuilding library "%s" sources#%s - nothing done with h_files = %s)r   getr	   rY   generate_sourcestemplate_sourcesfilter_h_filesr/   )r=   lib_name
build_infor   h_filess        r#   rg   zbuild_src.build_library_sources  s    z~~i4455 	F0H=>>>''(J1GHH''(J1GHH..w77 	,H:\7, , , !(
9r?   c                    t          |j                  }t          j        d|j        z             |                     |j                  }|                    d          }d                    |dd                   }| j        r| 	                    |          | _
        |                     ||          }|                     ||          }|                     ||          }|                     ||          }|                     ||          }|                     |          \  }}|| j        vr
g | j        |<   g }|D ]\}t$          j                            t$          j                            |                    d         }	|                    ||	|f           ]| j        |xx         |z  cc<   |                     |          \  }}
|
rt          j        d||
           ||_        d S )Nzbuilding extension "%s" sourcesrp   r   r   )r   r   r	   rY   nameget_ext_fullnamerV   rS   r)   re   ext_target_dirr   r   swig_sourcesf2py_sourcespyrex_sourcesfilter_py_filesr1   rQ   rR   r   r   r}   r   )r=   rm   r   fullnamemodpathr/   py_filesr   r(   moduler   s              r#   ri   z!build_src.build_extension_sources0  s   s{##2ch?@@@((22..%%((71R4=))< 	@"&"6"6w"?"?D''55''55##GS11##GS11$$Wc22 0099$...,.D ) 	1 	1AW%%bg&6&6q&9&9::1=FNNGVQ/0000W%%%0%%%..w77 	'H:g' ' '
 r?   c                    g }g }|D ]<}t          |          r|                    |           '|                    |           =|s|S | j        rt          |          s| j        }nVt          |          r	|d         }n|j        }t          j        j        | j	        g|
                    d          d d         z    }|                     |           | j        rt          j        }nt          j        }t          j        |          }	|D ]o}
 |
||          }|st          |          r"d |D              |                    |           Bt          j        d|d           |                    |           pt          j        |	           |S )Nr   rp   r   c                 >    g | ]}t          j        d |d          S )
  adding '' to sources.)r	   rY   )rw   r   s     r#   rx   z.build_src.generate_sources.<locals>.<listcomp>~  s+    NNN!<==NNNr?   r   r   )r   r}   r)   r   r   r   rQ   rR   rS   r&   rV   mkpathr;   r	   INFOWARNset_thresholdr   rY   )r=   r   	extensionnew_sourcesfunc_sourcesr   r   r   	new_level	old_levelfuncs              r#   r   zbuild_src.generate_sourcesX  s    	, 	,F   ,""6****##F++++ 	< 	?I 6 6 	?+II9%% & |
 !~ '7(,

3(<(= ?II 	!III%i00	  		+ 		+DT)Y//F 6"" +NNvNNNN""6****@AAA""6****)$$$r?   c                 0    |                      |dg          S )Nr   filter_filesr=   r   s     r#   r   zbuild_src.filter_py_files  s      5'222r?   c                 2    |                      |g d          S )N)z.hz.hppz.incr   r   s     r#   r   zbuild_src.filter_h_files  s      *@*@*@AAAr?   c                     g }g }|D ]S}t           j                            |          \  }}||v r|                    |           >|                    |           T||fS r-   )rQ   rR   r   r}   )r=   r   extsr   r   r   baserm   s           r#   r   zbuild_src.filter_files  st     	+ 	+F'**622KT3d{{V$$$$""6****E!!r?   c                    g }t          |          r7|d                             d          }|d                             d          }n|j        }|j        }|D ]}t          j                            |          \  }}|dk    r| j        r t          j                            |          }	n2t          | j
        t          j                            |                    }	|                     |	           t          j                            |	t          j                            |                    }
| j        st          |g|z   |
          rt!          |          r't#          j        d|
z             t'          |          }n&t#          j        d|
z             t)          |          }t+          |
d          5 }|                    |           d d d            n# 1 swxY w Y   t/          |
          rOt          j                            |
          }||vr,t#          j        d|z             |                    |           |                    |
            |                    |           |S )	Nr   dependsinclude_dirsz.srczfrom_template:> %szconv_template:> %sr     adding '%s' to include_dirs.)r   r   r   r   rQ   rR   r   r)   r   r   r&   r   rS   r   r'   r   _f_pyf_ext_matchr	   rY   process_f_fileprocess_c_filer   r   _header_ext_matchr}   )r=   r   r   r   r   r   r   r   rm   
target_dirtarget_fileoutstrfidr   s                 r#   r   zbuild_src.template_sources  sx   y!! 	2l&&y11G$Q<++N;;LL'G$1L 	+ 	+F'**622KT3f}}< S!#!6!6JJ!+DNBGOOD<Q<Q!R!RJJ''' gll:rw7G7G7M7MNNJ *+vh.@+"N"N *'-- 8!5!EFFF!/!7!7!5!EFFF!/!7!7k3// *3		&)))* * * * * * * * * * * * * * *$[11 /44A,,!AQ!GHHH$++A..."";////""6****s   7GG	 G	c                 *   g }|j                             d          d         }|D ]m}t          j                            |          \  }}|dk    r.|                     ||||          }|                    |           X|                    |           n|S )z@Pyrex not supported; this remains for Cython support (see below)rp   r   z.pyx)r   rV   rQ   rR   r   generate_a_pyrex_sourcer}   )	r=   r   r   r   ext_namer   r   rm   r   s	            r#   r   zbuild_src.pyrex_sources  s    >'',,R0 	+ 	+F'**622KT3f}}"::4;A;DF F "";////""6****r?   c                     g S )zPyrex is not supported, but some projects monkeypatch this method.

        That allows compiling Cython code, see gh-6955.
        This method will remain here for compatibility reasons.
         )r=   r   r   r   r   s        r#   r   z!build_src.generate_a_pyrex_source  s	     	r?   c           	         g }g }g }i }g }|j                             d          d         }d}	|D ]y}
t          j                            |
          \  }}|dk    r| j        r t          j                            |          }n2t          | j        t          j                            |                    }t          j        	                    |
          rRt          |
          }||k    rt          d|
d|d|          t          j                            ||dz             }nt          j        d	|
z             |}d
}	t          j                            ||dz             }t          j        	                    |          st          j        d|d|d           t          j                            |          }t          j                            ||dz             }t          j        	                    |          st          |d          t          j        d|z             |                    |           |                    |
           |||
<   |                    |           >t%          |          r|                    |
           d|                    |
           {|s|s|S |D ]}|                     |           |j        | j        z   }| j        j        rD| j        j        D ]7\  }}||j        v r)|                    |                    dg                      8t          j        d|z             |rt5          |          d
k    rt          d|          |d         }
||
         }t          j                            |          pd}|
g|j        z   }| j        st;          ||d          r<|	s:t          j        d|
z             ddlm} |                     |d||
gz              n8t          j        d|
z             ntC          |          r	|d         }n|j         }t          j        j        | j        g|                    d          d d         z    }t          j                            ||dz             }|                    |           ||j        z   }| j        st;          ||d          rX|	sVt          j        d|z             |                     |           ddlm} |                     |dd|gz   d|gz   |z              nt          j        d|z             t          j        	                    |          stE          d|d          t          j                            | j        |          }t          j                            |d          }t          j                            |d          }t          j        d |z             |                    |           ||j#        vr1t          j        d!|z             |j#                            |           |	sdd l}t          j                            |j$        j%                  }t          j                            |d"d          }t          j                            |d"d          }tM          ||          stM          ||          r^|                     t          j                            |                     | '                    ||           | '                    ||           ndt          j        	                    |          st          d#|d$          t          j        	                    |          st          d%|d$          d&D ]p}t          j                            |||z             }t          j        	                    |          r,t          j        d |z             |                    |           q||z   S )'Nrp   r   r   z.pyfmismatch of extension names: 
 provides  but expected zmodule.cz.  source %s does not exist: skipping f2py'ing.r   	  target  does not exist:
   Assuming z:module.c was generated with "build_src --inplace" command. missing&   Yes! Using %r as up-to-date target.f2py_optionszf2py options: %szAonly one .pyf file is allowed per extension module but got more: r   zf2py: %s)f2py2ez--build-dirz+  skipping '%s' f2py interface (up-to-date)z	f2py:> %sz--lowerz-mz3  skipping f2py fortran files for '%s' (up-to-date)zf2py target file z not generatedzfortranobject.czfortranobject.hz  adding '%s' to sources.r   rC   zf2py target_c file z
 not foundzf2py target_h file )z-f2pywrappers.fz-f2pywrappers2.f90)(r   rV   rQ   rR   r   r)   r   r   r&   isfileget_f2py_modulenamer   rS   r	   debugrT   rY   r}   r
   r   r   r6   rI   rL   r   r   r   r   r'   r   
numpy.f2pyr   run_mainr   r   r   f2py__file__r   	copy_file)r=   r   r   r   r   	f_sourcesf2py_targetstarget_dirsr   	skip_f2pyr   r   rm   r   r   r   r   r   r   r   r   r   target_ctarget_hnumpysource_csource_hname_extfilenames                                r#   r   zbuild_src.f2py_sources  s1   	>'',,R0	 &	+ &	+F'**622KT3f}}< S!#!6!6JJ!+DNBGOOD<Q<Q!R!RJ7>>&)) 2.v66Dx''11"FFDDD((34 5 5 5 #%',,z4
?"K"KKKIO!') * * *#D !I"$',,z4
?"K"KK7>>+66 
2 %0KK"7 8 8 8 &(W__T%:%:
&(gll:tJ&O&O!w~~k:: U"5kkk6S"T"TT!I$/"1 2 2 2"":...##F+++'2V$"";////"3'' +  ((((""6**** 		 	 	 	AKKNNNN ->& 	L$($5$? L L j9... ''
~r(J(JKKK#|4555 %	+<  A%%))#/<23 3 3 "!_F&v.K55<Jh!22G
 Tk';HH T$Tv.///------'4j&&I!J K K K K 	G6RSSSS 9%% ( |"$(8)-C")=)> @J',,z8j3HIIK{+++)"33G
 
+k';HH 
+$
+4555J'''------	0=z0K !K!%x 0!11:!; < < < < 	O(* + + + w~~k** 	W .!UVVVGLL<<	7<<	+<==7<<	+<==,9:::8$$$I222H5CDDD")))444 	[
 344Aw||Au.?@@Hw||Au.?@@HXx(( 3E(H,E,E 3BGOOH55666x222x2227>>(++ [))xxx*YZZZ7>>(++ [))xxx*YZZZA 	+ 	+Hw||J80CDDHw~~h'' +4ABBB  ***Y&&r?   c                 	   g }g }i }g }g }d}d|j         v rd}	d}
|j                             d           n| j        rd}	d}
nd }	d}
d}|j                            d          d         }|D ]-}t
          j                            |          \  }}|d	k    r| j        r't
          j        	                    |          }| j
        }n4t          | j        t
          j        	                    |                    }|}t
          j                            |          rt          |          }||d
d          k    r t          d|d|d|d
d                    |	t!          |          }	|	dk    }
nt!          |          }|t#          j        d|d|	d           nX|	|k    rRt#          j        d|	d|d|d           |dk    rt#          j        d           d}
nt#          j        d|z             |
rd}t
          j                            ||d|          }nt#          j        d|z             |d
d          }d
}t)          ||          }t
          j                            |          st#          j        d|d|d           t
          j        	                    |          }t)          ||          }t
          j                            |          st          |d          t#          j        d|z             |                    |           |                    |           |                    t
          j                            ||dz                        |                    |           |d         ||<   |                    |           /|s|S |r||z   S |D ]}|                     |           | j        p|                                 }|dg|j         z   }|
r|                    d           |j        D ]}|                    d |z              |D ]}||         }|g|j        z   }| j        st9          ||d!          rct#          j        t
          j                            |          |
rd"pd#z   d$|           |                     || j         z   d%|d&||gz              t#          j         d'|z             ||z   S )(N.cz-c++c++TFr   rp   r   z.ir   r   r   r   zsource z' does not define swig target, assuming z swig targetz	expected z but source z	 defines zAresetting swig target to c++ (some targets may have .c extension)z$assuming that %r has c++ swig target.cpp_wrapz.  source %s does not exist: skipping swig'ing.r   r   z?_wrap.{c,cpp} was generated with "build_src --inplace" command.r   r   r   z-pythonz-Ir   z++ z: z-oz-outdirz+  skipping '%s' swig interface (up-to-date))!r8   remover9   r   rV   rQ   rR   r   r)   r   r   r   r&   r   get_swig_modulenamer   get_swig_targetr	   rT   rS   _find_swig_targetr}   r   r:   	find_swigr   r   r'   r   rY   r   spawnr   )r=   r   r   r   r   swig_targetsr  r   
target_exttypis_cpp	skip_swigr   r   r   rm   r   py_target_dirr   typ2r   r   r:   swig_cmdr   r   s                             r#   r   zbuild_src.swig_sources\  s    
Y(((CF&&v....] 	CFFCF	>'',,R0 <	+ <	+F'**622KT3d{{ < /!#!6!6J$($7MM!+DNBGOOD<Q<Q!R!RJ$.M7>>&)) *2.v66Dx|++1128&&$$$NO O O {-f55!$e.v66<HH(.&5 6 6 6 6 $YYHH(+VVVTTT&; < < <#U{{ #)l m m m)- #)OSY)Z [ [ [ ,%+
"$',,z26$$

<D #E #EKK HN &( ) ) )#ABB<D !I"3J"E"EK7>>+66 
2 %0KK"7 8 8 8 &(W__T%:%:
&7
D&I&I!w~~k:: U"5kkk6S"T"TT!I$/"1 2 2 2"":..."";///]DJ G GHHH##F+++'22V$$""6**** 	 	*)) 	 	AKKNNNNy,DNN,,)$y':: 	$OOF###' 	$ 	$AOODF####" 
	% 
	%F!&)Fh!22Gz %[&'BB %RW%5%5d%;%;(.4(=2&? &? &?@FH I I I

8dn4"FI}fMN O O O O 	G"$ % % % % X%%r?   N)__name__
__module____qualname__descriptionuser_optionsboolean_optionshelp_optionsr>   r_   rb   ra   rj   r   rk   rf   rg   ri   r   r   r   r   r   r   r   r   r   r   r?   r#   r&   r&   &   st       EK
 
 
L" :99OL     &8( 8( 8(t  $ $ $(!, !, !,H0 0 0,& & &<, , ,4  0& & &P, , ,\3 3 3B B B ,. 	" 	" 	" 	"" " "H    H' H' H'Tp& p& p& p& p&r?   r&   z!.*\.(f90|f95|f77|for|ftn|f|pyf)\Zz.*\.(inc|h|hpp)\ZzQ\s*%module\s*(.*\(\s*package\s*=\s*"(?P<package>[\w_]+)".*\)|)\s*(?P<name>[\w_]+)z-\*-\s*c\s*-\*-z-\*-\s*c\+\+\s*-\*-c                     t          |           5 }d }|                                }t          |          rd}t          |          rd}d d d            n# 1 swxY w Y   |S )Nr  r\   )r   readline_has_cpp_header_has_c_header)r   r(   resultlines       r#   r  r    s    	f zz||4   	F 	F               Ms   9AAAc                     t          |           5 }d }|D ]*}t          |          }|r|                    d          } n+d d d            n# 1 swxY w Y   |S Nr   )r   _swig_module_name_matchr   )r   r(   r   r/  r"   s        r#   r  r    s    	f  	 	D'--A wwv	               Ks   0AAAc                     dD ]H}t           j                            | |d|          }t           j                            |          r nI|S )N)r  r  r  )rQ   rR   rS   r   )r   r   rm   r   s       r#   r  r    sV      jss*CDD7>>&!! 	E	Mr?   z%\s*python\s*module\s*(?P<name>[\w_]+)z4\s*python\s*module\s*(?P<name>[\w_]*?__user__[\w_]*)c                     d }t          |           5 }|D ]:}t          |          }|r't          |          r#|                    d          } n;d d d            n# 1 swxY w Y   |S r1  )r   _f2py_module_name_match_f2py_user_module_name_matchr   )r   r   r(   r/  r"   s        r#   r   r     s    D	f  	 	D'--A /55 wwv	               Ks   >AA #A ).__doc__rQ   r   rO   rU   r   distutils.commandr   distutils.dep_utilr   r   distutils.utilr   distutils.errorsr   r   numpy.distutilsr	   rz   r
   r   r   r   r   numpy.distutils.from_templater   r   numpy.distutils.conv_templater   r$   r&   r   Imatchr   r   r2  r   r-  r,  r  r  r  r5  r6  r   r   r?   r#   <module>rA     so    				 				 



   ' ' ' ' ' ' 1 1 1 1 1 1 1 1 ' ' ' ' ' ' @ @ @ @ @ @ @ @                     I H H H H H H H H H H H     f
& f
& f
& f
& f
&	# f
& f
& f
&P 2:BBDIIO BJ3RT::@  %"*%y%'T+ ++0 
-rt44;"*3RT::A       %"*%M%'T+ ++0 )rz +=>@d D  DDI 
 
 
 
 
r?   