HOME


sh-3ll 1.0
DIR:/usr/local/lib64/python3.6/site-packages/numpy/f2py/__pycache__/
Upload File :
Current File : //usr/local/lib64/python3.6/site-packages/numpy/f2py/__pycache__/f2py2e.cpython-36.pyc
3

���h_�@s"dZddlZddlZddlZddlZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lmZddlm
Z
ejZejjZejZe	jZydd
lmZWnek
r�dZYnXd
eefZdd�Zdd�Zdd�Zdd�Zdd�Zd dd�Zdd�Zdd�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

�N�)�crackfortran)�rules)�cb_rules)�auxfuncs)�cfuncs)�f90mod_rules)�__version__)�	capi_mapszN/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'.

  --f2cmap <filename>  Load Fortran-to-Python KIND specification from the given
                   file. Default: .f2py_f2cmap in current directory.

  --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 3.5 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�}�x�|D�]~}|dkrrqb|dkr�d}qb|dkr�dA}qb|dkr�d}qb|dd	�d
kr�|j|d	d��qb|dkr�d}qb|dk�r�d}	qb|d
k�r�d}qb|dk�r�d}qb|dk�r|d7}qb|dk�r"d}qb|dk�r2d}qb|dk�rBd}qb|dk�rRd}qb|dk�rbd}qb|dk�rrd}qb|dk�r�d|d<qb|dk�r�d}qb|dk�r�d}qb|dk�r�d}
qb|dk�r�d|d<qb|dk�r�d}qb|dk�r�d}qb|dd�d k�rtt�tj�qb|d!k�rd}qb|dd	�d"k�rhtjd#j|d$dB��d%|d	d�tj|d$dC�<qb|dd&�d'k�r�td(�d}
qb|dd&�d)k�r�d}
qb|dd*k�r�t	d+t
|��tj�qb|�r�d}|}qb|�r�d}|}qb|	�r�d}	|}qb|
�rd}
|j|jt
j��qb|�r*d}||d,<qb|�r>d}||d-<qb|
�rRd}
||d.<qb|dk�r�y"t|��WdQRX|j|�Wn8tk
�r�}zt	d/t|�|f�WYdd}~XnXqb|dDk�r�|j|�qb|dkrb|j|�qbW|�r|�r|�rtt�tj�t
jj|��s8|�s.td0|�t
j|�|�rLt
jj||�}|�r~t
jj|��r~d|k�r~t	d1|�tj�||d2<||d3<|dEk�r�|�r�d|d4<n||d4<|�r�||d5<|�r�||d6<|�r�||d7<|�r�||d8<||d9<||d:<||d;<||d<<||d=<|jd.d�||fS)FNrr�.)�	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--f2cmapz--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
r
r�f2cmap_filez!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)	rrrrrrrrr���)NNr"r"r"r"r")�append�print�f2py_version�sys�exitrZoutneedsr�outmess�errmess�repr�extend�split�os�pathsep�open�IOError�str�	__usage__�path�isdir�mkdir�join�isfile�
setdefault)Z	inputline�filesrrr�f�f2Zf3Zf5Zf6Zf7Zf8Zf9Zf10rZdolcrrr rr!r�
modulename�options�lZdetail�r?�2/tmp/pip-build-5_djhm0z/numpy/numpy/f2py/f2py2e.py�
scaninputline�s





















 






$



rAcCsx|t_|dt_|dt_d|kr,|dt_d|kr>|dt_d|krP|dt_|dtjdd�<|dt_	tj|�}d|kr�t
d	|d�tj|�}|ddd�dkr�tj
j|�n$t|dd��}|j|�WdQRX|d
dk�rx:|D]}d|d|d
<q�Wnx|D]}|d
|d
<�qW|ddk�rXx<|D]}d|d|d<�q<Wnx|D]}|d|d<�q^W|S)Nrrrrrr!zdo-lowerrzSaving signatures to file "%s"
��stdout�wr
z
%smodule.c�namerz%s-f2pywrappers.fi����)rr=rrrZ
f77modulenamerrr!Zdolowercaser(Z
crack2fortranr&rC�writer/)r9r=�postlistZpyfr:�modr?r?r@�callcrackfortranFs<











