Пример #1
0
    def get_version(self,*args,**kwds):
        version = FCompiler.get_version(self,*args,**kwds)

        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:
            l = os.listdir(xlf_dir)
            l.sort()
            l.reverse()
            l = [d for d in l if os.path.isfile(os.path.join(xlf_dir,d,'xlf.cfg'))]
            if l:
                from distutils.version import LooseVersion
                self.version = version = LooseVersion(l[0])
        return version
Пример #2
0
    def get_version(self, *args, **kwds):
        version = FCompiler.get_version(self, *args, **kwds)

        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):
                try:
                    o = subprocess.check_output([lslpp, '-Lc', 'xlfcmp'])
                except (OSError, subprocess.CalledProcessError):
                    pass
                else:
                    m = re.search(r'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:
            l = sorted(os.listdir(xlf_dir))
            l.reverse()
            l = [
                d for d in l
                if os.path.isfile(os.path.join(xlf_dir, d, 'xlf.cfg'))
            ]
            if l:
                from distutils.version import LooseVersion
                self.version = version = LooseVersion(l[0])
        return version
Пример #3
0
 def get_version(self, force=0, ok_status=[256, 0, 1]):
     # XXX status==256 may indicate 'unrecognized option' or
     #     'no input file'. So, version_cmd needs more work.
     return FCompiler.get_version(self, force, ok_status)
Пример #4
0
 def get_version(self, force=0, ok_status=[256,0,1]):
     # XXX status==256 may indicate 'unrecognized option' or
     #     'no input file'. So, version_cmd needs more work.
     return FCompiler.get_version(self,force,ok_status)