[Numpy-svn] r3568 - trunk/numpy/distutils/fcompiler

numpy-svn@scip... numpy-svn@scip...
Fri Mar 2 10:49:04 CST 2007


Author: pearu
Date: 2007-03-02 10:49:00 -0600 (Fri, 02 Mar 2007)
New Revision: 3568

Modified:
   trunk/numpy/distutils/fcompiler/ibm.py
Log:
Applying info from Hans-Joachim Ehlers to improve xlf compiler support (on AIX using lslpp to determine compiler version).

Modified: trunk/numpy/distutils/fcompiler/ibm.py
===================================================================
--- trunk/numpy/distutils/fcompiler/ibm.py	2007-02-28 23:52:12 UTC (rev 3567)
+++ trunk/numpy/distutils/fcompiler/ibm.py	2007-03-02 16:49:00 UTC (rev 3568)
@@ -3,6 +3,7 @@
 import sys
 
 from numpy.distutils.fcompiler import FCompiler
+from numpy.distutils.exec_command import exec_command, find_executable
 from distutils import log
 
 class IbmFCompiler(FCompiler):
@@ -23,19 +24,18 @@
     def get_version(self,*args,**kwds):
         version = FCompiler.get_version(self,*args,**kwds)
 
-        if version is None:
-            # Let's try version_cmd without -qversion flag that
-            # xlf versions <=8.x don't have.
-            version_cmd =  self.version_cmd
-            orig_version_cmd = version_cmd[:]
-            if '-qversion' in version_cmd:
-                version_cmd.remove('-qversion')
-                version = FCompiler.get_version(self,*args,**kwds)
-                if version is None:
-                    version_cmd[:] = orig_version_cmd
+        if version is None and sys.platform.startswith('aix'):
+            # use lslpp to find out xlf version
+            lslpp = find_executable('lslpp')
+            xlf = find_executable('xlf')
+            if os.path.exists(xlf) and os.path.exists(lslpp):
+                s,o = exec_command(lslpp + ' -Lc xlfcmp')
+                m = re.search('xlfcmp:(?P<version>\d+([.]\d+)+)', o)
+                if m: version = m.group('version')
 
         xlf_dir = '/etc/opt/ibmcmp/xlf'
         if version is None and os.path.isdir(xlf_dir):
+            # linux:
             # If the output of xlf does not contain version info
             # (that's the case with xlf 8.1, for instance) then
             # let's try another method:



More information about the Numpy-svn mailing list