Current File : //usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyo
�
E�`Qc@s�dZddlZddlZddlZddlZddlZddlmZddlm	Z	m
Z
ddlmZddl
mZmZd�ZddlmZdd	lmZmZmZmZmZdd
lmZdd
lmZd�Zdejfd
��YZej dej!�j"Z#ej dej!�j"Z$ej dej!�j"Z%ej dej!�j&Z'ej dej!�j&Z(d�Z)d�Z*d�Z+ej dej!�j"Z,ej dej!�j"Z-d�Z.dS(s" Build swig, f2py, pyrex sources.
i����N(t	build_ext(tnewer_grouptnewer(tget_platform(tDistutilsErrortDistutilsSetupErrorcCs-yddl}tSWntk
r(tSXdS(Ni����(tPyrex.Compiler.MaintTruetImportErrortFalse(tPyrex((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyt
have_pyrexs

(tlog(tfortran_ext_matcht
appendpatht	is_stringtis_sequencetget_cmd(tprocess_filecCs�tjd�}t|d�}z�t|d�}zsxl|j�D]^}|j|�}|r�|j|jd|jd�||jd���q@|j|�q@WWd|j�XWd|j�XdS(sOSubstitute any occurence of @foo@ by d['foo'] from source file into
    target.s@([a-zA-Z_]+)@trtws@%s@iN(	tretcompiletopent	readlinestsearchtwritetreplacetgrouptclose(ttargettsourcetdtvartfstfttltm((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyt
subst_varss6t	build_srccBs�eZdZd*d,d-d.d/d0d1d2ddddfg	ZddgZgZd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d�Zd�Zd �Zd!�Zd"�Zd#�Zgd$�Zd%�Zd&�Zd'�Zd(�Zd)�ZRS(3s1build sources from SWIG, F2PY files or a functions
build-src=R sdirectory to "build" sources tos
f2py-opts=s!list of f2py command line optionssswig=spath to the SWIG executables
swig-opts=s!list of SWIG command line optionssswig-cppsAmake SWIG create C++ files (default is autodetected from sources)s
f2pyflags=s3additional flags to f2py (use --f2py-opts= instead)s
swigflags=s3additional flags to swig (use --swig-opts= instead)tforcetfs2forcibly build everything (ignore file timestamps)tinplacetis=ignore build-lib and put compiled extensions into the source s,directory alongside your pure Python modulescCs�d|_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_d|_
d|_d|_d|_dS(N(tNonet
extensionstpackaget
py_modulestpy_modules_dictR't	build_libt
build_baseR(R*tpackage_dirt	f2pyflagst	f2py_optst	swigflagst	swig_optstswig_cpptswig(tself((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pytinitialize_optionsHs 															cCs�|jdddd�|jdkr7|jj|_n|jj|_|jjpUg|_|jjpjg|_|jj	pg|_	|j
dkr�dt�tj
dd!f}tjj|jd|�|_
ni|_|jr|jr�tjd	�n|j|_d|_n|jdkr1g|_ntj|j�|_|jr�|jrhtjd
�n|j|_d|_n|jdkr�g|_ntj|j�|_|jd�}|jdkr�|j|_n|jdkr�|j|_nx�dd
gD]�}d|jdd�}t||d�}|rt||�r_tjd|�q�tj d||f�t!|||�qqWdS(NtbuildR2R1R(s.%s-%siitsrcs0ignoring --f2pyflags as --f2py-opts already useds0ignoring --swigflags as --swig-opts already usedRR9tswig_opts--t_t-s-both build_src and build_ext define %s options+using "%s=%s" option from build_ext command(s
build_bases
build_base(s	build_libs	build_lib(sforcesforce("tset_undefined_optionsR.R,tdistributiontext_packagetext_modulesR-t	librariesR/t
data_filesR'RtsystversiontostpathtjoinR2R0R4R5RtwarntshlextsplitR6R7tget_finalized_commandR*R8Rtgetattrtinfotsetattr(R:tplat_specifierRtctotv((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pytfinalize_optionsZsV	"					cCs1tjd�|jp|js#dS|j�dS(NR'(RRQR-REt
build_sources(R:((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pytrun�s
cCs�|jr!|jd�j|_n|j�x|jD]}|j|�q5W|jr�|j|j�x!|jD]}|j|�qoWn|j	�|j
�dS(Ntbuild_py(R*ROtget_package_dirtbuild_py_modules_sourcesREtbuild_library_sourcesR-tcheck_extensions_listtbuild_extension_sourcestbuild_data_files_sourcestbuild_npy_pkg_config(R:tlibname_infotext((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyRX�s	
	
cCs�|js
dStjd�ddlm}g}x�|jD]�}t|t�r_|j|�q:t|t�r�|\}}|j	r�|j
dj|jt
j���}nt
jj|j|�}td�|�}td�|�}x�|D]�}|jjdkr||�}	n	|�}	|	dk	r�t|	t�rH|j|	�q|t|	t�rg|j|	�q|tt|	���q�q�W|||f�}
|j||
f�q:tt|���q:W||j(dS(Nsbuilding data_files sourcesi����(tget_data_filest.cSs
t|d�S(Nt__call__(thasattr(R)((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyt<lambda>�scSst|d�S(NRf(Rg(R)((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyRh�si(RFRRQtnumpy.distutils.misc_utilRdt
isinstancetstrtappendttupleR*R[RKRNRItsepRJR'tfiltert	func_codetco_argcountR,tlisttextendt	TypeErrortrepr(R:Rdtnew_data_filestdataR tfilest	build_dirtfuncsR)tst	filenames((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyR`�s:	
	'
	cCsddl}|\}}}tjj|�}x$|j�D]\}}	|	||<q:W|jdkr{tjj||�}
