Exemple #1
0
def get_gfortran_version(conf,fc):
	version_re=re.compile(r"GNU\s*Fortran",re.I).search
	cmd=fc+['--version']
	out,err=fc_config.getoutput(conf,cmd,stdin=False)
	if out:match=version_re(out)
	else:match=version_re(err)
	if not match:
		conf.fatal('Could not determine the compiler type')
	cmd=fc+['-dM','-E','-']
	out,err=fc_config.getoutput(conf,cmd,stdin=True)
	if out.find('__GNUC__')<0:
		conf.fatal('Could not determine the compiler type')
	k={}
	out=out.split('\n')
	import shlex
	for line in out:
		lst=shlex.split(line)
		if len(lst)>2:
			key=lst[1]
			val=lst[2]
			k[key]=val
	def isD(var):
		return var in k
	def isT(var):
		return var in k and k[var]!='0'
	conf.env['FC_VERSION']=(k['__GNUC__'],k['__GNUC_MINOR__'],k['__GNUC_PATCHLEVEL__'])
def get_pgfortran_version(conf, fc):
    version_re = re.compile(r"The Portland Group", re.I).search
    cmd = fc + ["-V"]
    out, err = fc_config.getoutput(conf, cmd, stdin=False)
    if out:
        match = version_re(out)
    else:
        match = version_re(err)
    if not match:
        conf.fatal("Could not verify PGI signature")
    cmd = fc + ["-help=variable"]
    out, err = fc_config.getoutput(conf, cmd, stdin=False)
    if out.find("COMPVER") < 0:
        conf.fatal("Could not determine the compiler type")
    k = {}
    prevk = ""
    out = out.splitlines()
    for line in out:
        lst = line.partition("=")
        if lst[1] == "=":
            key = lst[0].rstrip()
            if key == "":
                key = prevk
            val = lst[2].rstrip()
            k[key] = val
        else:
            prevk = line.partition(" ")[0]

    def isD(var):
        return var in k

    def isT(var):
        return var in k and k[var] != "0"

    conf.env["FC_VERSION"] = k["COMPVER"].split(".")
Exemple #3
0
def get_pgfortran_version(conf, fc):
    version_re = re.compile(r"The Portland Group", re.I).search
    cmd = fc + ['-V']
    out, err = fc_config.getoutput(conf, cmd, stdin=False)
    if out: match = version_re(out)
    else: match = version_re(err)
    if not match:
        conf.fatal('Could not verify PGI signature')
    cmd = fc + ['-help=variable']
    out, err = fc_config.getoutput(conf, cmd, stdin=False)
    if out.find('COMPVER') < 0:
        conf.fatal('Could not determine the compiler type')
    k = {}
    prevk = ''
    out = out.splitlines()
    for line in out:
        lst = line.partition('=')
        if lst[1] == '=':
            key = lst[0].rstrip()
            if key == '': key = prevk
            val = lst[2].rstrip()
            k[key] = val
        else:
            prevk = line.partition(' ')[0]

    def isD(var):
        return var in k

    def isT(var):
        return var in k and k[var] != '0'

    conf.env['FC_VERSION'] = (k['COMPVER'].split('.'))
Exemple #4
0
def get_gfortran_version(conf, fc):
    version_re = re.compile(r"GNU\s*Fortran", re.I).search
    cmd = fc + ['--version']
    out, err = fc_config.getoutput(conf, cmd, stdin=False)
    if out: match = version_re(out)
    else: match = version_re(err)
    if not match:
        conf.fatal('Could not determine the compiler type')
    cmd = fc + ['-dM', '-E', '-']
    out, err = fc_config.getoutput(conf, cmd, stdin=True)
    if out.find('__GNUC__') < 0:
        conf.fatal('Could not determine the compiler type')
    k = {}
    out = out.splitlines()
    import shlex
    for line in out:
        lst = shlex.split(line)
        if len(lst) > 2:
            key = lst[1]
            val = lst[2]
            k[key] = val

    def isD(var):
        return var in k

    def isT(var):
        return var in k and k[var] != '0'

    conf.env.FC_VERSION = (k['__GNUC__'], k['__GNUC_MINOR__'],
                           k['__GNUC_PATCHLEVEL__'])
