Skip to content

Commit 1879a46

Browse files
authored
Merge pull request #317 from xylar/strip-rc-from-spack-for-mache-version
Strip off rc, etc. from version used for spack branch names
2 parents db6bfd7 + 385724b commit 1879a46

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

conda/meta.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ requirements:
2222
- importlib_resources
2323
- jinja2
2424
- lxml
25+
- packaging
2526
- pyyaml
2627
- requests
2728
- rsync

mache/spack/env.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from importlib import resources as importlib_resources
44

55
from jinja2 import Template
6+
from packaging.version import Version
67

78
from mache.machine_info import MachineInfo, discover_machine
89
from mache.spack.script import get_spack_script
@@ -139,9 +140,13 @@ def make_spack_env(
139140

140141
modules = f'{modules}\nexport TMPDIR={tmpdir}'
141142

143+
# Use PEP 440 parsing to strip any pre/dev/post release tags and keep only
144+
# the base release version (e.g., "1.2.3rc1" -> "1.2.3").
145+
version = Version(__version__).base_version
146+
142147
template_args = dict(
143148
modules=modules,
144-
version=__version__,
149+
version=version,
145150
spack_path=spack_path,
146151
env_name=env_name,
147152
yaml_filename=yaml_filename,

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ dependencies = [
2424
"importlib_resources",
2525
"jinja2",
2626
"lxml",
27+
"packaging",
2728
"pyyaml",
2829
"requests",
2930
"termcolor",

spec-file.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ python >=3.9
22
importlib_resources
33
jinja2
44
lxml
5+
packaging
56
pyyaml
67
requests
78
rsync

0 commit comments

Comments
 (0)