rIc	Cs�tj�td�ggi}}}x�tt|��D]�}d||dkrRtj||�q.d||kr�x>||dj�D]*}||kr�g||<||j||d�qpW|j||�|j||d�q.Wi}x�tt|��D]�}|||k�rtd||dj	dd�|||D��f�q�g}d||k�r�xX||dj�D]D}||k�rf||k�rf|j||j
|��ntd	|||f��q8Wi|||<t|||tj
|||��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?r@�
<listcomp>}sz buildmodules.<locals>.<listcomp>z:	Module "%s" uses nonexisting "%s" which will be ignored.
)rZbuildcfuncsr(�range�lenrZbuildcallbacks�keysr#r6�index�dict_appendrZbuildmodule)�lst�modulesZmnames�isusedby�i�u�retZumr?r?r@�buildmodulesjs8*"r[cCsTxN|j�D]B\}}||kr"g||<t|t�r>|||||<q
||j|�q
WdS)N)�items�
isinstance�listr#)Zd_outZd_in�k�vr?r?r@rT�s
rTc	Cs0tj�tjjtjjtj��}tjj|dd�}tjj|dd�}t	|�\}}|t
_tj
|d�t||�}i}x`tt|��D]P}d||krzx>||dj�D]*}	|	|kr�g||	<||	j||d�q�WqzWxxtt|��D]h}||ddko�d	||dkr�||d|kr�td
||ddjdd
�|||dD��f�q�Wd|k�r�|ddk�r�td�tdtjjtjd�|df�dSxRtt|��D]B}||ddk�r�d|k�r�td�tdt||d����q�W|dt
_|t_|dt
_t|�}
x&|
j�D]}t|
|||d���qW|
S)aJ
    Equivalent to running::

        f2py <args>

    where ``<args>=string.join(<list>,' ')``, but in Python.  Unless
    ``-h`` is used, this function returns a dictionary containing
    information on generated modules and their dependencies on source
    files.  For example, the command ``f2py -m scalar scalar.f`` can be
    executed from Python as follows

    You cannot build extension modules with this function, that is,
    using ``-c`` is not allowed. Use ``compile`` command instead

    Examples
    --------
    .. include:: run_main_session.dat
        :literal:

    �srczfortranobject.hzfortranobject.crrKrE�blockz
python modulerJz<Skipping Makefile build for module "%s" which is used by %s
rLcSsg|]}d|�qS)z"%s"r?)rMrNr?r?r@rO�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-r3�dirname�abspathr�__file__r6rArr=r
Zload_f2cmap_filerIrPrQrRr#r(�basenamer&�argvr)�	TypeErrorr*Zdebugoptionsrr r[rT)Zcomline_listZf2pydirZfobjhsrcZfobjcsrcr9r=rGrWrXrYrZ�mnr?r?r@�run_main�sR
 4



rkc	Cszgg}}tj|d|d�j}|r0t|�}nd}x<dd�|D�D]*}||�rd|j||d��qD|j|�qDW||fS)z,
    Filter files by prefix and suffix.
    z.*z\ZrcSsg|]}|j��qSr?)�strip)rM�xr?r?r@rO�sz filter_files.<locals>.<listcomp>N)�re�compile�matchrQr#)	�prefix�suffixr9�
remove_prefix�filtered�restrp�ind�filer?r?r@�filter_files�s

rxcCstjjtjj|j��}|S)N)r-r3rdrf)r�pr?r?r@�
get_prefix�srzc$s�ddl}tjjd�}tj|=d}ytjjd�}Wntk
rHd}YnX|dk	rvtj|d}tj|d=tj|=nd}|j�}tjd���fdd�tjdd�D��
�
fd	d�tjD�t_�
r�d
d��
D��
tjd���fdd�tjdd�D���fd
d�tjD�t_g�d}xPtjdd�D]>}|d@k�r8d}n|dk�rFd}|�sV|dk�r$�j|��q$W��r��dAdk�r��jd��j	���fdd�tjD�t_tjd���fdd�tjdd�D���fdd�tjD�t_tjd���fdd�tjdd�D���fdd�tjD�t_g}x؈D]�}d}|dt
|��|k�r&ddlm}	|	j
�t|	jj��}
|t
|�d�j�}}||
k�r�i}
y|
|}Wn<tk
�r�||
j�k�r�td|t
|�d��YnX|}�j|�}d|�|<�q&�q&Wx|D]}�j|�}�|=�qWt
��dk�s4tt����tjd���fdd�tjdd�D��	�	fdd�tjD�t_d�k�r��	jd�d }tjdd�}x`dBD]X}|tjk�r�tjj|�}�j	tj||d��tj|d=tj|=tjdd�}�q�Wd$tjk�rBtjjd$�}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}||jd/d�}t
|�dk�r4|jd�t
|�dk�rPt|�||<n
td0|��qWdd1lm}i}|�r�|j	|jd2g��dd3l m!}m"}||||||||�d4�	}�
�r�dd5l#m$} x8�
D]0}!||!�}|�s�t%d6t|!��| |f|��q�W|f|�}"tjdg�	t_tjj	d7d8|d9|d:d;g���rJtjj	d<g����rbtjj	d=g��||"gd>�|�r�t&j'j(|��r�ddl)}#t%d?|�|#j*|�dS)Cz 
    Do it all in one call!
    rNz-cz--build-dirrz