def get_pgfortran_version(conf,fc):
		version_re = re.compile(r"The Portland Group", re.I).search
		cmd = fc + ['-V']
		out,err = fc_config.getoutput(conf, cmd, stdin=False)
		if out: match = version_re(out)
		else: match = version_re(err)
		if not match:
				conf.fatal('Could not verify PGI signature')
		cmd = fc + ['-help=variable']
		out,err = fc_config.getoutput(conf, cmd, stdin=False)
		if out.find('COMPVER')<0:
				conf.fatal('Could not determine the compiler type')
		k = {}
		prevk = ''
		out = out.split('\n')
		for line in out:
				lst = line.partition('=')
				if lst[1] == '=':
						key = lst[0].rstrip()
						if key == '': key = prevk
						val = lst[2].rstrip()
						k[key] = val
				else: prevk = line.partition(' ')[0]
		def isD(var):
				return var in k
		def isT(var):
				return var in k and k[var]!='0'
		conf.env['FC_VERSION'] = (k['COMPVER'].split('.'))
Exemple #6
0
def check_cython_version(conf, minver):
    conf.start_msg("Checking cython version")
    minver = tuple(minver)
    import re
    version_re = re.compile(
        r'cython\s*version\s*(?P<major>\d*)\.(?P<minor>\d*)(?:\.(?P<micro>\d*))?',
        re.I).search
    cmd = conf.cmd_to_list(conf.env['CYTHON'])
    cmd = cmd + ['--version']
    from waflib.Tools import fc_config
    stdout, stderr = fc_config.getoutput(conf, cmd)
    if stdout:
        match = version_re(stdout)
    else:
        match = version_re(stderr)
    if not match:
        conf.fatal("cannot determine the Cython version")
    cy_ver = [match.group('major'), match.group('minor')]
    if match.group('micro'):
        cy_ver.append(match.group('micro'))
    else:
        cy_ver.append('0')
    cy_ver = tuple([int(x) for x in cy_ver])
    if cy_ver < minver:
        conf.end_msg(False)
        conf.fatal("cython version %s < %s" % (cy_ver, minver))
    conf.end_msg(str(cy_ver))
Exemple #7
0
def check_cython_version(conf, minver):
    conf.start_msg("Checking cython version")
    minver = tuple(minver)
    import re
    version_re = re.compile(r'cython\s*version\s*(?P<major>\d*)\.(?P<minor>\d*)(?:\.(?P<micro>\d*))?', re.I).search
    cmd = conf.cmd_to_list(conf.env['CYTHON'])
    cmd = cmd + ['--version']
    from waflib.Tools import fc_config
    stdout, stderr = fc_config.getoutput(conf, cmd)
    if stdout:
        match = version_re(stdout)
    else:
        match = version_re(stderr)
    if not match:
        conf.fatal("cannot determine the Cython version")
    cy_ver = [match.group('major'), match.group('minor')]
    if match.group('micro'):
        cy_ver.append(match.group('micro'))
    else:
        cy_ver.append('0')
    cy_ver = tuple([int(x) for x in cy_ver])
    if cy_ver < minver:
        conf.end_msg(False)
        conf.fatal("cython version %s < %s" % (cy_ver, minver))
    conf.end_msg(str(cy_ver))
Exemple #8
0
def get_crayftn_version(conf, fc):
		version_re = re.compile(r"Cray Fortran\s*:\s*Version\s*(?P<major>\d*)\.(?P<minor>\d*)", re.I).search
		cmd = fc + ['-V']
		out,err = fc_config.getoutput(conf, cmd, stdin=False)
		if out: match = version_re(out)
		else: match = version_re(err)
		if not match:
				conf.fatal('Could not determine the Cray Fortran compiler version.')
		k = match.groupdict()
		conf.env['FC_VERSION'] = (k['major'], k['minor'])
Exemple #9
0
def get_crayftn_version(conf, fc):
		version_re = re.compile(r"Cray Fortran\s*:\s*Version\s*(?P<major>\d*)\.(?P<minor>\d*)", re.I).search
		cmd = fc + ['-V']
		out,err = fc_config.getoutput(conf, cmd, stdin=False)
		if out: match = version_re(out)
		else: match = version_re(err)
		if not match:
				conf.fatal('Could not determine the Cray Fortran compiler version.')
		k = match.groupdict()
		conf.env['FC_VERSION'] = (k['major'], k['minor'])
Exemple #10
0
def get_ifort_version(conf, fc):
    version_re = re.compile(r"Intel[\sa-zA-Z()0-9,-]*Version\s*(?P<major>\d*)\.(?P<minor>\d*)", re.I).search
    if Utils.is_win32:
        cmd = fc
    else:
        cmd = fc + ["-logo"]
    out, err = fc_config.getoutput(conf, cmd, stdin=False)
    match = version_re(out) or version_re(err)
    if not match:
        conf.fatal("cannot determine ifort version.")
    k = match.groupdict()
    conf.env["FC_VERSION"] = (k["major"], k["minor"])
Exemple #11
0
def get_g95_version(conf,fc):
	version_re=re.compile(r"g95\s*(?P<major>\d*)\.(?P<minor>\d*)").search
	cmd=fc+['--version']
	out,err=fc_config.getoutput(conf,cmd,stdin=False)
	if out:
		match=version_re(out)
	else:
		match=version_re(err)
	if not match:
		conf.fatal('cannot determine g95 version')
	k=match.groupdict()
	conf.env.FC_VERSION=(k['major'],k['minor'])
Exemple #12
0
def get_ifort_version(conf,fc):
	version_re=re.compile(r"\bIntel\b.*\bVersion\s*(?P<major>\d*)\.(?P<minor>\d*)",re.I).search
	if Utils.is_win32:
		cmd=fc
	else:
		cmd=fc+['-logo']
	out,err=fc_config.getoutput(conf,cmd,stdin=False)
	match=version_re(out)or version_re(err)
	if not match:
		conf.fatal('cannot determine ifort version.')
	k=match.groupdict()
	conf.env.FC_VERSION=(k['major'],k['minor'])
Exemple #13
0
def get_ifort_version(conf,fc):
	version_re=re.compile(r"ifort\s*\(IFORT\)\s*(?P<major>\d*)\.(?P<minor>\d*)",re.I).search
	cmd=fc+['--version']
	out,err=fc_config.getoutput(conf,cmd,stdin=False)
	if out:
		match=version_re(out)
	else:
		match=version_re(err)
	if not match:
		conf.fatal('cannot determine ifort version.')
	k=match.groupdict()
	conf.env['FC_VERSION']=(k['major'],k['minor'])
Exemple #14
0
def get_g95_version(conf, fc):
    version_re = re.compile(r"g95\s*(?P<major>\d*)\.(?P<minor>\d*)").search
    cmd = fc + ['--version']
    out, err = fc_config.getoutput(conf, cmd, stdin=False)
    if out:
        match = version_re(out)
    else:
        match = version_re(err)
    if not match:
        conf.fatal('cannot determine g95 version')
    k = match.groupdict()
    conf.env['FC_VERSION'] = (k['major'], k['minor'])
Exemple #15
0
def get_ifort_version(conf,fc):
	version_re=re.compile(r"\bIntel\b.*\bVersion\s*(?P<major>\d*)\.(?P<minor>\d*)",re.I).search
	if Utils.is_win32:
		cmd=fc
	else:
		cmd=fc+['-logo']
	out,err=fc_config.getoutput(conf,cmd,stdin=False)
	match=version_re(out)or version_re(err)
	if not match:
		conf.fatal('cannot determine ifort version.')
	k=match.groupdict()
	conf.env.FC_VERSION=(k['major'],k['minor'])
Exemple #16
0
def get_gfortran_version(conf, fc):
    """Get the compiler version"""

    # ensure this is actually gfortran, not an imposter.
    version_re = re.compile(r"GNU\s*Fortran", re.I).search
    cmd = fc + ["--version"]
    out, err = fc_config.getoutput(conf, cmd, stdin=False)
    if out:
        match = version_re(out)
    else:
        match = version_re(err)
    if not match:
        conf.fatal("Could not determine the compiler type")

    # --- now get more detailed info -- see c_config.get_cc_version
    cmd = fc + ["-dM", "-E", "-"]
    out, err = fc_config.getoutput(conf, cmd, stdin=True)

    if out.find("__GNUC__") < 0:
        conf.fatal("Could not determine the compiler type")

    k = {}
    out = out.splitlines()
    import shlex

    for line in out:
        lst = shlex.split(line)
        if len(lst) > 2:
            key = lst[1]
            val = lst[2]
            k[key] = val

    def isD(var):
        return var in k

    def isT(var):
        return var in k and k[var] != "0"

    conf.env.FC_VERSION = (k["__GNUC__"], k["__GNUC_MINOR__"],
                           k["__GNUC_PATCHLEVEL__"])
