Skip to content
Snippets Groups Projects
Commit b185f87c authored by Toyohisa Kameyama's avatar Toyohisa Kameyama Committed by Peter Scheibel
Browse files

Add --frontend and --backend option to spack arch command (#11746)

parent 5c5d6cad
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,7 @@
def setup_parser(subparser):
parts = subparser.add_mutually_exclusive_group()
parts2 = subparser.add_mutually_exclusive_group()
parts.add_argument(
'-p', '--platform', action='store_true', default=False,
help='print only the platform')
......@@ -23,11 +24,24 @@ def setup_parser(subparser):
parts.add_argument(
'-t', '--target', action='store_true', default=False,
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):
arch = architecture.Arch(
architecture.platform(), 'default_os', 'default_target')
if args.frontend:
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:
print(arch.platform)
......
......@@ -13,6 +13,10 @@ def test_arch():
"""Sanity check ``spack arch`` to make sure it works."""
arch()
arch('-f')
arch('--frontend')
arch('-b')
arch('--backend')
def test_arch_platform():
......@@ -20,6 +24,8 @@ def test_arch_platform():
arch('-p')
arch('--platform')
arch('-f', '-p')
arch('-b', '-p')
def test_arch_operating_system():
......@@ -27,6 +33,8 @@ def test_arch_operating_system():
arch('-o')
arch('--operating-system')
arch('-f', '-o')
arch('-b', '-o')
def test_arch_target():
......@@ -34,3 +42,5 @@ def test_arch_target():
arch('-t')
arch('--target')
arch('-f', '-t')
arch('-b', '-t')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment