diff options
Diffstat (limited to 'numpy/distutils/fcompiler/ibm.py')
-rw-r--r-- | numpy/distutils/fcompiler/ibm.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/numpy/distutils/fcompiler/ibm.py b/numpy/distutils/fcompiler/ibm.py index c4cb2fca7..70d2132e1 100644 --- a/numpy/distutils/fcompiler/ibm.py +++ b/numpy/distutils/fcompiler/ibm.py @@ -78,15 +78,14 @@ class IBMFCompiler(FCompiler): xlf_cfg = '/etc/opt/ibmcmp/xlf/%s/xlf.cfg' % version fo, new_cfg = make_temp_file(suffix='_xlf.cfg') log.info('Creating '+new_cfg) - fi = open(xlf_cfg, 'r') - crt1_match = re.compile(r'\s*crt\s*[=]\s*(?P<path>.*)/crt1.o').match - for line in fi: - m = crt1_match(line) - if m: - fo.write('crt = %s/bundle1.o\n' % (m.group('path'))) - else: - fo.write(line) - fi.close() + with open(xlf_cfg, 'r') as fi: + crt1_match = re.compile(r'\s*crt\s*[=]\s*(?P<path>.*)/crt1.o').match + for line in fi: + m = crt1_match(line) + if m: + fo.write('crt = %s/bundle1.o\n' % (m.group('path'))) + else: + fo.write(line) fo.close() opt.append('-F'+new_cfg) return opt |