summaryrefslogtreecommitdiff
path: root/numpy/f2py/rules.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/f2py/rules.py')
-rw-r--r--numpy/f2py/rules.py23
1 files changed, 13 insertions, 10 deletions
diff --git a/numpy/f2py/rules.py b/numpy/f2py/rules.py
index d1eb4016e..16bd58fb4 100644
--- a/numpy/f2py/rules.py
+++ b/numpy/f2py/rules.py
@@ -57,7 +57,10 @@ import __version__
f2py_version = __version__.version
import pprint
-import sys,string,time,types,copy
+import sys
+import time
+import types
+import copy
errmess=sys.stderr.write
outmess=sys.stdout.write
show=pprint.pprint
@@ -1166,7 +1169,7 @@ def buildmodule(m,um):
fn = os.path.join(options['buildpath'],vrd['modulename']+'module.c')
ret['csrc'] = fn
f=open(fn,'w')
- f.write(string.replace(ar['modulebody'],'\t',2*' '))
+ f.write(ar['modulebody'].replace('\t',2*' '))
f.close()
outmess('\tWrote C/API module "%s" to file "%s/%smodule.c"\n'%(m['name'],options['buildpath'],vrd['modulename']))
@@ -1174,7 +1177,7 @@ def buildmodule(m,um):
fn = os.path.join(options['buildpath'],vrd['modulename']+'module.rest')
f=open(fn,'w')
f.write('.. -*- rest -*-\n')
- f.write(string.join(ar['restdoc'],'\n'))
+ f.write('\n'.join(ar['restdoc']))
f.close()
outmess('\tReST Documentation is saved to file "%s/%smodule.rest"\n'%(options['buildpath'],vrd['modulename']))
if options['dolatexdoc']:
@@ -1184,7 +1187,7 @@ def buildmodule(m,um):
f.write('%% This file is auto-generated with f2py (version:%s)\n'%(f2py_version))
if not options.has_key('shortlatex'):
f.write('\\documentclass{article}\n\\usepackage{a4wide}\n\\begin{document}\n\\tableofcontents\n\n')
- f.write(string.join(ar['latexdoc'],'\n'))
+ f.write('\n'.join(ar['latexdoc']))
if not options.has_key('shortlatex'):
f.write('\\end{document}')
f.close()
@@ -1197,14 +1200,14 @@ def buildmodule(m,um):
f.write('C This file is autogenerated with f2py (version:%s)\n'%(f2py_version))
f.write('C It contains Fortran 77 wrappers to fortran functions.\n')
lines = []
- for l in string.split(string.join(funcwrappers,'\n\n')+'\n','\n'):
+ for l in '\n\n'.join(funcwrappers)+'\n'.split('\n'):
if l and l[0]==' ':
while len(l)>=66:
lines.append(l[:66]+'\n &')
l = l[66:]
lines.append(l+'\n')
else: lines.append(l+'\n')
- lines = string.join(lines,'').replace('\n &\n','\n')
+ lines = ''.join(lines).replace('\n &\n','\n')
f.write(lines)
f.close()
outmess('\tFortran 77 wrappers are saved to "%s"\n'%(wn))
@@ -1216,7 +1219,7 @@ def buildmodule(m,um):
f.write('! This file is autogenerated with f2py (version:%s)\n'%(f2py_version))
f.write('! It contains Fortran 90 wrappers to fortran functions.\n')
lines = []
- for l in string.split(string.join(funcwrappers2,'\n\n')+'\n','\n'):
+ for l in '\n\n'.join(funcwrappers2)+'\n'.split('\n'):
if len(l)>72 and l[0]==' ':
lines.append(l[:72]+'&\n &')
l = l[72:]
@@ -1225,7 +1228,7 @@ def buildmodule(m,um):
l = l[66:]
lines.append(l+'\n')
else: lines.append(l+'\n')
- lines = string.join(lines,'').replace('\n &\n','\n')
+ lines = ''.join(lines).replace('\n &\n','\n')
f.write(lines)
f.close()
outmess('\tFortran 90 wrappers are saved to "%s"\n'%(wn))
@@ -1313,8 +1316,8 @@ def buildapi(rout):
{'docsign':rd['docsign'],
'docsignopt':optargs,
})
- rd['latexdocsignatureshort']=string.replace(rd['docsignatureshort'],'_','\\_')
- rd['latexdocsignatureshort']=string.replace(rd['latexdocsignatureshort'],',',', ')
+ rd['latexdocsignatureshort']=rd['docsignatureshort'].replace('_','\\_')
+ rd['latexdocsignatureshort']=rd['latexdocsignatureshort'].replace(',',', ')
cfs=stripcomma(replace('#callfortran##callfortranappend#',{'callfortran':rd['callfortran'],'callfortranappend':rd['callfortranappend']}))
if len(rd['callfortranappend'])>1:
rd['callcompaqfortran']=stripcomma(replace('#callfortran# 0,#callfortranappend#',{'callfortran':rd['callfortran'],'callfortranappend':rd['callfortranappend']}))