summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/external/__init__.py2
-rwxr-xr-xlib/spack/external/archspec/cli.py60
-rw-r--r--lib/spack/external/archspec/json/cpu/microarchitectures.json12
3 files changed, 62 insertions, 12 deletions
diff --git a/lib/spack/external/__init__.py b/lib/spack/external/__init__.py
index ccaff0cc7c..7f083ba5d2 100644
--- a/lib/spack/external/__init__.py
+++ b/lib/spack/external/__init__.py
@@ -18,7 +18,7 @@ archspec
* Homepage: https://pypi.python.org/pypi/archspec
* Usage: Labeling, comparison and detection of microarchitectures
-* Version: 0.2.0 (commit e44bad9c7b6defac73696f64078b2fe634719b62)
+* Version: 0.2.0-dev (commit f3667f95030c6573842fb5f6df0d647285597509)
astunparse
----------------
diff --git a/lib/spack/external/archspec/cli.py b/lib/spack/external/archspec/cli.py
index 4338b84fed..4049f98f7a 100755
--- a/lib/spack/external/archspec/cli.py
+++ b/lib/spack/external/archspec/cli.py
@@ -6,19 +6,61 @@
archspec command line interface
"""
-import click
+import argparse
+import typing
import archspec
import archspec.cpu
-@click.group(name="archspec")
-@click.version_option(version=archspec.__version__)
-def main():
- """archspec command line interface"""
+def _make_parser() -> argparse.ArgumentParser:
+ parser = argparse.ArgumentParser(
+ "archspec",
+ description="archspec command line interface",
+ add_help=False,
+ )
+ parser.add_argument(
+ "--version",
+ "-V",
+ help="Show the version and exit.",
+ action="version",
+ version=f"archspec, version {archspec.__version__}",
+ )
+ parser.add_argument("--help", "-h", help="Show the help and exit.", action="help")
+ subcommands = parser.add_subparsers(
+ title="command",
+ metavar="COMMAND",
+ dest="command",
+ )
-@main.command()
-def cpu():
- """archspec command line interface for CPU"""
- click.echo(archspec.cpu.host())
+ cpu_command = subcommands.add_parser(
+ "cpu",
+ help="archspec command line interface for CPU",
+ description="archspec command line interface for CPU",
+ )
+ cpu_command.set_defaults(run=cpu)
+
+ return parser
+
+
+def cpu() -> int:
+ """Run the `archspec cpu` subcommand."""
+ print(archspec.cpu.host())
+ return 0
+
+
+def main(argv: typing.Optional[typing.List[str]] = None) -> int:
+ """Run the `archspec` command line interface."""
+ parser = _make_parser()
+
+ try:
+ args = parser.parse_args(argv)
+ except SystemExit as err:
+ return err.code
+
+ if args.command is None:
+ parser.print_help()
+ return 0
+
+ return args.run()
diff --git a/lib/spack/external/archspec/json/cpu/microarchitectures.json b/lib/spack/external/archspec/json/cpu/microarchitectures.json
index b63149fc4b..a2f6790ffc 100644
--- a/lib/spack/external/archspec/json/cpu/microarchitectures.json
+++ b/lib/spack/external/archspec/json/cpu/microarchitectures.json
@@ -2782,6 +2782,10 @@
{
"versions": "13.0:",
"flags" : "-mcpu=apple-m1"
+ },
+ {
+ "versions": "16.0:",
+ "flags" : "-mcpu=apple-m2"
}
],
"apple-clang": [
@@ -2790,8 +2794,12 @@
"flags" : "-march=armv8.5-a"
},
{
- "versions": "13.0:",
- "flags" : "-mcpu=vortex"
+ "versions": "13.0:14.0.2",
+ "flags" : "-mcpu=apple-m1"
+ },
+ {
+ "versions": "14.0.2:",
+ "flags" : "-mcpu=apple-m2"
}
]
}