VfisPdZddlZddlZddlZddlZddlZddlmZddlm Z m Z m Z m Z m Z mZmZmZddl mZe jZe jZejZe jZejdkZded ed Zd Zd Zd ZdZdZddZdZ Gddej!Z"dZ#dZ$dZ%dZ&dZ'ddZ(dZ)dS)ae f2py2e - Fortran to Python C/API generator. 2nd Edition. See __usage__ below. Copyright 1999 -- 2011 Pearu Peterson all rights reserved. Copyright 2011 -- present NumPy Developers. 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. N)f2py_build_generator) __version__auxfuncs capi_mapscb_rulescfuncs crackfortran f90mod_rulesrules)errmess) aJUsage: 1) To construct extension module sources: f2py [] [[[only:]||[skip:]] \ ] \ [: ...] 2) To compile fortran files and build extension modules: f2py -c [, , ] 3) To generate signature files: f2py -h ...< same options as in (1) > Description: This program generates a Python C/API file (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: -h Write signatures of the fortran routines to file and exit. You can then edit and use it instead of . If ==stdout then the signatures are printed to stdout. Names of fortran routines for which Python C/API functions will be generated. Default is all that are found in . Paths to fortran/signature files that will be scanned for in order to determine their signatures. skip: Ignore fortran functions that follow until `:'. only: Use only fortran functions that follow until `:'. : Get back to mode. -m Name of the module; f2py generates a Python/C API file module.c or extension module . Default is 'untitled'. '-include
' Writes additional headers in the C wrapper, can be passed multiple times, generates #include
each time. --[no-]lower Do [not] lower the cases in . By default, --lower is assumed with -h key, and --no-lower without -h key. --build-dir All f2py generated files are created in . Default is tempfile.mkdtemp(). --overwrite-signature Overwrite existing signature file. --[no-]latex-doc Create (or not) 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) 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. --[no-]freethreading-compatible Create a module that declares it does or doesn't require the GIL. The default is --freethreading-compatible for backward compatibility. Inspect the Fortran code you are wrapping for thread safety issues before passing --no-freethreading-compatible, as f2py does not analyze fortran code for thread safety issues. --include-paths ::... Search include files from the given directories. --help-link [..] List system resources found by system_info.py. See also --link- switch below. [..] is optional list of resources names. E.g. try 'f2py --help-link lapack_opt'. --f2cmap Load Fortran-to-Python KIND specification from the given file. Default: .f2py_f2cmap in current directory. --quiet Run quietly. --verbose Run with extra verbosity. --skip-empty-wrappers Only generate wrapper files when needed. -v Print f2py version ID and exit. build backend options (only effective with -c) [NO_MESON] is used to indicate an option not meant to be used with the meson backend or above Python 3.12: --fcompiler= Specify Fortran compiler type by vendor [NO_MESON] --compiler= Specify distutils C compiler type [NO_MESON] --help-fcompiler List available Fortran compilers and exit [NO_MESON] --f77exec= Specify the path to F77 compiler [NO_MESON] --f90exec= Specify the path to F90 compiler [NO_MESON] --f77flags= Specify F77 compiler flags --f90flags= Specify F90 compiler flags --opt= Specify optimization flags [NO_MESON] --arch= Specify architecture specific optimization flags [NO_MESON] --noopt Compile without optimization [NO_MESON] --noarch Compile without arch-dependent optimization [NO_MESON] --debug Compile with debugging information --dep Specify a meson dependency for the module. This may be passed multiple times for multiple dependencies. Dependencies are stored in a list for further processing. Example: --dep lapack --dep scalapack This will identify "lapack" and "scalapack" as dependencies and remove them from argv, leaving a dependencies list containing ["lapack", "scalapack"]. --backend Specify the build backend for the compilation process. The supported backends are 'meson' and 'distutils'. If not specified, defaults to 'distutils'. On Python 3.12 or higher, the default is 'meson'. Extra options (only effective with -c): --link- Link extension module with 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. [NO_MESON] -L/path/to/lib/ -l -D -U -I/path/to/include/ .o .so .a Using the following macros may be required with non-gcc Fortran compilers: -DPREPEND_FORTRAN -DNO_APPEND_FORTRAN -DUPPERCASE_FORTRAN 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=, a message is sent to stderr whenever F2PY interface makes a copy of an array. Integer sets the threshold for array sizes when a message should be shown. Version: z numpy Version: z License: NumPy license (see LICENSE.txt in the NumPy source code) Copyright 1999 -- 2011 Pearu Peterson all rights reserved. Copyright 2011 -- present NumPy Developers. https://numpy.org/doc/stable/f2py/index.html c ggggf\}}}}d\}}}}} } } } d} d}d}d}d}d}d}t|\}}}d\}}|ddd}|D]}|d kr |d krd}|d krd}|d krd}%|dd dkr||d dQ|dkrd}Z|dkrd} c|dkrd}l|dkrd} u|dkr| dz } |dkrd}|dkrd}|dkrd}|dkrd}|dkrd}|dkrd}|dkrd|d<|dkrd} |dkrd} |dkrd} |dkrd|d <|d!krd}|d"krd}|dd#d$kr)ttt j3|d%krd}=|dd d&krQt jd'|d(dd)|d dzt j|d(d<|d*krd+}|dd,kr5td-t|d.t j|rd}|}|rd}|}| rd} |}| r d} ||d/< | r d} ||d0<| r d} ||d1< |dkrn t|5 dddn #1swxYwY||f#t$r!}td2|d3|d4Yd}~d}~wwxYw|dkr|||dkr|||s+|s)|s'ttt jtj|s)| st#d5|d.tj||r tj||}|rItj|r*d |vr&td6|d7t j||d8<||d9<| |d:<|dkr|sd|d;<n||d;<|r||d<<|r||d=<|r||d><|r||d?<||d@<||dA<||dB<||dC<||dD<| |dE<|d1d||fS)FN)rrrrrrrrrTr.)NN) buildpathcoutputf2py_wrapper_outputonly:skip::z--debug---lower --build-dirz --no-lower--quietz --verbosez --latex-docz--no-latex-docz --rest-docz --no-rest-docz--wrap-functionsz--no-wrap-functionsz --short-latex shortlatexz --coutputz--f2py-wrapper-output--f2cmapz--overwrite-signaturez h-overwrite-h-mz-vz--show-compilersz-include userincludes z #include z--skip-empty-wrappersF-zUnknown option  rr f2cmap_filez OSError: z. Skipping file "z". zCreating build directory zSignature file "z4" exists!!! Use --overwrite-signature to overwrite. emptygendebugverbosedo-lowermodule signsfile onlyfuncs skipfuncs dolatexdoc dorestdoc wrapfuncsr include_paths requires_gil)get_newer_optionsappendprint f2py_versionsysexitr outneedsr#r repropenOSError __usage__ospathisdiroutmessmkdirjoinisfile setdefault) inputlinefilesr/r.r)ff2f3f5f6f8f9f10r*r(dolcr0r1r2rr3freethreading_compatibler- modulenameoptionsldetails @c:\PYTHON\DbComparer\venv\Lib\site-packages\numpy/f2py/f2py2e.py scaninputlinerYs)+RR&E9i%;"Ar2r2r2sGH DJIII9J99U9U6M+Y&Iz%&*,,GX X  77  '\\AA '\\AA #XXAA rrUj LL122     )^^DD -  BB ,  DD )^^GG +   qLGG -  JJ " " "JJ ,  II / ! !II $ $ $II ' ' 'II / ! !$%GL ! ! +  BB ) ) )BB *__CC ) ) )%&GM " " $YYBB $YYBB rrUd]] ,    HJJJJ $ $ $BB rrUj ON + 2 21QrT7 ; ; ;+6122+>F !B$ ( ( ) ) )HH qTS[[ 1d1gg111 2 2 2 HJJJJ  BII  BJJ  BII  B!"GI    B-.G) * *  C%&GM " " !VV J!WW Q J J JHFHHqHHHIIIIIIII J "WW   Q     !VV   Q    eJ i  7== # # ? = === > > > 7GLLI66 RW^^I..=3O3O _y _ _ _ a a a  "GJGG GI rzz)z " '&)( )( )( &GL$GK$GK$GK,GO"::GN }d+++ '>s<,J+;J = J+ J J+J J++ K5KKc|t_|dt_|dt_d|vr|dt_d|vr|dt_d|vr|dt_|dtjdd<|dt_ tj|}d|vrtd |dd tj |}|dd dd kr tj |nCt|dd 5}||dddn #1swxYwY|d|D]}|dd|d<n|D] }|d|d<|d|D]}|dd|d<n|D] }|d|d<|D]}|drd|d<d|d<dt_|S)Nr)r*r,r/r.r3r+r-zSaving signatures to file "z" istdoutwrnamezmodule.crz-f2pywrappers.fr4Py_MOD_GIL_USEDgil_usedPy_MOD_GIL_NOT_USEDr)r rUr r)r* f77modulenamer/r.r3 dolowercaserC crack2fortranr9r[writer=)rIrUpostlistpyfrJmods rXcallcrackfortranrhWs|EM )L"9-L7%,X%6 "g!(!5 g!(!5 $+O$ " 4/C OO3C OO!#L Os+E  EEc |tjtdggi}}}|D]}d|dvrtj|!d|vrG|dD],}||vrg||<|||d-||||di}t||D]\}}||vr:td|ddd||Dd Cg} d|vrj|dD]O}||vr3||vr/| || |9td |d |d Pi||<t||tj || |S) NzBuilding modules... __user__r]usez Skipping module "" which is used by ,c3 K|] }d|zV dS)z"%s"N.0ss rX zbuildmodules..s&BBavzBBBBBB. z Module "z" uses nonexisting "z" which will be ignored. ) r buildcfuncsrCrbuildcallbackskeysr6ziprEindex dict_appendr buildmodule) lstmodulesmnamesisusedbyitemuretr,r]ums rX buildmodulesrs6  #$$$ "BXVG ( ( f % %  #D ) ) ) )}}e))++55A((&( QK&&tF|4444 NN4 MM$v, ' ' ' ' CGV,,BB  8   GchhBB8D>BBBBBBBD E E E EB++--88AH}}f '&,,q//":;;;;77717778888CI D 5#4VR#@#@ A A A A Jrtc|D]M\}}||vrg||<t|tr|||z||<2|||NdSN)items isinstancelistr6)d_outd_inkvs rXr{r{sw**,,A E>>E!H a   Qx!|E!HH !HOOA     rtc<tjtjtjt j}tj|dd}tj|dd}t}| |\}}tdd|\}}|j r(d|vr|j }nt||j }|d|gz }t|\} } | t_t#j| dt'| | } i} | D]M} d | vrG| d D],}|| vrg| |<| || d -N| D]Y} | d }| d d krCd |vr?|| vr;dd| |D}t-d|d|dZd| vre| ddkrWt-dt-tjt0jdd| dddS| D]F} | d d kr8d | vrt5dt7dt9| d zG| dt_| t<_| dt_tA| }|D]}tC||||d|S)au Equivalent to running:: f2py where ``=string.join(,' ')``, but in Python. Unless ``-h`` is used, this function returns a dictionary containing information on generated modules and their dependencies on source files. You cannot build extension modules with this function, that is, using ``-c`` is not allowed. Use the ``compile`` command instead. Examples -------- The command ``f2py -m scalar scalar.f`` can be executed from Python as follows. .. literalinclude:: ../../source/f2py/code/results/run_main_session.dat :language: python srczfortranobject.hzfortranobject.cr[.]pyf([.]src|)r r!r'rkr]blockz python modulerjrmc3"K|] }d|dV dS)"Nrorps rXrszrun_main..s*!J!Jq(a(((!J!J!J!J!J!Jrtz$Skipping Makefile build for module "rlr&r-r*rzKStopping. Edit the signature file and then run f2py on the signature file: r NzJTip: If your original code is Fortran source then you must use -m option. z2All blocks must be python module blocks but got %sr)r2)csrch)"r reset_global_f2py_varsr@rAdirnameabspathr __file__rEmake_f2py_compile_parserparse_known_args filter_files module_namevalidate_modulenamerYrrUrload_f2cmap_filerhrxr6rCbasenamer9argvr TypeErrorr< debugoptionsr r2rr{) comline_listf2pydirfobjhsrcfobjcsrcparserargs pyf_files_modnamerIrUrerplistrrusedbyrmns rXrun_mainrs.')))goobgoofo>>??Gw||GU,=>>Hw||GU,=>>H % ' 'F00>>D,$5|DDLIq  ( <    G*4+G w' "<00NE7H w}5666w//HH22 E>>5\&&(( 2 2H$$"$HQK ""5=111144Fm >_ , ,{1J1Jh&&!J!JH[4I!J!J!JJJ3;33(.333444g 9  ! ! ] _ _ _ rw'' 44OOw{7KOOO P P P'' >_ , ,g--acccPU7^$$&'' ' - $G,H"L -H x Chhjj@@CGhX>>???? Jrtcgg}}tj|dz|zdzj}|rt|}nd}d|DD]@}||r|||d+||A||fS)z, Filter files by prefix and suffix. z.*z\Zrc6g|]}|Sro)strip)rqxs rX z filter_files..s ***q***rtN)recompilematchlenr6) prefixsuffixrI remove_prefixfilteredrestrindfiles rXrrsdH Jv~.6 7 7 =E&kk**E*** 5;;  OODJ ' ' ' ' KK     T>rtctjtj|j}|Sr)r@rArr)r,ps rX get_prefixrs* 8899A HrtceZdZddZdS)CombineIncludePathsNctt|dgpg}|dkrtd|dvr)||dn||t ||_dS)Nr3--include_pathszJUse --include-paths or -I instead of --include_paths which will be removed>--include-pathsrr)setgetattrrCupdatesplitaddrr3)selfr namespacevalues option_stringinclude_paths_sets rX__call__zCombineIncludePaths.__call__s ?B G G M2NN - - - ` a a a B B B  $ $V\\#%6%6 7 7 7 7  ! !& ) ) )"&'8"9"9 rtr)__name__ __module__ __qualname__rrortrXrrs(::::::rtrc"tjd}|ddt|ddt|ddt|dd tj|S) NFadd_helpz-Ir3)destactionrrz--freethreading-compatibleftcompat)argparseArgumentParser add_argumentrBooleanOptionalActionrs rX f2py_parserr)s  $e 4 4 4F ?;NOOO )H[\\\ )H[\\\ 4:hNlmmm Mrtcd|}t}||\}}|j}|jg}||j|fS)Nr)rErrrr3r)ilinerrremainipathss rXr5r51sb XXe__ # # % %E ]]F**511LD&  F ! 4=& ((rtctjd}|ddd|ddd gd |d d |S)NFrz--depr6 dependencies)rrz --backendmeson distutils)choicesdefaultr!r)r)rrrrs rXrr:sn  $e 4 4 4F ~FFF  g{-C[YYY =111 Mrtct}|\}}tjdg|zt_|j}t r|dkrt dd}|jpg||jdS)NrrzMCannot use distutils backend with Python>=3.12, using meson backend instead. r)rbackendrT) rrr9rrMESON_ONLY_VERrCrr)rrremaining_argv backend_keys rXpreparse_sysargvrAs& ' 'F!2244D. }~-CH,K+442 3 3 3 )/R&  rtc( !"#$%&'()*+,ddl}t}|d}|d}|d}|d}t|}tjd}tj|=d} tjd}n#t $rd}YnwxYw|3tj|d z}tj|d z=tj|=nd }|}tj d  fd tjd dD,,fd tjDt_,r d ,D,tj d!!fdtjd dD%%fdtjDt_g&d} tjd dD].} | dvrd } n| dkrd} | s| dkr& | /&r!&ddkr& d% &&fdtjDt_tj d""fdtjd dD((fdtjDt_tj d*tj d)*fdtjd dD')fdtjd dD$ts|dks' $$'fdtjDt_g} (D](} d} | dt| | krts|dkrtd>dd lm}|t%|j}| t| dx}}||vr\i} ||}nN#t,$rA||vr(t1d!| t| dd"YnwxYw|}(| }d|z(|<(*| D]} (| }(|=t(d#ksJt3(tj d$##fd%tjd dD++fd&tjDt_d'%vr+ d'tjd d}d(}|tjvrztj|}% tj||d#ztj|d z=tj|=tjd d}t5d)d*|\}}||z}t7||}t5d)d+|\}}t5d,d)|d -\}}t5d.d)|d -\}}t5d/d)|d -\}}t5d0d)|d -\}}t9t|D]|}||d1d }t|d kr| dt|d#krt=|||<lt1d2|}|dkr|sutd3% d4t?d5d5 %d6|d5d5 |nMt?d5d5 %d5d5 |tC|\}}}||||||||||%,'(+|d|i}| dS)7z Do it all in one call! rNrTuntitledrr-crrz--link-c>g|]}||Sror)rq_m_reg1s rXrzrun_compile..us(BBBB%++b//BRBBBrtcg|]}|v| Sroro)rqr sysinfo_flagss rXrzrun_compile..vs#AAAr=)@)@)@)@)@rtc"g|] }|dd S)Nro)rqrJs rXrzrun_compile..xs 6661122666rtzg--((no-|)(wrap-functions|lower|freethreading-compatible)|debug-capi|quiet|skip-empty-wrappers)|-includec>g|]}||Sror)rqr_reg2s rXrzrun_compile..|(???u{{2?"???rtcg|]}|v| Sroro)rqr f2py_flagss rXrzrun_compile..}#>>>r:)=)=)=)=)=rt)rrrrcg|]}|v| Sroro)rqr f2py_flags2s rXrzrun_compile..#???r;)>)>)>)>)>rtz4--((f(90)?compiler(-exec|)|compiler)=|help-compiler)c>g|]}||Sror)rqr_reg3s rXrzrun_compile..rrtcg|]}|v| Sroro)rqr flib_flagss rXrzrun_compile..rrtz--f(77|90)flags=z@--((f(77|90)exec|opt|arch)=|(debug|noopt|noarch|help-fcompiler))c>g|]}||Sror)rqrreg_f77_f90_flagss rXrzrun_compile..s-IIIr->-D-DR-H-HIIIIrtc>g|]}||Sror)rqrreg_distutils_flagss rXrzrun_compile..s-RRRb4G4M4Mb4Q4QRrRRRrtrc"g|] }|zv | Sroro)rqrdistutils_flagsfc_flagss rXrzrun_compile..s(PPPrH4N)O)O)O)O)Ortz --fcompiler=zT--fcompiler cannot be used with meson,set compiler with the FC environment variable ) fcompilerzUnknown vendor: "rr"z --(verbose)c>g|]}||Sror)rqr_reg5s rXrzrun_compile..s(@@@" B@2@@@rtcg|]}|v| Sroro)rqr setup_flagss rXrzrun_compile..rrtrrrrz[.](o|a|so|dylib)z-L)rz-lz-Uz-D=zInvalid use of -D:zjUsing meson backend Will pass --lower to f2py See https://numpy.org/doc/stable/f2py/buildtools/meson.html rrz -m )"tempfilerrr9rrz ValueErrormkdtemprrr6extendrrrCnumpy.distutilsrload_all_fcompiler_classesrfcompiler_classrxlowerKeyErrorrr7r<rrrangertuplerrEr5)-rargyrTrr build_backendiremove_build_dir build_dirfladel_listrrrr allowed_keysnvovvmapsources f2cmapoptr_sources extra_objects library_dirs libraries undef_macros define_macros name_value include_dirsrbuilderrrr rrrrrr rrrrs- @@@@@@@@@@@@@rX run_compiler<UsOOO   Dl#J 'Ly/K(55M tA   HNN= ) )  }HQUO HQUO HQKK$$&& Jz " "EBBBB#(122,BBBMAAAASXAAACH766 666 Jr t tE????sx|???J>>>>SX>>>CHK B Xabb\"" " " "BB #XXB  "c   q ! ! ! {2#--3k"""????SX???CH J? A AE????sx|???J>>>>SX>>>CH #677*%hiiIIIISXabb\IIIHRRRRCHQRRLRRRO )kW44(((PPPPPSXPPPCHH   Wc!ffW:?? !7!7F 65555544666#I$=$B$B$D$DEE CFFGG***,,,R\))DE!"X#EEET[[]]22!"CaAj"C"C"CDDDEB$$Q'' . 3 1 + ,   Q   qMM z??a   j!1!1    J~ & &E@@@@ @@@K????SX???CHJ9%%%hqrrlGICH HNN9 % %#(1QU7+,,, HQUOSXa[(122,&r+rOsN   555555                    " # }  "g-[2lm[2[2no[2[2[2 ~LLL^(((V   FUUUp$   : : : : :(/ : : :)))(aaaH         rt