Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add spack arch --operating-system and --target flags #8879

Merged
merged 2 commits into from
Aug 3, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 16 additions & 3 deletions lib/spack/spack/cmd/arch.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,24 @@ def setup_parser(subparser):
parts = subparser.add_mutually_exclusive_group()
parts.add_argument(
'-p', '--platform', action='store_true', default=False,
help="print only the platform")
help='print only the platform')
parts.add_argument(
'-o', '--operating-system', action='store_true', default=False,
help='print only the operating system')
parts.add_argument(
'-t', '--target', action='store_true', default=False,
help='print only the target')


def arch(parser, args):
arch = architecture.Arch(
architecture.platform(), 'default_os', 'default_target')

if args.platform:
print(architecture.platform())
print(arch.platform)
elif args.operating_system:
print(arch.platform_os)
elif args.target:
print(arch.target)
else:
print(architecture.sys_type())
print(arch)
4 changes: 2 additions & 2 deletions lib/spack/spack/cmd/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@
@B{variant=value1,value2,value3} set multi-value <variant> values

architecture variants:
@m{target=target} specific <target> processor
@m{os=operating_system} specific <operating_system>
@m{platform=platform} linux, darwin, cray, bgq, etc.
@m{os=operating_system} specific <operating_system>
@m{target=target} specific <target> processor
@m{arch=platform-os-target} shortcut for all three above

cross-compiling:
Expand Down
23 changes: 22 additions & 1 deletion lib/spack/spack/test/cmd/arch.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,27 @@


def test_arch():
"""Sanity check the arch command to make sure it works."""
"""Sanity check ``spack arch`` to make sure it works."""

arch()


def test_arch_platform():
"""Sanity check ``spack arch --platform`` to make sure it works."""

arch('-p')
arch('--platform')


def test_arch_operating_system():
"""Sanity check ``spack arch --operating-system`` to make sure it works."""

arch('-o')
arch('--operating-system')


def test_arch_target():
"""Sanity check ``spack arch --target`` to make sure it works."""

arch('-t')
arch('--target')