def get_solstudio_version(conf, fc):
	"""Get the compiler version"""

	version_re = re.compile(r"Sun Fortran 95 *(?P<major>\d*)\.(?P<minor>\d*)", re.I).search
	cmd = fc + ['-V']

	out, err = fc_config.getoutput(conf,cmd,stdin=False)
	if out: match = version_re(out)
	else: match = version_re(err)
	if not match:
		conf.fatal('Could not determine the Sun Studio Fortran version.')
	k = match.groupdict()
	conf.env['FC_VERSION'] = (k['major'], k['minor'])
Exemple #18
0
def get_open64_version(conf, fc):
	"""Get the Open64 compiler version"""

	version_re = re.compile(r"Open64 Compiler Suite: *Version *(?P<major>\d*)\.(?P<minor>\d*)", re.I).search
	cmd = fc + ['-version']

	out, err = fc_config.getoutput(conf,cmd,stdin=False)
	if out: match = version_re(out)
	else: match = version_re(err)
	if not match:
		conf.fatal('Could not determine the Open64 version.')
	k = match.groupdict()
	conf.env['FC_VERSION'] = (k['major'], k['minor'])
Exemple #19
0
def get_open64_version(conf, fc):
	"""Get the Open64 compiler version"""

	version_re = re.compile(r"Open64 Compiler Suite: *Version *(?P<major>\d*)\.(?P<minor>\d*)", re.I).search
	cmd = fc + ['-version']

	out, err = fc_config.getoutput(conf,cmd,stdin=False)
	if out: match = version_re(out)
	else: match = version_re(err)
	if not match:
		conf.fatal('Could not determine the Open64 version.')
	k = match.groupdict()
	conf.env['FC_VERSION'] = (k['major'], k['minor'])
Exemple #20
0
def get_gfortran_version(conf, fc):
    """Get the compiler version"""

    # ensure this is actually gfortran, not an imposter.
    version_re = re.compile(r"GNU\s*Fortran", re.I).search
    cmd = fc + ["--version"]
    out, err = fc_config.getoutput(conf, cmd, stdin=False)
    if out:
        match = version_re(out)
    else:
        match = version_re(err)
    if not match:
        conf.fatal("Could not determine the compiler type")

        # --- now get more detailed info -- see c_config.get_cc_version
    cmd = fc + ["-dM", "-E", "-"]
    out, err = fc_config.getoutput(conf, cmd, stdin=True)

    if out.find("__GNUC__") < 0:
        conf.fatal("Could not determine the compiler type")

    k = {}
    out = out.split("\n")
    import shlex

    for line in out:
        lst = shlex.split(line)
        if len(lst) > 2:
            key = lst[1]
            val = lst[2]
            k[key] = val

    def isD(var):
        return var in k

    def isT(var):
        return var in k and k[var] != "0"

    conf.env["FC_VERSION"] = (k["__GNUC__"], k["__GNUC_MINOR__"], k["__GNUC_PATCHLEVEL__"])
def get_solstudio_version(conf, fc):
	"""Get the compiler version"""

	version_re = re.compile(r"Sun Fortran 95 *(?P<major>\d*)\.(?P<minor>\d*)", re.I).search
	cmd = fc + ['-V']

	out, err = fc_config.getoutput(conf,cmd,stdin=False)
	if out: match = version_re(out)
	else: match = version_re(err)
	if not match:
		conf.fatal('Could not determine the Sun Studio Fortran version.')
	k = match.groupdict()
	conf.env['FC_VERSION'] = (k['major'], k['minor'])
Exemple #22
0
def get_nfort_version(conf,fc):
	version_re=re.compile(r"nfort\s*\(NFORT\)\s*(?P<major>\d+)\.(?P<minor>\d+)\.",re.I).search
	cmd=fc+['--version']
	out,err=fc_config.getoutput(conf,cmd,stdin=False)
	if out:
		match=version_re(out)
	else:
		match=version_re(err)
	if not match:
		return(False)
		conf.fatal('Could not determine the NEC NFORT Fortran compiler version.')
	else:
		k=match.groupdict()
		conf.env['FC_VERSION']=(k['major'],k['minor'])
