本文整理汇总了Python中spack.version.ver函数的典型用法代码示例。如果您正苦于以下问题:Python ver函数的具体用法?Python ver怎么用?Python ver使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ver函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cxx11_flag
def cxx11_flag(self):
if self.version < ver('4.3'):
tty.die("Only gcc 4.3 and above support c++11.")
elif self.version < ver('4.7'):
return "-std=c++0x"
else:
return "-std=c++11"
示例2: cxx14_flag
def cxx14_flag(self):
if self.version < ver('4.8'):
tty.die("Only gcc 4.8 and above support c++14.")
elif self.version < ver('4.9'):
return "-std=c++1y"
else:
return "-std=c++14"
示例3: default_version
def default_version(cls, cc):
"""Older versions of gcc use the ``-dumpversion`` option.
Output looks like this::
4.4.7
In GCC 7, this option was changed to only return the major
version of the compiler::
7
A new ``-dumpfullversion`` option was added that gives us
what we want::
7.2.0
"""
# Skip any gcc versions that are actually clang, like Apple's gcc.
# Returning "unknown" makes them not detected by default.
# Users can add these manually to compilers.yaml at their own risk.
if spack.compilers.clang.Clang.default_version(cc) != 'unknown':
return 'unknown'
version = super(Gcc, cls).default_version(cc)
if ver(version) >= ver('7'):
version = get_compiler_version(cc, '-dumpfullversion')
return version
示例4: test_find_versions_of_archive_3
def test_find_versions_of_archive_3():
versions = find_versions_of_archive(root_tarball, root, list_depth=3)
assert ver('0.0.0') in versions
assert ver('1.0.0') in versions
assert ver('2.0.0') in versions
assert ver('3.0') in versions
assert ver('4.5') in versions
示例5: fc_version
def fc_version(cls, fc):
"""Older versions of gfortran use the ``-dumpversion`` option.
Output looks like this::
GNU Fortran (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
Copyright (C) 2010 Free Software Foundation, Inc.
or::
4.8.5
In GCC 7, this option was changed to only return the major
version of the compiler::
7
A new ``-dumpfullversion`` option was added that gives us
what we want::
7.2.0
"""
version = get_compiler_version(
fc, '-dumpversion',
r'(?:GNU Fortran \(GCC\) )?([\d.]+)')
if ver(version) >= ver('7'):
version = get_compiler_version(fc, '-dumpfullversion')
return version
示例6: test_version_ranges
def test_version_ranges():
assert_ver_lt('1.2:1.4', '1.6')
assert_ver_gt('1.6', '1.2:1.4')
assert_ver_eq('1.2:1.4', '1.2:1.4')
assert ver('1.2:1.4') != ver('1.2:1.6')
assert_ver_lt('1.2:1.4', '1.5:1.6')
assert_ver_gt('1.5:1.6', '1.2:1.4')
示例7: assert_ver_eq
def assert_ver_eq(a, b):
"""Asserts the results of comparisons when 'a' is equal to 'b'."""
a, b = ver(a), ver(b)
assert not a > b
assert a >= b
assert not a != b
assert a == b
assert not a < b
assert a <= b
示例8: assert_ver_gt
def assert_ver_gt(a, b):
"""Asserts the results of comparisons when 'a' is greater than 'b'."""
a, b = ver(a), ver(b)
assert a > b
assert a >= b
assert a != b
assert not a == b
assert not a < b
assert not a <= b
示例9: cxx11_flag
def cxx11_flag(self):
if self.version < ver('4.3'):
raise UnsupportedCompilerFlag(self,
"the C++11 standard",
"cxx11_flag",
" < 4.3")
elif self.version < ver('4.7'):
return "-std=c++0x"
else:
return "-std=c++11"
示例10: cxx17_flag
def cxx17_flag(self):
if self.version < ver('5.0'):
raise UnsupportedCompilerFlag(self,
"the C++17 standard",
"cxx17_flag",
"< 5.0")
elif self.version < ver('6.0'):
return "-std=c++1z"
else:
return "-std=c++17"
示例11: cxx14_flag
def cxx14_flag(self):
# Adapted from CMake's Intel-CXX rules.
if self.version < ver('15'):
raise UnsupportedCompilerFlag(self,
"the C++14 standard",
"cxx14_flag",
"< 15")
elif self.version < ver('15.0.2'):
return "-std=c++1y"
else:
return "-std=c++14"
示例12: cxx14_flag
def cxx14_flag(self):
if self.version < ver('4.8'):
raise UnsupportedCompilerFlag(self,
"the C++14 standard",
"cxx14_flag",
"< 4.8")
elif self.version < ver('4.9'):
return "-std=c++1y"
elif self.version < ver('6.0'):
return "-std=c++14"
else:
return ""
示例13: cxx17_flag
def cxx17_flag(self):
if self.is_apple:
# Adapted from CMake's rules for AppleClang
if self.version < ver('6.1.0'):
tty.die("Only Apple LLVM 6.1 and above support c++17.")
else:
return "-std=c++1z"
else:
if self.version < ver('3.5'):
tty.die("Only Clang 3.5 and above support c++17.")
else:
return "-std=c++1z"
示例14: cxx11_flag
def cxx11_flag(self):
if self.is_apple:
# Adapted from CMake's AppleClang-CXX rules
# Spack's AppleClang detection only valid form Xcode >= 4.6
if self.version < ver('4.0.0'):
tty.die("Only Apple LLVM 4.0 and above support c++11")
else:
return "-std=c++11"
else:
if self.version < ver('3.3'):
tty.die("Only Clang 3.3 and above support c++11.")
else:
return "-std=c++11"
示例15: try_fetch
def try_fetch(self, rev, test_file, args):
"""Tries to:
1. Fetch the repo using a fetch strategy constructed with
supplied args.
2. Check if the test_file is in the checked out repository.
3. Assert that the repository is at the revision supplied.
4. Add and remove some files, then reset the repo, and
ensure it's all there again.
"""
self.pkg.versions[ver('git')] = args
self.pkg.do_stage()
self.assert_rev(rev)
file_path = join_path(self.pkg.stage.source_path, test_file)
self.assertTrue(os.path.isdir(self.pkg.stage.source_path))
self.assertTrue(os.path.isfile(file_path))
os.unlink(file_path)
self.assertFalse(os.path.isfile(file_path))
untracked_file = 'foobarbaz'
touch(untracked_file)
self.assertTrue(os.path.isfile(untracked_file))
self.pkg.do_restage()
self.assertFalse(os.path.isfile(untracked_file))
self.assertTrue(os.path.isdir(self.pkg.stage.source_path))
self.assertTrue(os.path.isfile(file_path))
self.assert_rev(rev)