Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit 9c7896a

Browse files
author
Koen van Walstijn
committed
NOTICKET: Fix job_creator version lookup from spack lockfile
1 parent 6ee39f7 commit 9c7896a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

job_creator/src/job_creator/containers.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import glob
33
import hashlib
44
import json
5+
import re
56
import logging
67
import logging.config
78
import os
@@ -500,10 +501,11 @@ def get_package_version(self, package_name: str) -> str:
500501

501502
logger.debug(f"Looking for package {package_name}")
502503
logger.debug(f"Roots: {spack_lock['roots']}")
504+
name_from_spec = re.compile(r"^\s*([\w-]*)")
503505
spack_hash = next(
504506
root
505507
for root in spack_lock["roots"]
506-
if root["spec"].split("~")[0].split("+")[0] == package_name
508+
if re.match(name_from_spec, root["spec"])[1] == package_name
507509
)["hash"]
508510
package_version = spack_lock["concrete_specs"][spack_hash]["version"]
509511

0 commit comments

Comments
 (0)