Exemple #23
0
def get_ifort_version(conf, fc):
	"""get the compiler version"""

	version_re = re.compile(r"ifort\s*\(IFORT\)\s*(?P<major>\d*)\.(?P<minor>\d*)", re.I).search
	cmd = fc + ['--version']
	out, err = fc_config.getoutput(conf, cmd, stdin=False)
	if out:
		match = version_re(out)
	else:
		match = version_re(err)
	if not match:
		conf.fatal('cannot determine ifort version.')
	k = match.groupdict()
	conf.env['FC_VERSION'] = (k['major'], k['minor'])
def get_g95_version(conf, fc):
    """get the compiler version"""

    version_re = re.compile(r"g95\s*(?P<major>\d*)\.(?P<minor>\d*)").search
    cmd = fc + ["--version"]
    out, err = fc_config.getoutput(conf, cmd, stdin=False)
    if out:
        match = version_re(out)
    else:
        match = version_re(err)
    if not match:
        conf.fatal("cannot determine g95 version")
    k = match.groupdict()
    conf.env.FC_VERSION = (k["major"], k["minor"])
Exemple #25
0
def get_ifort_version(conf, fc):
    """get the compiler version"""

    version_re = re.compile(r"ifort\s*\(IFORT\)\s*(?P<major>\d*)\.(?P<minor>\d*)", re.I).search
    cmd = fc + ["--version"]
    out, err = fc_config.getoutput(conf, cmd, stdin=False)
    if out:
        match = version_re(out)
    else:
        match = version_re(err)
    if not match:
        conf.fatal("cannot determine ifort version.")
    k = match.groupdict()
    conf.env["FC_VERSION"] = (k["major"], k["minor"])
Exemple #26
0
def get_nfort_version(conf,fc):
	version_re=re.compile(r"nfort\s*\(NFORT\)\s*(?P<major>\d+)\.(?P<minor>\d+)\.",re.I).search
	cmd=fc+['--version']
	out,err=fc_config.getoutput(conf,cmd,stdin=False)
	if out:
		match=version_re(out)
	else:
		match=version_re(err)
	if not match:
		return(False)
		conf.fatal('Could not determine the NEC NFORT Fortran compiler version.')
	else:
		k=match.groupdict()
		conf.env['FC_VERSION']=(k['major'],k['minor'])
Exemple #27
0
def get_sxfc_version(conf, fc):
	version_re = re.compile(r"FORTRAN90/SX\s*Version\s*(?P<major>\d*)\.(?P<minor>\d*)", re.I).search
	cmd = fc + ['-V']
	out,err = fc_config.getoutput(conf, cmd, stdin=False)
	if out: match = version_re(out)
	else: match = version_re(err)
	if not match:
		version_re=re.compile(r"NEC Fortran 2003 Compiler for\s*(?P<major>\S*)\s*\(c\)\s*(?P<minor>\d*)",re.I).search
		if out: match = version_re(out)
		else: match = version_re(err)
		if not match:
			conf.fatal('Could not determine the NEC Fortran compiler version.')
	k = match.groupdict()
	conf.env['FC_VERSION'] = (k['major'], k['minor'])
Exemple #28
0
def get_g77_version(conf, fc):
    """Get the compiler version"""

    # ensure this is actually g77, not an imposter.
    version_re = re.compile(r"GNU\s*Fortran", re.I).search
    cmd = fc + ['--version']
    out, err = fc_config.getoutput(conf, cmd, stdin=False)
    if out: match = version_re(out)
    else: match = version_re(err)
    if not match:
        conf.fatal('Could not determine the compiler type')

    # --- now get more detailed info -- see c_config.get_cc_version
    cmd = fc + ['-dM', '-E', '-']
    out, err = fc_config.getoutput(conf, cmd, stdin=True)

    if out.find('__GNUC__') < 0:
        conf.fatal('Could not determine the compiler type')

    k = {}
    out = out.split('\n')
    import shlex

    for line in out:
        lst = shlex.split(line)
        if len(lst)>2:
            key = lst[1]
            val = lst[2]
            k[key] = val

    def isD(var):
        return var in k

    def isT(var):
        return var in k and k[var] != '0'

    conf.env['FC_VERSION'] = (k['__GNUC__'], k['__GNUC_MINOR__'], k['__GNUC_PATCHLEVEL__'])