ntjj|j||�}
tjjtjj	|�d�}tjj|
|�}tjj
|
�s�tj|
�nt|||�tjj||�}
|
|fS(Ni����ii(
tshutilRIRJtdirnametitemsR*RKR'tbasenametsplitexttexiststmakedirsR&(R:RQtgdR}ttemplatetinstall_dirt
subst_dictttemplate_dirtkRVt
generated_dirt	generatedtgenerated_pathtfull_install_dir((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyt_build_npy_pkg_config�s 	"c
Cs<tjd�tjtd��}|jdks>|j�nt}i}|jdkrhd}t}n!t	|d�r�|j
}t}n|r8x�|jjj
�D]�\}}|jj|}tjjtjj|�|�}i|d6}	xB|D]:}
|j|
|	�\}}|jjj||gf�q�Wq�WndS(Ns(build_src: building npy-pkg config filestinstalliRetinstall_libbasetprefix(RRQtcopyRt	finalizedRWR	R*RRgR�RBtinstalled_pkg_configRR3RIRJRKtabspathR�RFRl(
R:tinstall_cmdt
build_npkgR�t
top_prefixtpkgtinfostpkg_pathR�R RQR�R�((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyRa�s*

			!

cCsT|js
dStjd�g}x#|jD]}t|�r5t|�dkr5|\}}}|jrx|j|�}n-tjj	|j
tjj	|jd���}t|d�r�tjj	||d�}||�}n|dkr�q*n|||fg}||jkrg|j|<n|j|c|7<q*|j|�q*W||j(dS(Nsbuilding py_modules sourcesiReRfs.py(R/RRQRtlenR*R[RIRJRKR'RNRgR,R0Rl(R:tnew_py_modulesRR.tmodule_baseRyRtmodules((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyR\s,	
	cCs�t|jdg��}|s"dStjd|�|j|||f�}|j|||f�}|j|�\}}|r�tjd|j|�n||d<dS(Ntsourcessbuilding library "%s" sourcess#%s - nothing done with h_files = %s(RrtgetRRQtgenerate_sourcesttemplate_sourcestfilter_h_filesR.(R:tlib_namet
build_infoR�th_files((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyR]"s	
cCs�t|j�}tjd|j�|j|j�}|jd�}dj|dd!�}|jrx|j	|�|_
n|j||�}|j||�}|j
||�}|j||�}|j||�}|j|�\}}||jkrg|j|<ng}xF|D]>}tjjtjj|��d}	|j||	|f�qW|j|c|7<|j|�\}}
|
r�tjd||
�n||_dS(Nsbuilding extension "%s" sourcesReii����s#%s - nothing done with h_files = %s(RrR�RRQtnametget_ext_fullnameRNRKR*R[text_target_dirR�R�tswig_sourcestf2py_sourcest
pyrex_sourcestfilter_py_filesR0RIRJR�R�RlR�(R:RcR�tfullnametmodpathR.tpy_filesR�R)tmoduleR�((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyR_:s2	
"	
c
Cs^g}g}x7|D]/}t|�r5|j|�q|j|�qW|sP|S|jrrt|�rr|j}nKt|�r�|d}n	|j}tjj|j	g|j
d�d �}|j|�x�|D]�}|||�}|s�q�nt|�r5g|D]}	tj
d|	f�^q|j|�q�tj
d|f�|j|�q�W|S(NiRei����s  adding '%s' to sources.(RRlR*RR�R�RIRJRKR'RNtmkpathRRQRs(
R:R�t	extensiontnew_sourcestfunc_sourcesRRyR�tfuncR{((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyR�fs4

	

'cCs|j|dg�S(Ns.py(tfilter_files(R:R�((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyR��scCs|j|dddg�S(Ns.hs.hpps.inc(R�(R:R�((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyR��scCshg}g}xO|D]G}tjj|�\}}||krM|j|�q|j|�qW||fS(N(RIRJR�Rl(R:R�textsR�RxRtbaseRc((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyR��s
cCs�g}t|�r;|djd�}|djd�}n|j}|j}x�|D]�}tjj|�\}}|dkr�|jr�tjj|�}	nt	|j
tjj|��}	|j|	�tjj|	tjj
|��}
|jst|g||
�ryt|�r3tjd|
�t|�}ntjd|
�t|�}t|
d�}|j|�|j�nt|
�r�tjj|
�}
|
|kr�tjd|
�|j|
�q�n|j|
�qT|j|�qTW|S(	Nitdependstinclude_dirss.srcsfrom_template:> %ssconv_template:> %sRs  adding '%s' to include_dirs.(RR�R�R�RIRJR�R*R~RR'R�RKR�R(Rt_f_pyf_ext_matchRRQtprocess_f_filetprocess_c_fileRRRt_header_ext_matchRl(R:R�R�R�R�R�RR�Rct
target_dirttarget_filetoutstrtfidR ((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyR��s>		
	
!

c	Cs�g}|jjd�d}xg|D]_}tjj|�\}}|dkru|j||||�}|j|�q#|j|�q#W|S(NRei����s.pyx(R�RNRIRJR�tgenerate_a_pyrex_sourceRl(	R:R�R�R�text_nameRR�RcR�((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyR��s
	c	Cs||jst�r(tjj|�}nt|jtjj|��}tjj||d�}|g|j}|j	s�t
