Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/site-packages/numpy/f2py/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/site-packages/numpy/f2py/__pycache__/f2py2e.cpython-35.pyc



(��^fY�@s�dZddlmZmZmZddlZddlZddlZddlZddl	m
Z
ddl	mZddl	mZddl	m
Z
dd	l	mZdd
l	mZddl	mZejZejjZejZe
jZyddlmZWnek
rdZYnXd
eefZdd�Zdd�Zdd�Zdd�Zdd�Z ddd�Z!dd�Z"dd�Z#dd�Z$dS) a�

f2py2e - Fortran to Python C/API generator. 2nd Edition.
         See __usage__ below.

Copyright 1999--2011 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@cens.ioc.ee>
Permission to use, modify, and distribute this software is given under the
terms of the NumPy License.

NO WARRANTY IS EXPRESSED OR IMPLIED.  USE AT YOUR OWN RISK.
$Date: 2005/05/06 08:31:19 $
Pearu Peterson

�)�division�absolute_import�print_functionN�)�crackfortran)�rules)�cb_rules)�auxfuncs)�cfuncs)�f90mod_rules)�__version__zN/Aa�Usage:

1) To construct extension module sources:

      f2py [<options>] <fortran files> [[[only:]||[skip:]] \
                                        <fortran functions> ] \
                                       [: <fortran files> ...]

2) To compile fortran files and build extension modules:

      f2py -c [<options>, <build_flib options>, <extra options>] <fortran files>

3) To generate signature files:

      f2py -h <filename.pyf> ...< same options as in (1) >

Description: This program generates a Python C/API file (<modulename>module.c)
             that contains wrappers for given fortran functions so that they
             can be called from Python. With the -c option the corresponding
             extension modules are built.

Options:

  --2d-numpy       Use numpy.f2py tool with NumPy support. [DEFAULT]
  --2d-numeric     Use f2py2e tool with Numeric support.
  --2d-numarray    Use f2py2e tool with Numarray support.
  --g3-numpy       Use 3rd generation f2py from the separate f2py package.
                   [NOT AVAILABLE YET]

  -h <filename>    Write signatures of the fortran routines to file <filename>
                   and exit. You can then edit <filename> and use it instead
                   of <fortran files>. If <filename>==stdout then the
                   signatures are printed to stdout.
  <fortran functions>  Names of fortran routines for which Python C/API
                   functions will be generated. Default is all that are found
                   in <fortran files>.
  <fortran files>  Paths to fortran/signature files that will be scanned for
                   <fortran functions> in order to determine their signatures.
  skip:            Ignore fortran functions that follow until `:'.
  only:            Use only fortran functions that follow until `:'.
  :                Get back to <fortran files> mode.

  -m <modulename>  Name of the module; f2py generates a Python/C API
                   file <modulename>module.c or extension module <modulename>.
                   Default is 'untitled'.

  --[no-]lower     Do [not] lower the cases in <fortran files>. By default,
                   --lower is assumed with -h key, and --no-lower without -h key.

  --build-dir <dirname>  All f2py generated files are created in <dirname>.
                   Default is tempfile.mkdtemp().

  --overwrite-signature  Overwrite existing signature file.

  --[no-]latex-doc Create (or not) <modulename>module.tex.
                   Default is --no-latex-doc.
  --short-latex    Create 'incomplete' LaTeX document (without commands
                   \documentclass, \tableofcontents, and \begin{document},
                   \end{document}).

  --[no-]rest-doc Create (or not) <modulename>module.rst.
                   Default is --no-rest-doc.

  --debug-capi     Create C/API code that reports the state of the wrappers
                   during runtime. Useful for debugging.

  --[no-]wrap-functions    Create Fortran subroutine wrappers to Fortran 77
                   functions. --wrap-functions is default because it ensures
                   maximum portability/compiler independence.

  --include-paths <path1>:<path2>:...   Search include files from the given
                   directories.

  --help-link [..] List system resources found by system_info.py. See also
                   --link-<resource> switch below. [..] is optional list
                   of resources names. E.g. try 'f2py --help-link lapack_opt'.

  --quiet          Run quietly.
  --verbose        Run with extra verbosity.
  -v               Print f2py version ID and exit.


