diff options
Diffstat (limited to 'numpy/f2py')
-rw-r--r-- | numpy/f2py/cfuncs.py | 10 | ||||
-rwxr-xr-x | numpy/f2py/crackfortran.py | 4 | ||||
-rw-r--r-- | numpy/f2py/f2py.1 | 20 | ||||
-rwxr-xr-x | numpy/f2py/f2py2e.py | 2 | ||||
-rw-r--r-- | numpy/f2py/rules.py | 12 |
5 files changed, 30 insertions, 18 deletions
diff --git a/numpy/f2py/cfuncs.py b/numpy/f2py/cfuncs.py index 02462241c..5312b0ec5 100644 --- a/numpy/f2py/cfuncs.py +++ b/numpy/f2py/cfuncs.py @@ -472,15 +472,17 @@ cppmacros['CHECKARRAY']="""\ cppmacros['CHECKSTRING']="""\ #define CHECKSTRING(check,tcheck,name,show,var)\\ \tif (!(check)) {\\ -\t\tPyErr_SetString(#modulename#_error,\"(\"tcheck\") failed for \"name);\\ -\t\tfprintf(stderr,show\"\\n\",slen(var),var);\\ +\t\tchar errstring[256];\\ +\t\tsprintf(errstring, \"%s: \"show, \"(\"tcheck\") failed for \"name, slen(var), var);\\ +\t\tPyErr_SetString(#modulename#_error, errstring);\\ \t\t/*goto capi_fail;*/\\ \t} else """ cppmacros['CHECKSCALAR']="""\ #define CHECKSCALAR(check,tcheck,name,show,var)\\ \tif (!(check)) {\\ -\t\tPyErr_SetString(#modulename#_error,\"(\"tcheck\") failed for \"name);\\ -\t\tfprintf(stderr,show\"\\n\",var);\\ +\t\tchar errstring[256];\\ +\t\tsprintf(errstring, \"%s: \"show, \"(\"tcheck\") failed for \"name, var);\\ +\t\tPyErr_SetString(#modulename#_error,errstring);\\ \t\t/*goto capi_fail;*/\\ \t} else """ ## cppmacros['CHECKDIMS']="""\ diff --git a/numpy/f2py/crackfortran.py b/numpy/f2py/crackfortran.py index 8e5f2882f..449db33a3 100755 --- a/numpy/f2py/crackfortran.py +++ b/numpy/f2py/crackfortran.py @@ -2446,9 +2446,9 @@ def crack2fortrangen(block,tab='\n'): global skipfuncs, onlyfuncs setmesstext(block) ret='' - if type(block) is type([]): + if isinstance(block, list): for g in block: - if g['block'] in ['function','subroutine']: + if g and g['block'] in ['function','subroutine']: if g['name'] in skipfuncs: continue if onlyfuncs and g['name'] not in onlyfuncs: diff --git a/numpy/f2py/f2py.1 b/numpy/f2py/f2py.1 index b8769a0cc..b9391e592 100644 --- a/numpy/f2py/f2py.1 +++ b/numpy/f2py/f2py.1 @@ -20,7 +20,7 @@ f2py \- Fortran to Python interface generator This program generates a Python C/API file (<modulename>module.c) that contains wrappers for given Fortran or C functions so that they can be called from Python. -With the -c option the corresponding +With the \-c option the corresponding extension modules are built. .SH OPTIONS .TP @@ -49,8 +49,8 @@ Name of the module; f2py generates a Python/C API file \'untitled\'. .TP .B \-\-[no\-]lower -Do [not] lower the cases in <fortran files>. By default, --lower is -assumed with -h key, and --no-lower without -h key. +Do [not] lower the cases in <fortran files>. By default, \-\-lower is +assumed with \-h key, and \-\-no\-lower without \-h key. .TP .B \-\-build\-dir <dirname> All f2py generated files are created in <dirname>. Default is tempfile.mktemp(). @@ -59,14 +59,14 @@ All f2py generated files are created in <dirname>. Default is tempfile.mktemp(). Overwrite existing signature file. .TP .B \-\-[no\-]latex\-doc -Create (or not) <modulename>module.tex. Default is --no-latex-doc. +Create (or not) <modulename>module.tex. Default is \-\-no\-latex\-doc. .TP .B \-\-short\-latex Create 'incomplete' LaTeX document (without commands \\documentclass, \\tableofcontents, and \\begin{document}, \\end{document}). .TP .B \-\-[no\-]rest\-doc -Create (or not) <modulename>module.rst. Default is --no-rest-doc. +Create (or not) <modulename>module.rst. Default is \-\-no\-rest\-doc. .TP .B \-\-debug\-capi Create C/API code that reports the state of the wrappers during @@ -81,12 +81,12 @@ statement in signature files instead. .TP .B \-\-[no\-]wrap\-functions Create Fortran subroutine wrappers to Fortran 77 -functions. --wrap-functions is default because it ensures maximum +functions. \-\-wrap\-functions is default because it ensures maximum portability/compiler independence. .TP .B \-\-help\-link [..] List system resources found by system_info.py. [..] may contain -a list of resources names. See also --link-<resource> switch below. +a list of resources names. See also \-\-link\-<resource> switch below. .TP .B \-\-quiet Run quietly. @@ -100,7 +100,7 @@ Print f2py version ID and exit. .B \-\-include_paths path1:path2:... Search include files (that f2py will scan) from the given directories. .SH "CONFIG_FC OPTIONS" -The following options are effective only when -c switch is used. +The following options are effective only when \-c switch is used. .TP .B \-\-help-compiler List available Fortran compilers [DEPRECIATED]. @@ -147,13 +147,13 @@ Compile without arch-dependent optimization. .B \-\-debug Compile with debugging information. .SH "EXTRA OPTIONS" -The following options are effective only when -c switch is used. +The following options are effective only when \-c switch is used. .TP .B \-\-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. +\-\-link\-lapack_opt. See also \-\-help\-link switch. .TP .B -L/path/to/lib/ -l<libname> diff --git a/numpy/f2py/f2py2e.py b/numpy/f2py/f2py2e.py index 2fd4f6caa..264a01312 100755 --- a/numpy/f2py/f2py2e.py +++ b/numpy/f2py/f2py2e.py @@ -543,7 +543,7 @@ def run_compile(): setup(ext_modules = [ext]) if remove_build_dir and os.path.exists(build_dir): - import shutil + import shutil outmess('Removing build directory %s\n'%(build_dir)) shutil.rmtree(build_dir) diff --git a/numpy/f2py/rules.py b/numpy/f2py/rules.py index 825b13b23..ef4b9cc34 100644 --- a/numpy/f2py/rules.py +++ b/numpy/f2py/rules.py @@ -245,7 +245,7 @@ static PyObject *#apiname#(const PyObject *capi_self, f2py_start_clock(); #endif \tif (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\\ -\t\t\"#argformat#|#keyformat##xaformat#:#pyname#\",\\ +\t\t\"#argformat##keyformat##xaformat#:#pyname#\",\\ \t\tcapi_kwlist#args_capi##keys_capi##keys_xa#))\n\t\treturn NULL; #frompyobj# /*end of frompyobj*/ @@ -1355,6 +1355,16 @@ def buildapi(rout): rd['latexdocstrsigns']=rd['latexdocstrsigns']+rd[k][0:1]+\ ['\\begin{description}']+rd[k][1:]+\ ['\\end{description}'] + + # Workaround for Python 2.6, 2.6.1 bug: http://bugs.python.org/issue4720 + if rd['keyformat'] or rd['xaformat']: + argformat = rd['argformat'] + if isinstance(argformat, list): + argformat.append('|') + else: + assert isinstance(argformat, str),repr((argformat, type(argformat))) + rd['argformat'] += '|' + ar=applyrules(routine_rules,rd) if ismoduleroutine(rout): outmess('\t\t\t %s\n'%(ar['docshort'])) |