diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 33b47409..07f52f93 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,8 +18,8 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.6, 3.7, 3.8, 3.9] - spack-version: [0.21.0, develop] + python-version: [3.8, 3.9, 3.12] + spack-version: [0.21.2, develop] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} @@ -77,8 +77,8 @@ jobs: strategy: fail-fast: false matrix: - python-version: [3.7, 3.8, 3.9] - spack-version: [0.21.0, develop] + python-version: [3.8, 3.9] + spack-version: [0.21.2, develop] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} diff --git a/check.py b/check.py new file mode 100644 index 00000000..b0631076 --- /dev/null +++ b/check.py @@ -0,0 +1,21 @@ +# Copyright (c) 2022, National Technology & Engineering Solutions of Sandia, +# LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. +# Government retains certain rights in this software. +# +# This software is released under the BSD 3-clause license. See LICENSE file +# for more details. + +""" +a script to make sure minimum requirements for spack-manager +are met. + +- python@3.8 or higher +""" +import sys + +def check_spack_manager_requirements(): + if sys.version_info < (3,8): + raise ValueError("Spack-Manager requires Python 3.8 or higher.") + +if __name__ == "__main__": + check_spack_manager_requirements() diff --git a/install.py b/install.py index b74c8b7f..bbd91178 100755 --- a/install.py +++ b/install.py @@ -15,13 +15,21 @@ import llnl.util.tty as tty import os import spack.main +import importlib.util +import sys +spec = importlib.util.spec_from_file_location("check", os.path.join(os.path.dirname(sys.argv[0]), "check.py")) +check = importlib.util.module_from_spec(spec) +sys.modules["check"] = check +spec.loader.exec_module(check) parser = argparse.ArgumentParser() parser.add_argument("-s", "--scope", required=False, help="Spack scope to register spack-manager") +parser.add_argument("--test", action='store_true', help="Don't actually install but test installation process") if __name__ == "__main__": args = parser.parse_args() + check.check_spack_manager_requirements() extension_path = os.path.realpath(os.getcwd()) if not os.path.isdir(os.path.join(extension_path, "manager")): @@ -34,5 +42,8 @@ register_args.extend(["add", "config:extensions:[{0}]".format(extension_path)]) - config = spack.main.SpackCommand("config") - config(*register_args) + if args.test: + print("TEST:: config", *register_args) + else: + config = spack.main.SpackCommand("config") + config(*register_args)