f2py on windows XP - "Unknown Switch"??

John Machin sjmachin at lexicon.net
Mon Aug 28 08:57:26 EDT 2006


On 28/08/2006 9:47 PM, Sile wrote:
> Thanks for your reply,
> Sorry about the last post - pasting from another post didn't work so
> well...
> 
> The --version output from my f95 compiler is as follows:
> 
> C:\>g95 --version
> G95 (GCC 4.0.3 (g95 0.90!) Aug 22 2006)
> Copyright (C) 2002-2005 Free Software Foundation, Inc.
[snip]
> The f95.py file is located under Numpy as follows.......
> C:\Program
> Files\ESI_Software\UTILS_2006\Python2.3_CFD\Lib\site-packages\numpy\distutils\fcompiler\f95.py

Looks like asking the Numpy folks might be a good idea ...

> 
> import os
> import sys
> 
> from numpy.distutils.cpuinfo import cpu
> from numpy.distutils.fcompiler import FCompiler
> 
> class G95FCompiler(FCompiler):
> 
>     compiler_type = 'g95'
>     version_pattern = r'G95.*\(GCC 4.0.3 \(g95!\) (?P<version>.*)\).*'

That won't match the guff your f95 puts out. The "!)" appears *after* 
the version number. See below.

|>>> import re
|>>> guff = 'G95 (GCC 4.0.3 (g95 0.90!) Aug 22 2006) etc etc'
|>>> vp1 = r'G95.*\(GCC 4.0.3 \(g95!\) (?P<version>.*)\).*'
|>>> vp2 = r'G95.*\(GCC 4.0.3 \(g95 (?P<version>.*)!\).*'
|>>> m1 = re.match(vp1, guff)
|>>> print m1
None
|>>> m2 = re.match(vp2, guff)
|>>> print m2
<_sre.SRE_Match object at 0x00AED9E0>
|>>> print m2.group('version')
0.90
|>>>


> THE LINE ABOVE WAS ORIGINALLY:
> version_pattern = r'G95.*\(experimental \(g95!\)
> (?P<version.*)\).*'

No it wasn't. It would have had a ">" after "version" :-)

HTH,
John



More information about the Python-list mailing list