||d�rxt�r6ddl}tj
d|�|j|�|jjjd|jjjd|jd|�}	|jjj|d|	�}
|
jd	krutd
|
j|f��quqxtjj|�rbtjd||f�qxtd|f��n|S(
Ns.cRi����spyrexc:> %stdefaultstinclude_pathtoutput_filetoptionsis'%d errors while compiling %r with PyrexsFPyrex required for compiling %r but not available, using old target %rs0Pyrex required for compiling %r but notavailable(R*RRIRJR~RR'RKR�R(RRRRQR�tCompilertMaintCompilationOptionstdefault_optionsR�Rt
num_errorsRtisfileRL(R:R�R�RR�R�R�R�R
R�tpyrex_result((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyR��s2	
				c
Cs�g}g}g}i}g}|jjd�d}d}	x�|D]�}
tjj|
�\}}|dkr|jr�tjj|�}
nt|jtjj|��}
tjj	|
�r	t
|
�}||kr�td|
||f��ntjj|
|d�}n�t
jd|
�|}d}	tjj|
|d�}tjj	|�s�t
jd	||f�tjj|�}
tjj|
|d�}tjj	|�s�td
|f��nt
jd|�n|j|
�|j|
�|||
<|j|�qAt|�r|j|
�qA|j|
�qAW|p9|s@|Sx|D]}|j|�qGW|j|j}|jjr�xH|jjD]7\}}||jkr�|j|jdg��q�q�Wnt
jd
|�|r�t|�dkrtd|f��n|d}
||
}tjj|�p-d}
|
g|j}|js[t||d�r�|	r�t
jd|
�ddl}|jj |d|
|
g�q�t
jd|
�n	t!|�r�|d}n	|j}tjj|jg|jd�d �}
tjj|
|d�}|j|�||j}|jsLt||d�r�|	r�t
jd|�|j|
�ddl}|jj |dd|
gd|g|�nt
jd|�tjj	|�s�t"d|f��ntjj|jd�}tjj|jd�}t
jd|�|j|�|j|j#krnt
jd|j�|j#j|j�n|	s%ddl}tjj|jj$�}tjj|dd�}tjj|dd�}t%||�s�t%||�ru|jtjj|��|j&||�|j&||�qunPtjj	|�sMtd|f��ntjj	|�sutd|f��nx`dd gD]R}tjj|
||�}tjj	|�r�t
jd|�|j|�q�q�W||S(!NRei����is.pyfs;mismatch of extension names: %s provides %r but expected %rsmodule.cs.  source %s does not exist: skipping f2py'ing.isd  target %s does not exist:
   Assuming %smodule.c was generated with "build_src --inplace" command.s
%r missings&   Yes! Using %r as up-to-date target.tf2py_optionssf2py options: %ssConly one .pyf file is allowed per extension module but got more: %rRsf2py: %ss--build-dirs+  skipping '%s' f2py interface (up-to-date)s	f2py:> %ss--lowers-ms3  skipping f2py fortran files for '%s' (up-to-date)s!f2py target file %r not generatedsfortranobject.csfortranobject.hs  adding '%s' to sources.s  adding '%s' to include_dirs.R=sf2py target_c file %r not foundsf2py target_h file %r not founds-f2pywrappers.fs-f2pywrappers2.f90('R�RNRIRJR�R*R~RR'R�tget_f2py_modulenameRRKRtdebugRLRQRlR
R�R�R5RBRERsR�R�R�R(Rt
numpy.f2pytf2pytrun_mainRRR�t__file__Rt	copy_file(R:R�R�R�R�t	f_sourcestf2py_targetsttarget_dirsR�t	skip_f2pyRR�RcR�R�R�R R�R�R�tnumpyttarget_cttarget_htsource_ctsource_htname_exttfilename((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyR��s�
				



#


	


	%	
	cCs�g}g}i}g}g}d}d|jkrRd}	t}
