Changeset 28117


Ignore:
Timestamp:
02/29/24 15:53:35 (13 months ago)
Author:
jdquinn
Message:

CHG: Missing Python 3 packager

File:
1 copied

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/packagers/mac/package-issm-mac-binaries-python-3.sh

    r28116 r28117  
    22
    33################################################################################
    4 # Packages and tests ISSM distributable package with MATLAB API for macOS.
     4# Packages and tests ISSM distributable package for macOS with Python 3 API.
    55#
    66# Options:
     
    88#                                               for some reason but build is valid.
    99#
    10 # NOTE: The following variables *must* be defined in order for this script to
    11 # work properly,
     10# NOTE:
     11# - Assumes that the following constants are defined,
    1212#
    1313#               COMPRESSED_PKG
     
    3434## Override certain other aliases
    3535#
    36 alias cp=$(which cp)
    3736alias grep=$(which grep)
    3837
    3938## Constants
    4039#
    41 MATLAB_NROPTIONS="'benchmark','all','exclude',[125,126,129,234,235,418,420,435,444,445,701,702,703,1101,1102,1103,1104,1105,1106,1107,1108,1109,1110,1201,1202,1203,1204,1205,1206,1207,1208,1301,1302,1303,1304,1401,1402,1601,1602,2002,2003,2004,2006,2007,2008,2010,2011,2012,2013,2020,2021,2051,2052,2053,2084,2085,2090,2091,2092,2101,2424,2425,3001:3300,3480,3481,4001:4100]" # NOTE: Combination of test suites from basic, Dakota, and Solid Earth builds, with tests that require a restart and those that require the JVM excluded
    42 MATLAB_PATH="/Applications/MATLAB_R2023b.app"
     40PYTHON_NROPTIONS="--benchmark all --exclude 125 126 129 234 235 418 420 435 444 445 701 702 703 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1201 1202 1203 1204 1205 1206 1207 1208 1301 1302 1303 1304 1401 1402 1601 1602 2002 2003 2004 2005 2006 2007 2008 2010 2011 2012 2013 2020 2021 2051 2052 2053 2084 2085 2090 2091 2092 2101 2424 2425 3001:3300 3480 3481 4001:4100" # NOTE: Combination of test suites from basic, Dakota, and Solid Earth builds, with tests that require a restart and those that require the JVM excluded
    4341
    4442## Environment
    4543#
    46 export PATH="${ISSM_DIR}/bin:$(getconf PATH)" # Ensure that we pick up binaries from 'bin' directory rather than 'externalpackages'; used when running tests
     44export PATH="${ISSM_DIR}/bin:$(getconf PATH)" # Ensure that we pick up binaries from 'bin' directory rather than 'externalpackages'
    4745
    4846## Parse options
     
    6260fi
    6361
    64 # Check if MATLAB exists
    65 if ! [ -d ${MATLAB_PATH} ]; then
    66         echo "${MATLAB_PATH} does not point to a MATLAB installation! Please modify MATLAB_PATH variable in $(basename $0) and try again."
    67         exit 1
    68 fi
    69 
    7062# Clean up from previous packaging
    7163echo "Cleaning up existing assets"
     
    7870
    7971echo "Modify generic"
    80 cat generic_static.m | sed -e "s/generic_static/generic/g" > generic.m
     72cat generic_static.py | sed -e "s/generic_static/generic/g" > generic.py
    8173
    8274echo "Moving MPICH binaries to bin/"
     
    140132        echo "Running tests"
    141133        cd ${ISSM_DIR}/test/NightlyRun
    142         rm matlab.log 2> /dev/null
     134        rm python.log 2> /dev/null
     135
     136        # Set Python environment
     137        export PYTHONPATH="${ISSM_DIR}/src/m/dev"
     138        export PYTHONSTARTUP="${PYTHONPATH}/devpath.py"
     139        export PYTHONUNBUFFERED=1 # We don't want Python to buffer output, otherwise issm.exe output is not captured
    143140
    144141        # Run tests, redirecting output to logfile and suppressing output to console
    145         ${MATLAB_PATH}/bin/matlab -nojvm -nosplash -nojvm -r "try, addpath ${ISSM_DIR}/bin ${ISSM_DIR}/lib ${ISSM_DIR}/share; runme(${MATLAB_NROPTIONS}); exit; catch me,fprintf('%s',getReport(me)); exit; end" &> matlab.log
     142        ./runme.py ${PYTHON_NROPTIONS} &> python.log 2>&1
    146143
    147         # Check that MATLAB did not exit in error
    148         matlabExitedInError=`grep -c -E "Activation cannot proceed|Error in|Illegal|Invalid MEX-file|license|Warning: Name is nonexistent or not a directory" matlab.log`
     144        # Check that Python did not exit in error
     145        pythonExitCode=`echo $?`
     146        pythonExitedInError=`grep -c -E "Error|No such file or directory|Permission denied|Standard exception|Traceback|bad interpreter|syntax error" python.log`
    149147
    150         if [ ${matlabExitedInError} -ne 0 ]; then
    151                 echo "----------MATLAB exited in error!----------"
    152                 cat matlab.log
    153                 echo "-----------End of matlab.log-----------"
     148        if [[ ${pythonExitCode} -ne 0 || ${pythonExitedInError} -ne 0 ]]; then
     149                echo "----------Python exited in error!----------"
     150                cat python.log
     151                echo "-----------End of python.log-----------"
    154152
    155153                # Clean up execution directory
     
    160158
    161159        # Check that all tests passed
    162         sed -i '' "/FAILED TO establish the default connection to the WindowServer/d" matlab.log # First, need to remove WindowServer error message
    163         numTestsFailed=`grep -c -E "FAILED|ERROR" matlab.log`
     160        sed -i '' "/FAILED TO establish the default connection to the WindowServer/d" python.log # First, need to remove WindowServer error message
     161        numTestsFailed=`grep -c -E "FAILED|ERROR" python.log`
    164162
    165163        if [ ${numTestsFailed} -ne 0 ]; then
    166164                echo "One or more tests FAILED"
    167                 cat matlab.log
     165                cat python.log
    168166                exit 1
    169167        else
     
    181179mkdir ${PKG}/execution
    182180cp packagers/mac/issm-executable_entitlements.plist ${PKG}/bin/entitlements.plist
     181# ${ISSM_DIR}/scripts/py_to_pyc.sh ${PKG}/bin # Compile Python source files
    183182echo "Cleaning up unneeded/unwanted files"
     183# rm -f ${PKG}/bin/*.py # Remove all Python scripts
    184184rm -f ${PKG}/bin/generic_static.* # Remove static versions of generic cluster classes
    185185rm -f ${PKG}/lib/*.a # Remove static libraries from package
Note: See TracChangeset for help on using the changeset viewer.