Add --frontend and --backend option to spack arch command (#11746)
This commit is contained in:
parent
5c5d6cad44
commit
b185f87c55
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
def setup_parser(subparser):
|
def setup_parser(subparser):
|
||||||
parts = subparser.add_mutually_exclusive_group()
|
parts = subparser.add_mutually_exclusive_group()
|
||||||
|
parts2 = subparser.add_mutually_exclusive_group()
|
||||||
parts.add_argument(
|
parts.add_argument(
|
||||||
'-p', '--platform', action='store_true', default=False,
|
'-p', '--platform', action='store_true', default=False,
|
||||||
help='print only the platform')
|
help='print only the platform')
|
||||||
@ -23,11 +24,24 @@ def setup_parser(subparser):
|
|||||||
parts.add_argument(
|
parts.add_argument(
|
||||||
'-t', '--target', action='store_true', default=False,
|
'-t', '--target', action='store_true', default=False,
|
||||||
help='print only the target')
|
help='print only the target')
|
||||||
|
parts2.add_argument(
|
||||||
|
'-f', '--frontend', action='store_true', default=False,
|
||||||
|
help='print frontend')
|
||||||
|
parts2.add_argument(
|
||||||
|
'-b', '--backend', action='store_true', default=False,
|
||||||
|
help='print backend')
|
||||||
|
|
||||||
|
|
||||||
def arch(parser, args):
|
def arch(parser, args):
|
||||||
arch = architecture.Arch(
|
if args.frontend:
|
||||||
architecture.platform(), 'default_os', 'default_target')
|
arch = architecture.Arch(architecture.platform(),
|
||||||
|
'frontend', 'frontend')
|
||||||
|
elif args.backend:
|
||||||
|
arch = architecture.Arch(architecture.platform(),
|
||||||
|
'backend', 'backend')
|
||||||
|
else:
|
||||||
|
arch = architecture.Arch(architecture.platform(),
|
||||||
|
'default_os', 'default_target')
|
||||||
|
|
||||||
if args.platform:
|
if args.platform:
|
||||||
print(arch.platform)
|
print(arch.platform)
|
||||||
|
@ -13,6 +13,10 @@ def test_arch():
|
|||||||
"""Sanity check ``spack arch`` to make sure it works."""
|
"""Sanity check ``spack arch`` to make sure it works."""
|
||||||
|
|
||||||
arch()
|
arch()
|
||||||
|
arch('-f')
|
||||||
|
arch('--frontend')
|
||||||
|
arch('-b')
|
||||||
|
arch('--backend')
|
||||||
|
|
||||||
|
|
||||||
def test_arch_platform():
|
def test_arch_platform():
|
||||||
@ -20,6 +24,8 @@ def test_arch_platform():
|
|||||||
|
|
||||||
arch('-p')
|
arch('-p')
|
||||||
arch('--platform')
|
arch('--platform')
|
||||||
|
arch('-f', '-p')
|
||||||
|
arch('-b', '-p')
|
||||||
|
|
||||||
|
|
||||||
def test_arch_operating_system():
|
def test_arch_operating_system():
|
||||||
@ -27,6 +33,8 @@ def test_arch_operating_system():
|
|||||||
|
|
||||||
arch('-o')
|
arch('-o')
|
||||||
arch('--operating-system')
|
arch('--operating-system')
|
||||||
|
arch('-f', '-o')
|
||||||
|
arch('-b', '-o')
|
||||||
|
|
||||||
|
|
||||||
def test_arch_target():
|
def test_arch_target():
|
||||||
@ -34,3 +42,5 @@ def test_arch_target():
|
|||||||
|
|
||||||
arch('-t')
|
arch('-t')
|
||||||
arch('--target')
|
arch('--target')
|
||||||
|
arch('-f', '-t')
|
||||||
|
arch('-b', '-t')
|
||||||
|
Loading…
Reference in New Issue
Block a user