Skip to content

Commit 59c0ddf

Browse files
committed
20250902_00 Fix
- Slight bug in handling versions correctly.
1 parent 66214d4 commit 59c0ddf

File tree

105 files changed

+156
-114
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+156
-114
lines changed

bin/numpy-comp.sh

Lines changed: 52 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,61 @@ else
2121
VERSION=$1
2222
fi
2323

24-
# Handle wildcard versions by using the minimum version number
25-
VERSION_NUM=$(echo "$VERSION" | sed 's/\*//g' | tr -d '.')
26-
MIN_VERSION_NUM=1260
24+
# Function to compare semantic versions
25+
compare_versions() {
26+
local version1=$1
27+
local version2=$2
28+
29+
# Remove any wildcards and split into components
30+
local v1_clean=$(echo "$version1" | sed 's/\*//g')
31+
local v2_clean=$(echo "$version2" | sed 's/\*//g')
32+
33+
# Split versions into arrays
34+
IFS='.' read -ra V1_PARTS <<< "$v1_clean"
35+
IFS='.' read -ra V2_PARTS <<< "$v2_clean"
36+
37+
# Pad shorter array with zeros
38+
local max_len=${#V1_PARTS[@]}
39+
if [ ${#V2_PARTS[@]} -gt $max_len ]; then
40+
max_len=${#V2_PARTS[@]}
41+
fi
42+
43+
# Compare each component
44+
for ((i=0; i<max_len; i++)); do
45+
local v1_part=${V1_PARTS[i]:-0}
46+
local v2_part=${V2_PARTS[i]:-0}
47+
48+
if [ "$v1_part" -lt "$v2_part" ]; then
49+
return 1 # version1 < version2
50+
elif [ "$v1_part" -gt "$v2_part" ]; then
51+
return 0 # version1 > version2
52+
fi
53+
done
54+
55+
return 2 # versions are equal
56+
}
57+
58+
# Check if version is greater than or equal to 1.26.0
59+
MIN_VERSION="1.26.0"
2760

2861
# If version contains wildcard, treat it as equal to minimum version
2962
if [[ "$VERSION" == *"*"* ]]; then
30-
VERSION_NUM=$MIN_VERSION_NUM
31-
fi
32-
33-
if [ "$VERSION_NUM" -lt "$MIN_VERSION_NUM" ]; then
34-
echo "Error: Version must be greater than or equal to 1.26.0"
35-
echo "Specified version: $VERSION"
36-
exit 1
63+
VERSION_CLEAN=$(echo "$VERSION" | sed 's/\*//g')
64+
compare_versions "$VERSION_CLEAN" "$MIN_VERSION"
65+
result=$?
66+
if [ $result -eq 1 ]; then
67+
echo "Error: Version must be greater than or equal to 1.26.0"
68+
echo "Specified version: $VERSION"
69+
exit 1
70+
fi
71+
else
72+
compare_versions "$VERSION" "$MIN_VERSION"
73+
result=$?
74+
if [ $result -eq 1 ]; then
75+
echo "Error: Version must be greater than or equal to 1.26.0"
76+
echo "Specified version: $VERSION"
77+
exit 1
78+
fi
3779
fi
3880

3981
echo "Installing NumPy version $VERSION..."

docs/shdoc/README.md

Lines changed: 1 addition & 1 deletion

docs/shdoc/bin/shinclude/config_lib_sh.md

Lines changed: 1 addition & 1 deletion

docs/shdoc/bin/shinclude/errno_lib_sh.md

Lines changed: 1 addition & 1 deletion

docs/shdoc/bin/shinclude/functions/__set_venv_vars.md

Lines changed: 1 addition & 1 deletion

docs/shdoc/bin/shinclude/functions/__venv_conda_check.md

Lines changed: 1 addition & 1 deletion

docs/shdoc/bin/shinclude/functions/_deprecated.md

Lines changed: 1 addition & 1 deletion

docs/shdoc/bin/shinclude/functions/_source_check.md

Lines changed: 1 addition & 1 deletion

docs/shdoc/bin/shinclude/functions/benv.md

Lines changed: 1 addition & 1 deletion

docs/shdoc/bin/shinclude/functions/cact.md

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)