[-][-]link[-]csg|]}�j|�r|�qSr?)rp)rM�_m)�_reg1r?r@rOszrun_compile.<locals>.<listcomp>csg|]}|�kr|�qSr?r?)rMr{)�
sysinfo_flagsr?r@rOscSsg|]}|dd��qS)�Nr?)rMr:r?r?r@rO
szF[-][-]((no[-]|)(wrap[-]functions|lower)|debug[-]capi|quiet)|[-]includecsg|]}�j|�r|�qSr?)rp)rMr{)�_reg2r?r@rOscsg|]}|�kr|�qSr?r?)rMr{)�
f2py_flagsr?r@rOs�only:�skip:rcsg|]}|�kr|�qSr?r?)rMr{)�f2py_flags2r?r@rOsz<[-][-]((f(90)?compiler([-]exec|)|compiler)=|help[-]compiler)csg|]}�j|�r|�qSr?)rp)rMr{)�_reg3r?r@rO scsg|]}|�kr|�qSr?r?)rMr{)�
flib_flagsr?r@rO!szN[-][-]((f(77|90)(flags|exec)|opt|arch)=|(debug|noopt|noarch|help[-]fcompiler))csg|]}�j|�r|�qSr?)rp)rMr{)�_reg4r?r@rO$scsg|]}|�kr|�qSr?r?)rMr{)�fc_flagsr?r@rO%sz--fcompiler=)�	fcompilerzUnknown vendor: "%s"rz[-][-](verbose)csg|]}�j|�r|�qSr?)rp)rMr{)�_reg5r?r@rOAscsg|]}|�kr|�qSr?r?)rMr{)�setup_flagsr?r@rOBsz--quietZuntitled�--include_paths�--include-paths�--f2cmapz-m)�get_f2py_modulenamerz[.]pyf([.]src|)z[.](o|a|so)z-I)rsz-Lz-lz-Uz-D�=zInvalid use of -D:)�get_info�include_dirs)�setup�	Extension)	rE�sourcesr��library_dirs�	libraries�
define_macros�undef_macros�
extra_objectsZf2py_options)rTz9No %s resources found in system (try `f2py --help-link`)
�buildz--build-tempz--build-basez--build-platlibrZ	config_fc�	build_ext)�ext_moduleszRemoving build directory %s
)r�r�r")r�r�r�)+�tempfiler&rhrS�
ValueError�mkdtemprnror#r+rQZnumpy.distutilsr�Zload_all_fcompiler_classesr^Zfcompiler_classrR�lower�KeyError�valuesr$�AssertionErrorr*Z!numpy.distutils.command.build_srcr�rxrPr,�tuple�numpy.distutils.system_infor��getZnumpy.distutils.corer�r�Znumpy.distutils.misc_utilrTr(r-r3�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�Zext_argsrT�n�extr�r?)r|rr�r�r�r�r�r�r�r�r}r@�run_compile�s





















r�cCs�dtjdd�kr4tjjd�ddlm}|�dSdtjdd�kr^tjjd�tjd�nldtjdd�kr~tjjd�nLdtjdd�kr�tjjd	�tjjd�n d
tjdd�kr�tjjd
�ndtjdd�kr�t	�nt
tjdd��dS)Nz--help-linkrr)�show_allz
--g3-numpyz*G3 f2py support is not implemented, yet.\nz--2e-numericz
--2e-numarrayz
-DNUMARRAYz
--2e-numpyz-c)r&rh�remover�r��stderrrFr'r#r�rk)r�r?r?r@�main�s$r�)N)"�__doc__r&r-�pprintrnrrrrrrrr	r
�versionr%r�rFr)�showr(ZnumpyZ
numpy_version�ImportErrorr2rArIr[rTrkrxrzr�r�r?r?r?r@�<module>sB
$"
C
,