diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 000000000..bcc804747 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,86 @@ +name: Build and Test ๐Ÿงช + +on: + # Schedule and workflow_dispatch (manual) only work on default branch + schedule: + - cron: "0 6 * * *" # Fire at 06:00 AM every day + workflow_dispatch: + pull_request: + push: + branches: + - github_action_mac +# - github_action_build # The name of our test branch +# - master + release: + types: + - published + +permissions: + contents: read # To read the project source code (git) +# packages: read # To read the docker image from package registry + +jobs: + build_swift-t: + name: Swift/T OS=${{ matrix.os }} PY=${{ matrix.python-version }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + # - macos-14 + + # Comma separated list of python versions to test + python-version: ["3.11"] # "3.8", "3.9", "3.10", + + mpi: + - mpich + + steps: + - name: Checkout + uses: actions/checkout@v4 + + # R may need to run before installing sed: + - name: Set up R + uses: r-lib/actions/setup-r@v2 + + - name: Install deps + run: | + dev/github-actions/setup-deps.sh ${{ matrix.os }} + +# # TODO RInside + - name: Install R requirements + run: R -e "install.packages('RInside')" +# # run: Rscript install/R-requirements.R + + # - uses: r-lib/actions/setup-r-dependencies@v2 + # with: + # extra-packages: any::RInside + + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + +# - name: Upgrade pip +# run: python -m pip install -U pip + + - name: Initialize swift-t settings + run: | + dev/build/init-settings.sh + dev/github-actions/edit-settings.sh + + # TODO set swift-t install, R, python, and ?? + # sed -i 's/original/new/g' file.txt +# - run: +# - run: sed -i 's/ENABLE_R=0/ENABLE_R=1/g' dev/build/swift-t-settings.sh + + - name: build swift-t + run: | + dev/build/build-swift-t.sh -vv + + - name: Report Swift/T version info + run: /tmp/swift-t-install/stc/bin/swift-t -v + + - name: Check that Swift/T runs + run: /tmp/swift-t-install/stc/bin/swift-t -E 'trace(42);' diff --git a/.github/workflows/conda.yaml b/.github/workflows/conda.yaml new file mode 100644 index 000000000..aadea83da --- /dev/null +++ b/.github/workflows/conda.yaml @@ -0,0 +1,80 @@ +name: Conda Build ๐Ÿ + +# Build the Swift/T Anaconda package + +env: + # For Chicago time on log messages: + TZ: CST6CDT + +on: + # Schedule and workflow_dispatch (manual) only work on default branch + schedule: + - cron: "0 6 * * *" # Fire at 06:00 AM every day + workflow_dispatch: + pull_request: + push: + branches: + - github_action_mac +# - master + release: + types: + - published + +permissions: + contents: read # To read the project source code (git) + +jobs: + build_conda_pkg: + name: OS=${{ matrix.os }} PY=${{ matrix.python-version }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + # - ubuntu-latest + - macos-13 + # - macos-14 # This is ARM64 + # - macos-14-arm64 + + # Comma separated list of python versions to test + python-version: ["3.11"] # "3.9", + + mpi: + - mpich + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup dependencies + run: | + dev/github-actions/check setup-conda.sh ${{ matrix.os }} + + - name: Save tool.log + uses: actions/upload-artifact@v4 + with: + name: tool-log + path: tool.log + + - name: Check tool.log + run: | + grep "setup-conda: SUCCESS" tool.log + + - name: Build Anaconda package + run: | + dev/github-actions/check dev/jenkins/anaconda.sh + + - name: Save anaconda.log + uses: actions/upload-artifact@v4 + with: + name: anaconda-log + path: anaconda.log + + - name: Check anaconda.log + run: | + grep "anaconda.sh: SUCCESS" tool.log + + - name: Report Swift/T version info + run: /tmp/swift-t-install/stc/bin/swift-t -v + + - name: Check that Swift/T runs + run: /tmp/swift-t-install/stc/bin/swift-t -E 'trace(42);' diff --git a/dev/build/functions.sh b/dev/build/functions.sh index 197c2724c..61ed0f659 100644 --- a/dev/build/functions.sh +++ b/dev/build/functions.sh @@ -26,6 +26,7 @@ assert() } LOG() +# Usage: LOG $LVL MESSAGE... { if (( ${#} == 0 )) then @@ -125,6 +126,11 @@ check_make() MAKE_QUIET="--quiet" fi + if (( VERBOSITY >= $LOG_DEBUG )) + then + echo "using make: " $( which make ) + fi + MAKE_V="" if (( VERBOSITY == $LOG_TRACE )) then @@ -136,9 +142,12 @@ make_clean() { if (( RUN_MAKE_CLEAN )) then - if [ -f Makefile ] + if [[ -f Makefile ]] then + LOG $LOG_DEBUG "make_clean() ..." make clean + else + LOG $LOG_DEBUG "make_clean(): No Makefile." fi fi } diff --git a/dev/conda/README.adoc b/dev/conda/README.adoc index 30d7c96d0..9bc711cb4 100644 --- a/dev/conda/README.adoc +++ b/dev/conda/README.adoc @@ -18,8 +18,11 @@ toc::[] We are Anaconda project `swift-t`: + https://anaconda.org/swift-t -`swift-t`:: Swift/T -`swift-t-r`:: Swift/T and R +`swift-t`:: +Swift/T + +`swift-t-r`:: +Swift/T and R == End user interface @@ -39,7 +42,6 @@ These are standard directory names: * `linux-64`: "Linux on PC": Works * `osx-64`: "Mac on PC": Works * `osx-arm64`: "Mac on ARM": Works -+ This plaform skips Ant, the C compiler, and ZSH, and assumes they are on the user system: * `aarch64`: "Linux on ARM": Works @@ -145,7 +147,7 @@ Use `dev/conda/upload.sh` to automate this. == Dependencies `r-rinside`:: -This package does not exist for `linux-aarch-64` + +This package does not exist for `linux-aarch-64` == M4 usage diff --git a/dev/conda/build-generic.sh b/dev/conda/build-generic.sh index f30a90473..8318245fe 100755 --- a/dev/conda/build-generic.sh +++ b/dev/conda/build-generic.sh @@ -113,8 +113,11 @@ then done fi -if [[ $PLATFORM =~ osx-* ]] +set -x +if [[ $PLATFORM =~ osx-* ]] && [[ ${GITHUB_ACTION:-0} != 0 ]] then + # Use this syntax on Mac, unless in GitHub, + # where we install Homebrew gnu-sed SED_I=( sed -i "''" ) else SED_I=( sed -i ) @@ -162,4 +165,7 @@ for file in turbine-config.sh; do ln -sv ../swift-t/turbine/scripts/$file . done +set -x +ls $PREFIX/bin + echo "BUILD-GENERIC.SH STOP $( date '+%Y-%m-%d %H:%M:%S' )" diff --git a/dev/conda/conda-platform.sh b/dev/conda/conda-platform.sh index 3dd08f1b9..9898fe573 100755 --- a/dev/conda/conda-platform.sh +++ b/dev/conda/conda-platform.sh @@ -2,6 +2,7 @@ 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 # Arguments: diff --git a/dev/conda/helpers.zsh b/dev/conda/helpers.zsh index b5bee8da5..8a38e02eb 100644 --- a/dev/conda/helpers.zsh +++ b/dev/conda/helpers.zsh @@ -4,7 +4,7 @@ checksum() { - # Use redirection to suppress filename in md5 output + # Use redirection to suppress filename in program output local PKG=$1 if [[ $PLATFORM =~ osx-* ]] { md5 -r < $PKG @@ -12,7 +12,3 @@ checksum() md5sum < $PKG } } - -print_environment() -{ -} diff --git a/dev/conda/osx-64/build.sh b/dev/conda/osx-64/build.sh index e346b012a..7142db61f 100644 --- a/dev/conda/osx-64/build.sh +++ b/dev/conda/osx-64/build.sh @@ -10,23 +10,48 @@ DEV_CONDA=$( cd $RECIPE_DIR/.. ; /bin/pwd -P ) ( set -eu - # Find Java bin directory - echo CONDA_EXE=$CONDA_EXE - CONDA=$( dirname $( dirname $CONDA_EXE ) ) - # OpenJDK home should be under MINICONDA/pkgs/openjdk-* - OPENJDK=( $( find $CONDA/pkgs -type d -name "openjdk-*" ) ) - if (( ${#OPENJDK} == 0 )) + # Find Java bin directory in Conda PREFIX sandbox + # echo CONDA_EXE=$CONDA_EXE + # CONDA=$( dirname $( dirname $CONDA_EXE ) ) + # OpenJDK home should be under PREFIX/pkgs/openjdk-* + # Should be in PREFIX/bin but is not on any system + # On Linux it is under $PREFIX/pkgs/openjdk-*/lib/jvm/bin + # On GitHub macos-13 it is under $PREFIX/lib/jvm/bin + echo FIND JAVA PREFIX $PREFIX + which java javac || true + conda list + # Does not exist: + # source $PREFIX/etc/profile.d/conda.sh + set -x + find $PREFIX + which java javac || true + echo $PATH + set -x + FOUND_JDK=0 + find $PREFIX -name java + JDKS=( $( find $PREFIX/pkgs -type d -name "openjdk-*" ) ) + if (( ${#JDKS} > 0 )) then - echo "build.sh: Could not find OpenJDK in $CONDA" - exit 1 + JDK_BIN=${JDKS[0]}/lib/jvm/bin + if ! [[ -d $JDK_BIN ]] + then + echo "build.sh: Broken JVM directory structure in $PREFIX" + exit 1 + fi + FOUND_JDK=1 fi - if ! [[ -d ${OPENJDK[0]}/lib/jvm/bin ]] + if [[ -d $PREFIX/lib/jvm/bin ]] then - echo "build.sh: Could not find OpenJDK binaries in $CONDA" + JDK_BIN=$PREFIX/lib/jvm/bin + FOUND_JDK=1 + fi + if (( ! FOUND_JDK )) + then + echo "build.sh: Could not find OpenJDK in $CONDA" exit 1 fi - echo "build.sh: Found OpenJDK: $OPENJDK" - PATH=${OPENJDK[0]}/lib/jvm/bin:$PATH + echo "build.sh: Found OpenJDK bin directory: $JDK_BIN" + PATH=$JDK_BIN:$PATH which java javac if (( ${ENABLE_R:-0} )) @@ -43,6 +68,6 @@ DEV_CONDA=$( cd $RECIPE_DIR/.. ; /bin/pwd -P ) echo "build.sh: calling build-generic.sh ..." $DEV_CONDA/build-generic.sh -) +) 2>&1 | dd echo "build.sh: STOP" diff --git a/dev/github-actions/check b/dev/github-actions/check new file mode 100755 index 000000000..694c0208d --- /dev/null +++ b/dev/github-actions/check @@ -0,0 +1,24 @@ +#!/bin/sh + +# CHECK +# Run job, always return success for GitHub action +# Allows us to capture artifacts and test for success later +# Adds dev/github-actions to PATH to shorten commands + +echo "CHECK: ${*}" + +if [ ! -d dev/github-actions ] +then + echo "CHECK: MISCONFIGURATION!" + exit 1 +fi + +PATH=dev/github-actions:$PATH + +# Run the arguments here! +if ! ${*} +then + echo "CHECK FAILED: ${*}" +fi + +# Always succeeds. diff --git a/dev/github-actions/edit-settings.sh b/dev/github-actions/edit-settings.sh new file mode 100755 index 000000000..b2dda6d7d --- /dev/null +++ b/dev/github-actions/edit-settings.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu + +# SETTINGS SH +# Edit swift-t-settings.sh via settings.sed +# Assumes PWD is the top of the Swift/T clone +# We immediately cd into /dev/ + +cd dev +SETTINGS_SH=build/swift-t-settings.sh +echo "Editing $SETTINGS_SH ..." +sed -i -f github-actions/settings.sed build/swift-t-settings.sh diff --git a/dev/github-actions/settings.sed b/dev/github-actions/settings.sed new file mode 100644 index 000000000..c9a5999fa --- /dev/null +++ b/dev/github-actions/settings.sed @@ -0,0 +1,8 @@ +# sed edits to swift-t-settings.sh + +s/ENABLE_PYTHON=0/ENABLE_PYTHON=1/ +s/MAKE_PARALLELISM=1/MAKE_PARALLELISM=4/ + +# Local Variables: +# mode: sh; +# End: diff --git a/dev/github-actions/setup-conda.sh b/dev/github-actions/setup-conda.sh new file mode 100755 index 000000000..f5168f207 --- /dev/null +++ b/dev/github-actions/setup-conda.sh @@ -0,0 +1,127 @@ +#!/bin/bash +set -eu + +# SETUP CONDA +# Sets up system tools for an Anaconda Swift/T build +# For any matrix.os +# Produces artifact tool.log, which is checked by subsequent steps + +MATRIX_OS=$1 + +START=$SECONDS + +log() +{ + printf "setup-conda: %s\n" "$*" +} + +log "Installing dependencies for OS=$MATRIX_OS ..." +# Create initial timestamp: +log "Start..." >> tool.log + +# Set up tools: +case $MATRIX_OS in + "ubuntu-latest") + TOOL=( sudo apt-get install --yes ) + ;; + macos-*) + TOOL=( brew install ) + brew update >& tool.log + ;; + *) + log "unknown OS: $MATRIX_OS" + exit 1 +esac + +# Basic Mac packages: +PKGS_MAC=( + automake + make + coreutils + # To resolve the sed -i problem on Mac + gnu-sed + # For consistent timing messages: + gnu-time +) + +# Select package lists: +case $MATRIX_OS in + "ubuntu-latest") + PKGS=( zsh ) + ;; + "macos-13") + # macos-13 already has autoconf + PKGS=( ${PKGS_MAC[@]} ) + ;; + "macos-14") + PKGS=( ${PKGS_MAC[@]} + autoconf + ) + ;; + "macos-14-arm64") + PKGS=( ${PKGS_MAC[@]} + autoconf + ) + ;; + *) + log "unknown OS: $MATRIX_OS" + exit 1 +esac + +if ( + set -eux + ${TOOL[@]} ${PKGS[@]} +) 2>&1 >> tool.log +then + COUNT=${#PKGS[@]} + T=$(( SECONDS - START )) + log "Installed $COUNT packages in $T seconds." +else + log "FAILED to install packages!" + log "tool.log:" + cat tool.log + exit 1 +fi + +# Setup Mac PATH +# Add these tools to PATH via GITHUB_PATH, one per line +case $MATRIX_OS in + macos-13) + BINS=( + /usr/local/opt/make/bin + /usr/local/opt/coreutils/libexec/gnubin + /usr/local/opt/gnu-sed/libexec/gnubin + /usr/local/opt/gnu-time/libexec/gnubin + # Does not exist: /usr/local/opt/bin + ) + ;; + macos-14*) + BINS=( + # Should be in main bin: + # /opt/homebrew/opt/autoconf/libexec/gnubin + # /opt/homebrew/opt/automake/libexec/gnubin + /opt/homebrew/opt/make/libexec/gnubin + /opt/homebrew/opt/coreutils/libexec/gnubin + /opt/homebrew/opt/gnu-sed/libexec/gnubin + /opt/homebrew/opt/gnu-time/libexec/gnubin + /opt/homebrew/bin + ) + ;; +esac + +for BIN in ${BINS[@]} +do + if [[ ! -d ${BIN} ]] + then + echo "BIN does not exist: $BIN" + exit 1 + fi +done + +echo ${BINS[@]} | fmt -w 1 >> $GITHUB_PATH +{ + echo PATHS: + echo ${BINS[@]} | fmt -w 1 +} >> tool.log + +log "SUCCESS" >> tool.log diff --git a/dev/github-actions/setup-deps.sh b/dev/github-actions/setup-deps.sh new file mode 100755 index 000000000..ffe1da1a1 --- /dev/null +++ b/dev/github-actions/setup-deps.sh @@ -0,0 +1,89 @@ +#!/bin/bash +set -eu + +# SETUP DEPS +# Sets up system tools for a full Swift/T build +# For any matrix.os + +MATRIX_OS=$1 + +START=$SECONDS + +log() +{ + printf "setup-deps: %s\n" "$*" +} + +log "Installing dependencies for OS=$MATRIX_OS ..." + +if [[ $MATRIX_OS == "ubuntu-latest" ]] +then + TOOL=( sudo apt-get install --yes ) + PKGS=( + autoconf + default-jdk + libcurl4-openssl-dev + make + mpich + tcl-dev + zsh + ) +elif [[ $MATRIX_OS == "macos-14" ]] +then + TOOL=( brew install ) + PKGS=( + autoconf + automake + # To resolve the sed -i problem on Mac + gnu-sed + make + mpich + swig + tcl-tk + ) + brew update >& tool.log +elif [[ $MATRIX_OS == "macos-14-arm64" ]] +then + TOOL=( brew install ) + PKGS=( + autoconf + automake + # To resolve the sed -i problem on Mac + gnu-sed + make + mpich + swig + tcl-tk + ) + brew update >& tool.log +else + log "unknown OS: $MATRIX_OS" + exit 1 +fi + +if ( + set -eux + ${TOOL[@]} ${PKGS[@]} +) 2>&1 >> tool.log +then + COUNT=${#PKGS[@]} + T=$(( SECONDS - START )) + log "Installed $COUNT packages in $T seconds." +else + log "FAILED to install packages!" + log "tool.log:" + cat tool.log + exit 1 +fi + +# Setup Mac PATH +# Add these tools to PATH via GITHUB_PATH, one per line +if [[ $MATRIX_OS == macos-* ]] +then + BINS=( + /opt/homebrew/opt/gnu-sed/libexec/gnubin + /opt/homebrew/opt/make/libexec/gnubin + /opt/homebrew/opt/bin + ) + echo ${BINS[@]} | fmt -w 1 >> $GITHUB_PATH +fi diff --git a/dev/github-actions/setup-macos-14.sh b/dev/github-actions/setup-macos-14.sh new file mode 100755 index 000000000..8a2484091 --- /dev/null +++ b/dev/github-actions/setup-macos-14.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +# SETUP for matrix.os == macos-14 + +START=$SECONDS + +log() +{ + printf "setup-macos-14.sh: %s\n" "$*" +} + +log "Installing Homebrew packages..." + +PKGS=( + autoconf + automake + # To resolve the sed -i problem on Mac + gnu-sed + make + mpich + swig + tcl-tk +) + +if ( + set -eux + brew update + brew install ${PKGS[@]} +) # >& brew.log +then + T=$(( SECONDS - START )) + log "Installed Homebrew packages in $T seconds." +else + log "FAILED to install Homebrew packages!" + log "brew.log:" + cat brew.log + exit 1 +fi + +# Add these tools to PATH via GITHUB_PATH, one per line +BINS=( + /opt/homebrew/opt/gnu-sed/libexec/gnubin + /opt/homebrew/opt/make/libexec/gnubin + /opt/homebrew/opt/bin +) +echo ${BINS[@]} | fmt -w 1 >> $GITHUB_PATH diff --git a/dev/github-actions/setup-ubuntu-latest.sh b/dev/github-actions/setup-ubuntu-latest.sh new file mode 100755 index 000000000..93f5251b3 --- /dev/null +++ b/dev/github-actions/setup-ubuntu-latest.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# SETUP for matrix.os == ubuntu-latest + +START=$SECONDS + +log() +{ + printf "setup-ubuntu-latest.sh: %s\n" "$*" +} + +log "Installing Ubuntu packages..." + +PKGS=( + autoconf + default-jdk + libcurl4-openssl-dev + make + mpich + tcl-dev + zsh +) + +if ( + set -eux + sudo apt-get install -y ${PKGS[@]} +) > apt.log +then + T=$(( SECONDS - START )) + log "Installed Ubuntu packages in $T seconds." +else + log "FAILED to install Ubuntu packages!" + log "apt.log:" + cat apt.log + exit 1 +fi diff --git a/dev/jenkins/anaconda.sh b/dev/jenkins/anaconda.sh index 0d85b0fc8..770552f9e 100755 --- a/dev/jenkins/anaconda.sh +++ b/dev/jenkins/anaconda.sh @@ -7,12 +7,19 @@ set -eu # and one in which to install the package # May be run interactively, just set environment variable WORKSPACE # and clone Swift/T in that location (which is what Jenkins does) +# Also runs as GitHub action via /.github/workflows/conda.yaml +# in which case we create artifact anaconda.log + +# Environment: +# WORKSPACE: A working directory set by Jenkins +# JENKINS_HOME: Set by Jenkins, else unset +# GITHUB_ACTION: Set by GitHub, else unset setopt PUSHD_SILENT # Defaults: PYTHON_VERSION="39" -CONDA_LABEL="23.11.0-1" +CONDA_TIMESTAMP="23.11.0-1" # Examples: # py39_23.11.0-1 # py310_23.11.0-1 @@ -25,6 +32,11 @@ log() print ${(%)DATE_FMT_NICE} "anaconda.sh:" ${*} } +# If on GitHub, pretend we are in Jenkins: +if [[ ${GITHUB_ACTION:-0} != 0 ]] { + log "Start..." >> anaconda.log + WORKSPACE=$RUNNER_TEMP +} if [[ ${WORKSPACE:-0} == 0 ]] { log "Set WORKSPACE!" exit 1 @@ -33,8 +45,8 @@ if [[ ${WORKSPACE:-0} == 0 ]] { help() { cat <& /dev/null +if [[ ${JENKINS_HOME:-0} != 0 ]] \ + renice --priority 19 --pid $$ >& /dev/null export TMP=$WORKSPACE/tmp-$PYTHON_VERSION @@ -64,8 +77,37 @@ THIS=${0:A:h} SWIFT_T=$THIS/../.. SWIFT_T=${SWIFT_T:A} +# Set CONDA_OS, the name for our OS in the Miniconda download: +if [[ ${RUNNER_OS:-0} == "macOS" ]] { + # On GitHub, we may be on Mac: + CONDA_OS="MacOSX" +} else { + CONDA_OS="Linux" +} + +# Set CONDA_ARCH, the name for our chip in the Miniconda download: +# Set CONDA_PLATFORM, the name for our platform +# in our Anaconda builder + set -x + uname -a + which automake autoconf make + make -v +if [[ ${RUNNER_ARCH:-0} == "ARM64" ]] { + # On GitHub, we may be on ARM: + CONDA_ARCH="arm64" + CONDA_PLATFORM="osx-arm64" +} else { + CONDA_ARCH="x86_64" + case $CONDA_OS { + MacOSX) CONDA_PLATFORM="osx-64" ;; + Linux) CONDA_PLATFORM="linux-64" ;; + } +} +set +x + # The Miniconda we are working with: -MINICONDA=Miniconda3-py${PYTHON_VERSION}_${CONDA_LABEL}-Linux-x86_64.sh +CONDA_LABEL=${CONDA_TIMESTAMP}-${CONDA_OS}-${CONDA_ARCH} +MINICONDA=Miniconda3-py${PYTHON_VERSION}_${CONDA_LABEL}.sh log "MINICONDA: $MINICONDA" if (( ${#R} )) log "ENABLING R" @@ -73,11 +115,14 @@ if (( ${#R} )) log "ENABLING R" # among Minicondas and easy to delete: export CONDA_PKGS_DIRS=$WORKSPACE/conda-cache +source $SWIFT_T/dev/conda/helpers.zsh + task() # Run a command line verbosely and report the time in simple format: { log "TASK START:" ${*} - if /bin/time --format "TASK TIME: %E" ${*} + # Force use of GNU time program: + if =time --format "TASK TIME: %E" ${*} then log "TASK DONE:" ${*} CODE=0 @@ -142,7 +187,7 @@ task $SWIFT_T/dev/release/make-release-pkg.zsh -T # Set up the build environment in Miniconda-build task $SWIFT_T/dev/conda/setup-conda.sh # Build the Swift/T package! -task $SWIFT_T/dev/conda/conda-platform.sh ${R} linux-64 +task $SWIFT_T/dev/conda/conda-platform.sh $R $CONDA_PLATFORM log "CHECKING PACKAGE..." BLD_DIR=$WORKSPACE/sfw/Miniconda-build/conda-bld/linux-64 @@ -153,7 +198,7 @@ then log "Could not find the PKG at: $PKG" return 1 fi -md5sum $PKG +checksum $PKG print # Enable the install environment @@ -180,3 +225,11 @@ print log "SWIFT/T OK." log "PKG=$PKG" print + +if [[ ${GITHUB_ACTION:-0} != 0 ]] { + # Record success if on GitHub: + { + log "SUCCESS" + log "PKG=$PKG" + } >> anaconda.log +} diff --git a/turbine/code/Makefile.in b/turbine/code/Makefile.in index adcb7dcf2..25812f8f6 100644 --- a/turbine/code/Makefile.in +++ b/turbine/code/Makefile.in @@ -322,8 +322,8 @@ endif HDF5_CPPFLAGS = @HDF5_CPPFLAGS@ CFLAGS += $(DEFINES) $(INCLUDES) $(HDF5_CPPFLAGS) -# LIBS: links to ADLB, c-utils, MPE, and MPI -LIBS := +# LIBS: links to Tcl, ADLB, c-utils, MPE, and MPI +LIBS := @TCL_LIB_SPEC@ LIBS += -L$(ADLB)/lib -ladlb LIBS += -L$(C_UTILS)/lib -lexmcutils ifeq ($(ENABLE_MPE),1) @@ -335,6 +335,7 @@ ifeq ($(ENABLE_MPE),1) endif LIBS += $(MPI_LIB) ifeq ($(HAVE_PYTHON),1) + $(warning PYTHON_LIB_FLAGS $(PYTHON_LIB_FLAGS)) LIBS += -L$(PYTHON_LIBDIR) $(PYTHON_LIB_FLAGS) RPATH_PYTHON = yes endif @@ -367,8 +368,8 @@ else FIX_RINSIDE_INSTALL_NAME = FIX_PYTHON_INSTALL_NAME = endif - endif + ifeq ($(HAVE_JVM_SCRIPT),1) SWIFTTJVM_LIB = $(USE_JVM_SCRIPT_HOME)/src LIBS += -L$(SWIFTTJVM_LIB)/.libs -lswifttjvm diff --git a/turbine/code/configure.ac b/turbine/code/configure.ac index d62db22fc..3fbb8990f 100644 --- a/turbine/code/configure.ac +++ b/turbine/code/configure.ac @@ -459,8 +459,10 @@ then fi # Short form of call to our Python configuration reporting tool: PY_CFG="${PYTHON_EXE} scripts/python-config.py" - AC_MSG_RESULT([Displaying $PY_CFG --all]) - $PY_CFG --all + AC_MSG_RESULT([Displaying $PY_CFG --debug]) + $PY_CFG --debug + AC_MSG_RESULT([Displaying $PY_CFG --list]) + $PY_CFG --list if ! PYTHON_INCLUDE_FLAGS=$( $PY_CFG --include-flags ) then AC_MSG_ERROR([Failed to execute $PY_CFG --include-flags]) diff --git a/turbine/code/scripts/python-config.py b/turbine/code/scripts/python-config.py index e80031705..79ebe00a8 100644 --- a/turbine/code/scripts/python-config.py +++ b/turbine/code/scripts/python-config.py @@ -1,7 +1,21 @@ + """ -Script to generate python build config paths needed to build turbine with -embedded python interpreter support. Requires python 2.6+. +PYTHON CONFIG PY + +Generates Python build config paths needed to build Turbine with +embedded Python interpreter support using Python sysconfig . + +Requires Python 2.6+ + +Usage: + --list Show all configuration variables available from sysconfig + --all Show all configuration variables relevant to Turbine + --debug Like --all but pretty-print and include some debug info + on stderr + --help Show individual configuration variable selection flags + --flag* Show one or more individual configuration variables """ + from __future__ import print_function import sys @@ -10,6 +24,8 @@ import os.path +debug = False + CONFIG_NAMES = [ 'include-dir', 'include-flags', 'lib-dir', 'lib-name', 'lib-flags', @@ -21,9 +37,22 @@ def print_usage(prog_name): + ' | '.join('--' + name for name in CONFIG_NAMES)) +def align_kv(k, v): + indent = " " if debug else "" + print("%s%-14s %s" % (indent, k, v)) + + +def debug_kv(k, v): + if not debug: return + sys.stderr.write(" %-14s %s\n" % (k, v)) + + def get_lib_name(): # LDLIBRARY has format libpythonX.Yz.so - lib_file = sysconfig.get_config_var('LDLIBRARY') + # Bryce used LDLIBRARY c. 2017 + # Seems that we should now use LIBRARY as of 2024-09-09 + lib_file = sysconfig.get_config_var('LIBRARY') + debug_kv("LIBRARY", lib_file) lib_name = os.path.splitext(lib_file)[0] if lib_name.startswith('lib'): lib_name = lib_name[3:] @@ -61,14 +90,35 @@ def get_config_value(name): return value +def show_debug(names): + global debug + debug = True + for name in names: + align_kv(name, get_config_value(name)) + + +def show_list(): + global debug + debug = True + for k, v in sysconfig.get_config_vars().items(): + align_kv(k, v) + if __name__ == '__main__': if len(sys.argv) < 2: print_usage(sys.argv[0]) sys.exit(1) - if sys.argv[1] == '--help': + elif sys.argv[1] == '--help': print_usage(sys.argv[0]) sys.exit(0) - if sys.argv[1] == '--all': + elif sys.argv[1] == '--debug': + show_name = True + names = CONFIG_NAMES + show_debug(names) + sys.exit(0) + elif sys.argv[1] == '--list': + show_list() + sys.exit(0) + elif sys.argv[1] == '--all': show_name = True names = CONFIG_NAMES else: @@ -83,7 +133,7 @@ def get_config_value(name): for name in names: try: if show_name: - print("%-14s" % name, get_config_value(name)) + print(name, get_config_value(name)) else: print(get_config_value(name)) except ValueError: