summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--var/spack/repos/builtin/packages/rust/package.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/var/spack/repos/builtin/packages/rust/package.py b/var/spack/repos/builtin/packages/rust/package.py
index 81ab540ade..230d64ca05 100644
--- a/var/spack/repos/builtin/packages/rust/package.py
+++ b/var/spack/repos/builtin/packages/rust/package.py
@@ -103,10 +103,17 @@ class Rust(Package):
phases = ["configure", "build", "install"]
@classmethod
- def determine_version(csl, exe):
- output = Executable(exe)("--version", output=str, error=str)
+ def determine_spec_details(cls, prefix, exes_in_prefix):
+ rustc_candidates = [x for x in exes_in_prefix if os.path.basename(x) == "rustc"]
+ cargo_candidates = [x for x in exes_in_prefix if os.path.basename(x) == "cargo"]
+ # Both rustc and cargo must be present
+ if not (rustc_candidates and cargo_candidates):
+ return
+ output = Executable(rustc_candidates[0])("--version", output=str, error=str)
match = re.match(r"rustc (\S+)", output)
- return match.group(1) if match else None
+ if match:
+ version_str = match.group(1)
+ return Spec.from_detection(f"rust@{version_str}")
def setup_dependent_package(self, module, dependent_spec):
module.cargo = Executable(os.path.join(self.spec.prefix.bin, "cargo"))