numpy.distutils options (only effective with -c):

  --fcompiler=         Specify Fortran compiler type by vendor
  --compiler=          Specify C compiler type (as defined by distutils)

  --help-fcompiler     List available Fortran compilers and exit
  --f77exec=           Specify the path to F77 compiler
  --f90exec=           Specify the path to F90 compiler
  --f77flags=          Specify F77 compiler flags
  --f90flags=          Specify F90 compiler flags
  --opt=               Specify optimization flags
  --arch=              Specify architecture specific optimization flags
  --noopt              Compile without optimization
  --noarch             Compile without arch-dependent optimization
  --debug              Compile with debugging information

Extra options (only effective with -c):

  --link-<resource>    Link extension module with <resource> as defined
                       by numpy.distutils/system_info.py. E.g. to link
                       with optimized LAPACK libraries (vecLib on MacOSX,
                       ATLAS elsewhere), use --link-lapack_opt.
                       See also --help-link switch.

  -L/path/to/lib/ -l<libname>
  -D<define> -U<name>
  -I/path/to/include/
  <filename>.o <filename>.so <filename>.a

  Using the following macros may be required with non-gcc Fortran
  compilers:
    -DPREPEND_FORTRAN -DNO_APPEND_FORTRAN -DUPPERCASE_FORTRAN
    -DUNDERSCORE_G77

  When using -DF2PY_REPORT_ATEXIT, a performance report of F2PY
  interface is printed out at exit (platforms: Linux).

  When using -DF2PY_REPORT_ON_ARRAY_COPY=<int>, a message is
  sent to stderr whenever F2PY interface makes a copy of an
  array. Integer <int> sets the threshold for array sizes when
  a message should be shown.

