Skip to content

Commit 1f62967

Browse files
committed
Start on PYTHON_SERIES approach
1 parent 42b55a5 commit 1f62967

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

dev/conda/conda-build.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ export SWIFT_T_VERSION
6161
log "SWIFT/T VERSION: $SWIFT_T_VERSION"
6262
# Setenvs PYTHON_VERSION: passed into meta.yaml: e.g. "3.12.11"
6363
source $DEV_CONDA/get-python-version.sh
64-
# Python version, just major.minor: e.g. "3.12"
65-
export PYTHON_VERSION_MM=${PYTHON_VERSION_MM%.*}
64+
log "PYTHON_VERSION: $PYTHON_VERSION SERIES: $PYTHON_SERIES"
6665
# Optionally set R_VERSION from user argument:
6766
if (( ${#R} )) export R_VERSION=${R[2]}
6867

dev/conda/get-python-version.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,17 @@ T=( $( python --version ) )
66
print "get-python-version.sh: Python version detected: $T"
77

88
export PYTHON_VERSION=${T[2]}
9+
10+
# ZSH syntax: Split e.g. "3.12.7" into ( 3 12 7 )
11+
VS=( ${(s:.:)PYTHON_VERSION} )
12+
13+
# Python version, just major.minor: e.g. "3.12"
14+
export PYTHON_VERSION_MM="${VS[1]}.${VS[2]}"
15+
16+
# Get the next Python version (as an upper bound for meta.yaml)
17+
NEXT_MINOR=$[ ${VS[2]} + 1 ]
18+
export PYTHON_NEXT_MM="${VS[1]}.${NEXT_MINOR}"
19+
20+
# Current Python series in meta.yaml range format:
21+
# E.g., >=3.12,<3.13
22+
export PYTHON_SERIES=">=${PYTHON_VERSION_MM},<${PYTHON_NEXT_MM}"

dev/conda/meta-template.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ m4_ifelse(m4_getenv(ENABLE_R),`1',m4_include(env-R.yaml))
3030
# Remember to sync any dependency changes here with conda-install.sh
3131
requirements:
3232
build:
33-
- python==m4_getenv(PYTHON_VERSION)
33+
- python m4_getenv(PYTHON_SERIES)
3434
# Anaconda Autoconf 2.72 is buggy 2025-05-12
3535
- autoconf==2.71
3636
# Automake is needed on osx-arm64: 2025-10-27
@@ -46,7 +46,7 @@ m4_ifelse(m4_getenv(USE_TK), `1',m4_include(pkgs-tk.yaml))m4_dnl
4646
m4_ifelse(m4_getenv(USE_ZSH), `1',m4_include(pkgs-zsh.yaml))m4_dnl
4747
m4_ifelse(m4_getenv(ENABLE_R), `1',m4_include(pkgs-R.yaml))m4_dnl
4848
run:
49-
- python==m4_getenv(PYTHON_VERSION_MM)
49+
- python m4_getenv(PYTHON_SERIES)
5050
- openjdk>=17
5151
- m4_getenv(SPEC_MPICH)
5252
- swig

0 commit comments

Comments
 (0)