Skip to content

Commit

Permalink
Standardize on CONDA_PLATFORM
Browse files Browse the repository at this point in the history
  • Loading branch information
j-woz committed Dec 12, 2024
1 parent 8a1a617 commit 967f80a
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 28 deletions.
18 changes: 9 additions & 9 deletions dev/conda/build-generic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ set -o pipefail

# BUILD GENERIC SH
# Generic builder for all platforms
# RECIPE_DIR is the PLATFORM directory
# RECIPE_DIR is the CONDA_PLATFORM directory
# Called internally by
# "conda build" -> PLATFORM/build.sh -> build-generic.sh
# The Swift/T build output goes into PLATFORM/build-swift-t.log
# Puts some metadata in PLATFORM/build-generic.log
# "conda build" -> CONDA_PLATFORM/build.sh -> build-generic.sh
# The Swift/T build output goes into CONDA_PLATFORM/build-swift-t.log
# Puts some metadata in CONDA_PLATFORM/build-generic.log
# link to work directory is important,
# contains meta.yaml and Swift/T source
# If PLATFORM-specific settings are needed, put them in
# PLATFORM/build.sh
# If CONDA_PLATFORM-specific settings are needed, put them in
# CONDA_PLATFORM/deps.sh

# Environment notes:
# Generally, environment variables are not inherited into here.
Expand Down Expand Up @@ -40,11 +40,11 @@ echo ENABLE_R=$ENABLE_R
echo "ENABLE_R: $ENABLE_R"
} > $RECIPE_DIR/build-generic.log

if [[ $PLATFORM =~ osx-* ]]
if [[ $CONDA_PLATFORM =~ osx-* ]]
then
NULL=""
ZT=""
if [[ $PLATFORM =~ osx-arm64 ]]
if [[ $CONDA_PLATFORM =~ osx-arm64 ]]
then
# These variables affect the mpicc/mpicxx wrappers
export MPICH_CC=clang
Expand Down Expand Up @@ -121,7 +121,7 @@ then
fi

set -x
if [[ $PLATFORM =~ osx-* ]] && [[ ${GITHUB_ACTION:-0} == 0 ]]
if [[ $CONDA_PLATFORM =~ osx-* ]] && [[ ${GITHUB_ACTION:-0} == 0 ]]
then
# Use this syntax on Mac, unless in GitHub,
# where we install Homebrew gnu-sed
Expand Down
16 changes: 8 additions & 8 deletions dev/conda/conda-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ set -eu
# Generates settings.sed for the Swift/T build
# Many exported environment variables here
# are substituted into meta.yaml
# This script runs in the PLATFORM subdirectory
# This script runs in the CONDA_PLATFORM subdirectory
# and should not change directories
# A LOG is produced named platform/conda-build.log
# You can only run 1 job concurrently
# You can only run 1 job concurrently per Anaconda installation
# because of the log and
# because of meta.yaml
# The Swift/T source must have already been put in $TMP/distro
Expand Down Expand Up @@ -52,14 +52,14 @@ source $DEV_CONDA/get-python-version.sh
# Optionally set R_VERSION from user argument:
if (( ${#R} )) export R_VERSION=${R[2]}

if (( ${#PLATFORM:-} == 0 )) {
log "unset: PLATFORM"
if (( ${#CONDA_PLATFORM:-} == 0 )) {
log "unset: CONDA_PLATFORM"
log " This script should be called by a conda-platform.sh"
return 1
}

log "VERSION: $SWIFT_T_VERSION"
log "PLATFORM: $PLATFORM $*"
log "SWIFT/T VERSION: $SWIFT_T_VERSION"
log "CONDA_PLATFORM: $CONDA_PLATFORM $*"

# This is passed into meta.yaml:
export DISTRO=$TMP/distro
Expand Down Expand Up @@ -115,7 +115,7 @@ export USE_ZLIB=0
export USE_ZSH=1

# Allow platform to modify dependencies
source $DEV_CONDA/$PLATFORM/deps.sh
source $DEV_CONDA/$CONDA_PLATFORM/deps.sh

export DATE=${(%)DATE_FMT_S}
m4 -P -I $DEV_CONDA $COMMON_M4 $META_TEMPLATE > meta.yaml
Expand All @@ -134,7 +134,7 @@ if [[ -f $LOG ]] {
print
}

if (( ENABLE_R )) && [[ $PLATFORM == "osx-arm64" ]] {
if (( ENABLE_R )) && [[ $CONDA_PLATFORM == "osx-arm64" ]] {
# This is just for our emews-rinside:
CHANNEL_SWIFT=( -c swift-t )
} else {
Expand Down
19 changes: 10 additions & 9 deletions dev/conda/conda-platform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,30 @@
set -eu

# CONDA PLATFORM
# Build conda for a given PLATFORM
# Dependency files are in the PLATFORM directory
# Generated scripts and log files are put in the PLATFORM directory
# Build conda for a given CONDA_PLATFORM
# Dependency files are in the CONDA_PLATFORM directory
# Generated scripts and logs are put in the CONDA_PLATFORM directory
# Arguments:
# -C configure-only- generate meta.yaml and settings.sed, then stop
# -r R_VERSION for the R version
# PLATFORM: The PLATFORM directory
# CONDA_PLATFORM: The PLATFORM directory

C="" R=""
zparseopts -D -E -F h=HELP C=C r:=R
if (( ${#*} != 1 )) {
print "conda-platform.sh: Provide PLATFORM!"
print "conda-platform.sh: Provide CONDA_PLATFORM!"
return 1
}
export PLATFORM=$1
# The PLATFORM under Anaconda naming conventions:
export CONDA_PLATFORM=$1

# The Swift/T Conda script directory (absolute):
DEV_CONDA=${0:A:h}

if [[ ! -d $DEV_CONDA/$PLATFORM ]] {
printf "conda-platform.sh: No such platform: '%s'\n" $PLATFORM
if [[ ! -d $DEV_CONDA/$CONDA_PLATFORM ]] {
printf "conda-platform.sh: No such platform: '%s'\n" $CONDA_PLATFORM
return 1
}

cd $DEV_CONDA/$PLATFORM
cd $DEV_CONDA/$CONDA_PLATFORM
$DEV_CONDA/conda-build.sh $HELP $C $R
1 change: 0 additions & 1 deletion dev/conda/helpers.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ checksum()
{
# Use redirection to suppress filename in program output
local PKG=$1
print "checksum(CONDA_PLATFORM=$CONDA_PLATFORM)" $PKG
if [[ $CONDA_PLATFORM =~ osx-* ]] {
md5 -r < $PKG
} else {
Expand Down
2 changes: 1 addition & 1 deletion dev/conda/meta-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ build:
# Environment variables for build.sh must be listed here,
# normal environment inheritance does not happen!
script_env:
- PLATFORM=getenv(PLATFORM)
- CONDA_PLATFORM=getenv(CONDA_PLATFORM)
m4_ifelse(getenv(ENABLE_R),`1',m4_include(env-R.yaml))

# Remember to sync any dependency changes here with conda-install.sh
Expand Down
1 change: 1 addition & 0 deletions dev/conda/upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ print "TIME: ${A[mtime]}"
printf "SIZE: %.1f MB\n" $(( float(${A[size]}) / (1024*1024) ))
HASH=( $( md5sum $PKG ) )
print "HASH: ${HASH[1]}"
if (( ${#FORCE} )) print "FORCING!"

print
printf "CONFIRM? "
Expand Down

0 comments on commit 967f80a

Please sign in to comment.