Ticket #12606: 12606-sage-info.patch

File 12606-sage-info.patch, 3.3 KB (added by jdemeyer, 10 years ago)
  • spkg/bin/sage

    # HG changeset patch
    # User Jeroen Demeyer <jdemeyer@cage.ugent.be>
    # Date 1346267702 -7200
    # Node ID 862505b1d0b9af08970b8260195207165dfa14c2
    # Parent  8316139c0955f7cbea9b0180d534a59a1b31716e
    Fix sage --info [packages]
    
    diff --git a/spkg/bin/sage b/spkg/bin/sage
    a b  
    125125    echo "                                 if they are already installed"
    126126    echo "                           -s -- do not delete the spkg/build directories"
    127127    echo "                                 after a successful build"
     128    echo "  -info [packages]    -- print the SPKG.txt of the given packages"
    128129    echo "  -optional           -- list all optional packages that can be installed"
    129130    echo "  -standard           -- list all standard packages that can be installed"
    130131   #echo "  -update             -- download latest non-optional Sage packages (do not build them)"
     
    900901                continue;;
    901902            --check) OPTC="-c"
    902903                continue;;
     904            -info) OPTINFO="--info"
     905                continue;;
     906            --info) OPTINFO="--info"
     907                continue;;
     908            -*) echo >&2 "Error: unknown option '$PKG'"
     909                exit 2;;
    903910        esac
    904911
    905         echo "Calling sage-spkg on '$PKG'"
    906912        PKG_NAME=`echo "$PKG" | sed -e "s/\.spkg$//"`
    907913        PKG_NAME=`basename "$PKG_NAME"`
    908914
    909915        "$SAGE_ROOT"/spkg/pipestatus \
    910             "sage-spkg $OPTF $OPTS $OPTC '$PKG' 2>&1" \
     916            "sage-spkg $OPTINFO $OPTF $OPTS $OPTC '$PKG' 2>&1" \
    911917            "(trap '' SIGINT; tee -a '$SAGE_ROOT/install.log' '$SAGE_LOGS/$PKG_NAME.log')"
    912918        # Do not try to install further packages if one failed
    913919        if [ $? -ne 0 ]; then
     
    952958    install -f "$@"
    953959fi
    954960
     961if [ "$1" = '-info' -o "$1" = '--info' ]; then
     962    shift
     963    # If there are no further arguments, simply list all installed
     964    # packages.
     965    if [ $# -eq 0 ]; then
     966        exec sage-spkg
     967    fi
     968    install --info "$@"
     969fi
     970
    955971if [ "$1" = '-pkg' -o "$1" = '-spkg' -o "$1" = "--pkg" -o "$1" = "--spkg" ]; then
    956972   cd "$CUR"
    957973   shift
  • spkg/bin/sage-spkg

    diff --git a/spkg/bin/sage-spkg b/spkg/bin/sage-spkg
    a b  
    142142##################################################################
    143143if [ $# -eq 0 ]; then
    144144    echo "Currently installed packages:"
    145     ls -1 "$INSTALLED"
    146     exit 0
     145    exec ls -1 "$INSTALLED"
    147146fi
    148147
    149148# Options have to come in a specific order,
    150149# this is ensured by spkg/bin/sage.
    151150INFO=0
    152 if [ $1 = '--info' ]; then
     151if [ "$1" = '--info' ]; then
    153152    INFO=1
    154153    shift
    155154fi
    156155
    157156FORCE=0
    158 if [ $1 = '-f' ]; then
     157if [ "$1" = '-f' ]; then
    159158    FORCE=1
    160159    shift
    161160fi
    162161
    163 if [ $1 = '-s' ]; then
     162if [ "$1" = '-s' ]; then
    164163    export SAGE_KEEP_BUILT_SPKGS=yes
    165164    shift
    166165fi
    167166
    168 if [ $1 = '-c' ]; then
     167if [ "$1" = '-c' ]; then
    169168    export SAGE_CHECK=yes
    170169    SAGE_CHECK_PACKAGES=x  # nonempty, so not set to '!python' later
    171170    shift
     
    230229    for spkg in `ls -1t */${PKG_NAME}.spkg */${PKG_NAME}-*.spkg 2>/dev/null`; do
    231230        if [ -f "$spkg" ]; then
    232231            # Found a good package
     232            echo "Found package $PKG_NAME in spkg/$spkg"
    233233            PKG_SRC="`pwd`/$spkg"
    234234            PKG_NAME=`basename "$spkg" | sed 's/\.spkg$//'`
    235235            break