本文整理汇总了Python中spack.spec.Spec.concretize方法的典型用法代码示例。如果您正苦于以下问题:Python Spec.concretize方法的具体用法?Python Spec.concretize怎么用?Python Spec.concretize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类spack.spec.Spec
的用法示例。
在下文中一共展示了Spec.concretize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_install_overwrite
# 需要导入模块: from spack.spec import Spec [as 别名]
# 或者: from spack.spec.Spec import concretize [as 别名]
def test_install_overwrite(
mock_packages, mock_archive, mock_fetch, config, install_mockery
):
# It's not possible to overwrite something that is not yet installed
with pytest.raises(AssertionError):
install('--overwrite', 'libdwarf')
# --overwrite requires a single spec
with pytest.raises(AssertionError):
install('--overwrite', 'libdwarf', 'libelf')
# Try to install a spec and then to reinstall it.
spec = Spec('libdwarf')
spec.concretize()
install('libdwarf')
assert os.path.exists(spec.prefix)
expected_md5 = fs.hash_directory(spec.prefix)
# Modify the first installation to be sure the content is not the same
# as the one after we reinstalled
with open(os.path.join(spec.prefix, 'only_in_old'), 'w') as f:
f.write('This content is here to differentiate installations.')
bad_md5 = fs.hash_directory(spec.prefix)
assert bad_md5 != expected_md5
install('--overwrite', '-y', 'libdwarf')
assert os.path.exists(spec.prefix)
assert fs.hash_directory(spec.prefix) == expected_md5
assert fs.hash_directory(spec.prefix) != bad_md5
示例2: test_external_and_virtual
# 需要导入模块: from spack.spec import Spec [as 别名]
# 或者: from spack.spec.Spec import concretize [as 别名]
def test_external_and_virtual(self):
spec = Spec('externaltest')
spec.concretize()
self.assertEqual(spec['externaltool'].external, '/path/to/external_tool')
self.assertEqual(spec['stuff'].external, '/path/to/external_virtual_gcc')
self.assertTrue(spec['externaltool'].compiler.satisfies('gcc'))
self.assertTrue(spec['stuff'].compiler.satisfies('gcc'))
示例3: test_conditional_patched_deps_with_conditions
# 需要导入模块: from spack.spec import Spec [as 别名]
# 或者: from spack.spec.Spec import concretize [as 别名]
def test_conditional_patched_deps_with_conditions(mock_packages, config):
"""Test whether conditional patched dependencies with conditions work."""
spec = Spec('patch-several-dependencies @1.0 ^[email protected]')
spec.concretize()
# basic patch on libelf
assert 'patches' in list(spec['libelf'].variants.keys())
# foo
assert ('b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c'
in spec['libelf'].variants['patches'].value)
# conditional patch on libdwarf
assert 'patches' in list(spec['libdwarf'].variants.keys())
# bar
assert ('7d865e959b2466918c9863afca942d0fb89d7c9ac0c99bafc3749504ded97730'
in spec['libdwarf'].variants['patches'].value)
# baz is conditional on libdwarf version (no guarantee on order w/conds)
assert ('bf07a7fbb825fc0aae7bf4a1177b2b31fcf8a3feeaf7092761e18c859ee52a9c'
in spec['libdwarf'].variants['patches'].value)
# URL patches
assert 'patches' in list(spec['fake'].variants.keys())
# urlpatch.patch, urlpatch.patch.gz
assert (('1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd',
'abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234abcd1234') ==
spec['fake'].variants['patches'].value)
示例4: test_patched_dependency
# 需要导入模块: from spack.spec import Spec [as 别名]
# 或者: from spack.spec.Spec import concretize [as 别名]
def test_patched_dependency(
mock_packages, config, install_mockery, mock_fetch):
"""Test whether patched dependencies work."""
spec = Spec('patch-a-dependency')
spec.concretize()
assert 'patches' in list(spec['libelf'].variants.keys())
# make sure the patch makes it into the dependency spec
assert (('c45c1564f70def3fc1a6e22139f62cb21cd190cc3a7dbe6f4120fa59ce33dcb8',) ==
spec['libelf'].variants['patches'].value)
# make sure the patch in the dependent's directory is applied to the
# dependency
libelf = spec['libelf']
pkg = libelf.package
pkg.do_patch()
with pkg.stage:
with working_dir(pkg.stage.source_path):
# output a Makefile with 'echo Patched!' as the default target
configure = Executable('./configure')
configure()
# Make sure the Makefile contains the patched text
with open('Makefile') as mf:
assert 'Patched!' in mf.read()
示例5: test_yaml_subdag
# 需要导入模块: from spack.spec import Spec [as 别名]
# 或者: from spack.spec.Spec import concretize [as 别名]
def test_yaml_subdag(config, builtin_mock):
spec = Spec('mpileaks^mpich+debug')
spec.concretize()
yaml_spec = Spec.from_yaml(spec.to_yaml())
for dep in ('callpath', 'mpich', 'dyninst', 'libdwarf', 'libelf'):
assert spec[dep].eq_dag(yaml_spec[dep])
示例6: test_getitem_query
# 需要导入模块: from spack.spec import Spec [as 别名]
# 或者: from spack.spec.Spec import concretize [as 别名]
def test_getitem_query(self):
s = Spec('mpileaks')
s.concretize()
# Check a query to a non-virtual package
a = s['callpath']
query = a.last_query
assert query.name == 'callpath'
assert len(query.extra_parameters) == 0
assert not query.isvirtual
# Check a query to a virtual package
a = s['mpi']
query = a.last_query
assert query.name == 'mpi'
assert len(query.extra_parameters) == 0
assert query.isvirtual
# Check a query to a virtual package with
# extra parameters after query
a = s['mpi:cxx,fortran']
query = a.last_query
assert query.name == 'mpi'
assert len(query.extra_parameters) == 2
assert 'cxx' in query.extra_parameters
assert 'fortran' in query.extra_parameters
assert query.isvirtual
示例7: test_copy_satisfies_transitive
# 需要导入模块: from spack.spec import Spec [as 别名]
# 或者: from spack.spec.Spec import concretize [as 别名]
def test_copy_satisfies_transitive(self):
spec = Spec('dttop')
spec.concretize()
copy = spec.copy()
for s in spec.traverse():
assert s.satisfies(copy[s.name])
assert copy[s.name].satisfies(s)
示例8: test_conflicts_in_spec
# 需要导入模块: from spack.spec import Spec [as 别名]
# 或者: from spack.spec.Spec import concretize [as 别名]
def test_conflicts_in_spec(self, conflict_spec):
# Check that an exception is raised an caught by the appropriate
# exception types.
for exc_type in (ConflictsInSpecError, RuntimeError, SpecError):
s = Spec(conflict_spec)
with pytest.raises(exc_type):
s.concretize()
示例9: test_external_and_virtual
# 需要导入模块: from spack.spec import Spec [as 别名]
# 或者: from spack.spec.Spec import concretize [as 别名]
def test_external_and_virtual(self):
spec = Spec('externaltest')
spec.concretize()
assert spec['externaltool'].external_path == '/path/to/external_tool'
assert spec['stuff'].external_path == '/path/to/external_virtual_gcc'
assert spec['externaltool'].compiler.satisfies('gcc')
assert spec['stuff'].compiler.satisfies('gcc')
示例10: test_regression_issue_7705
# 需要导入模块: from spack.spec import Spec [as 别名]
# 或者: from spack.spec.Spec import concretize [as 别名]
def test_regression_issue_7705(self):
# spec.package.provides(name) doesn't account for conditional
# constraints in the concretized spec
s = Spec('simple-inheritance~openblas')
s.concretize()
assert not s.package.provides('lapack')
示例11: test_external_package
# 需要导入模块: from spack.spec import Spec [as 别名]
# 或者: from spack.spec.Spec import concretize [as 别名]
def test_external_package(self):
spec = Spec('externaltool')
spec.concretize()
self.assertEqual(spec['externaltool'].external, '/path/to/external_tool')
self.assertFalse('externalprereq' in spec)
self.assertTrue(spec['externaltool'].compiler.satisfies('gcc'))
示例12: test_test_deptype
# 需要导入模块: from spack.spec import Spec [as 别名]
# 或者: from spack.spec.Spec import concretize [as 别名]
def test_test_deptype():
"""Ensure that test-only dependencies are only included for specified
packages in the following spec DAG::
w
/|
x y
|
z
w->y deptypes are (link, build), w->x and y->z deptypes are (test)
"""
default = ('build', 'link')
test_only = ('test',)
x = MockPackage('x', [], [])
z = MockPackage('z', [], [])
y = MockPackage('y', [z], [test_only])
w = MockPackage('w', [x, y], [test_only, default])
mock_repo = MockPackageMultiRepo([w, x, y, z])
with spack.repo.swap(mock_repo):
spec = Spec('w')
spec.concretize(tests=(w.name,))
assert ('x' in spec)
assert ('z' not in spec)
示例13: test_with_or_without
# 需要导入模块: from spack.spec import Spec [as 别名]
# 或者: from spack.spec.Spec import concretize [as 别名]
def test_with_or_without(self):
s = Spec('a')
s.concretize()
pkg = spack.repo.get(s)
# Called without parameters
options = pkg.with_or_without('foo')
assert '--with-bar' in options
assert '--without-baz' in options
assert '--no-fee' in options
def activate(value):
return 'something'
options = pkg.with_or_without('foo', activation_value=activate)
assert '--with-bar=something' in options
assert '--without-baz' in options
assert '--no-fee' in options
options = pkg.enable_or_disable('foo')
assert '--enable-bar' in options
assert '--disable-baz' in options
assert '--disable-fee' in options
options = pkg.with_or_without('bvv')
assert '--with-bvv' in options
示例14: test_external_spec
# 需要导入模块: from spack.spec import Spec [as 别名]
# 或者: from spack.spec.Spec import concretize [as 别名]
def test_external_spec(config, mock_packages):
spec = Spec('externaltool')
spec.concretize()
check_yaml_round_trip(spec)
spec = Spec('externaltest')
spec.concretize()
check_yaml_round_trip(spec)
示例15: test_external_spec
# 需要导入模块: from spack.spec import Spec [as 别名]
# 或者: from spack.spec.Spec import concretize [as 别名]
def test_external_spec(config, builtin_mock):
spec = Spec('externaltool')
spec.concretize()
check_yaml_round_trip(spec)
spec = Spec('externaltest')
spec.concretize()
check_yaml_round_trip(spec)