Version:     %s
numpy Version: %s
Requires:    Python 2.3 or higher.
License:     NumPy license (see LICENSE.txt in the NumPy source code)
Copyright 1999 - 2011 Pearu Peterson all rights reserved.
http://cens.ioc.ee/projects/f2py2e/cCsNggggf\}}}}d;\}}}}}	}
}}d}
d<}d}d}d}d}g}d=\}}d|ddddi}xT|D]L}|dkr�q�|dkr�d}q�|d	kr�d>}q�|d
kr�d}q�|dd�dkr|j|dd��q�|d
kr*d}q�|dkr?d}	q�|dkrTd}q�|dkrid}
q�|dkr�|
d7}
q�|dkr�d}q�|dkr�d}q�|dkr�d}q�|dkr�d}q�|dkr�d}q�|dkrd}q�|dkrd|d<q�|dkr.d}q�|dkrCd}q�|dkr\d|d<q�|dkrqd}q�|dkr�d}q�|dd �d!kr�tt�tj�q�|d"kr�d}q�|dd�d#kr$tjd$j|d%d?��d&|dd�tj|d%d@�<q�|dd'�d(krMtd)�d}
q�|dd'�d*krld}
q�|dd+kr�t	d,t
|��tj�q�|r�d}|}q�|r�d}|}q�|	r�d}	|}q�|
rd}
|j|jt
j��q�|rd}||d<q�|r6d}||d<q�|dkr�y!t|�j�|j|�Wq�tk
r�}zt	d-t|�|f�WYdd}~Xq�Xq�|dAkr�|j|�q�|dkr�|j|�q�W|r
|r
|r
tt�tj�t
jj|�s=|
s0td.|�t
j|�|rXt
jj||�}|r�t
jj|�r�d|kr�t	d/|�tj�||d0<|
|d1<|dBkr�|r�d|d2<n
||d2<|r�||d3<|r�||d4<|r||d5<|r||d6<||d7<||d8<||d9<||d<||d:<||fS)CNrr�.�	buildpath�coutput�f2py_wrapper_output�zonly:zskip:�:�z--debug-z--lowerz--build-dirz
--no-lowerz--quietz	--verbosez--latex-docz--no-latex-docz
--rest-docz
--no-rest-docz--wrap-functionsz--no-wrap-functionsz
--short-latexZ
shortlatexz	--coutputz--f2py-wrapper-outputz--overwrite-signaturezh-overwritez-hz-m�z-vz--show-compilersz-include�userincludes�	z	#include �z--include_pathszHf2py option --include_paths is deprecated, use --include-paths instead.
z--include-paths�-zUnknown option %s
z!IOError: %s. Skipping file "%s".
zCreating build directory %szFSignature file "%s" exists!!! Use --overwrite-signature to overwrite.
�debug�verbosezdo-lower�module�	signsfile�	onlyfuncs�	skipfuncs�
dolatexdoc�	dorestdoc�	wrapfuncs�
include_paths)rrrrrrrr���)NNr#r#r#r#r#)�append�print�f2py_version�sys�exitr
Zoutneedsr�outmess�errmess�repr�extend�split�os�pathsep�open�close�IOError�str�	__usage__�path�isdir�mkdir�join�isfile)Z	inputline�filesrrr�f�f2Zf3Zf5Zf6Zf7Zf8Zf9rZdolcrr r!rr"r�
modulename�options�lZdetail�r@�D/opt/alt/python35/lib64/python3.5/site-packages/numpy/f2py/f2py2e.py�
scaninputline�s
							
						
		
		

	(		
			

*


$













rBcCs�|t_|dt_|dt_d|kr<|dt_d|krU|dt_d|krn|dt_|dtjdd�<|dt_	tj|�}d|kr%t
d	|d�tj|�}|ddd�dkr�tj
j|�n*t|dd�}|j|�|j�|d
dkr[xB|D]}d|d|d
<q<Wnx|D]}|d
|d
<qbW|ddkr�xB|D]}d|d|d<q�Wnx|D]}|d|d<q�W|S)Nrrrrrr"zdo-lowerrzSaving signatures to file "%s"
��stdout�wrz
%smodule.c�namerz%s-f2pywrappers.fi����)rr>rrrZ
f77modulenamerrr"Zdolowercaser)Z
crack2fortranr'rD�writer0r1)r:r>�postlistZpyfr;�modr@r@rA�callcrackfortran<s>	











rJc	Cstj�td�ggi}}}x�tt|��D]�}d||dkritj||�q;d||kr�xK||dj�D]5}||kr�g||<||j||d�q�W|j||�|j||d�q;Wi}xtt|��D]}|||krYtd||dj	dd�|||D��f�q
g}d||kr�xi||dj�D]S}||kr�||kr�|j||j
|��q�td	|||f�q�Wi|||<t|||tj
|||��q
W|S)
NzBuilding modules...
�__user__rF�usez+	Skipping module "%s" which is used by %s.
�,cSsg|]}d|�qS)z"%s"r@)�.0�sr@r@rA�
<listcomp>ts	z buildmodules.<locals>.<listcomp>z:	Module "%s" uses nonexisting "%s" which will be ignored.
)r
Zbuildcfuncsr)�range�lenrZbuildcallbacks�keysr$r8�index�dict_appendrZbuildmodule)�lst�modulesZmnames�isusedby�i�u�retZumr@r@rA�buildmodulesas8


3)r\cCslxe|j�D]W\}}||kr/g||<t|t�rS|||||<q
||j|�q
WdS)N)�items�
isinstance�listr$)Zd_outZd_in�k�vr@r@rArU�s
rUc	Cs�tj�tjjtjjtj��}tjj|dd�}tjj|dd�}t	|�\}}|t
_t||�}i}xxt
t|��D]d}d||kr�xK||dj�D]5}	|	|kr�g||	<||	j||d�q�Wq�Wx�t
t|��D]�}||ddkrd||dkr||d|krtd	||dd
jdd�|||dD��f�qWd
|kr�|ddkr�td�tdtjjtjd�|d
f�dSxbt
t|��D]N}||ddkrd|kr5td�tdt||d���qW|dt
_|t_|dt
_t|�}
x1|
j�D]#}t|
|d|d|i�q�W|
S)zwRun f2py as if string.join(comline_list,' ') is used as a command line.
    In case of using -h flag, return None.
    �srczfortranobject.hzfortranobject.crLrF�blockz