|jjd�n$|jrjd}	t}
nd}	t}
d}|jjd�d}x�|D]�}
tj	j
|
�\}}|dkre|jr�tj	j|�}|j
}n$t|jtj	j|��}|}tj	j|
�rWt|
�}||dkr\td	|
||df��n|	dkr�t|
�}	|	dk}
|
r5d
}q5n�t|
�}|dkr�tjd|
|	f�|
r5d
}q5nb|	|kr5tjd|	|
|f�|dkr!tjd
�t}
d
}q5tjd|
�ntj	j|d||f�}n�tjd|
�|d}d}t||�}tj	j|�s
tjd||f�tj	j|�}t||�}tj	j|�s�td|f��ntjd|�n|j|�|j|�|jtj	j||d��|j|
�|d||
<q�|j|
�q�W|s�|S|r�||Sx|D]}|j|�q�W|jp�|j�}|dg|j}|
r�|jd�nx"|jD]}|jd|�q�Wx�|D]�}
||
}|
g|j}|jsQt||d�r�tj dtj	j!|�|
rudpxd|
f�|j"||jd|d||
g�qtj#d|
�qW||S(Ns.cs-c++sc++iRei����s.iis;mismatch of extension names: %s provides %r but expected %rs.cpps>source %r does not define swig target, assuming %s swig targets0expected %r but source %r defines %r swig targetsAresetting swig target to c++ (some targets may have .c extension)s$assuming that %r has c++ swig targets	%s_wrap%ss.  source %s does not exist: skipping swig'ing.si  target %s does not exist:
   Assuming %s_wrap.{c,cpp} was generated with "build_src --inplace" command.s
%r missings&   Yes! Using %r as up-to-date target.s.pys-pythons-IRs%s: %ss++ts-os-outdirs+  skipping '%s' swig interface (up-to-date)($R7RtremoveR8R,R	R�RNRIRJR�R*R~R�RR'R�tget_swig_modulenameRtget_swig_targetRRLRKt_find_swig_targetRlR�R9t	find_swigR�R�R(RRQR�tspawnR�(R:R�R�R�R�tswig_targetsR�R�t
target_extttyptis_cppt	skip_swigR�RR�RcR�t
py_target_dirR�ttyp2R�R R9tswig_cmdRR�((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyR�ys�		
			
		
		

 



$	(s
build-src=R sdirectory to "build" sources toN(s
f2py-opts=Ns!list of f2py command line options(sswig=Nspath to the SWIG executable(s
swig-opts=Ns!list of SWIG command line options(sswig-cppNsAmake SWIG create C++ files (default is autodetected from sources)(s
f2pyflags=Ns3additional flags to f2py (use --f2py-opts= instead)(s
swigflags=Ns3additional flags to swig (use --swig-opts= instead)(sforceR)s2forcibly build everything (ignore file timestamps)(t__name__t
__module__tdescriptionR,tuser_optionstboolean_optionsthelp_optionsR;RWRYRXR`R�RaR\R]R_R�R�R�R�R�R�R�R�R�(((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyR'2sB
		:			$					,	'			%			�s".*[.](f90|f95|f77|for|ftn|f|pyf)\Zs.*[.](inc|h|hpp)\ZsQ\s*%module\s*(.*\(\s*package\s*=\s*"(?P<package>[\w_]+)".*\)|)\s*(?P<name>[\w_]+)s-[*]-\s*c\s*-[*]-s-[*]-\s*c[+][+]\s*-[*]-cCsYt|d�}d}|j�}t|�r6d}nt|�rKd}n|j�|S(NRsc++RT(RR,treadlinet_has_cpp_headert
_has_c_headerR(RR)tresulttline((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyR��s		
cCsqt|d�}t|d|j�}d}x6|�D]+}t|�}|r4|jd�}Pq4q4W|j�|S(NRt
xreadlinesR�(RRPRR,t_swig_module_name_matchRR(RR)tf_readlinesR�R�R%((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyR�s
cCsPxIddgD];}tjj|d||f�}tjj|�r
Pq
q
W|S(Ns.cpps.cs	%s_wrap%s(RIRJRKR�(R�R�RcR((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyR�s
s%\s*python\s*module\s*(?P<name>[\w_]+)s4\s*python\s*module\s*(?P<name>[\w_]*?__user__[\w_]*)cCs�d}t|�}t|d|j�}xH|�D]=}t|�}|r1t|�r[q1n|jd�}Pq1q1W|j�|S(NR�R�(R,RRPRt_f2py_module_name_matcht_f2py_user_module_name_matchRR(RR�R)RR�R%((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyR�s
(/t__doc__RIRRGRMR�tdistutils.commandRtdistutils.dep_utilRRtdistutils.utilRtdistutils.errorsRRRtnumpy.distutilsRRiR
RRRRtnumpy.distutils.from_templateRR�tnumpy.distutils.conv_templateR�R&R'RtItmatchR�R�RRR�R�R�R�R�RRR�(((sG/usr/lib64/python2.7/site-packages/numpy/distutils/command/build_src.pyt<module>s@	
(	���