Exemple #29
0
def get_nag_version(conf, fc):
	"""Get the NAG compiler version"""

	version_re = re.compile(r"^NAG Fortran Compiler *Release *(?P<major>\d*)\.(?P<minor>\d*)", re.M).search
	cmd = fc + ['-V']

	out, err = fc_config.getoutput(conf,cmd,stdin=False)
	if out:
		match = version_re(out)
		if not match:
			match = version_re(err)
	else: match = version_re(err)
	if not match:
		conf.fatal('Could not determine the NAG version.')
	k = match.groupdict()
	conf.env['FC_VERSION'] = (k['major'], k['minor'])
def get_nag_version(conf, fc):
	"""Get the NAG compiler version"""

	version_re = re.compile(r"^NAG Fortran Compiler *Release *(?P<major>\d*)\.(?P<minor>\d*)", re.M).search
	cmd = fc + ['-V']

	out, err = fc_config.getoutput(conf,cmd,stdin=False)
	if out:
		match = version_re(out)
		if not match:
			match = version_re(err)
	else: match = version_re(err)
	if not match:
		conf.fatal('Could not determine the NAG version.')
	k = match.groupdict()
	conf.env['FC_VERSION'] = (k['major'], k['minor'])
def get_ifort_version(conf, fc):
    """
    Detects the compiler version and sets ``conf.env.FC_VERSION``
    """
    version_re = re.compile(
        r"\bIntel\b.*\bVersion\s*(?P<major>\d*)\.(?P<minor>\d*)", re.I).search
    if Utils.is_win32:
        cmd = fc
    else:
        cmd = fc + ["-logo"]

    out, err = fc_config.getoutput(conf, cmd, stdin=False)
    match = version_re(out) or version_re(err)
    if not match:
        conf.fatal("cannot determine ifort version.")
    k = match.groupdict()
    conf.env.FC_VERSION = (k["major"], k["minor"])
def get_sxfc_version(conf, fc):
    version_re = re.compile(
        r"FORTRAN90/SX\s*Version\s*(?P<major>\d*)\.(?P<minor>\d*)",
        re.I).search
    cmd = fc + ['-V']
    out, err = fc_config.getoutput(conf, cmd, stdin=False)
    if out: match = version_re(out)
    else: match = version_re(err)
    if not match:
        version_re = re.compile(
            r"NEC Fortran 2003 Compiler for\s*(?P<major>\S*)\s*\(c\)\s*(?P<minor>\d*)",
            re.I).search
        if out: match = version_re(out)
        else: match = version_re(err)
        if not match:
            conf.fatal('Could not determine the NEC Fortran compiler version.')
    k = match.groupdict()
    conf.env['FC_VERSION'] = (k['major'], k['minor'])
Exemple #33
0
def get_ifort_version(conf, fc):
	"""get the compiler version"""

	version_re = re.compile(r"Intel[\sa-zA-Z()0-9,-]*Version\s*(?P<major>\d*)\.(?P<minor>\d*)",re.I).search
	if Utils.is_win32:
		cmd = fc
	else:
		cmd = fc + ['-logo']

	out, err = fc_config.getoutput(conf, cmd, stdin=False)
	if out:
		match = version_re(out)
	else:
		match = version_re(err)
	if not match:
		conf.fatal('cannot determine ifort version.')
	k = match.groupdict()
	conf.env['FC_VERSION'] = (k['major'], k['minor'])
Exemple #34
0
def get_ifort_version(conf, fc):
    """get the compiler version"""

    version_re = re.compile(
        r"Intel[\sa-zA-Z()0-9,-]*Version\s*(?P<major>\d*)\.(?P<minor>\d*)",
        re.I).search
    if Utils.is_win32:
        cmd = fc
    else:
        cmd = fc + ['-logo']

    out, err = fc_config.getoutput(conf, cmd, stdin=False)
    if out:
        match = version_re(out)
    else:
        match = version_re(err)
    if not match:
        conf.fatal('cannot determine ifort version.')
    k = match.groupdict()
    conf.env['FC_VERSION'] = (k['major'], k['minor'])