python modulerKz<Skipping Makefile build for module "%s" which is used by %s
rMcSsg|]}d|�qS)z"%s"r@)rNrOr@r@rArP�s	zrun_main.<locals>.<listcomp>rrrzKStopping. Edit the signature file and then run f2py on the signature file: z%s %s
rNzJTip: If your original code is Fortran source then you must use -m option.
z2All blocks must be python module blocks but got %srr!Zcsrc�h)rZreset_global_f2py_varsr.r5�dirname�abspathr
�__file__r8rBr	r>rJrQrRrSr$r)�basenamer'�argvr*�	TypeErrorr+Zdebugoptionsrr!r\rU)Zcomline_listZf2pydirZfobjhsrcZfobjcsrcr:r>rHrXrYrZr[Zmnr@r@rA�run_main�sP
!	
!(<%
	
!rkc	Cs�gg}}tj|d|d�j}|r@t|�}nd}xNdd�|D�D]9}||�r�|j||d��qZ|j|�qZW||fS)z,
    Filter files by prefix and suffix.
    z.*z\ZrcSsg|]}|j��qSr@)�strip)rN�xr@r@rArP�s	z filter_files.<locals>.<listcomp>N)�re�compile�matchrRr$)	�prefix�suffixr:�
remove_prefix�filtered�restrp�ind�filer@r@rA�filter_files�s
rxcCs%tjjtjj|j��}|S)N)r.r5rerg)r�pr@r@rA�
get_prefix�s!rzc$s�ddl}tjjd�}tj|=d}ytjjd�}Wntk
r^d}YnX|dk	r�tj|d}tj|d=tj|=nd}|j�}tjd���fdd�tjdd�D��
�
fd	d�tjD�t_�
rd
d��
D��
tjd���fdd�tjdd�D���fd
d�tjD�t_g�d}xatjdd�D]L}|dFkr�d}n|dkr�d}|s�|dkr��j|�q�W�r��dGdkr��jd��j	���fdd�tjD�t_tjd���fdd�tjdd�D���fdd�tjD�t_tjd���fdd�tjdd�D���fdd�tjD�t_g}x
�D]}d}|dt
|��|kr�ddlm}	|	j
�t|	jj��}
|t
|�d�j�}}||
kr�i}
y|
|}WnBtk
r�||
j�kr�td|t
|�d��YnX|}�j|�}d|�|<q�q�Wx$|D]}�j|�}�|=q�Wt
��dks/tt����tjd���fdd�tjdd�D��	�	fdd�tjD�t_d�kr��	jd�d }tjdd�}x~d!d"gD]p}|tjkr�tjj|�}�j	tj||d��tj|d=tj|=tjdd�}q�Wd#tjkr�tjjd#�}tj|d}tj|d=tj|=tjdd�}nVdd$lm}td%d&|�\}}||}x!|D]}||�}|r�Pq�Wtd%d'|�\}}td(d%|d)d�\}}td*d%|d)d�\}}td+d%|d)d�\}}td,d%|d)d�\}}td-d%|d)d�\}}x�tt
|��D]m}||jd.d�}t
|�dkr�|jd�t
|�dkr
t|�||<q�td/|�q�Wdd0lm}i}|rS|j	|jd1g��dd2l m!}m"}d3|d4|d1|d5|d6|d7|d8|d9|d:�i	}�
r�dd;l#m$} xA�
D]9}!||!�}|s�t%d<t|!��| ||�q�W||�}"tjdg�	t_tjj	d=d>|d?|d@dAg��rdtjj	dBg���r�tjj	dCg��|dD|"g�|r�t&j'j(|�r�ddl)}#t%dE|�|#j*|�dS)Hz 
    Do it all in one call!
    rNz-cz--build-dirrz
