summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2018-08-02 17:28:21 -0500
committerTodd Gamblin <tgamblin@llnl.gov>2018-08-03 11:32:08 -0500
commit4f76e80925fc60b905d72efa2056c547456fefa4 (patch)
treee1575aa9e126d07f41229c2e43eba6e62421d88a
parentfebfa609350f4845fd7f387070308305671b7fb7 (diff)
downloadspack-4f76e80925fc60b905d72efa2056c547456fefa4.tar.gz
spack-4f76e80925fc60b905d72efa2056c547456fefa4.tar.bz2
spack-4f76e80925fc60b905d72efa2056c547456fefa4.tar.xz
spack-4f76e80925fc60b905d72efa2056c547456fefa4.zip
Add spack arch --operating-system and --target flags
-rw-r--r--lib/spack/spack/cmd/arch.py19
-rw-r--r--lib/spack/spack/cmd/help.py4
-rw-r--r--lib/spack/spack/test/cmd/arch.py23
3 files changed, 40 insertions, 6 deletions
diff --git a/lib/spack/spack/cmd/arch.py b/lib/spack/spack/cmd/arch.py
index adec8db139..da76968cd8 100644
--- a/lib/spack/spack/cmd/arch.py
+++ b/lib/spack/spack/cmd/arch.py
@@ -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)
diff --git a/lib/spack/spack/cmd/help.py b/lib/spack/spack/cmd/help.py
index b0bd85b8b1..15830bc322 100644
--- a/lib/spack/spack/cmd/help.py
+++ b/lib/spack/spack/cmd/help.py
@@ -59,9 +59,9 @@ spec expression syntax:
@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:
diff --git a/lib/spack/spack/test/cmd/arch.py b/lib/spack/spack/test/cmd/arch.py
index fe8dec8b2e..ce104f7182 100644
--- a/lib/spack/spack/test/cmd/arch.py
+++ b/lib/spack/spack/test/cmd/arch.py
@@ -29,6 +29,27 @@ arch = SpackCommand('arch')
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')