Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib64/python3.7/site-packages/numpy/f2py/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/site-packages/numpy/f2py/__pycache__/f2py2e.cpython-37.pyc

B

��FdfY�@s*dZddlmZmZmZddlZddlZddlZddlZddl	m
Z
ddl	mZddl	mZddl	m
Z
dd	l	mZdd
l	mZddl	mZejZejjZejZe
jZyddlmZWnek
r�dZYnXd
eefZdd�Zdd�Zdd�Zdd�Zdd�Z d dd�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/cCs�ggggf\}}}}d\}}}}}	}
}}d}
d}d}d}d}d}g}d\}}|ddd�}�xX|D�]N}|dkrpq`|d	kr~d}q`|d
kr�d}q`|dkr�d}q`|dd�d
kr�|�|dd��q`|dkr�d}q`|dkr�d}	q`|dkr�d}q`|dk�r�d}
q`|dk�r|
d7}
q`|dk�rd}q`|dk�r,d}q`|dk�r<d}q`|dk�rLd}q`|dk�r\d}q`|dk�rld}q`|dk�r�d|d<q`|dk�r�d}q`|dk�r�d}q`|dk�r�d|d<q`|dk�r�d}q`|d k�r�d}q`|dd!�d"k�r�tt�t��q`|d#k�rd}q`|dd�d$k�rRtjd%�|d&d��d'|dd�tj|d&d�<q`|dd(�d)k�rrtd*�d}
q`|dd(�d+k�r�d}
q`|dd,k�r�t	d-t
|��t��q`|�r�d}|}q`|�r�d}|}q`|	�r�d}	|}q`|
�rd}
|�|�t
j��q`|�rd}||d.<q`|�r(d}||d/<q`|dk�r�yt|���|�|�Wn8tk
�r�}zt	d0t|�|f�Wdd}~XYnXq`|dk�r�|�|�q`|dkr`|�|�q`W|�s�|�s�|�s�tt�t��t
j�|��s|
�s�td1|�t
�|�|�rt
j�||�}|�rFt
j�|��rFd|k�rFt	d2|�t��||d3<|
|d4<|dk�rp|�spd|d5<n||d5<|�r�||d6<|�r�||d7<|�r�||d8<|�r�||d9<||d:<||d;<||d<<||d=<||d><||fS)?N)rrrrrrrrr���r�.)NN)�	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
rrz!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�	wrapfuncsr�
include_paths)�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�f2Zf3Zf5Zf6Zf7Zf8Zf9rZdolcr r!r"rr#r�
modulename�options�lZdetail�r@�D/opt/alt/python37/lib64/python3.7/site-packages/numpy/f2py/f2py2e.py�
scaninputline�s


















 



$



rBcCst|t_|dt_|dt_d|kr,|dt_d|kr>|dt_d|krP|dt_|dtjdd�<|dt_	t�|�}d|kr�t
d	|d�t�|�}|dd
d�dkr�tj
�|�n t|dd�}|�|�|��|d
dk�rx:|D]}d|d|d
<q�Wnx|D]}|d
|d
<�qW|ddk�rTx<|D]}d|d|d<�q8Wnx|D]}|d|d<�qZW|S)Nrrrrrr#zdo-lowerrzSaving signatures to file "%s"
i�����stdout�wrz
%smodule.c�namerz%s-f2pywrappers.f)rr>rrrZ
f77modulenamerrr#Zdolowercaser)Z
crack2fortranr'rC�writer0r1)r:r>�postlistZpyfr;�modr@r@rA�callcrackfortran<s>












rIc
Cs�t��td�ggi}}}x�tt|��D]�}d||dkrRt�||�q.d||kr�x>||d��D]*}||kr�g||<||�||d�qpW|�||�|�||d�q.Wi}x�tt|��D]�}|||k�rtd||d�	dd�|||D��f�q�g}d||k�r�xX||d��D]D}||k�rf||k�rf|�||�
|��ntd	|||f��q8Wi|||<t|||t�
|||��q�W|S)
NzBuilding modules...
�__user__rE�usez+	Skipping module "%s" which is used by %s.
�,cSsg|]}d|�qS)z"%s"r@)�.0�sr@r@rA�
<listcomp>tsz 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*"r[cCsTxN|��D]B\}}||kr"g||<t|t�r>|||||<q
||�|�q
WdS)N)�items�
isinstance�listr$)Zd_outZd_in�k�vr@r@rArT�s
rTc
Cs"t��tj�tj�tj��}tj�|dd�}tj�|dd�}t	|�\}}|t
_t||�}i}x`t
t|��D]P}d||krlx>||d��D]*}	|	|kr�g||	<||	�||d�q�WqlWxxt
t|��D]h}||ddkr�d||dkr�||d|kr�td	||dd
�dd�|||dD��f�q�Wd
|k�r�|ddk�r|td�tdtj�tjd�|d
f�dSxRt
t|��D]B}||ddk�r�d|k�r�td�tdt||d����q�W|dt
_|t_|dt
_t|�}
x&|
��D]}t|
|||d���qW|
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.crKrE�blockz
python modulerJz<Skipping Makefile build for module "%s" which is used by %s
rLcSsg|]}d|�qS)z"%s"r@)rMrNr@r@rArO�szrun_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>rIrPrQrRr$r)�basenamer'�argvr*�	TypeErrorr+Zdebugoptionsrr"r[rT)Zcomline_listZf2pydirZfobjhsrcZfobjcsrcr:r>rGrWrXrYrZZmnr@r@rA�run_main�sP
 4