[-][-]link[-]cs%g|]}�j|�r|�qSr@)rp)rN�_m)�_reg1r@rArP�s	zrun_compile.<locals>.<listcomp>cs"g|]}|�kr|�qSr@r@)rNr{)�
sysinfo_flagsr@rArP�s	cSs g|]}|dd��qS)�Nr@)rNr;r@r@rArP�s	zF[-][-]((no[-]|)(wrap[-]functions|lower)|debug[-]capi|quiet)|[-]includecs%g|]}�j|�r|�qSr@)rp)rNr{)�_reg2r@rArP�s	cs"g|]}|�kr|�qSr@r@)rNr{)�
f2py_flagsr@rArP�s	�only:�skip:rcs"g|]}|�kr|�qSr@r@)rNr{)�f2py_flags2r@rArPs	z<[-][-]((f(90)?compiler([-]exec|)|compiler)=|help[-]compiler)cs%g|]}�j|�r|�qSr@)rp)rNr{)�_reg3r@rArPs	cs"g|]}|�kr|�qSr@r@)rNr{)�
flib_flagsr@rArPs	zN[-][-]((f(77|90)(flags|exec)|opt|arch)=|(debug|noopt|noarch|help[-]fcompiler))cs%g|]}�j|�r|�qSr@)rp)rNr{)�_reg4r@rArP	s	cs"g|]}|�kr|�qSr@r@)rNr{)�fc_flagsr@rArP
s	z--fcompiler=)�	fcompilerzUnknown vendor: "%s"rz[-][-](verbose)cs%g|]}�j|�r|�qSr@)rp)rNr{)�_reg5r@rArP&s	cs"g|]}|�kr|�qSr@r@)rNr{)�setup_flagsr@rArP's	z--quietZuntitledz--include_pathsz--include-pathsz-m)�get_f2py_modulenamerz[.]pyf([.]src|)z[.](o|a|so)z-Irsz-Lz-lz-Uz-D�=zInvalid use of -D:)�get_info�include_dirs)�setup�	ExtensionrF�sources�library_dirs�	libraries�
define_macros�undef_macros�
extra_objects�f2py_options)rUz9No %s resources found in system (try `f2py --help-link`)
�buildz--build-tempz--build-basez--build-platlibr
�	config_fc�	build_ext�ext_moduleszRemoving build directory %s
)r�r�r#)+�tempfiler'rirT�
ValueError�mkdtemprnror$r,rR�numpy.distutilsr��load_all_fcompiler_classesr_�fcompiler_classrS�lower�KeyError�valuesr%�AssertionErrorr+Z!numpy.distutils.command.build_srcr�rxrQr-�tuple�numpy.distutils.system_infor��get�numpy.distutils.corer�r��numpy.distutils.misc_utilrUr)r.r5�exists�shutil�rmtree)$r�rYZremove_build_dir�	build_dir�fl�aZdel_listrOrar�Zallowed_keys�nv�ovZvmapr=r��optnamer�Z	pyf_filesr;r�r�r�r�r�r��
name_valuer�Znum_infor�r��ext_argsrU�n�extr�r@)r|rr�r�r�r�r�r�r�r�r}rA�run_compile�s


&	&	

	&	&

 
#
$&





r�cCs�dtjdd�krDtjjd�ddlm}|�dSdtjdd�krgt�nttjdd��dS)Nz--help-linkrr)�show_allz-c)r'ri�remover�r�r�rk)r�r@r@rA�main�s
r�)%�__doc__�
__future__rrrr'r.�pprintrnrrrrr	r
rr�versionr&�stderrrGr*Zshowr)�numpyZ
numpy_version�ImportErrorr4rBrJr\rUrkrxrzr�r�r@r@r@rA�<module>s<			
��%"
1