Skip to content

Commit fbd3c8c

Browse files
committed
changes from review; add tests
1 parent 3389876 commit fbd3c8c

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

gfortran_utils.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ function get_distutils_platform {
99
# Report platform as in form of distutils get_platform.
1010
# This is like the platform tag that pip will use.
1111
# Modify fat architecture tags on macOS to reflect compiled architecture
12+
13+
# Deprecate this function once get_distutils_platform_ex is used in all
14+
# downstream projects
1215
local plat=$1
1316
case $plat in
1417
i686|x86_64|intel|aarch64|s390x|ppc64le) ;;
@@ -35,7 +38,7 @@ function get_distutils_platform_ex {
3538
# Modify fat architecture tags on macOS to reflect compiled architecture
3639
# For non-darwin, report manylinux version
3740
local plat=$1
38-
local MB_ML_VER=${MB_ML_VER:-1}
41+
local mb_ml_ver=${MB_ML_VER:-1}
3942
case $plat in
4043
i686|x86_64|intel|aarch64|s390x|ppc64le) ;;
4144
*) echo Did not recognize plat $plat; return 1 ;;
@@ -46,7 +49,7 @@ function get_distutils_platform_ex {
4649
echo plat=intel not allowed for Manylinux
4750
return 1
4851
fi
49-
echo "manylinux${MB_ML_VER}_${plat}"
52+
echo "manylinux${mb_ml_ver}_${plat}"
5053
return
5154
fi
5255
# macOS 32-bit arch is i386
@@ -74,7 +77,7 @@ function get_gf_lib_for_suf {
7477
local plat=${3:-$PLAT}
7578
local uname=${4:-$(uname)}
7679
if [ -z "$prefix" ]; then echo Prefix not defined; exit 1; fi
77-
local plat_tag=$(get_distutils_platform $plat $uname)
80+
local plat_tag=$(get_distutils_platform_ex $plat $uname)
7881
if [ -n "$suffix" ]; then suffix="-$suffix"; fi
7982
local fname="$prefix-${plat_tag}${suffix}.tar.gz"
8083
local out_fname="${ARCHIVE_SDIR}/$fname"

test_gf_utils.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Get gfortran utils
22
source gfortran_utils.sh
3+
set -e
4+
35

46
uname=$(uname)
57
FNAME_ROOT="openblas-v0.3.0"
@@ -55,3 +57,21 @@ rm $exp_64_tgz $exp_32_tgz
5557
[ "$(get_gf_lib "${FNAME_ROOT}" "i686")" == "$exp_32_tgz" ] || \
5658
(echo Wrong tgz output; exit 1)
5759
[ -f "$exp_32_tgz" ] || (echo Failed archive fetch; exit 1)
60+
61+
# Test get_distutils_platform_ex processing of MB_ML_VER
62+
if [ $uname != Darwin ]; then
63+
export MB_ML_VER=2010
64+
ml_plat_root="manylinux2010"
65+
ml_exp_64_tgz="${ARCH_ROOT}-${ml_plat_root}_x86_64${SUFP}.tar.gz"
66+
val=$(get_gf_lib "${FNAME_ROOT}" "x86_64")
67+
[ "${val}" == "$ml_exp_64_tgz" ] || \
68+
(echo Wrong tgz output ${val}, ${ml_exp_64_tgz}; exit 1)
69+
fi
70+
71+
# Test get_distutils_platform since it is no longer used internally
72+
[ "$(get_distutils_platform "x86_64" "x86_64")" == "manylinux1_x86_64" ] || \
73+
(echo Wrong get_distutils_platform output for x86_64; exit 1)
74+
75+
darwin_target=$(echo $MACOSX_DEPLOYMENT_TARGET | tr .- _)
76+
[ "$(get_distutils_platform "x86_64" "Darwin")" == "macosx_${darwin_target}_x86_64" ] || \
77+
(echo Wrong get_distutils_platform output for Darwin; exit 1)

0 commit comments

Comments
 (0)