Skip to content

Commit 6aff57c

Browse files
committed
streamline spack version detection
1 parent 670f4c3 commit 6aff57c

File tree

2 files changed

+8
-47
lines changed

2 files changed

+8
-47
lines changed

stackinator/main.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ def make_argparser():
5454
parser.add_argument("-d", "--debug", action="store_true")
5555
parser.add_argument("-m", "--mount", required=False, type=str)
5656
parser.add_argument("-c", "--cache", required=False, type=str)
57-
spack_version_group = parser.add_mutually_exclusive_group()
58-
spack_version_group.add_argument("--develop", action="store_true", required=False)
59-
spack_version_group.add_argument("--spack-version", required=False, type=str)
57+
parser.add_argument("--develop", action="store_true", required=False)
6058

6159
return parser
6260

stackinator/recipe.py

Lines changed: 7 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,9 @@ def __init__(self, args):
121121
self._logger.debug("no pre install hook provided")
122122

123123
# determine the version of spack being used:
124-
# --develop flag implies the next release of spack
125-
# --spack-version option explicitly sets the version
126-
# otherwise the name of the commit provided in the config.yaml file is inspected
127-
self.spack_version = self.find_spack_version(args.develop, args.spack_version)
124+
# currently this just returns 1.0... develop is ignored
125+
# --develop flag will imply the next release of spack after 1.0 is supported properly
126+
self.spack_version = self.find_spack_version(args.develop)
128127

129128
# Returns:
130129
# Path: if the recipe contains a spack package repository
@@ -207,46 +206,10 @@ def config(self, config_path):
207206
schema.config_validator.validate(raw)
208207
self._config = raw
209208

210-
def find_spack_version(self, develop, spack_version):
211-
# determine the "major" version, if it can be inferred.
212-
# one of "0.21", "0.22", "0.23", "0.24" or "unknown".
213-
# "0.24" implies the latest features in develop that will
214-
# are being developed for the next version of spack
215-
216-
# the user has explicitly requested develop:
217-
if develop:
218-
return "0.24"
219-
220-
if spack_version is not None:
221-
return spack_version
222-
223-
# infer from the branch name
224-
# Note: this could be improved by first downloading
225-
# the requested spack version/tag/commit, then checking
226-
# the version returned by `spack --version`
227-
#
228-
# this would require defering this decision until after
229-
# the repo is cloned in build.py... a lot of work.
230-
commit = self.config["spack"]["commit"]
231-
if commit is None or commit == "develop":
232-
return "0.24"
233-
# currently supported
234-
if commit.find("0.24") >= 0:
235-
return "0.24"
236-
# currently supported
237-
if commit.find("0.23") >= 0:
238-
return "0.23"
239-
# currently supported
240-
if commit.find("0.22") >= 0:
241-
return "0.22"
242-
# currently supported
243-
if commit.find("0.21") >= 0:
244-
return "0.21"
245-
# currently supported
246-
if commit.find("0.20") >= 0:
247-
raise ValueError(f"spack minimum version is v0.21 - recipe uses {commit}")
248-
249-
return "unknown"
209+
# In Stackinator 6 we replaced logic required to determine the
210+
# pre 1.0 Spack version.
211+
def find_spack_version(self, develop):
212+
return "1.0"
250213

251214
@property
252215
def environment_view_meta(self):

0 commit comments

Comments
 (0)