def check_perl_version(needed): try: out = check_call(['perl', '--version']) except FatalError: return None, None m = re.search('v[0-9]+\.[0-9]+(\.[0-9]+)?', out) if not m: raise FatalError('Could not detect perl version') newer = StrictVersion(m.group()[1:]) >= StrictVersion(needed) return which('perl'), newer
def check_perl_version(needed): perl = which('perl') try: out = check_call([perl, '--version']) except FatalError: return None, None, None m = re.search('v[0-9]+\.[0-9]+(\.[0-9]+)?', out) if not m: raise FatalError('Could not detect perl version') found = m.group()[1:] newer = StrictVersion(found) >= StrictVersion(needed) return perl, found, newer