rjc	Cszgg}}t�|d|d�j}|r0t|�}nd}x<dd�|D�D]*}||�rd|�||d��qD|�|�qDW||fS)z,
    Filter files by prefix and suffix.
    z.*z\ZrcSsg|]}|���qSr@)�strip)rM�xr@r@rArO�sz filter_files.<locals>.<listcomp>N)�re�compile�matchrQr$)	�prefix�suffixr:�
remove_prefix�filtered�restro�ind�filer@r@rA�filter_files�s

rwcCstj�tj�|j��}|S)N)r.r5rdrf)r�pr@r@rA�
get_prefix�sryc$
s�ddl}tj�d�}tj|=d}ytj�d�}Wntk
rHd}YnX|dk	rvtj|d}tj|d=tj|=nd}|��}t�d���fdd�tjdd�D��
�
fd	d�tjD�t_�
r�d
d��
D��
t�d���fdd�tjdd�D���fd
d�tjD�t_g�d}xPtjdd�D]>}|dk�r8d}n|dk�rFd}|�sV|dk�r$��|��q$W��r��ddk�r���d���	���fdd�tjD�t_t�d���fdd�tjdd�D���fdd�tjD�t_t�d���fdd�tjdd�D���fdd�tjD�t_g}x؈D]�}d}|dt
|��|k�r&ddlm}	|	�
�t|	j���}
|t
|�d���}}||
k�r�i}
y|
|}Wn<tk
�r�||
��k�r�td|t
|�d��YnX|}��|�}d|�|<�q&�q&Wx|D]}��|�}�|=�qWt
��dk�s4tt����t�d���fdd�tjdd�D��	�	fdd�tjD�t_d�k�r��	�d�d }tjdd�}x`d!D]X}|tjk�r�tj�|�}��	tj||d��tj|d=tj|=tjdd�}�q�Wd"tjk�rBtj�d"�}tj|d}tj|d=tj|=tjdd�}nDdd#lm}td$d%|�\}}||}x|D]}||�}|�rlP�qlWtd$d&|�\}}td'd$|dd(�\}}td)d$|dd(�\}}td*d$|dd(�\}}td+d$|dd(�\}}td,d$|dd(�\}}xdtt
|��D]T}||�d-d�}t
|�dk�r4|�d�t
|�dk�rPt|�||<n
td.|��qWdd/lm}i}|�r�|�	|�d0g��dd1l m!}m"}||||||||�d2�	}�
�r�dd3l#m$} x8�
D]0}!||!�}|�s�t%d4t|!��| |f|��q�W|f|�}"tjdg�	t_tj�	d5d6|d7|d8d9g���rJtj�	d:g����rbtj�	d;g��||"gd<�|�r�t&j'�(|��r�ddl)}#t%d=|�|#�*|�dS)>z 
    Do it all in one call!
    rNz-cz--build-dirrz
[-][-]link[-]csg|]}��|�r|�qSr@)ro)rM�_m)�_reg1r@rArO�szrun_compile.<locals>.<listcomp>csg|]}|�kr|�qSr@r@)rMrz)�
sysinfo_flagsr@rArO�scSsg|]}|dd��qS)�Nr@)rMr;r@r@rArO�szF[-][-]((no[-]|)(wrap[-]functions|lower)|debug[-]capi|quiet)|[-]includecsg|]}��|�r|�qSr@)ro)rMrz)�_reg2r@rArO�scsg|]}|�kr|�qSr@r@)rMrz)�
f2py_flagsr@rArO�s)zonly:zskip:rr
csg|]}|�kr|�qSr@r@)rMrz)�f2py_flags2r@rArOsz<[-][-]((f(90)?compiler([-]exec|)|compiler)=|help[-]compiler)csg|]}��|�r|�qSr@)ro)rMrz)�_reg3r@rArOscsg|]}|�kr|�qSr@r@)rMrz)�
flib_flagsr@rArOszN[-][-]((f(77|90)(flags|exec)|opt|arch)=|(debug|noopt|noarch|help[-]fcompiler))csg|]}��|�r|�qSr@)ro)rMrz)�_reg4r@rArO	scsg|]}|�kr|�qSr@r@)rMrz)�fc_flagsr@rArO
sz--fcompiler=)�	fcompilerzUnknown vendor: "%s"rz[-][-](verbose)csg|]}��|�r|�qSr@)ro)rMrz)�_reg5r@rArO&scsg|]}|�kr|�qSr@r@)rMrz)�setup_flagsr@rArO'sz--quietZuntitled)z--include_pathsz--include-pathsz-m)�get_f2py_modulenamerz[.]pyf([.]src|)z[.](o|a|so)z-I)rrz-Lz-lz-Uz-D�=zInvalid use of -D:)�get_info�include_dirs)�setup�	Extension)	rE�sourcesr��library_dirs�	libraries�
define_macros�undef_macros�
extra_objects�f2py_options)rTz9No %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
)+�tempfiler'rhrS�
ValueError�mkdtemprmrnr$r,rQ�numpy.distutilsr��load_all_fcompiler_classesr^�fcompiler_classrR�lower�KeyError�valuesr%�AssertionErrorr+Z!numpy.distutils.command.build_srcr�rwrPr-�tuple�numpy.distutils.system_infor��get�numpy.distutils.corer�r��numpy.distutils.misc_utilrTr)r.r5�exists�shutil�rmtree)$r�rXZremove_build_dir�	build_dir�fl�aZdel_listrNr`r�Zallowed_keys�nv�ovZvmapr=r��optnamer�Z	pyf_filesr;r�r�r�r�r�r��
name_valuer�Znum_infor�r��ext_argsrT�n�extr�r@)r{r~r�r�r�rr�r�r�r�r|rA�run_compile�s





















r�cCsddtjdd�kr4tj�d�ddlm}|�dSdtjdd�krNt�nttjdd��dS)Nz--help-linkrr)�show_allz-c)r'rh�remover�r�r�rj)r�r@r@rA�main�sr�)N)%�__doc__�
__future__rrrr'r.�pprintrmrrrrr	r
rr�versionr&�stderrrFr*Zshowr)�numpyZ
numpy_version�ImportErrorr4rBrIr[rTrjrwryr�r�r@r@r@rA�<module>sB
%"
1
,